Skip to content

Commit e0bbbf5

Browse files
Merge from 'master' to 'sycl-web' (#5)
CONFLICT (content): Merge conflict in clang/test/Misc/nvptx.languageOptsOpenCL.cl
2 parents 5ab867b + a779a16 commit e0bbbf5

File tree

525 files changed

+97768
-5587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

525 files changed

+97768
-5587
lines changed

clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ namespace readability {
2525
/// This check is similar to `-Wold-style-cast`, but it suggests automated fixes
2626
/// in some cases. The reported locations should not be different from the
2727
/// ones generated by `-Wold-style-cast`.
28+
///
29+
/// For the user-facing documentation see:
30+
/// http://clang.llvm.org/extra/clang-tidy/checks/google-readability-casting.html
2831
class AvoidCStyleCastsCheck : public ClangTidyCheck {
2932
public:
3033
AvoidCStyleCastsCheck(StringRef Name, ClangTidyContext *Context)

clang-tools-extra/clang-tidy/google/AvoidUnderscoreInGoogletestNameCheck.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ namespace readability {
1818

1919
// Check for underscores in the names of googletest tests, per
2020
// https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore
21+
///
22+
/// For the user-facing documentation see:
23+
/// http://clang.llvm.org/extra/clang-tidy/checks/google-readability-avoid-underscore-in-googletest-name.html
2124
class AvoidUnderscoreInGoogletestNameCheck : public ClangTidyCheck {
2225
public:
2326
using ClangTidyCheck::ClangTidyCheck;

clang-tools-extra/clang-tidy/google/DefaultArgumentsCheck.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ namespace google {
1818
/// Checks that default parameters are not given for virtual methods.
1919
///
2020
/// See https://google.github.io/styleguide/cppguide.html#Default_Arguments
21+
///
22+
/// For the user-facing documentation see:
23+
/// http://clang.llvm.org/extra/clang-tidy/checks/google-default-arguments.html
2124
class DefaultArgumentsCheck : public ClangTidyCheck {
2225
public:
2326
DefaultArgumentsCheck(StringRef Name, ClangTidyContext *Context)

clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ namespace google {
1818
/// Checks that all single-argument constructors are explicit.
1919
///
2020
/// See https://google.github.io/styleguide/cppguide.html#Explicit_Constructors
21+
///
22+
/// For the user-facing documentation see:
23+
/// http://clang.llvm.org/extra/clang-tidy/checks/google-explicit-constructor.html
2124
class ExplicitConstructorCheck : public ClangTidyCheck {
2225
public:
2326
ExplicitConstructorCheck(StringRef Name, ClangTidyContext *Context)

clang-tools-extra/clang-tidy/google/ExplicitMakePairCheck.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ namespace build {
2222
/// specified explicitly, and such use isn't intended in any case.
2323
///
2424
/// Corresponding cpplint.py check name: 'build/explicit_make_pair'.
25+
///
26+
/// For the user-facing documentation see:
27+
/// http://clang.llvm.org/extra/clang-tidy/checks/google-build-explicit-make-pair.html
2528
class ExplicitMakePairCheck : public ClangTidyCheck {
2629
public:
2730
ExplicitMakePairCheck(StringRef Name, ClangTidyContext *Context)

clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ namespace readability {
2727
///
2828
/// For extension-less header files, using an empty string or leaving an
2929
/// empty string between ";" if there are other filename extensions.
30+
///
31+
/// For the user-facing documentation see:
32+
/// http://clang.llvm.org/extra/clang-tidy/checks/google-global-names-in-headers.html
3033
class GlobalNamesInHeadersCheck : public ClangTidyCheck {
3134
public:
3235
GlobalNamesInHeadersCheck(StringRef Name, ClangTidyContext *Context);

clang-tools-extra/clang-tidy/google/IntegerTypesCheck.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ namespace runtime {
2525
/// with `u?intXX(_t)?`.
2626
///
2727
/// Corresponding cpplint.py check: 'runtime/int'.
28+
///
29+
/// For the user-facing documentation see:
30+
/// http://clang.llvm.org/extra/clang-tidy/checks/google-runtime-int.html
2831
class IntegerTypesCheck : public ClangTidyCheck {
2932
public:
3033
IntegerTypesCheck(StringRef Name, ClangTidyContext *Context);

clang-tools-extra/clang-tidy/google/OverloadedUnaryAndCheck.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ namespace runtime {
2121
/// https://google.github.io/styleguide/cppguide.html#Operator_Overloading
2222
///
2323
/// Corresponding cpplint.py check name: 'runtime/operator'.
24+
///
25+
/// For the user-facing documentation see:
26+
/// http://clang.llvm.org/extra/clang-tidy/checks/google-runtime-operator.html
2427
class OverloadedUnaryAndCheck : public ClangTidyCheck {
2528
public:
2629
OverloadedUnaryAndCheck(StringRef Name, ClangTidyContext *Context)

clang-tools-extra/clang-tidy/google/TodoCommentCheck.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ namespace readability {
1919
/// Finds TODO comments without a username or bug number.
2020
///
2121
/// Corresponding cpplint.py check: 'readability/todo'
22+
///
23+
/// For the user-facing documentation see:
24+
/// http://clang.llvm.org/extra/clang-tidy/checks/google-readability-todo.html
2225
class TodoCommentCheck : public ClangTidyCheck {
2326
public:
2427
TodoCommentCheck(StringRef Name, ClangTidyContext *Context);

clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ namespace build {
3030
/// https://google.github.io/styleguide/cppguide.html#Namespaces
3131
///
3232
/// Corresponding cpplint.py check name: 'build/namespaces'.
33+
///
34+
/// For the user-facing documentation see:
35+
/// http://clang.llvm.org/extra/clang-tidy/checks/google-build-namespaces.html
3336
class UnnamedNamespaceInHeaderCheck : public ClangTidyCheck {
3437
public:
3538
UnnamedNamespaceInHeaderCheck(StringRef Name, ClangTidyContext *Context);

clang-tools-extra/clang-tidy/google/UsingNamespaceDirectiveCheck.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ namespace build {
3131
/// \endcode
3232
///
3333
/// Corresponding cpplint.py check name: `build/namespaces`.
34+
///
35+
/// For the user-facing documentation see:
36+
/// https://clang.llvm.org/extra/clang-tidy/checks/google-build-using-namespace.html
3437
class UsingNamespaceDirectiveCheck : public ClangTidyCheck {
3538
public:
3639
UsingNamespaceDirectiveCheck(StringRef Name, ClangTidyContext *Context)

clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ void UnnecessaryCopyInitialization::registerMatchers(MatchFinder *Finder) {
6363
declStmt(
6464
has(varDecl(hasLocalStorage(),
6565
hasType(qualType(
66-
hasCanonicalType(
67-
matchers::isExpensiveToCopy()),
66+
hasCanonicalType(allOf(
67+
matchers::isExpensiveToCopy(),
68+
unless(hasDeclaration(namedDecl(
69+
hasName("::std::function")))))),
6870
unless(hasDeclaration(namedDecl(
6971
matchers::matchesAnyListedName(
7072
AllowedTypes)))))),

clang-tools-extra/test/clang-tidy/checkers/performance-unnecessary-copy-initialization.cpp

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,3 +405,58 @@ void negativeInitialzedFromFreeFunctionWithNonDefaultArg() {
405405
ExpensiveToCopyType Orig;
406406
const ExpensiveToCopyType Copy = freeFunctionWithDefaultArg(&Orig);
407407
}
408+
409+
namespace std {
410+
inline namespace __1 {
411+
412+
template <class>
413+
class function;
414+
template <class R, class... Args>
415+
class function<R(Args...)> {
416+
public:
417+
function();
418+
function(const function &other);
419+
R operator()(Args &&...args) const;
420+
};
421+
422+
} // namespace __1
423+
} // namespace std
424+
425+
void negativeStdFunction() {
426+
std::function<int()> Orig;
427+
std::function<int()> Copy = Orig;
428+
int i = Orig();
429+
}
430+
431+
using Functor = std::function<int()>;
432+
433+
void negativeAliasedStdFunction() {
434+
Functor Orig;
435+
Functor Copy = Orig;
436+
int i = Orig();
437+
}
438+
439+
typedef std::function<int()> TypedefFunc;
440+
441+
void negativeTypedefedStdFunction() {
442+
TypedefFunc Orig;
443+
TypedefFunc Copy = Orig;
444+
int i = Orig();
445+
}
446+
447+
namespace fake {
448+
namespace std {
449+
template <class R, class... Args>
450+
struct function {
451+
// Custom copy constructor makes it expensive to copy;
452+
function(const function &);
453+
};
454+
} // namespace std
455+
456+
void positiveFakeStdFunction(std::function<void(int)> F) {
457+
auto Copy = F;
458+
// CHECK-MESSAGES: [[@LINE-1]]:8: warning: local copy 'Copy' of the variable 'F' is never modified;
459+
// CHECK-FIXES: const auto& Copy = F;
460+
}
461+
462+
} // namespace fake

clang/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
449449
PATTERN "*.def"
450450
PATTERN "*.h"
451451
PATTERN "config.h" EXCLUDE
452-
PATTERN ".svn" EXCLUDE
453452
)
454453

455454
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang

clang/docs/ClangCommandLineReference.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3335,6 +3335,8 @@ X86
33353335

33363336
.. option:: -mtsxldtrk, -mno-tsxldtrk
33373337

3338+
.. option:: -muintr, -mno-uintr
3339+
33383340
.. option:: -mvaes, -mno-vaes
33393341

33403342
.. option:: -mvpclmulqdq, -mno-vpclmulqdq

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ X86 Support in Clang
200200
implies -mtune=<cpu>. -mtune=generic is the default with no -march or -mtune
201201
specified.
202202

203+
- Support for ``HRESET`` instructions has been added.
204+
205+
- Support for ``UINTR`` instructions has been added.
206+
203207
Internal API Changes
204208
--------------------
205209

clang/include/clang/AST/APValue.h

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,10 @@ class APValue {
235235
struct UninitArray {};
236236
struct UninitStruct {};
237237

238-
friend class ASTReader;
238+
friend class ASTRecordReader;
239239
friend class ASTWriter;
240+
friend class ASTImporter;
241+
friend class ASTNodeImporter;
240242

241243
private:
242244
ValueKind Kind;
@@ -569,11 +571,9 @@ class APValue {
569571
*(APFixedPoint *)(char *)Data.buffer = std::move(FX);
570572
}
571573
void setVector(const APValue *E, unsigned N) {
572-
assert(isVector() && "Invalid accessor");
573-
((Vec*)(char*)Data.buffer)->Elts = new APValue[N];
574-
((Vec*)(char*)Data.buffer)->NumElts = N;
574+
MutableArrayRef<APValue> InternalElts = setVectorUninit(N);
575575
for (unsigned i = 0; i != N; ++i)
576-
((Vec*)(char*)Data.buffer)->Elts[i] = E[i];
576+
InternalElts[i] = E[i];
577577
}
578578
void setComplexInt(APSInt R, APSInt I) {
579579
assert(R.getBitWidth() == I.getBitWidth() &&
@@ -594,11 +594,7 @@ class APValue {
594594
void setLValue(LValueBase B, const CharUnits &O,
595595
ArrayRef<LValuePathEntry> Path, bool OnePastTheEnd,
596596
bool IsNullPtr);
597-
void setUnion(const FieldDecl *Field, const APValue &Value) {
598-
assert(isUnion() && "Invalid accessor");
599-
((UnionData*)(char*)Data.buffer)->Field = Field;
600-
*((UnionData*)(char*)Data.buffer)->Value = Value;
601-
}
597+
void setUnion(const FieldDecl *Field, const APValue &Value);
602598
void setAddrLabelDiff(const AddrLabelExpr* LHSExpr,
603599
const AddrLabelExpr* RHSExpr) {
604600
((AddrLabelDiffData*)(char*)Data.buffer)->LHSExpr = LHSExpr;
@@ -656,6 +652,24 @@ class APValue {
656652
new ((void*)(char*)Data.buffer) AddrLabelDiffData();
657653
Kind = AddrLabelDiff;
658654
}
655+
656+
private:
657+
/// The following functions are used as part of initialization, during
658+
/// deserialization and importing. Reserve the space so that it can be
659+
/// filled in by those steps.
660+
MutableArrayRef<APValue> setVectorUninit(unsigned N) {
661+
assert(isVector() && "Invalid accessor");
662+
Vec *V = ((Vec *)(char *)Data.buffer);
663+
V->Elts = new APValue[N];
664+
V->NumElts = N;
665+
return {V->Elts, V->NumElts};
666+
}
667+
MutableArrayRef<LValuePathEntry>
668+
setLValueUninit(LValueBase B, const CharUnits &O, unsigned Size,
669+
bool OnePastTheEnd, bool IsNullPtr);
670+
MutableArrayRef<const CXXRecordDecl *>
671+
setMemberPointerUninit(const ValueDecl *Member, bool IsDerivedMember,
672+
unsigned Size);
659673
};
660674

661675
} // end namespace clang.

clang/include/clang/AST/ASTContext.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ class ASTContext : public RefCountedBase<ASTContext> {
289289
/// Mapping from GUIDs to the corresponding MSGuidDecl.
290290
mutable llvm::FoldingSet<MSGuidDecl> MSGuidDecls;
291291

292-
/// Used to cleanups APValues stored in the AST.
293-
mutable llvm::SmallVector<APValue *, 0> APValueCleanups;
292+
/// Mapping from APValues to the corresponding TemplateParamObjects.
293+
mutable llvm::FoldingSet<TemplateParamObjectDecl> TemplateParamObjectDecls;
294294

295295
/// A cache mapping a string value to a StringLiteral object with the same
296296
/// value.
@@ -2876,6 +2876,11 @@ class ASTContext : public RefCountedBase<ASTContext> {
28762876
/// GUID value.
28772877
MSGuidDecl *getMSGuidDecl(MSGuidDeclParts Parts) const;
28782878

2879+
/// Return the template parameter object of the given type with the given
2880+
/// value.
2881+
TemplateParamObjectDecl *getTemplateParamObjectDecl(QualType T,
2882+
const APValue &V) const;
2883+
28792884
/// Parses the target attributes passed in, and returns only the ones that are
28802885
/// valid feature names.
28812886
ParsedTargetAttr filterFunctionTargetAttrs(const TargetAttr *TD) const;

clang/include/clang/AST/ASTImporter.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#ifndef LLVM_CLANG_AST_ASTIMPORTER_H
1515
#define LLVM_CLANG_AST_ASTIMPORTER_H
1616

17+
#include "clang/AST/APValue.h"
1718
#include "clang/AST/DeclBase.h"
1819
#include "clang/AST/DeclarationName.h"
1920
#include "clang/AST/ExprCXX.h"
@@ -503,6 +504,13 @@ class TypeSourceInfo;
503504
/// "to" context, or the import error.
504505
llvm::Expected<CXXBaseSpecifier *> Import(const CXXBaseSpecifier *FromSpec);
505506

507+
/// Import the given APValue from the "from" context into
508+
/// the "to" context.
509+
///
510+
/// \return the equivalent APValue in the "to" context or the import
511+
/// error.
512+
llvm::Expected<APValue> Import(const APValue &FromValue);
513+
506514
/// Import the definition of the given declaration, including all of
507515
/// the declarations it contains.
508516
LLVM_NODISCARD llvm::Error ImportDefinition(Decl *From);

0 commit comments

Comments
 (0)