summaryrefslogtreecommitdiff
path: root/include/clang/Basic
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Basic')
-rw-r--r--include/clang/Basic/AArch64SVEACLETypes.def70
-rw-r--r--include/clang/Basic/Attr.td182
-rw-r--r--include/clang/Basic/AttrDocs.td210
-rw-r--r--include/clang/Basic/AttributeCommonInfo.h190
-rw-r--r--include/clang/Basic/Builtins.def27
-rw-r--r--include/clang/Basic/BuiltinsAArch64.def56
-rw-r--r--include/clang/Basic/BuiltinsAMDGPU.def9
-rw-r--r--include/clang/Basic/BuiltinsARM.def48
-rw-r--r--include/clang/Basic/BuiltinsBPF.def24
-rw-r--r--include/clang/Basic/BuiltinsPPC.def14
-rw-r--r--include/clang/Basic/BuiltinsWebAssembly.def33
-rw-r--r--include/clang/Basic/BuiltinsX86.def4
-rw-r--r--include/clang/Basic/BuiltinsX86_64.def4
-rw-r--r--include/clang/Basic/CodeGenOptions.def14
-rw-r--r--include/clang/Basic/CodeGenOptions.h6
-rw-r--r--include/clang/Basic/Diagnostic.h17
-rw-r--r--include/clang/Basic/DiagnosticASTKinds.td139
-rw-r--r--include/clang/Basic/DiagnosticCommentKinds.td6
-rw-r--r--include/clang/Basic/DiagnosticCommonKinds.td26
-rw-r--r--include/clang/Basic/DiagnosticDriverKinds.td9
-rw-r--r--include/clang/Basic/DiagnosticFrontendKinds.td13
-rw-r--r--include/clang/Basic/DiagnosticGroups.td50
-rw-r--r--include/clang/Basic/DiagnosticOptions.def1
-rw-r--r--include/clang/Basic/DiagnosticParseKinds.td55
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td388
-rw-r--r--include/clang/Basic/DiagnosticSerializationKinds.td15
-rw-r--r--include/clang/Basic/Features.def4
-rw-r--r--include/clang/Basic/FileManager.h204
-rw-r--r--include/clang/Basic/IdentifierTable.h6
-rw-r--r--include/clang/Basic/LangOptions.def11
-rw-r--r--include/clang/Basic/LangOptions.h16
-rw-r--r--include/clang/Basic/LangStandard.h136
-rw-r--r--include/clang/Basic/LangStandards.def189
-rw-r--r--include/clang/Basic/Linkage.h6
-rw-r--r--include/clang/Basic/OpenCLOptions.h6
-rw-r--r--include/clang/Basic/OpenMPKinds.def103
-rw-r--r--include/clang/Basic/OpenMPKinds.h13
-rw-r--r--include/clang/Basic/OperatorKinds.h19
-rw-r--r--include/clang/Basic/SourceManager.h83
-rw-r--r--include/clang/Basic/Specifiers.h3
-rw-r--r--include/clang/Basic/Stack.h29
-rw-r--r--include/clang/Basic/StmtNodes.td7
-rw-r--r--include/clang/Basic/SyncScope.h2
-rw-r--r--include/clang/Basic/TargetBuiltins.h10
-rw-r--r--include/clang/Basic/TargetInfo.h23
-rw-r--r--include/clang/Basic/TokenKinds.def72
-rw-r--r--include/clang/Basic/TokenKinds.h11
-rw-r--r--include/clang/Basic/TypeNodes.td106
-rw-r--r--include/clang/Basic/X86Target.def5
-rw-r--r--include/clang/Basic/arm_neon.td8
50 files changed, 2330 insertions, 352 deletions
diff --git a/include/clang/Basic/AArch64SVEACLETypes.def b/include/clang/Basic/AArch64SVEACLETypes.def
new file mode 100644
index 0000000000000..7d387587dc297
--- /dev/null
+++ b/include/clang/Basic/AArch64SVEACLETypes.def
@@ -0,0 +1,70 @@
+//===-- AArch64SVEACLETypes.def - Metadata about SVE types ------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines various SVE builtin types. The macros are:
+//
+// SVE_TYPE(Name, Id, SingletonId) - A builtin type that has not been
+// covered by any other #define. Defining this macro covers all
+// the builtins.
+//
+// SVE_VECTOR_TYPE(Name, Id, SingletonId, ElKind, ElBits, IsSigned, IsFP) -
+// An SVE scalable vector.
+//
+// SVE_PREDICATE_TYPE(Name, Id, SingletonId, ElKind) - An SVE scalable
+// predicate.
+//
+// where:
+//
+// - Name is the name of the builtin type.
+//
+// - BuiltinType::Id is the enumerator defining the type.
+//
+// - Context.SingletonId is the global singleton of this type.
+//
+// - ElKind enumerates the type of the elements.
+//
+// - ElBits is the size of one element in bits.
+//
+// - IsSigned is true for vectors of signed integer elements and
+// for vectors of floating-point elements.
+//
+// - IsFP is true for vectors of floating-point elements.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SVE_VECTOR_TYPE
+#define SVE_VECTOR_TYPE(Name, Id, SingletonId, ElKind, ElBits, IsSigned, IsFP)\
+ SVE_TYPE(Name, Id, SingletonId)
+#endif
+
+#ifndef SVE_PREDICATE_TYPE
+#define SVE_PREDICATE_TYPE(Name, Id, SingletonId, ElKind)\
+ SVE_TYPE(Name, Id, SingletonId)
+#endif
+
+//===- Vector point types -----------------------------------------------===//
+
+SVE_VECTOR_TYPE("__SVInt8_t", SveInt8, SveInt8Ty, SveElSInt8, 8, true, false)
+SVE_VECTOR_TYPE("__SVInt16_t", SveInt16, SveInt16Ty, SveElSInt16, 16, true, false)
+SVE_VECTOR_TYPE("__SVInt32_t", SveInt32, SveInt32Ty, SveElSInt32, 32, true, false)
+SVE_VECTOR_TYPE("__SVInt64_t", SveInt64, SveInt64Ty, SveElSInt64, 64, true, false)
+
+SVE_VECTOR_TYPE("__SVUint8_t", SveUint8, SveUint8Ty, SveElUInt8, 8, false, false)
+SVE_VECTOR_TYPE("__SVUint16_t", SveUint16, SveUint16Ty, SveElUInt16, 16, false, false)
+SVE_VECTOR_TYPE("__SVUint32_t", SveUint32, SveUint32Ty, SveElUInt32, 32, false, false)
+SVE_VECTOR_TYPE("__SVUint64_t", SveUint64, SveUint64Ty, SveElUInt64, 64, false, false)
+
+SVE_VECTOR_TYPE("__SVFloat16_t", SveFloat16, SveFloat16Ty, SveElHalf, 16, true, true)
+SVE_VECTOR_TYPE("__SVFloat32_t", SveFloat32, SveFloat32Ty, SveElFloat, 32, true, true)
+SVE_VECTOR_TYPE("__SVFloat64_t", SveFloat64, SveFloat64Ty, SveElDouble, 64, true, true)
+
+SVE_PREDICATE_TYPE("__SVBool_t", SveBool, SveBoolTy, SveElBool)
+
+#undef SVE_VECTOR_TYPE
+#undef SVE_PREDICATE_TYPE
+#undef SVE_TYPE
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td
index d39b16e62b7fa..c3a2ee325dfe4 100644
--- a/include/clang/Basic/Attr.td
+++ b/include/clang/Basic/Attr.td
@@ -722,9 +722,25 @@ def AVRSignal : InheritableAttr, TargetSpecificAttr<TargetAVR> {
def AsmLabel : InheritableAttr {
let Spellings = [Keyword<"asm">, Keyword<"__asm__">];
- let Args = [StringArgument<"Label">];
+ let Args = [
+ // Label specifies the mangled name for the decl.
+ StringArgument<"Label">,
+
+ // IsLiteralLabel specifies whether the label is literal (i.e. suppresses
+ // the global C symbol prefix) or not. If not, the mangle-suppression prefix
+ // ('\01') is omitted from the decl name at the LLVM IR level.
+ //
+ // Non-literal labels are used by some external AST sources like LLDB.
+ BoolArgument<"IsLiteralLabel", /*optional=*/0, /*fake=*/1>
+ ];
let SemaHandler = 0;
- let Documentation = [Undocumented];
+ let Documentation = [AsmLabelDocs];
+ let AdditionalMembers =
+[{
+bool isEquivalent(AsmLabelAttr *Other) const {
+ return getLabel() == Other->getLabel() && getIsLiteralLabel() == Other->getIsLiteralLabel();
+}
+}];
}
def Availability : InheritableAttr {
@@ -911,6 +927,17 @@ def Const : InheritableAttr {
let Documentation = [Undocumented];
}
+def ConstInit : InheritableAttr {
+ // This attribute does not have a C [[]] spelling because it requires the
+ // CPlusPlus language option.
+ let Spellings = [Keyword<"constinit">,
+ Clang<"require_constant_initialization", 0>];
+ let Subjects = SubjectList<[GlobalVar], ErrorDiag>;
+ let Accessors = [Accessor<"isConstinit", [Keyword<"constinit">]>];
+ let Documentation = [ConstInitDocs];
+ let LangOpts = [CPlusPlus];
+}
+
def Constructor : InheritableAttr {
let Spellings = [GCC<"constructor">];
let Args = [DefaultIntArgument<"Priority", 65535>];
@@ -1170,7 +1197,7 @@ def ExtVectorType : Attr {
def FallThrough : StmtAttr {
let Spellings = [CXX11<"", "fallthrough", 201603>, C2x<"", "fallthrough">,
- CXX11<"clang", "fallthrough">];
+ CXX11<"clang", "fallthrough">, GCC<"fallthrough">];
// let Subjects = [NullStmt];
let Documentation = [FallthroughDocs];
}
@@ -1935,15 +1962,6 @@ def ReqdWorkGroupSize : InheritableAttr {
let Documentation = [Undocumented];
}
-def RequireConstantInit : InheritableAttr {
- // This attribute does not have a C [[]] spelling because it requires the
- // CPlusPlus language option.
- let Spellings = [Clang<"require_constant_initialization", 0>];
- let Subjects = SubjectList<[GlobalVar], ErrorDiag>;
- let Documentation = [RequireConstantInitDocs];
- let LangOpts = [CPlusPlus];
-}
-
def WorkGroupSizeHint : InheritableAttr {
// Does not have a [[]] spelling because it is an OpenCL-related attribute.
let Spellings = [GNU<"work_group_size_hint">];
@@ -2002,6 +2020,14 @@ def PragmaClangRodataSection : InheritableAttr {
let Documentation = [Undocumented];
}
+def PragmaClangRelroSection : InheritableAttr {
+ // This attribute has no spellings as it is only ever created implicitly.
+ let Spellings = [];
+ let Args = [StringArgument<"Name">];
+ let Subjects = SubjectList<[GlobalVar], ErrorDiag>;
+ let Documentation = [Undocumented];
+}
+
def PragmaClangTextSection : InheritableAttr {
// This attribute has no spellings as it is only ever created implicitly.
let Spellings = [];
@@ -2335,11 +2361,19 @@ def WarnUnused : InheritableAttr {
}
def WarnUnusedResult : InheritableAttr {
- let Spellings = [CXX11<"", "nodiscard", 201603>, C2x<"", "nodiscard">,
+ let Spellings = [CXX11<"", "nodiscard", 201907>, C2x<"", "nodiscard">,
CXX11<"clang", "warn_unused_result">,
GCC<"warn_unused_result">];
let Subjects = SubjectList<[ObjCMethod, Enum, Record, FunctionLike]>;
+ let Args = [StringArgument<"Message", 1>];
let Documentation = [WarnUnusedResultsDocs];
+ let AdditionalMembers = [{
+ // Check whether this the C++11 nodiscard version, even in non C++11
+ // spellings.
+ bool IsCXX11NoDiscard() const {
+ return this->getSemanticSpelling() == CXX11_nodiscard;
+ }
+ }];
}
def Weak : InheritableAttr {
@@ -2428,6 +2462,12 @@ def NoSanitizeSpecific : InheritableAttr {
let ASTNode = 0;
}
+def CFICanonicalJumpTable : InheritableAttr {
+ let Spellings = [Clang<"cfi_canonical_jump_table">];
+ let Subjects = SubjectList<[Function], ErrorDiag>;
+ let Documentation = [CFICanonicalJumpTableDocs];
+}
+
// C/C++ Thread safety attributes (e.g. for deadlock, data race checking)
// Not all of these attributes will be given a [[]] spelling. The attributes
// which require access to function parameter names cannot use the [[]] spelling
@@ -2788,6 +2828,20 @@ def TypeTagForDatatype : InheritableAttr {
let Documentation = [TypeTagForDatatypeDocs];
}
+def Owner : InheritableAttr {
+ let Spellings = [CXX11<"gsl", "Owner">];
+ let Subjects = SubjectList<[Struct]>;
+ let Args = [TypeArgument<"DerefType", /*opt=*/1>];
+ let Documentation = [LifetimeOwnerDocs];
+}
+
+def Pointer : InheritableAttr {
+ let Spellings = [CXX11<"gsl", "Pointer">];
+ let Subjects = SubjectList<[Struct]>;
+ let Args = [TypeArgument<"DerefType", /*opt=*/1>];
+ let Documentation = [LifetimePointerDocs];
+}
+
// Microsoft-related attributes
def MSNoVTable : InheritableAttr, TargetSpecificAttr<TargetMicrosoftCXXABI> {
@@ -2981,10 +3035,12 @@ def LoopHint : Attr {
let Args = [EnumArgument<"Option", "OptionType",
["vectorize", "vectorize_width", "interleave", "interleave_count",
"unroll", "unroll_count", "unroll_and_jam", "unroll_and_jam_count",
- "pipeline", "pipeline_initiation_interval", "distribute"],
+ "pipeline", "pipeline_initiation_interval", "distribute",
+ "vectorize_predicate"],
["Vectorize", "VectorizeWidth", "Interleave", "InterleaveCount",
"Unroll", "UnrollCount", "UnrollAndJam", "UnrollAndJamCount",
- "PipelineDisabled", "PipelineInitiationInterval", "Distribute"]>,
+ "PipelineDisabled", "PipelineInitiationInterval", "Distribute",
+ "VectorizePredicate"]>,
EnumArgument<"State", "LoopHintState",
["enable", "disable", "numeric", "assume_safety", "full"],
["Enable", "Disable", "Numeric", "AssumeSafety", "Full"]>,
@@ -3004,12 +3060,13 @@ def LoopHint : Attr {
case PipelineDisabled: return "pipeline";
case PipelineInitiationInterval: return "pipeline_initiation_interval";
case Distribute: return "distribute";
+ case VectorizePredicate: return "vectorize_predicate";
}
llvm_unreachable("Unhandled LoopHint option.");
}
void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const {
- unsigned SpellingIndex = getSpellingListIndex();
+ unsigned SpellingIndex = getAttributeSpellingListIndex();
// For "#pragma unroll" and "#pragma nounroll" the string "unroll" or
// "nounroll" is already emitted as the pragma name.
if (SpellingIndex == Pragma_nounroll || SpellingIndex == Pragma_nounroll_and_jam)
@@ -3045,7 +3102,7 @@ def LoopHint : Attr {
// Return a string suitable for identifying this attribute in diagnostics.
std::string getDiagnosticName(const PrintingPolicy &Policy) const {
- unsigned SpellingIndex = getSpellingListIndex();
+ unsigned SpellingIndex = getAttributeSpellingListIndex();
if (SpellingIndex == Pragma_nounroll)
return "#pragma nounroll";
else if (SpellingIndex == Pragma_unroll)
@@ -3176,11 +3233,16 @@ def OMPDeclareTargetDecl : InheritableAttr {
let Args = [
EnumArgument<"MapType", "MapTypeTy",
[ "to", "link" ],
- [ "MT_To", "MT_Link" ]>
+ [ "MT_To", "MT_Link" ]>,
+ EnumArgument<"DevType", "DevTypeTy",
+ [ "host", "nohost", "any" ],
+ [ "DT_Host", "DT_NoHost", "DT_Any" ]>
];
let AdditionalMembers = [{
void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const {
// Use fake syntax because it is for testing and debugging purpose only.
+ if (getDevType() != DT_Any)
+ OS << " device_type(" << ConvertDevTypeTyToStr(getDevType()) << ")";
if (getMapType() != MT_To)
OS << ' ' << ConvertMapTypeTyToStr(getMapType());
}
@@ -3193,6 +3255,14 @@ def OMPDeclareTargetDecl : InheritableAttr {
return llvm::None;
}
+ static llvm::Optional<DevTypeTy> getDeviceType(const ValueDecl *VD) {
+ if (!VD->hasAttrs())
+ return llvm::None;
+ if (const auto *Attr = VD->getAttr<OMPDeclareTargetDeclAttr>())
+ return Attr->getDevType();
+
+ return llvm::None;
+ }
}];
}
@@ -3219,6 +3289,82 @@ def OMPAllocateDecl : InheritableAttr {
let Documentation = [Undocumented];
}
+def OMPDeclareVariant : InheritableAttr {
+ let Spellings = [Pragma<"omp", "declare variant">];
+ let Subjects = SubjectList<[Function]>;
+ let SemaHandler = 0;
+ let HasCustomParsing = 1;
+ let InheritEvenIfAlreadyPresent = 1;
+ let Documentation = [OMPDeclareVariantDocs];
+ let Args = [
+ ExprArgument<"VariantFuncRef">,
+ ExprArgument<"Score">,
+ EnumArgument<"CtxSelectorSet", "CtxSelectorSetType",
+ [ "", "implementation"
+ ],
+ [
+ "CtxSetUnknown", "CtxSetImplementation"
+ ]>,
+ EnumArgument<"CtxScore", "ScoreType",
+ [ "", "score"
+ ],
+ [
+ "ScoreUnknown", "ScoreSpecified"
+ ]>,
+ EnumArgument<"CtxSelector", "CtxSelectorType",
+ [ "", "vendor"
+ ],
+ [
+ "CtxUnknown", "CtxVendor"
+ ]>,
+ VariadicStringArgument<"ImplVendors">
+ ];
+ let AdditionalMembers = [{
+ void printScore(raw_ostream & OS, const PrintingPolicy &Policy) const {
+ if (const Expr *E = getScore()) {
+ OS << "score(";
+ E->printPretty(OS, nullptr, Policy);
+ OS << "):";
+ }
+ }
+ void printPrettyPragma(raw_ostream & OS, const PrintingPolicy &Policy)
+ const {
+ assert(getCtxSelectorSet() != CtxSetUnknown &&
+ getCtxSelector() != CtxUnknown && "Unknown context selector.");
+ if (const Expr *E = getVariantFuncRef()) {
+ OS << "(";
+ E->printPretty(OS, nullptr, Policy);
+ OS << ")";
+ }
+ // TODO: add printing of real context selectors.
+ OS << " match(";
+ switch (getCtxSelectorSet()) {
+ case CtxSetImplementation:
+ OS << "implementation={";
+ switch (getCtxSelector()) {
+ case CtxVendor:
+ OS << "vendor(";
+ printScore(OS, Policy);
+ if (implVendors_size() > 0) {
+ OS << *implVendors(). begin();
+ for (StringRef VendorName : llvm::drop_begin(implVendors(), 1))
+ OS << ", " << VendorName;
+ }
+ OS << ")";
+ break;
+ case CtxUnknown:
+ llvm_unreachable("Unknown context selector.");
+ }
+ OS << "}";
+ break;
+ case CtxSetUnknown:
+ llvm_unreachable("Unknown context selector set.");
+ }
+ OS << ")";
+ }
+ }];
+}
+
def InternalLinkage : InheritableAttr {
let Spellings = [Clang<"internal_linkage">];
let Subjects = SubjectList<[Var, Function, CXXRecord]>;
diff --git a/include/clang/Basic/AttrDocs.td b/include/clang/Basic/AttrDocs.td
index fac6116057dc2..114a9856c5fb4 100644
--- a/include/clang/Basic/AttrDocs.td
+++ b/include/clang/Basic/AttrDocs.td
@@ -1408,15 +1408,17 @@ all optional, but the attribute has to have at least one clause.
}];
}
-def RequireConstantInitDocs : Documentation {
+def ConstInitDocs : Documentation {
let Category = DocCatVariable;
+ let Heading = "require_constant_initialization, constinit (C++20)";
let Content = [{
This attribute specifies that the variable to which it is attached is intended
to have a `constant initializer <http://en.cppreference.com/w/cpp/language/constant_initialization>`_
according to the rules of [basic.start.static]. The variable is required to
have static or thread storage duration. If the initialization of the variable
is not a constant initializer an error will be produced. This attribute may
-only be used in C++.
+only be used in C++; the ``constinit`` spelling is only accepted in C++20
+onwards.
Note that in C++03 strict constant expression checking is not done. Instead
the attribute reports if Clang can emit the variable as a constant, even if it's
@@ -1431,6 +1433,12 @@ for constant initialization have been met. Since these requirements change
between dialects and have subtle pitfalls it's important to fail fast instead
of silently falling back on dynamic initialization.
+The first use of the attribute on a variable must be part of, or precede, the
+initializing declaration of the variable. C++20 requires the ``constinit``
+spelling of the attribute to be present on the initializing declaration if it
+is used anywhere. The other spellings can be specified on a forward declaration
+and omitted on a later initializing declaration.
+
.. code-block:: c++
// -std=c++14
@@ -1482,6 +1490,13 @@ generated when a function or its return type is marked with ``[[nodiscard]]``
potentially-evaluated discarded-value expression that is not explicitly cast to
`void`.
+A string literal may optionally be provided to the attribute, which will be
+reproduced in any resulting diagnostics. Redeclarations using different forms
+of the attribute (with or without the string literal or with different string
+literal contents) are allowed. If there are redeclarations of the entity with
+differing string literals, it is unspecified which one will be used by Clang
+in any resulting diagnostics.
+
.. code-block: c++
struct [[nodiscard]] error_info { /*...*/ };
error_info enable_missile_safety_mode();
@@ -1493,6 +1508,33 @@ potentially-evaluated discarded-value expression that is not explicitly cast to
}
error_info &foo();
void f() { foo(); } // Does not diagnose, error_info is a reference.
+
+Additionally, discarded temporaries resulting from a call to a constructor
+marked with ``[[nodiscard]]`` or a constructor of a type marked
+``[[nodiscard]]`` will also diagnose. This also applies to type conversions that
+use the annotated ``[[nodiscard]]`` constructor or result in an annotated type.
+
+.. code-block: c++
+ struct [[nodiscard]] marked_type {/*..*/ };
+ struct marked_ctor {
+ [[nodiscard]] marked_ctor();
+ marked_ctor(int);
+ };
+
+ struct S {
+ operator marked_type() const;
+ [[nodiscard]] operator int() const;
+ };
+
+ void usages() {
+ marked_type(); // diagnoses.
+ marked_ctor(); // diagnoses.
+ marked_ctor(3); // Does not diagnose, int constructor isn't marked nodiscard.
+
+ S s;
+ static_cast<marked_type>(s); // diagnoses
+ (int)s; // diagnoses
+ }
}];
}
@@ -2187,6 +2229,18 @@ to avoid false positives in other places.
}];
}
+def CFICanonicalJumpTableDocs : Documentation {
+ let Category = DocCatFunction;
+ let Heading = "cfi_canonical_jump_table";
+ let Content = [{
+.. _langext-cfi_canonical_jump_table:
+
+Use ``__attribute__((cfi_canonical_jump_table))`` on a function declaration to
+make the function's CFI jump table canonical. See :ref:`the CFI documentation
+<cfi-canonical-jump-tables>` for more details.
+ }];
+}
+
def DocCatTypeSafety : DocumentationCategory<"Type Safety Checking"> {
let Content = [{
Clang supports additional attributes to enable checking type safety properties
@@ -2504,6 +2558,30 @@ manipulating bits of the enumerator when issuing warnings.
}];
}
+def AsmLabelDocs : Documentation {
+ let Category = DocCatDecl;
+ let Content = [{
+This attribute can be used on a function or variable to specify its symbol name.
+
+On some targets, all C symbols are prefixed by default with a single character, typically ``_``. This was done historically to distinguish them from symbols used by other languages. (This prefix is also added to the standard Itanium C++ ABI prefix on "mangled" symbol names, so that e.g. on such targets the true symbol name for a C++ variable declared as ``int cppvar;`` would be ``__Z6cppvar``; note the two underscores.) This prefix is *not* added to the symbol names specified by the ``asm`` attribute; programmers wishing to match a C symbol name must compensate for this.
+
+For example, consider the following C code:
+
+.. code-block:: c
+
+ int var1 asm("altvar") = 1; // "altvar" in symbol table.
+ int var2 = 1; // "_var2" in symbol table.
+
+ void func1(void) asm("altfunc");
+ void func1(void) {} // "altfunc" in symbol table.
+ void func2(void) {} // "_func2" in symbol table.
+
+Clang's implementation of this attribute is compatible with GCC's, `documented here <https://gcc.gnu.org/onlinedocs/gcc/Asm-Labels.html>`_.
+
+While it is possible to use this attribute to name a special symbol used internally by the compiler, such as an LLVM intrinsic, this is neither recommended nor supported and may cause the compiler to crash or miscompile. Users who wish to gain access to intrinsic behavior are strongly encouraged to request new builtin functions.
+ }];
+}
+
def EnumExtensibilityDocs : Documentation {
let Category = DocCatDecl;
let Content = [{
@@ -2583,7 +2661,7 @@ is retained by the return value of the annotated function
It is only supported in C++.
This attribute provides an experimental implementation of the facility
-described in the C++ committee paper [http://wg21.link/p0936r0](P0936R0),
+described in the C++ committee paper `P0936R0 <http://wg21.link/p0936r0>`_,
and is subject to change as the design of the corresponding functionality
changes.
}];
@@ -2709,9 +2787,10 @@ def LoopHintDocs : Documentation {
let Content = [{
The ``#pragma clang loop`` directive allows loop optimization hints to be
specified for the subsequent loop. The directive allows pipelining to be
-disabled, or vectorization, interleaving, and unrolling to be enabled or disabled.
-Vector width, interleave count, unrolling count, and the initiation interval
-for pipelining can be explicitly specified. See `language extensions
+disabled, or vectorization, vector predication, interleaving, and unrolling to
+be enabled or disabled. Vector width, vector predication, interleave count,
+unrolling count, and the initiation interval for pipelining can be explicitly
+specified. See `language extensions
<http://clang.llvm.org/docs/LanguageExtensions.html#extensions-for-loop-hint-optimizations>`_
for details.
}];
@@ -3129,6 +3208,55 @@ The syntax of the declare target directive is as follows:
#pragma omp declare target new-line
declarations-definition-seq
#pragma omp end declare target new-line
+
+or
+
+ .. code-block:: c
+
+ #pragma omp declare target (extended-list) new-line
+
+or
+
+ .. code-block:: c
+
+ #pragma omp declare target clause[ [,] clause ... ] new-line
+
+where clause is one of the following:
+
+
+ .. code-block:: c
+
+ to(extended-list)
+ link(list)
+ device_type(host | nohost | any)
+ }];
+}
+
+def OMPDeclareVariantDocs : Documentation {
+ let Category = DocCatFunction;
+ let Heading = "#pragma omp declare variant";
+ let Content = [{
+The `declare variant` directive declares a specialized variant of a base
+ function and specifies the context in which that specialized variant is used.
+ The declare variant directive is a declarative directive.
+The syntax of the `declare variant` construct is as follows:
+
+ .. code-block:: none
+
+ #pragma omp declare variant(variant-func-id) clause new-line
+ [#pragma omp declare variant(variant-func-id) clause new-line]
+ [...]
+ function definition or declaration
+
+where clause is one of the following:
+
+ .. code-block:: none
+
+ match(context-selector-specification)
+
+and where `variant-func-id` is the name of a function variant that is either a
+ base language identifier or, for C++, a template-id.
+
}];
}
@@ -4194,4 +4322,72 @@ be accessed on both device side and host side. It has external linkage and is
not initialized on device side. It has internal linkage and is initialized by
the initializer on host side.
}];
-} \ No newline at end of file
+}
+
+def LifetimeOwnerDocs : Documentation {
+ let Category = DocCatDecl;
+ let Content = [{
+.. Note:: This attribute is experimental and its effect on analysis is subject to change in
+ a future version of clang.
+
+The attribute ``[[gsl::Owner(T)]]`` applies to structs and classes that own an
+object of type ``T``:
+
+.. code-block:: c++
+
+ class [[gsl::Owner(int)]] IntOwner {
+ private:
+ int value;
+ public:
+ int *getInt() { return &value; }
+ };
+
+The argument ``T`` is optional and is ignored.
+This attribute may be used by analysis tools and has no effect on code
+generation.
+
+See Pointer_ for an example.
+}];
+}
+
+def LifetimePointerDocs : Documentation {
+ let Category = DocCatDecl;
+ let Content = [{
+.. Note:: This attribute is experimental and its effect on analysis is subject to change in
+ a future version of clang.
+
+The attribute ``[[gsl::Pointer(T)]]`` applies to structs and classes that behave
+like pointers to an object of type ``T``:
+
+.. code-block:: c++
+
+ class [[gsl::Pointer(int)]] IntPointer {
+ private:
+ int *valuePointer;
+ public:
+ int *getInt() { return &valuePointer; }
+ };
+
+The argument ``T`` is optional and is ignored.
+This attribute may be used by analysis tools and has no effect on code
+generation.
+
+Example:
+When constructing an instance of a class annotated like this (a Pointer) from
+an instance of a class annotated with ``[[gsl::Owner]]`` (an Owner),
+then the analysis will consider the Pointer to point inside the Owner.
+When the Owner's lifetime ends, it will consider the Pointer to be dangling.
+
+.. code-block:: c++
+
+ int f() {
+ IntPointer P;
+ if (true) {
+ IntOwner O(7);
+ P = IntPointer(O); // P "points into" O
+ } // P is dangling
+ return P.get(); // error: Using a dangling Pointer.
+ }
+
+}];
+}
diff --git a/include/clang/Basic/AttributeCommonInfo.h b/include/clang/Basic/AttributeCommonInfo.h
new file mode 100644
index 0000000000000..545e7e9a2b47e
--- /dev/null
+++ b/include/clang/Basic/AttributeCommonInfo.h
@@ -0,0 +1,190 @@
+//======- AttributeCommonInfo.h - Base info about Attributes-----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the AttributeCommonInfo type, which is the base for a
+// ParsedAttr and is used by Attr as a way to share info between the two.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H
+#define LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H
+#include "clang/Basic/SourceLocation.h"
+
+namespace clang {
+class IdentifierInfo;
+class ASTRecordWriter;
+
+class AttributeCommonInfo {
+public:
+ /// The style used to specify an attribute.
+ enum Syntax {
+ /// __attribute__((...))
+ AS_GNU,
+
+ /// [[...]]
+ AS_CXX11,
+
+ /// [[...]]
+ AS_C2x,
+
+ /// __declspec(...)
+ AS_Declspec,
+
+ /// [uuid("...")] class Foo
+ AS_Microsoft,
+
+ /// __ptr16, alignas(...), etc.
+ AS_Keyword,
+
+ /// #pragma ...
+ AS_Pragma,
+
+ // Note TableGen depends on the order above. Do not add or change the order
+ // without adding related code to TableGen/ClangAttrEmitter.cpp.
+ /// Context-sensitive version of a keyword attribute.
+ AS_ContextSensitiveKeyword,
+ };
+ enum Kind {
+#define PARSED_ATTR(NAME) AT_##NAME,
+#include "clang/Sema/AttrParsedAttrList.inc"
+#undef PARSED_ATTR
+ NoSemaHandlerAttribute,
+ IgnoredAttribute,
+ UnknownAttribute,
+ };
+
+private:
+ const IdentifierInfo *AttrName = nullptr;
+ const IdentifierInfo *ScopeName = nullptr;
+ SourceRange AttrRange;
+ const SourceLocation ScopeLoc;
+ // Corresponds to the Kind enum.
+ unsigned AttrKind : 16;
+ /// Corresponds to the Syntax enum.
+ unsigned SyntaxUsed : 3;
+ unsigned SpellingIndex : 4;
+
+protected:
+ static constexpr unsigned SpellingNotCalculated = 0xf;
+
+public:
+ AttributeCommonInfo(SourceRange AttrRange)
+ : AttrRange(AttrRange), ScopeLoc(), AttrKind(0), SyntaxUsed(0),
+ SpellingIndex(SpellingNotCalculated) {}
+
+ AttributeCommonInfo(SourceLocation AttrLoc)
+ : AttrRange(AttrLoc), ScopeLoc(), AttrKind(0), SyntaxUsed(0),
+ SpellingIndex(SpellingNotCalculated) {}
+
+ AttributeCommonInfo(const IdentifierInfo *AttrName,
+ const IdentifierInfo *ScopeName, SourceRange AttrRange,
+ SourceLocation ScopeLoc, Syntax SyntaxUsed)
+ : AttrName(AttrName), ScopeName(ScopeName), AttrRange(AttrRange),
+ ScopeLoc(ScopeLoc),
+ AttrKind(getParsedKind(AttrName, ScopeName, SyntaxUsed)),
+ SyntaxUsed(SyntaxUsed), SpellingIndex(SpellingNotCalculated) {}
+
+ AttributeCommonInfo(const IdentifierInfo *AttrName,
+ const IdentifierInfo *ScopeName, SourceRange AttrRange,
+ SourceLocation ScopeLoc, Kind AttrKind, Syntax SyntaxUsed)
+ : AttrName(AttrName), ScopeName(ScopeName), AttrRange(AttrRange),
+ ScopeLoc(ScopeLoc), AttrKind(AttrKind), SyntaxUsed(SyntaxUsed),
+ SpellingIndex(SpellingNotCalculated) {}
+
+ AttributeCommonInfo(const IdentifierInfo *AttrName,
+ const IdentifierInfo *ScopeName, SourceRange AttrRange,
+ SourceLocation ScopeLoc, Kind AttrKind, Syntax SyntaxUsed,
+ unsigned Spelling)
+ : AttrName(AttrName), ScopeName(ScopeName), AttrRange(AttrRange),
+ ScopeLoc(ScopeLoc), AttrKind(AttrKind), SyntaxUsed(SyntaxUsed),
+ SpellingIndex(Spelling) {}
+
+ AttributeCommonInfo(const IdentifierInfo *AttrName, SourceRange AttrRange,
+ Syntax SyntaxUsed)
+ : AttrName(AttrName), ScopeName(nullptr), AttrRange(AttrRange),
+ ScopeLoc(), AttrKind(getParsedKind(AttrName, ScopeName, SyntaxUsed)),
+ SyntaxUsed(SyntaxUsed), SpellingIndex(SpellingNotCalculated) {}
+
+ AttributeCommonInfo(SourceRange AttrRange, Kind K, Syntax SyntaxUsed)
+ : AttrName(nullptr), ScopeName(nullptr), AttrRange(AttrRange), ScopeLoc(),
+ AttrKind(K), SyntaxUsed(SyntaxUsed),
+ SpellingIndex(SpellingNotCalculated) {}
+
+ AttributeCommonInfo(SourceRange AttrRange, Kind K, Syntax SyntaxUsed,
+ unsigned Spelling)
+ : AttrName(nullptr), ScopeName(nullptr), AttrRange(AttrRange), ScopeLoc(),
+ AttrKind(K), SyntaxUsed(SyntaxUsed), SpellingIndex(Spelling) {}
+
+ AttributeCommonInfo(AttributeCommonInfo &&) = default;
+ AttributeCommonInfo(const AttributeCommonInfo &) = default;
+
+ Kind getParsedKind() const { return Kind(AttrKind); }
+ Syntax getSyntax() const { return Syntax(SyntaxUsed); }
+ const IdentifierInfo *getAttrName() const { return AttrName; }
+ SourceLocation getLoc() const { return AttrRange.getBegin(); }
+ SourceRange getRange() const { return AttrRange; }
+ void setRange(SourceRange R) { AttrRange = R; }
+
+ bool hasScope() const { return ScopeName; }
+ const IdentifierInfo *getScopeName() const { return ScopeName; }
+ SourceLocation getScopeLoc() const { return ScopeLoc; }
+
+ bool isDeclspecAttribute() const { return SyntaxUsed == AS_Declspec; }
+ bool isMicrosoftAttribute() const { return SyntaxUsed == AS_Microsoft; }
+
+ bool isGNUScope() const;
+
+ bool isAlignasAttribute() const {
+ // FIXME: Use a better mechanism to determine this.
+ return getParsedKind() == AT_Aligned && isKeywordAttribute();
+ }
+
+ bool isCXX11Attribute() const {
+ return SyntaxUsed == AS_CXX11 || isAlignasAttribute();
+ }
+
+ bool isC2xAttribute() const { return SyntaxUsed == AS_C2x; }
+
+ bool isKeywordAttribute() const {
+ return SyntaxUsed == AS_Keyword || SyntaxUsed == AS_ContextSensitiveKeyword;
+ }
+
+ bool isContextSensitiveKeywordAttribute() const {
+ return SyntaxUsed == AS_ContextSensitiveKeyword;
+ }
+
+ unsigned getAttributeSpellingListIndex() const {
+ assert((isAttributeSpellingListCalculated() || AttrName) &&
+ "Spelling cannot be found");
+ return isAttributeSpellingListCalculated()
+ ? SpellingIndex
+ : calculateAttributeSpellingListIndex();
+ }
+ void setAttributeSpellingListIndex(unsigned V) { SpellingIndex = V; }
+
+ static Kind getParsedKind(const IdentifierInfo *Name,
+ const IdentifierInfo *Scope, Syntax SyntaxUsed);
+
+private:
+ /// Get an index into the attribute spelling list
+ /// defined in Attr.td. This index is used by an attribute
+ /// to pretty print itself.
+ unsigned calculateAttributeSpellingListIndex() const;
+
+ friend class clang::ASTRecordWriter;
+ // Used exclusively by ASTDeclWriter to get the raw spelling list state.
+ unsigned getAttributeSpellingListIndexRaw() const { return SpellingIndex; }
+
+protected:
+ bool isAttributeSpellingListCalculated() const {
+ return SpellingIndex != SpellingNotCalculated;
+ }
+};
+} // namespace clang
+
+#endif // LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H
diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def
index 984e607a2fc45..76e3b03de833b 100644
--- a/include/clang/Basic/Builtins.def
+++ b/include/clang/Basic/Builtins.def
@@ -113,14 +113,17 @@ BUILTIN(__builtin_atan2l, "LdLdLd", "Fne")
BUILTIN(__builtin_abs , "ii" , "ncF")
BUILTIN(__builtin_copysign, "ddd", "ncF")
BUILTIN(__builtin_copysignf, "fff", "ncF")
+BUILTIN(__builtin_copysignf16, "hhh", "ncF")
BUILTIN(__builtin_copysignl, "LdLdLd", "ncF")
BUILTIN(__builtin_copysignf128, "LLdLLdLLd", "ncF")
BUILTIN(__builtin_fabs , "dd" , "ncF")
BUILTIN(__builtin_fabsf, "ff" , "ncF")
BUILTIN(__builtin_fabsl, "LdLd", "ncF")
+BUILTIN(__builtin_fabsf16, "hh" , "ncF")
BUILTIN(__builtin_fabsf128, "LLdLLd", "ncF")
BUILTIN(__builtin_fmod , "ddd" , "Fne")
BUILTIN(__builtin_fmodf, "fff" , "Fne")
+BUILTIN(__builtin_fmodf16, "hhh" , "Fne")
BUILTIN(__builtin_fmodl, "LdLdLd", "Fne")
BUILTIN(__builtin_frexp , "ddi*" , "Fn")
BUILTIN(__builtin_frexpf, "ffi*" , "Fn")
@@ -154,6 +157,7 @@ BUILTIN(__builtin_powif, "ffi" , "Fnc")
BUILTIN(__builtin_powil, "LdLdi", "Fnc")
BUILTIN(__builtin_pow , "ddd" , "Fne")
BUILTIN(__builtin_powf, "fff" , "Fne")
+BUILTIN(__builtin_powf16, "hhh" , "Fne")
BUILTIN(__builtin_powl, "LdLdLd", "Fne")
// Standard unary libc/libm functions with double/float/long double variants:
@@ -180,9 +184,11 @@ BUILTIN(__builtin_cbrtf, "ff", "Fnc")
BUILTIN(__builtin_cbrtl, "LdLd", "Fnc")
BUILTIN(__builtin_ceil , "dd" , "Fnc")
BUILTIN(__builtin_ceilf, "ff" , "Fnc")
+BUILTIN(__builtin_ceilf16, "hh" , "Fnc")
BUILTIN(__builtin_ceill, "LdLd", "Fnc")
BUILTIN(__builtin_cos , "dd" , "Fne")
BUILTIN(__builtin_cosf, "ff" , "Fne")
+BUILTIN(__builtin_cosf16, "hh" , "Fne")
BUILTIN(__builtin_cosh , "dd" , "Fne")
BUILTIN(__builtin_coshf, "ff" , "Fne")
BUILTIN(__builtin_coshl, "LdLd", "Fne")
@@ -195,9 +201,11 @@ BUILTIN(__builtin_erfcf, "ff", "Fne")
BUILTIN(__builtin_erfcl, "LdLd", "Fne")
BUILTIN(__builtin_exp , "dd" , "Fne")
BUILTIN(__builtin_expf, "ff" , "Fne")
+BUILTIN(__builtin_expf16, "hh" , "Fne")
BUILTIN(__builtin_expl, "LdLd", "Fne")
BUILTIN(__builtin_exp2 , "dd" , "Fne")
BUILTIN(__builtin_exp2f, "ff" , "Fne")
+BUILTIN(__builtin_exp2f16, "hh" , "Fne")
BUILTIN(__builtin_exp2l, "LdLd", "Fne")
BUILTIN(__builtin_expm1 , "dd", "Fne")
BUILTIN(__builtin_expm1f, "ff", "Fne")
@@ -207,15 +215,19 @@ BUILTIN(__builtin_fdimf, "fff", "Fne")
BUILTIN(__builtin_fdiml, "LdLdLd", "Fne")
BUILTIN(__builtin_floor , "dd" , "Fnc")
BUILTIN(__builtin_floorf, "ff" , "Fnc")
+BUILTIN(__builtin_floorf16, "hh" , "Fnc")
BUILTIN(__builtin_floorl, "LdLd", "Fnc")
BUILTIN(__builtin_fma, "dddd", "Fne")
BUILTIN(__builtin_fmaf, "ffff", "Fne")
+BUILTIN(__builtin_fmaf16, "hhhh", "Fne")
BUILTIN(__builtin_fmal, "LdLdLdLd", "Fne")
BUILTIN(__builtin_fmax, "ddd", "Fnc")
BUILTIN(__builtin_fmaxf, "fff", "Fnc")
+BUILTIN(__builtin_fmaxf16, "hhh", "Fnc")
BUILTIN(__builtin_fmaxl, "LdLdLd", "Fnc")
BUILTIN(__builtin_fmin, "ddd", "Fnc")
BUILTIN(__builtin_fminf, "fff", "Fnc")
+BUILTIN(__builtin_fminf16, "hhh", "Fnc")
BUILTIN(__builtin_fminl, "LdLdLd", "Fnc")
BUILTIN(__builtin_hypot , "ddd" , "Fne")
BUILTIN(__builtin_hypotf, "fff" , "Fne")
@@ -235,17 +247,20 @@ BUILTIN(__builtin_llroundl, "LLiLd", "Fne")
BUILTIN(__builtin_log , "dd" , "Fne")
BUILTIN(__builtin_log10 , "dd" , "Fne")
BUILTIN(__builtin_log10f, "ff" , "Fne")
+BUILTIN(__builtin_log10f16, "hh" , "Fne")
BUILTIN(__builtin_log10l, "LdLd", "Fne")
BUILTIN(__builtin_log1p , "dd" , "Fne")
BUILTIN(__builtin_log1pf, "ff" , "Fne")
BUILTIN(__builtin_log1pl, "LdLd", "Fne")
BUILTIN(__builtin_log2, "dd" , "Fne")
BUILTIN(__builtin_log2f, "ff" , "Fne")
+BUILTIN(__builtin_log2f16, "hh" , "Fne")
BUILTIN(__builtin_log2l, "LdLd" , "Fne")
BUILTIN(__builtin_logb , "dd", "Fne")
BUILTIN(__builtin_logbf, "ff", "Fne")
BUILTIN(__builtin_logbl, "LdLd", "Fne")
BUILTIN(__builtin_logf, "ff" , "Fne")
+BUILTIN(__builtin_logf16, "hh" , "Fne")
BUILTIN(__builtin_logl, "LdLd", "Fne")
BUILTIN(__builtin_lrint , "Lid", "Fne")
BUILTIN(__builtin_lrintf, "Lif", "Fne")
@@ -270,9 +285,11 @@ BUILTIN(__builtin_remquof, "fffi*", "Fn")
BUILTIN(__builtin_remquol, "LdLdLdi*", "Fn")
BUILTIN(__builtin_rint , "dd", "Fnc")
BUILTIN(__builtin_rintf, "ff", "Fnc")
+BUILTIN(__builtin_rintf16, "hh", "Fnc")
BUILTIN(__builtin_rintl, "LdLd", "Fnc")
BUILTIN(__builtin_round, "dd" , "Fnc")
BUILTIN(__builtin_roundf, "ff" , "Fnc")
+BUILTIN(__builtin_roundf16, "hh" , "Fnc")
BUILTIN(__builtin_roundl, "LdLd" , "Fnc")
BUILTIN(__builtin_scalbln , "ddLi", "Fne")
BUILTIN(__builtin_scalblnf, "ffLi", "Fne")
@@ -282,12 +299,14 @@ BUILTIN(__builtin_scalbnf, "ffi", "Fne")
BUILTIN(__builtin_scalbnl, "LdLdi", "Fne")
BUILTIN(__builtin_sin , "dd" , "Fne")
BUILTIN(__builtin_sinf, "ff" , "Fne")
+BUILTIN(__builtin_sinf16, "hh" , "Fne")
BUILTIN(__builtin_sinh , "dd" , "Fne")
BUILTIN(__builtin_sinhf, "ff" , "Fne")
BUILTIN(__builtin_sinhl, "LdLd", "Fne")
BUILTIN(__builtin_sinl, "LdLd", "Fne")
BUILTIN(__builtin_sqrt , "dd" , "Fne")
BUILTIN(__builtin_sqrtf, "ff" , "Fne")
+BUILTIN(__builtin_sqrtf16, "hh" , "Fne")
BUILTIN(__builtin_sqrtl, "LdLd", "Fne")
BUILTIN(__builtin_tan , "dd" , "Fne")
BUILTIN(__builtin_tanf, "ff" , "Fne")
@@ -301,6 +320,7 @@ BUILTIN(__builtin_tgammal, "LdLd", "Fne")
BUILTIN(__builtin_trunc , "dd", "Fnc")
BUILTIN(__builtin_truncf, "ff", "Fnc")
BUILTIN(__builtin_truncl, "LdLd", "Fnc")
+BUILTIN(__builtin_truncf16, "hh", "Fnc")
// C99 complex builtins
BUILTIN(__builtin_cabs, "dXd", "Fne")
@@ -394,6 +414,7 @@ BUILTIN(__builtin_signbitl, "iLd", "Fnc")
// Special FP builtins.
BUILTIN(__builtin_canonicalize, "dd", "nc")
BUILTIN(__builtin_canonicalizef, "ff", "nc")
+BUILTIN(__builtin_canonicalizef16, "hh", "nc")
BUILTIN(__builtin_canonicalizel, "LdLd", "nc")
// Builtins for arithmetic.
@@ -440,7 +461,7 @@ BUILTIN(__builtin_rotateleft64, "UWiUWiUWi", "nc")
BUILTIN(__builtin_rotateright8, "UcUcUc", "nc")
BUILTIN(__builtin_rotateright16, "UsUsUs", "nc")
BUILTIN(__builtin_rotateright32, "UZiUZiUZi", "nc")
-BUILTIN(__builtin_rotateright64, "UWiUWiWi", "nc")
+BUILTIN(__builtin_rotateright64, "UWiUWiUWi", "nc")
// Random GCC builtins
BUILTIN(__builtin_constant_p, "i.", "nctu")
@@ -984,9 +1005,7 @@ LIBBUILTIN(pthread_create, "", "fC<2,3>", "pthread.h", ALL_GNU_LANGUAGES)
LIBBUILTIN(_setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(__sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES)
-LIBBUILTIN(setjmp_syscall, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(savectx, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
-LIBBUILTIN(qsetjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(getcontext, "iK*", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h", ALL_GNU_LANGUAGES)
@@ -1449,7 +1468,7 @@ BUILTIN(__builtin_operator_new, "v*z", "tc")
BUILTIN(__builtin_operator_delete, "vv*", "tn")
BUILTIN(__builtin_char_memchr, "c*cC*iz", "n")
BUILTIN(__builtin_dump_struct, "ivC*v*", "tn")
-BUILTIN(__builtin_preserve_access_index, "vC*vC*", "nU")
+BUILTIN(__builtin_preserve_access_index, "v.", "t")
// Safestack builtins
BUILTIN(__builtin___get_unsafe_stack_start, "v*", "Fn")
diff --git a/include/clang/Basic/BuiltinsAArch64.def b/include/clang/Basic/BuiltinsAArch64.def
index 7701ad98f4832..4df8d5a167621 100644
--- a/include/clang/Basic/BuiltinsAArch64.def
+++ b/include/clang/Basic/BuiltinsAArch64.def
@@ -91,12 +91,18 @@ LANGBUILTIN(__sevl, "v", "", ALL_MS_LANGUAGES)
// Misc
BUILTIN(__builtin_sponentry, "v*", "c")
+// Transactional Memory Extension
+BUILTIN(__builtin_arm_tstart, "WUi", "nj")
+BUILTIN(__builtin_arm_tcommit, "v", "n")
+BUILTIN(__builtin_arm_tcancel, "vWUIi", "n")
+BUILTIN(__builtin_arm_ttest, "WUi", "nc")
+
TARGET_HEADER_BUILTIN(_BitScanForward, "UcUNi*UNi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_BitScanReverse, "UcUNi*UNi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_BitScanForward64, "UcUNi*ULLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_BitScanReverse64, "UcUNi*ULLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedAdd, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAdd, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedAnd64, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedDecrement64, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchange64, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -106,9 +112,9 @@ TARGET_HEADER_BUILTIN(_InterlockedIncrement64, "LLiLLiD*", "nh", "intrin.h"
TARGET_HEADER_BUILTIN(_InterlockedOr64, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedXor64, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd_acq, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd_rel, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd_nf, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd_acq, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd_rel, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd_nf, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd8_acq, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd8_rel, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd8_nf, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -125,9 +131,9 @@ TARGET_HEADER_BUILTIN(_InterlockedExchange8_rel, "ccD*c", "nh", "intrin.h
TARGET_HEADER_BUILTIN(_InterlockedExchange16_acq, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchange16_nf, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchange16_rel, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedExchange_acq, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedExchange_nf, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedExchange_rel, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedExchange_acq, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedExchange_nf, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedExchange_rel, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchange64_acq, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchange64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchange64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -138,9 +144,9 @@ TARGET_HEADER_BUILTIN(_InterlockedCompareExchange8_rel, "ccD*cc", "nh",
TARGET_HEADER_BUILTIN(_InterlockedCompareExchange16_acq, "ssD*ss", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedCompareExchange16_nf, "ssD*ss", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedCompareExchange16_rel, "ssD*ss", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_acq, "LiLiD*LiLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_nf, "LiLiD*LiLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_rel, "LiLiD*LiLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_acq, "NiNiD*NiNi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_nf, "NiNiD*NiNi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_rel, "NiNiD*NiNi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_acq, "LLiLLiD*LLiLLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_nf, "LLiLLiD*LLiLLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_rel, "LLiLLiD*LLiLLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -151,9 +157,9 @@ TARGET_HEADER_BUILTIN(_InterlockedOr8_rel, "ccD*c", "nh", "intrin.h", ALL
TARGET_HEADER_BUILTIN(_InterlockedOr16_acq, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedOr16_nf, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedOr16_rel, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedOr_acq, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedOr_nf, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedOr_rel, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr_acq, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr_nf, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr_rel, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedOr64_acq, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedOr64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedOr64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -164,9 +170,9 @@ TARGET_HEADER_BUILTIN(_InterlockedXor8_rel, "ccD*c", "nh", "intrin.h", AL
TARGET_HEADER_BUILTIN(_InterlockedXor16_acq, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedXor16_nf, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedXor16_rel, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedXor_acq, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedXor_nf, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedXor_rel, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor_acq, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor_nf, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor_rel, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedXor64_acq, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedXor64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedXor64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -177,9 +183,9 @@ TARGET_HEADER_BUILTIN(_InterlockedAnd8_rel, "ccD*c", "nh", "intrin.h", AL
TARGET_HEADER_BUILTIN(_InterlockedAnd16_acq, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedAnd16_nf, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedAnd16_rel, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedAnd_acq, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedAnd_nf, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedAnd_rel, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd_acq, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd_nf, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd_rel, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedAnd64_acq, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedAnd64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedAnd64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -187,9 +193,9 @@ TARGET_HEADER_BUILTIN(_InterlockedAnd64_rel, "LLiLLiD*LLi", "nh", "intrin.h", AL
TARGET_HEADER_BUILTIN(_InterlockedIncrement16_acq, "ssD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedIncrement16_nf, "ssD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedIncrement16_rel, "ssD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedIncrement_acq, "LiLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedIncrement_nf, "LiLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedIncrement_rel, "LiLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement_acq, "NiNiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement_nf, "NiNiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement_rel, "NiNiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedIncrement64_acq, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedIncrement64_nf, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedIncrement64_rel, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -197,9 +203,9 @@ TARGET_HEADER_BUILTIN(_InterlockedIncrement64_rel, "LLiLLiD*", "nh", "intrin.h",
TARGET_HEADER_BUILTIN(_InterlockedDecrement16_acq, "ssD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedDecrement16_nf, "ssD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedDecrement16_rel, "ssD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedDecrement_acq, "LiLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedDecrement_nf, "LiLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedDecrement_rel, "LiLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement_acq, "NiNiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement_nf, "NiNiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement_rel, "NiNiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedDecrement64_acq, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedDecrement64_nf, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedDecrement64_rel, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
diff --git a/include/clang/Basic/BuiltinsAMDGPU.def b/include/clang/Basic/BuiltinsAMDGPU.def
index 2f8fb9000a76a..9b3a0f96798f9 100644
--- a/include/clang/Basic/BuiltinsAMDGPU.def
+++ b/include/clang/Basic/BuiltinsAMDGPU.def
@@ -118,6 +118,13 @@ BUILTIN(__builtin_amdgcn_cvt_pknorm_u16, "E2Usff", "nc")
BUILTIN(__builtin_amdgcn_cvt_pk_i16, "E2sii", "nc")
BUILTIN(__builtin_amdgcn_cvt_pk_u16, "E2UsUiUi", "nc")
BUILTIN(__builtin_amdgcn_cvt_pk_u8_f32, "UifUiUi", "nc")
+BUILTIN(__builtin_amdgcn_sad_u8, "UiUiUiUi", "nc")
+BUILTIN(__builtin_amdgcn_msad_u8, "UiUiUiUi", "nc")
+BUILTIN(__builtin_amdgcn_sad_hi_u8, "UiUiUiUi", "nc")
+BUILTIN(__builtin_amdgcn_sad_u16, "UiUiUiUi", "nc")
+BUILTIN(__builtin_amdgcn_qsad_pk_u16_u8, "LUiLUiUiLUi", "nc")
+BUILTIN(__builtin_amdgcn_mqsad_pk_u16_u8, "LUiLUiUiLUi", "nc")
+BUILTIN(__builtin_amdgcn_mqsad_u32_u8, "V4UiLUiUiV4Ui", "nc")
//===----------------------------------------------------------------------===//
// CI+ only builtins.
@@ -125,6 +132,8 @@ BUILTIN(__builtin_amdgcn_cvt_pk_u8_f32, "UifUiUi", "nc")
TARGET_BUILTIN(__builtin_amdgcn_s_dcache_inv_vol, "v", "n", "ci-insts")
TARGET_BUILTIN(__builtin_amdgcn_buffer_wbinvl1_vol, "v", "n", "ci-insts")
TARGET_BUILTIN(__builtin_amdgcn_ds_gws_sema_release_all, "vUi", "n", "ci-insts")
+TARGET_BUILTIN(__builtin_amdgcn_is_shared, "bvC*0", "nc", "flat-address-space")
+TARGET_BUILTIN(__builtin_amdgcn_is_private, "bvC*0", "nc", "flat-address-space")
//===----------------------------------------------------------------------===//
// Interpolation builtins.
diff --git a/include/clang/Basic/BuiltinsARM.def b/include/clang/Basic/BuiltinsARM.def
index 3f0765115b1cc..19b51694aa22d 100644
--- a/include/clang/Basic/BuiltinsARM.def
+++ b/include/clang/Basic/BuiltinsARM.def
@@ -221,9 +221,9 @@ TARGET_HEADER_BUILTIN(_InterlockedIncrement64, "LLiLLiD*", "nh", "intrin.h"
TARGET_HEADER_BUILTIN(_InterlockedOr64, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedXor64, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd_acq, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd_rel, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd_nf, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd_acq, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd_rel, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd_nf, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd8_acq, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd8_rel, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchangeAdd8_nf, "ccD*c", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -240,9 +240,9 @@ TARGET_HEADER_BUILTIN(_InterlockedExchange8_rel, "ccD*c", "nh", "intrin.h
TARGET_HEADER_BUILTIN(_InterlockedExchange16_acq, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchange16_nf, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchange16_rel, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedExchange_acq, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedExchange_nf, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedExchange_rel, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedExchange_acq, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedExchange_nf, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedExchange_rel, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchange64_acq, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchange64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedExchange64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -253,9 +253,9 @@ TARGET_HEADER_BUILTIN(_InterlockedCompareExchange8_rel, "ccD*cc", "nh",
TARGET_HEADER_BUILTIN(_InterlockedCompareExchange16_acq, "ssD*ss", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedCompareExchange16_nf, "ssD*ss", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedCompareExchange16_rel, "ssD*ss", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_acq, "LiLiD*LiLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_nf, "LiLiD*LiLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_rel, "LiLiD*LiLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_acq, "NiNiD*NiNi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_nf, "NiNiD*NiNi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange_rel, "NiNiD*NiNi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_acq, "LLiLLiD*LLiLLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_nf, "LLiLLiD*LLiLLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_rel, "LLiLLiD*LLiLLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -266,9 +266,9 @@ TARGET_HEADER_BUILTIN(_InterlockedOr8_rel, "ccD*c", "nh", "intrin.h", ALL
TARGET_HEADER_BUILTIN(_InterlockedOr16_acq, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedOr16_nf, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedOr16_rel, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedOr_acq, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedOr_nf, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedOr_rel, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr_acq, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr_nf, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedOr_rel, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedOr64_acq, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedOr64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedOr64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -279,9 +279,9 @@ TARGET_HEADER_BUILTIN(_InterlockedXor8_rel, "ccD*c", "nh", "intrin.h", AL
TARGET_HEADER_BUILTIN(_InterlockedXor16_acq, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedXor16_nf, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedXor16_rel, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedXor_acq, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedXor_nf, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedXor_rel, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor_acq, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor_nf, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedXor_rel, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedXor64_acq, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedXor64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedXor64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -292,9 +292,9 @@ TARGET_HEADER_BUILTIN(_InterlockedAnd8_rel, "ccD*c", "nh", "intrin.h", AL
TARGET_HEADER_BUILTIN(_InterlockedAnd16_acq, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedAnd16_nf, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedAnd16_rel, "ssD*s", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedAnd_acq, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedAnd_nf, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedAnd_rel, "LiLiD*Li", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd_acq, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd_nf, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedAnd_rel, "NiNiD*Ni", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedAnd64_acq, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedAnd64_nf, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedAnd64_rel, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -302,9 +302,9 @@ TARGET_HEADER_BUILTIN(_InterlockedAnd64_rel, "LLiLLiD*LLi", "nh", "intrin.h", AL
TARGET_HEADER_BUILTIN(_InterlockedIncrement16_acq, "ssD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedIncrement16_nf, "ssD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedIncrement16_rel, "ssD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedIncrement_acq, "LiLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedIncrement_nf, "LiLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedIncrement_rel, "LiLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement_acq, "NiNiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement_nf, "NiNiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedIncrement_rel, "NiNiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedIncrement64_acq, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedIncrement64_nf, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedIncrement64_rel, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
@@ -312,9 +312,9 @@ TARGET_HEADER_BUILTIN(_InterlockedIncrement64_rel, "LLiLLiD*", "nh", "intrin.h",
TARGET_HEADER_BUILTIN(_InterlockedDecrement16_acq, "ssD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedDecrement16_nf, "ssD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedDecrement16_rel, "ssD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedDecrement_acq, "LiLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedDecrement_nf, "LiLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
-TARGET_HEADER_BUILTIN(_InterlockedDecrement_rel, "LiLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement_acq, "NiNiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement_nf, "NiNiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedDecrement_rel, "NiNiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedDecrement64_acq, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedDecrement64_nf, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedDecrement64_rel, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
diff --git a/include/clang/Basic/BuiltinsBPF.def b/include/clang/Basic/BuiltinsBPF.def
new file mode 100644
index 0000000000000..bd96b9ef531ba
--- /dev/null
+++ b/include/clang/Basic/BuiltinsBPF.def
@@ -0,0 +1,24 @@
+//===--- BuiltinsBPF.def - BPF Builtin function database --------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the BPF-specific builtin function database. Users of
+// this file must define the BUILTIN macro to make use of this information.
+//
+//===----------------------------------------------------------------------===//
+
+// The format of this database matches clang/Basic/Builtins.def.
+
+#if defined(BUILTIN) && !defined(TARGET_BUILTIN)
+# define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS)
+#endif
+
+// Get record field information.
+TARGET_BUILTIN(__builtin_preserve_field_info, "Ui.", "t", "")
+
+#undef BUILTIN
+#undef TARGET_BUILTIN
diff --git a/include/clang/Basic/BuiltinsPPC.def b/include/clang/Basic/BuiltinsPPC.def
index 3b6348ad7d70e..314e1cc059070 100644
--- a/include/clang/Basic/BuiltinsPPC.def
+++ b/include/clang/Basic/BuiltinsPPC.def
@@ -50,17 +50,17 @@ BUILTIN(__builtin_altivec_vavguw, "V4UiV4UiV4Ui", "")
BUILTIN(__builtin_altivec_vrfip, "V4fV4f", "")
-BUILTIN(__builtin_altivec_vcfsx, "V4fV4iIi", "")
-BUILTIN(__builtin_altivec_vcfux, "V4fV4iIi", "")
+BUILTIN(__builtin_altivec_vcfsx, "V4fV4SiIi", "")
+BUILTIN(__builtin_altivec_vcfux, "V4fV4UiIi", "")
BUILTIN(__builtin_altivec_vctsxs, "V4SiV4fIi", "")
BUILTIN(__builtin_altivec_vctuxs, "V4UiV4fIi", "")
-BUILTIN(__builtin_altivec_dss, "vUi", "")
+BUILTIN(__builtin_altivec_dss, "vUIi", "")
BUILTIN(__builtin_altivec_dssall, "v", "")
-BUILTIN(__builtin_altivec_dst, "vvC*iUi", "")
-BUILTIN(__builtin_altivec_dstt, "vvC*iUi", "")
-BUILTIN(__builtin_altivec_dstst, "vvC*iUi", "")
-BUILTIN(__builtin_altivec_dststt, "vvC*iUi", "")
+BUILTIN(__builtin_altivec_dst, "vvC*iUIi", "")
+BUILTIN(__builtin_altivec_dstt, "vvC*iUIi", "")
+BUILTIN(__builtin_altivec_dstst, "vvC*iUIi", "")
+BUILTIN(__builtin_altivec_dststt, "vvC*iUIi", "")
BUILTIN(__builtin_altivec_vexptefp, "V4fV4f", "")
diff --git a/include/clang/Basic/BuiltinsWebAssembly.def b/include/clang/Basic/BuiltinsWebAssembly.def
index 63177f016ac77..7fed9d2e43e74 100644
--- a/include/clang/Basic/BuiltinsWebAssembly.def
+++ b/include/clang/Basic/BuiltinsWebAssembly.def
@@ -31,6 +31,8 @@ TARGET_BUILTIN(__builtin_wasm_data_drop, "vIUi", "", "bulk-memory")
// Thread-local storage
TARGET_BUILTIN(__builtin_wasm_tls_size, "z", "nc", "bulk-memory")
+TARGET_BUILTIN(__builtin_wasm_tls_align, "z", "nc", "bulk-memory")
+TARGET_BUILTIN(__builtin_wasm_tls_base, "v*", "nU", "bulk-memory")
// Floating point min/max
BUILTIN(__builtin_wasm_min_f32, "fff", "nc")
@@ -47,6 +49,16 @@ BUILTIN(__builtin_wasm_atomic_wait_i32, "ii*iLLi", "n")
BUILTIN(__builtin_wasm_atomic_wait_i64, "iLLi*LLiLLi", "n")
BUILTIN(__builtin_wasm_atomic_notify, "Uii*Ui", "n")
+// Trapping fp-to-int conversions
+BUILTIN(__builtin_wasm_trunc_s_i32_f32, "if", "nc")
+BUILTIN(__builtin_wasm_trunc_u_i32_f32, "if", "nc")
+BUILTIN(__builtin_wasm_trunc_s_i32_f64, "id", "nc")
+BUILTIN(__builtin_wasm_trunc_u_i32_f64, "id", "nc")
+BUILTIN(__builtin_wasm_trunc_s_i64_f32, "LLif", "nc")
+BUILTIN(__builtin_wasm_trunc_u_i64_f32, "LLif", "nc")
+BUILTIN(__builtin_wasm_trunc_s_i64_f64, "LLid", "nc")
+BUILTIN(__builtin_wasm_trunc_u_i64_f64, "LLid", "nc")
+
// Saturating fp-to-int conversions
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i32_f32, "if", "nc", "nontrapping-fptoint")
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i32_f32, "if", "nc", "nontrapping-fptoint")
@@ -58,6 +70,8 @@ TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i64_f64, "LLid", "nc", "nontrappi
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i64_f64, "LLid", "nc", "nontrapping-fptoint")
// SIMD builtins
+TARGET_BUILTIN(__builtin_wasm_swizzle_v8x16, "V16cV16cV16c", "nc", "unimplemented-simd128")
+
TARGET_BUILTIN(__builtin_wasm_extract_lane_s_i8x16, "iV16cIi", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_extract_lane_u_i8x16, "iV16cIi", "nc", "unimplemented-simd128")
TARGET_BUILTIN(__builtin_wasm_extract_lane_s_i16x8, "iV8sIi", "nc", "simd128")
@@ -106,10 +120,29 @@ TARGET_BUILTIN(__builtin_wasm_max_f64x2, "V2dV2dV2d", "nc", "unimplemented-simd1
TARGET_BUILTIN(__builtin_wasm_sqrt_f32x4, "V4fV4f", "nc", "unimplemented-simd128")
TARGET_BUILTIN(__builtin_wasm_sqrt_f64x2, "V2dV2d", "nc", "unimplemented-simd128")
+TARGET_BUILTIN(__builtin_wasm_qfma_f32x4, "V4fV4fV4fV4f", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_qfms_f32x4, "V4fV4fV4fV4f", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_qfma_f64x2, "V2dV2dV2dV2d", "nc", "unimplemented-simd128")
+TARGET_BUILTIN(__builtin_wasm_qfms_f64x2, "V2dV2dV2dV2d", "nc", "unimplemented-simd128")
+
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i32x4_f32x4, "V4iV4f", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i32x4_f32x4, "V4iV4f", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i64x2_f64x2, "V2LLiV2d", "nc", "unimplemented-simd128")
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i64x2_f64x2, "V2LLiV2d", "nc", "unimplemented-simd128")
+TARGET_BUILTIN(__builtin_wasm_narrow_s_i8x16_i16x8, "V16cV8sV8s", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_narrow_u_i8x16_i16x8, "V16cV8sV8s", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_narrow_s_i16x8_i32x4, "V8sV4iV4i", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_narrow_u_i16x8_i32x4, "V8sV4iV4i", "nc", "simd128")
+
+TARGET_BUILTIN(__builtin_wasm_widen_low_s_i16x8_i8x16, "V8sV16c", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_widen_high_s_i16x8_i8x16, "V8sV16c", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_widen_low_u_i16x8_i8x16, "V8sV16c", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_widen_high_u_i16x8_i8x16, "V8sV16c", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_widen_low_s_i32x4_i16x8, "V4iV8s", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_widen_high_s_i32x4_i16x8, "V4iV8s", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_widen_low_u_i32x4_i16x8, "V4iV8s", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_widen_high_u_i32x4_i16x8, "V4iV8s", "nc", "simd128")
+
#undef BUILTIN
#undef TARGET_BUILTIN
diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def
index a0ba0ecf36bb8..5ab9dc1c3ac3a 100644
--- a/include/clang/Basic/BuiltinsX86.def
+++ b/include/clang/Basic/BuiltinsX86.def
@@ -751,8 +751,8 @@ TARGET_BUILTIN(__builtin_ia32_bextri_u32, "UiUiIUi", "nc", "tbm")
// LWP
TARGET_BUILTIN(__builtin_ia32_llwpcb, "vv*", "n", "lwp")
TARGET_BUILTIN(__builtin_ia32_slwpcb, "v*", "n", "lwp")
-TARGET_BUILTIN(__builtin_ia32_lwpins32, "UcUiUiUi", "n", "lwp")
-TARGET_BUILTIN(__builtin_ia32_lwpval32, "vUiUiUi", "n", "lwp")
+TARGET_BUILTIN(__builtin_ia32_lwpins32, "UcUiUiIUi", "n", "lwp")
+TARGET_BUILTIN(__builtin_ia32_lwpval32, "vUiUiIUi", "n", "lwp")
// SHA
TARGET_BUILTIN(__builtin_ia32_sha1rnds4, "V4iV4iV4iIc", "ncV:128:", "sha")
diff --git a/include/clang/Basic/BuiltinsX86_64.def b/include/clang/Basic/BuiltinsX86_64.def
index 56051af55e7d5..c535f43203e56 100644
--- a/include/clang/Basic/BuiltinsX86_64.def
+++ b/include/clang/Basic/BuiltinsX86_64.def
@@ -86,8 +86,8 @@ TARGET_BUILTIN(__builtin_ia32_bzhi_di, "UOiUOiUOi", "nc", "bmi2")
TARGET_BUILTIN(__builtin_ia32_pdep_di, "UOiUOiUOi", "nc", "bmi2")
TARGET_BUILTIN(__builtin_ia32_pext_di, "UOiUOiUOi", "nc", "bmi2")
TARGET_BUILTIN(__builtin_ia32_bextri_u64, "UOiUOiIUOi", "nc", "tbm")
-TARGET_BUILTIN(__builtin_ia32_lwpins64, "UcUOiUiUi", "n", "lwp")
-TARGET_BUILTIN(__builtin_ia32_lwpval64, "vUOiUiUi", "n", "lwp")
+TARGET_BUILTIN(__builtin_ia32_lwpins64, "UcUOiUiIUi", "n", "lwp")
+TARGET_BUILTIN(__builtin_ia32_lwpval64, "vUOiUiIUi", "n", "lwp")
TARGET_BUILTIN(__builtin_ia32_vcvtsd2si64, "OiV2dIi", "ncV:128:", "avx512f")
TARGET_BUILTIN(__builtin_ia32_vcvtsd2usi64, "UOiV2dIi", "ncV:128:", "avx512f")
TARGET_BUILTIN(__builtin_ia32_vcvtss2si64, "OiV4fIi", "ncV:128:", "avx512f")
diff --git a/include/clang/Basic/CodeGenOptions.def b/include/clang/Basic/CodeGenOptions.def
index cd7a84548765c..d2266cc2d613c 100644
--- a/include/clang/Basic/CodeGenOptions.def
+++ b/include/clang/Basic/CodeGenOptions.def
@@ -47,7 +47,8 @@ CODEGENOPT(CXXCtorDtorAliases, 1, 0) ///< Emit complete ctors/dtors as linker
///< aliases to base ctors when possible.
CODEGENOPT(DataSections , 1, 0) ///< Set when -fdata-sections is enabled.
CODEGENOPT(UniqueSectionNames, 1, 1) ///< Set for -funique-section-names.
-CODEGENOPT(DisableFPElim , 1, 0) ///< Set when -fomit-frame-pointer is enabled.
+ENUM_CODEGENOPT(FramePointer, FramePointerKind, 2, FramePointerKind::None) /// frame-pointer: all,non-leaf,none
+
CODEGENOPT(DisableFree , 1, 0) ///< Don't free memory.
CODEGENOPT(DiscardValueNames , 1, 0) ///< Discard Value Names from the IR (LLVMContext flag)
CODEGENOPT(DisableGCov , 1, 0) ///< Don't run the GCov pass, for testing.
@@ -132,6 +133,7 @@ CODEGENOPT(NoDwarfDirectoryAsm , 1, 0) ///< Set when -fno-dwarf-directory-asm is
CODEGENOPT(NoExecStack , 1, 0) ///< Set when -Wa,--noexecstack is enabled.
CODEGENOPT(FatalWarnings , 1, 0) ///< Set when -Wa,--fatal-warnings is
///< enabled.
+CODEGENOPT(NoWarn , 1, 0) ///< Set when -Wa,--no-warn is enabled.
CODEGENOPT(EnableSegmentedStacks , 1, 0) ///< Set when -fsplit-stack is enabled.
CODEGENOPT(NoImplicitFloat , 1, 0) ///< Set when -mno-implicit-float is enabled.
CODEGENOPT(NoInfsFPMath , 1, 0) ///< Assume FP arguments, results not +-Inf.
@@ -155,8 +157,6 @@ CODEGENOPT(NoZeroInitializedInBSS , 1, 0) ///< -fno-zero-initialized-in-bss.
ENUM_CODEGENOPT(ObjCDispatchMethod, ObjCDispatchMethodKind, 2, Legacy)
/// Replace certain message sends with calls to ObjC runtime entrypoints
CODEGENOPT(ObjCConvertMessagesToRuntimeCalls , 1, 1)
-CODEGENOPT(OmitLeafFramePointer , 1, 0) ///< Set when -momit-leaf-frame-pointer is
- ///< enabled.
VALUE_CODEGENOPT(OptimizationLevel, 2, 0) ///< The -O[0-3] option specified.
VALUE_CODEGENOPT(OptimizeSize, 2, 0) ///< If -Os (==1) or -Oz (==2) is specified.
@@ -195,6 +195,8 @@ CODEGENOPT(SanitizeMinimalRuntime, 1, 0) ///< Use "_minimal" sanitizer runtime f
///< diagnostics.
CODEGENOPT(SanitizeCfiICallGeneralizePointers, 1, 0) ///< Generalize pointer types in
///< CFI icall function signatures
+CODEGENOPT(SanitizeCfiCanonicalJumpTables, 1, 0) ///< Make jump table symbols canonical
+ ///< instead of creating a local jump table.
CODEGENOPT(SanitizeCoverageType, 2, 0) ///< Type of sanitizer coverage
///< instrumentation.
CODEGENOPT(SanitizeCoverageIndirectCalls, 1, 0) ///< Enable sanitizer coverage
@@ -226,6 +228,8 @@ CODEGENOPT(StrictEnums , 1, 0) ///< Optimize based on strict enum definiti
CODEGENOPT(StrictVTablePointers, 1, 0) ///< Optimize based on the strict vtable pointers
CODEGENOPT(TimePasses , 1, 0) ///< Set when -ftime-report is enabled.
CODEGENOPT(TimeTrace , 1, 0) ///< Set when -ftime-trace is enabled.
+VALUE_CODEGENOPT(TimeTraceGranularity, 32, 500) ///< Minimum time granularity (in microseconds),
+ ///< traced by time profiler
CODEGENOPT(UnrollLoops , 1, 0) ///< Control whether loops are unrolled.
CODEGENOPT(RerollLoops , 1, 0) ///< Control whether loops are rerolled.
CODEGENOPT(NoUseJumpTables , 1, 0) ///< Set when -fno-jump-tables is enabled.
@@ -274,6 +278,10 @@ CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists.
CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole-program
/// vtable optimization.
+CODEGENOPT(VirtualFunctionElimination, 1, 0) ///< Whether to apply the dead
+ /// virtual function elimination
+ /// optimization.
+
/// Whether to use public LTO visibility for entities in std and stdext
/// namespaces. This is enabled by clang-cl's /MT and /MTd flags.
CODEGENOPT(LTOVisibilityPublicStd, 1, 0)
diff --git a/include/clang/Basic/CodeGenOptions.h b/include/clang/Basic/CodeGenOptions.h
index 4e9025d2fea9d..8881a316d1fb8 100644
--- a/include/clang/Basic/CodeGenOptions.h
+++ b/include/clang/Basic/CodeGenOptions.h
@@ -117,6 +117,12 @@ public:
enum SignReturnAddressKeyValue { AKey, BKey };
+ enum class FramePointerKind {
+ None, // Omit all frame pointers.
+ NonLeaf, // Keep non-leaf frame pointers.
+ All, // Keep all frame pointers.
+ };
+
/// The code model to use (-mcmodel).
std::string CodeModel;
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h
index 5a707007e463f..9e494aa371cda 100644
--- a/include/clang/Basic/Diagnostic.h
+++ b/include/clang/Basic/Diagnostic.h
@@ -632,24 +632,22 @@ public:
/// Suppress all diagnostics, to silence the front end when we
/// know that we don't want any more diagnostics to be passed along to the
/// client
- void setSuppressAllDiagnostics(bool Val = true) {
- SuppressAllDiagnostics = Val;
- }
+ void setSuppressAllDiagnostics(bool Val) { SuppressAllDiagnostics = Val; }
bool getSuppressAllDiagnostics() const { return SuppressAllDiagnostics; }
/// Set type eliding, to skip outputting same types occurring in
/// template types.
- void setElideType(bool Val = true) { ElideType = Val; }
+ void setElideType(bool Val) { ElideType = Val; }
bool getElideType() { return ElideType; }
/// Set tree printing, to outputting the template difference in a
/// tree format.
- void setPrintTemplateTree(bool Val = false) { PrintTemplateTree = Val; }
+ void setPrintTemplateTree(bool Val) { PrintTemplateTree = Val; }
bool getPrintTemplateTree() { return PrintTemplateTree; }
/// Set color printing, so the type diffing will inject color markers
/// into the output.
- void setShowColors(bool Val = false) { ShowColors = Val; }
+ void setShowColors(bool Val) { ShowColors = Val; }
bool getShowColors() { return ShowColors; }
/// Specify which overload candidates to show when overload resolution
@@ -667,7 +665,7 @@ public:
/// the middle of another diagnostic.
///
/// This can be used by clients who suppress diagnostics themselves.
- void setLastDiagnosticIgnored(bool Ignored = true) {
+ void setLastDiagnosticIgnored(bool Ignored) {
if (LastDiagLevel == DiagnosticIDs::Fatal)
FatalErrorOccurred = true;
LastDiagLevel = Ignored ? DiagnosticIDs::Ignored : DiagnosticIDs::Warning;
@@ -1127,11 +1125,6 @@ public:
Emit();
}
- /// Retrieve an empty diagnostic builder.
- static DiagnosticBuilder getEmpty() {
- return {};
- }
-
/// Forces the diagnostic to be emitted.
const DiagnosticBuilder &setForceEmit() const {
IsForceEmit = true;
diff --git a/include/clang/Basic/DiagnosticASTKinds.td b/include/clang/Basic/DiagnosticASTKinds.td
index 23502152b4ac0..04d767445a8f4 100644
--- a/include/clang/Basic/DiagnosticASTKinds.td
+++ b/include/clang/Basic/DiagnosticASTKinds.td
@@ -37,8 +37,9 @@ def note_constexpr_virtual_call : Note<
def note_constexpr_pure_virtual_call : Note<
"pure virtual function %q0 called">;
def note_constexpr_polymorphic_unknown_dynamic_type : Note<
- "%select{||||virtual function called on|dynamic_cast applied to|"
- "typeid applied to}0 object '%1' whose dynamic type is not constant">;
+ "%select{|||||virtual function called on|dynamic_cast applied to|"
+ "typeid applied to|construction of|destruction of}0 object '%1' "
+ "whose dynamic type is not constant">;
def note_constexpr_dynamic_cast_to_reference_failed : Note<
"reference dynamic_cast failed: %select{"
"static type %1 of operand is a non-public base class of dynamic type %2|"
@@ -53,6 +54,9 @@ def note_constexpr_nonliteral : Note<
def note_constexpr_non_global : Note<
"%select{pointer|reference}0 to %select{|subobject of }1"
"%select{temporary|%3}2 is not a constant expression">;
+def note_constexpr_dynamic_alloc : Note<
+ "%select{pointer|reference}0 to %select{|subobject of }1"
+ "heap-allocated object is not a constant expression">;
def note_constexpr_uninitialized : Note<
"%select{|sub}0object of type %1 is not initialized">;
def note_constexpr_subobject_declared_here : Note<
@@ -100,6 +104,7 @@ def note_constexpr_typeid_polymorphic : Note<
def note_constexpr_void_comparison : Note<
"comparison between unequal pointers to void has unspecified result">;
def note_constexpr_temporary_here : Note<"temporary created here">;
+def note_constexpr_dynamic_alloc_here : Note<"heap allocation performed here">;
def note_constexpr_conditional_never_const : Note<
"both arms of conditional operator are unable to produce a "
"constant expression">;
@@ -109,16 +114,20 @@ def note_constexpr_call_limit_exceeded : Note<
"constexpr evaluation hit maximum call limit">;
def note_constexpr_step_limit_exceeded : Note<
"constexpr evaluation hit maximum step limit; possible infinite loop?">;
+def note_constexpr_heap_alloc_limit_exceeded : Note<
+ "constexpr evaluation hit maximum heap allocation limit">;
def note_constexpr_this : Note<
"%select{|implicit }0use of 'this' pointer is only allowed within the "
"evaluation of a call to a 'constexpr' member function">;
def note_constexpr_lifetime_ended : Note<
- "%select{read of|assignment to|increment of|decrement of|member call on|"
- "dynamic_cast of|typeid applied to}0 "
- "%select{temporary|variable}1 whose lifetime has ended">;
+ "%select{read of|read of|assignment to|increment of|decrement of|"
+ "member call on|dynamic_cast of|typeid applied to|construction of|"
+ "destruction of}0 %select{temporary|variable}1 whose "
+ "%plural{8:storage duration|:lifetime}0 has ended">;
def note_constexpr_access_uninit : Note<
- "%select{read of|assignment to|increment of|decrement of|member call on|"
- "dynamic_cast of|typeid applied to}0 "
+ "%select{read of|read of|assignment to|increment of|decrement of|"
+ "member call on|dynamic_cast of|typeid applied to|"
+ "construction of subobject of|destruction of}0 "
"%select{object outside its lifetime|uninitialized object}1 "
"is not allowed in a constant expression">;
def note_constexpr_use_uninit_reference : Note<
@@ -128,16 +137,21 @@ def note_constexpr_modify_const_type : Note<
"modification of object of const-qualified type %0 is not allowed "
"in a constant expression">;
def note_constexpr_access_volatile_type : Note<
- "%select{read of|assignment to|increment of|decrement of|<ERROR>|<ERROR>}0 "
+ "%select{read of|read of|assignment to|increment of|decrement of|"
+ "<ERROR>|<ERROR>|<ERROR>|<ERROR>}0 "
"volatile-qualified type %1 is not allowed in a constant expression">;
def note_constexpr_access_volatile_obj : Note<
- "%select{read of|assignment to|increment of|decrement of|<ERROR>|<ERROR>}0 "
+ "%select{read of|read of|assignment to|increment of|decrement of|"
+ "<ERROR>|<ERROR>|<ERROR>|<ERROR>}0 "
"volatile %select{temporary|object %2|member %2}1 is not allowed in "
"a constant expression">;
def note_constexpr_volatile_here : Note<
"volatile %select{temporary created|object declared|member declared}0 here">;
-def note_constexpr_ltor_mutable : Note<
- "read of mutable member %0 is not allowed in a constant expression">;
+def note_constexpr_access_mutable : Note<
+ "%select{read of|read of|assignment to|increment of|decrement of|"
+ "member call on|dynamic_cast of|typeid applied to|construction of|"
+ "destruction of}0 "
+ "mutable member %1 is not allowed in a constant expression">;
def note_constexpr_ltor_non_const_int : Note<
"read of non-const variable %0 is not allowed in a constant expression">;
def note_constexpr_ltor_non_constexpr : Note<
@@ -145,31 +159,44 @@ def note_constexpr_ltor_non_constexpr : Note<
def note_constexpr_ltor_incomplete_type : Note<
"read of incomplete type %0 is not allowed in a constant expression">;
def note_constexpr_access_null : Note<
- "%select{read of|assignment to|increment of|decrement of|member call on|"
- "dynamic_cast of|typeid applied to}0 "
+ "%select{read of|read of|assignment to|increment of|decrement of|"
+ "member call on|dynamic_cast of|typeid applied to|construction of|"
+ "destruction of}0 "
"dereferenced null pointer is not allowed in a constant expression">;
def note_constexpr_access_past_end : Note<
- "%select{read of|assignment to|increment of|decrement of|member call on|"
- "dynamic_cast of|typeid applied to}0 "
- "dereferenced one-past-the-end pointer is not allowed in a constant expression">;
+ "%select{read of|read of|assignment to|increment of|decrement of|"
+ "member call on|dynamic_cast of|typeid applied to|construction of|"
+ "destruction of}0 "
+ "dereferenced one-past-the-end pointer is not allowed "
+ "in a constant expression">;
def note_constexpr_access_unsized_array : Note<
- "%select{read of|assignment to|increment of|decrement of|member call on|"
- "dynamic_cast of|typeid applied to}0 "
+ "%select{read of|read of|assignment to|increment of|decrement of|"
+ "member call on|dynamic_cast of|typeid applied to|construction of|"
+ "destruction of}0 "
"element of array without known bound "
"is not allowed in a constant expression">;
def note_constexpr_access_inactive_union_member : Note<
- "%select{read of|assignment to|increment of|decrement of|member call on|"
- "dynamic_cast of|typeid applied to}0 "
+ "%select{read of|read of|assignment to|increment of|decrement of|"
+ "member call on|dynamic_cast of|typeid applied to|"
+ "construction of subobject of|destruction of}0 "
"member %1 of union with %select{active member %3|no active member}2 "
"is not allowed in a constant expression">;
def note_constexpr_access_static_temporary : Note<
- "%select{read of|assignment to|increment of|decrement of|member call on|"
- "dynamic_cast of|typeid applied to}0 temporary "
+ "%select{read of|read of|assignment to|increment of|decrement of|"
+ "member call on|dynamic_cast of|typeid applied to|reconstruction of|"
+ "destruction of}0 temporary "
"is not allowed in a constant expression outside the expression that "
"created the temporary">;
def note_constexpr_access_unreadable_object : Note<
- "%select{read of|assignment to|increment of|decrement of|member call on|"
- "dynamic_cast of|typeid applied to}0 object '%1' whose value is not known">;
+ "%select{read of|read of|assignment to|increment of|decrement of|"
+ "member call on|dynamic_cast of|typeid applied to|construction of|"
+ "destruction of}0 "
+ "object '%1' whose value is not known">;
+def note_constexpr_access_deleted_object : Note<
+ "%select{read of|read of|assignment to|increment of|decrement of|"
+ "member call on|dynamic_cast of|typeid applied to|construction of|"
+ "destruction of}0 "
+ "heap allocated object that has been deleted">;
def note_constexpr_modify_global : Note<
"a constant expression cannot modify an object that is visible outside "
"that expression">;
@@ -189,6 +216,13 @@ def note_constexpr_baa_insufficient_alignment : Note<
def note_constexpr_baa_value_insufficient_alignment : Note<
"value of the aligned pointer (%0) is not a multiple of the asserted %1 "
"%plural{1:byte|:bytes}1">;
+def note_constexpr_destroy_out_of_lifetime : Note<
+ "destroying object '%0' whose lifetime has already ended">;
+def note_constexpr_unsupported_destruction : Note<
+ "non-trivial destruction of type %0 in a constant expression is not supported">;
+def note_constexpr_unsupported_tempoarary_nontrivial_dtor : Note<
+ "non-trivial destruction of lifetime-extended temporary with type %0 "
+ "used in the result of a constant expression is not yet supported">;
def note_constexpr_unsupported_unsized_array : Note<
"array-to-pointer decay of array member without known bound is not supported">;
def note_constexpr_unsized_array_indexed : Note<
@@ -228,6 +262,62 @@ def note_constexpr_bit_cast_invalid_subtype : Note<
def note_constexpr_bit_cast_indet_dest : Note<
"indeterminate value can only initialize an object of type 'unsigned char'"
"%select{, 'char',|}1 or 'std::byte'; %0 is invalid">;
+def note_constexpr_pseudo_destructor : Note<
+ "pseudo-destructor call is not permitted in constant expressions "
+ "until C++20">;
+def note_constexpr_construct_complex_elem : Note<
+ "construction of individual component of complex number is not yet supported "
+ "in constant expressions">;
+def note_constexpr_destroy_complex_elem : Note<
+ "destruction of individual component of complex number is not yet supported "
+ "in constant expressions">;
+def note_constexpr_new : Note<
+ "dynamic memory allocation is not permitted in constant expressions "
+ "until C++20">;
+def note_constexpr_new_non_replaceable : Note<
+ "call to %select{placement|class-specific}0 %1">;
+def note_constexpr_new_placement : Note<
+ "this placement new expression is not yet supported in constant expressions">;
+def note_constexpr_placement_new_wrong_type : Note<
+ "placement new would change type of storage from %0 to %1">;
+def note_constexpr_new_negative : Note<
+ "cannot allocate array; evaluated array bound %0 is negative">;
+def note_constexpr_new_too_large : Note<
+ "cannot allocate array; evaluated array bound %0 is too large">;
+def note_constexpr_new_too_small : Note<
+ "cannot allocate array; evaluated array bound %0 is too small to hold "
+ "%1 explicitly initialized elements">;
+def note_constexpr_new_untyped : Note<
+ "cannot allocate untyped memory in a constant expression; "
+ "use 'std::allocator<T>::allocate' to allocate memory of type 'T'">;
+def note_constexpr_new_not_complete_object_type : Note<
+ "cannot allocate memory of %select{incomplete|function}0 type %1">;
+def note_constexpr_operator_new_bad_size : Note<
+ "allocated size %0 is not a multiple of size %1 of element type %2">;
+def note_constexpr_delete_not_heap_alloc : Note<
+ "delete of pointer '%0' that does not point to a heap-allocated object">;
+def note_constexpr_double_delete : Note<
+ "delete of pointer that has already been deleted">;
+def note_constexpr_double_destroy : Note<
+ "destruction of object that is already being destroyed">;
+def note_constexpr_new_delete_mismatch : Note<
+ "%plural{2:'delete' used to delete pointer to object "
+ "allocated with 'std::allocator<...>::allocate'|"
+ ":%select{non-array delete|array delete|'std::allocator<...>::deallocate'}0 "
+ "used to delete pointer to "
+ "%select{array object of type %2|non-array object of type %2|"
+ "object allocated with 'new'}0}1">;
+def note_constexpr_delete_subobject : Note<
+ "delete of pointer%select{ to subobject|}1 '%0' "
+ "%select{|that does not point to complete object}1">;
+def note_constexpr_delete_base_nonvirt_dtor : Note<
+ "delete of object with dynamic type %1 through pointer to "
+ "base class type %0 with non-virtual destructor">;
+def note_constexpr_memory_leak : Note<
+ "allocation performed here was not deallocated"
+ "%plural{0:|: (along with %0 other memory leak%s0)}0">;
+def err_experimental_clang_interp_failed : Error<
+ "the experimental clang interpreter failed to evaluate an expression">;
def warn_integer_constant_overflow : Warning<
"overflow in expression; result is %0 with type %1">,
@@ -277,7 +367,6 @@ def warn_odr_variable_multiple_def : Warning<
"external variable %0 defined in multiple translation units">,
InGroup<ODR>;
def note_odr_value_here : Note<"declared here with type %0">;
-def note_odr_defined_here : Note<"also defined here">;
def err_odr_function_type_inconsistent : Error<
"external function %0 declared with incompatible types in different "
"translation units (%1 vs. %2)">;
diff --git a/include/clang/Basic/DiagnosticCommentKinds.td b/include/clang/Basic/DiagnosticCommentKinds.td
index fcda3f3a21130..c577ac408539d 100644
--- a/include/clang/Basic/DiagnosticCommentKinds.td
+++ b/include/clang/Basic/DiagnosticCommentKinds.td
@@ -153,6 +153,12 @@ def warn_doc_deprecated_not_sync : Warning<
def note_add_deprecation_attr : Note<
"add a deprecation attribute to the declaration to silence this warning">;
+// inline contents commands
+
+def warn_doc_inline_contents_no_argument : Warning<
+ "'%select{\\|@}0%1' command does not have a valid word argument">,
+ InGroup<Documentation>, DefaultIgnore;
+
// verbatim block commands
def warn_verbatim_block_end_without_start : Warning<
diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td
index ca2faf59d70f9..484cc317f9658 100644
--- a/include/clang/Basic/DiagnosticCommonKinds.td
+++ b/include/clang/Basic/DiagnosticCommonKinds.td
@@ -12,11 +12,21 @@
let Component = "Common" in {
+// Substitutions.
+
+def select_constexpr_spec_kind : TextSubstitution<
+ "%select{<ERROR>|constexpr|consteval|constinit}0">;
+
// Basic.
def fatal_too_many_errors
: Error<"too many errors emitted, stopping now">, DefaultFatal;
+def warn_stack_exhausted : Warning<
+ "stack nearly exhausted; compilation time may suffer, and "
+ "crashes due to stack overflow are likely">,
+ InGroup<DiagGroup<"stack-exhausted">>, NoSFINAE;
+
def note_declared_at : Note<"declared here">;
def note_previous_definition : Note<"previous definition is here">;
def note_previous_declaration : Note<"previous declaration is here">;
@@ -107,6 +117,10 @@ def err_attribute_not_type_attr : Error<
"%0 attribute cannot be applied to types">;
def err_enum_template : Error<"enumeration cannot be a template">;
+def warn_cxx20_compat_consteval : Warning<
+ "'consteval' specifier is incompatible with C++ standards before C++20">,
+ InGroup<CXX2aCompat>, DefaultIgnore;
+
}
let CategoryName = "Nullability Issue" in {
@@ -172,9 +186,6 @@ def ext_cxx11_longlong : Extension<
def warn_cxx98_compat_longlong : Warning<
"'long long' is incompatible with C++98">,
InGroup<CXX98CompatPedantic>, DefaultIgnore;
-def warn_cxx20_compat_consteval : Warning<
- "consteval is incompatible with C++ standards before C++20">,
- InGroup<CXX2aCompat>, DefaultIgnore;
def err_integer_literal_too_large : Error<
"integer literal is too large to be represented in any %select{signed |}0"
"integer type">;
@@ -259,8 +270,6 @@ def err_target_unsupported_mcmse : Error<
"-mcmse is not supported for %0">;
def err_opt_not_valid_with_opt : Error<
"option '%0' cannot be specified with '%1'">;
-def err_opt_not_valid_without_opt : Error<
- "option '%0' cannot be specified without '%1'">;
def err_opt_not_valid_on_target : Error<
"option '%0' cannot be specified on this target">;
@@ -300,8 +309,13 @@ def err_omp_more_one_clause : Error<
"directive '#pragma omp %0' cannot contain more than one '%1' clause%select{| with '%3' name modifier| with 'source' dependence}2">;
// Static Analyzer Core
-def err_unknown_analyzer_checker : Error<
+def err_unknown_analyzer_checker_or_package : Error<
"no analyzer checkers or packages are associated with '%0'">;
def note_suggest_disabling_all_checkers : Note<
"use -analyzer-disable-all-checks to disable all static analyzer checkers">;
+
+// Poison system directories.
+def warn_poison_system_directories : Warning <
+ "include location '%0' is unsafe for cross-compilation">,
+ InGroup<DiagGroup<"poison-system-directories">>, DefaultIgnore;
}
diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td
index eab453ee20ec9..5ff03e1335636 100644
--- a/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/include/clang/Basic/DiagnosticDriverKinds.td
@@ -184,9 +184,6 @@ def warn_drv_unknown_argument_clang_cl_with_suggestion : Warning<
def warn_drv_ycyu_different_arg_clang_cl : Warning<
"support for '/Yc' and '/Yu' with different filenames not implemented yet; flags ignored">,
InGroup<ClangClPch>;
-def warn_drv_ycyu_no_fi_arg_clang_cl : Warning<
- "support for '%0' without a corresponding /FI flag not implemented yet; flag ignored">,
- InGroup<ClangClPch>;
def warn_drv_yc_multiple_inputs_clang_cl : Warning<
"support for '/Yc' with more than one source file not implemented yet; flag ignored">,
InGroup<ClangClPch>;
@@ -368,6 +365,9 @@ def err_drv_ropi_rwpi_incompatible_with_pic : Error<
def err_drv_ropi_incompatible_with_cxx : Error<
"ROPI is not compatible with c++">;
+def err_stack_tagging_requires_hardware_feature : Error<
+ "'-fsanitize=memtag' requires hardware support (+memtag)">;
+
def warn_target_unsupported_nan2008 : Warning<
"ignoring '-mnan=2008' option because the '%0' architecture does not support it">,
InGroup<UnsupportedNan>;
@@ -383,6 +383,9 @@ def warn_target_unsupported_abs2008 : Warning<
def warn_target_unsupported_compact_branches : Warning<
"ignoring '-mcompact-branches=' option because the '%0' architecture does not"
" support it">, InGroup<UnsupportedCB>;
+def warn_target_unsupported_extension : Warning<
+ "ignoring extension '%0' because the '%1' architecture does not support it">,
+ InGroup<InvalidCommandLineArgument>;
def warn_drv_unsupported_gpopt : Warning<
"ignoring '-mgpopt' option as it cannot be used with %select{|the implicit"
" usage of }0-mabicalls">,
diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td
index 7a990164b0d9f..a798b498d4e9a 100644
--- a/include/clang/Basic/DiagnosticFrontendKinds.td
+++ b/include/clang/Basic/DiagnosticFrontendKinds.td
@@ -64,8 +64,6 @@ def err_fe_backend_unsupported : Error<"%0">, BackendInfo;
def err_fe_invalid_code_complete_file : Error<
"cannot locate code-completion file %0">, DefaultFatal;
-def err_fe_stdout_binary : Error<"unable to change standard output to binary">,
- DefaultFatal;
def err_fe_dependency_file_requires_MT : Error<
"-dependency-file requires at least one -MT or -MQ option">;
def err_fe_invalid_plugin_name : Error<
@@ -217,10 +215,6 @@ def err_modules_embed_file_not_found :
DefaultFatal;
def err_module_header_file_not_found :
Error<"module header file '%0' not found">, DefaultFatal;
-def err_module_header_file_invalid :
- Error<"unexpected module header file input '%0'">, DefaultFatal;
-
-def err_interface_stubs : Error<"clang-ifs (-emit-iterface-stubs): %0">;
def err_test_module_file_extension_version : Error<
"test module file extension '%0' has different version (%1.%2) than expected "
@@ -275,7 +269,12 @@ def warn_profile_data_missing : Warning<
def warn_profile_data_unprofiled : Warning<
"no profile data available for file \"%0\"">,
InGroup<ProfileInstrUnprofiled>;
-
+def warn_profile_data_misexpect : Warning<
+ "Potential performance regression from use of __builtin_expect(): "
+ "Annotation was correct on %0 of profiled executions.">,
+ BackendInfo,
+ InGroup<MisExpect>,
+ DefaultIgnore;
} // end of instrumentation issue category
}
diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td
index 56f2ecfe8e4a6..928059539558a 100644
--- a/include/clang/Basic/DiagnosticGroups.td
+++ b/include/clang/Basic/DiagnosticGroups.td
@@ -61,8 +61,16 @@ def BoolConversion : DiagGroup<"bool-conversion", [PointerBoolConversion,
UndefinedBoolConversion]>;
def IntConversion : DiagGroup<"int-conversion">;
def EnumConversion : DiagGroup<"enum-conversion">;
-def ImplicitIntConversion : DiagGroup<"implicit-int-conversion">;
-def ImplicitFloatConversion : DiagGroup<"implicit-float-conversion">;
+def ObjCSignedCharBoolImplicitIntConversion :
+ DiagGroup<"objc-signed-char-bool-implicit-int-conversion">;
+def ImplicitIntConversion : DiagGroup<"implicit-int-conversion",
+ [ObjCSignedCharBoolImplicitIntConversion]>;
+def ImplicitIntFloatConversion : DiagGroup<"implicit-int-float-conversion">;
+def ObjCSignedCharBoolImplicitFloatConversion :
+ DiagGroup<"objc-signed-char-bool-implicit-float-conversion">;
+def ImplicitFloatConversion : DiagGroup<"implicit-float-conversion",
+ [ImplicitIntFloatConversion,
+ ObjCSignedCharBoolImplicitFloatConversion]>;
def ImplicitFixedPointConversion : DiagGroup<"implicit-fixed-point-conversion">;
def FloatOverflowConversion : DiagGroup<"float-overflow-conversion">;
@@ -99,7 +107,6 @@ def GNUComplexInteger : DiagGroup<"gnu-complex-integer">;
def GNUConditionalOmittedOperand : DiagGroup<"gnu-conditional-omitted-operand">;
def ConfigMacros : DiagGroup<"config-macros">;
def : DiagGroup<"ctor-dtor-privacy">;
-def GNUDesignator : DiagGroup<"gnu-designator">;
def GNUStringLiteralOperatorTemplate :
DiagGroup<"gnu-string-literal-operator-template">;
def UndefinedVarTemplate : DiagGroup<"undefined-var-template">;
@@ -113,11 +120,13 @@ def DeleteNonVirtualDtor : DiagGroup<"delete-non-virtual-dtor",
[DeleteNonAbstractNonVirtualDtor,
DeleteAbstractNonVirtualDtor]>;
def AbstractFinalClass : DiagGroup<"abstract-final-class">;
+def FinalDtorNonFinalClass : DiagGroup<"final-dtor-non-final-class">;
def CXX11CompatDeprecatedWritableStr :
DiagGroup<"c++11-compat-deprecated-writable-strings">;
def DeprecatedAttributes : DiagGroup<"deprecated-attributes">;
+def DeprecatedCommaSubscript : DiagGroup<"deprecated-comma-subscript">;
def DeprecatedDeclarations : DiagGroup<"deprecated-declarations">;
def UnavailableDeclarations : DiagGroup<"unavailable-declarations">;
def UnguardedAvailabilityNew : DiagGroup<"unguarded-availability-new">;
@@ -131,18 +140,27 @@ def DeprecatedImplementations :DiagGroup<"deprecated-implementations">;
def DeprecatedIncrementBool : DiagGroup<"deprecated-increment-bool">;
def DeprecatedRegister : DiagGroup<"deprecated-register">;
def DeprecatedThisCapture : DiagGroup<"deprecated-this-capture">;
+def DeprecatedVolatile : DiagGroup<"deprecated-volatile">;
def DeprecatedWritableStr : DiagGroup<"deprecated-writable-strings",
[CXX11CompatDeprecatedWritableStr]>;
// FIXME: Why is DeprecatedImplementations not in this group?
def Deprecated : DiagGroup<"deprecated", [DeprecatedAttributes,
+ DeprecatedCommaSubscript,
DeprecatedDeclarations,
DeprecatedDynamicExceptionSpec,
DeprecatedIncrementBool,
DeprecatedRegister,
DeprecatedThisCapture,
+ DeprecatedVolatile,
DeprecatedWritableStr]>,
DiagCategory<"Deprecations">;
+def CXX2aDesignator : DiagGroup<"c++2a-designator">;
+// Allow -Wno-c99-designator to be used to turn off all warnings on valid C99
+// designators (including the warning controlled by -Wc++2a-designator).
+def C99Designator : DiagGroup<"c99-designator", [CXX2aDesignator]>;
+def GNUDesignator : DiagGroup<"gnu-designator">;
+
def DynamicExceptionSpec
: DiagGroup<"dynamic-exception-spec", [DeprecatedDynamicExceptionSpec]>;
@@ -278,6 +296,7 @@ def ExitTimeDestructors : DiagGroup<"exit-time-destructors">;
def FlexibleArrayExtensions : DiagGroup<"flexible-array-extensions">;
def FourByteMultiChar : DiagGroup<"four-char-constants">;
def GlobalConstructors : DiagGroup<"global-constructors">;
+def BitwiseConditionalParentheses: DiagGroup<"bitwise-conditional-parentheses">;
def BitwiseOpParentheses: DiagGroup<"bitwise-op-parentheses">;
def LogicalOpParentheses: DiagGroup<"logical-op-parentheses">;
def LogicalNotParentheses: DiagGroup<"logical-not-parentheses">;
@@ -286,9 +305,11 @@ def OverloadedShiftOpParentheses: DiagGroup<"overloaded-shift-op-parentheses">;
def DanglingElse: DiagGroup<"dangling-else">;
def DanglingField : DiagGroup<"dangling-field">;
def DanglingInitializerList : DiagGroup<"dangling-initializer-list">;
+def DanglingGsl : DiagGroup<"dangling-gsl">;
def ReturnStackAddress : DiagGroup<"return-stack-address">;
def Dangling : DiagGroup<"dangling", [DanglingField,
DanglingInitializerList,
+ DanglingGsl,
ReturnStackAddress]>;
def DistributedObjectModifiers : DiagGroup<"distributed-object-modifiers">;
def ExpansionToDefined : DiagGroup<"expansion-to-defined">;
@@ -481,6 +502,7 @@ def StringCompare : DiagGroup<"string-compare">;
def StringPlusInt : DiagGroup<"string-plus-int">;
def StringPlusChar : DiagGroup<"string-plus-char">;
def StrncatSize : DiagGroup<"strncat-size">;
+def IntInBoolContext : DiagGroup<"int-in-bool-context">;
def TautologicalTypeLimitCompare : DiagGroup<"tautological-type-limit-compare">;
def TautologicalUnsignedZeroCompare : DiagGroup<"tautological-unsigned-zero-compare">;
def TautologicalUnsignedEnumZeroCompare : DiagGroup<"tautological-unsigned-enum-zero-compare">;
@@ -495,12 +517,14 @@ def TautologicalConstantCompare : DiagGroup<"tautological-constant-compare",
[TautologicalOutOfRangeCompare]>;
def TautologicalPointerCompare : DiagGroup<"tautological-pointer-compare">;
def TautologicalOverlapCompare : DiagGroup<"tautological-overlap-compare">;
+def TautologicalBitwiseCompare : DiagGroup<"tautological-bitwise-compare">;
def TautologicalUndefinedCompare : DiagGroup<"tautological-undefined-compare">;
def TautologicalObjCBoolCompare : DiagGroup<"tautological-objc-bool-compare">;
def TautologicalCompare : DiagGroup<"tautological-compare",
[TautologicalConstantCompare,
TautologicalPointerCompare,
TautologicalOverlapCompare,
+ TautologicalBitwiseCompare,
TautologicalUndefinedCompare,
TautologicalObjCBoolCompare]>;
def HeaderHygiene : DiagGroup<"header-hygiene">;
@@ -509,6 +533,7 @@ def CompareDistinctPointerType : DiagGroup<"compare-distinct-pointer-types">;
def GNUUnionCast : DiagGroup<"gnu-union-cast">;
def GNUVariableSizedTypeNotAtEnd : DiagGroup<"gnu-variable-sized-type-not-at-end">;
def Varargs : DiagGroup<"varargs">;
+def XorUsedAsPow : DiagGroup<"xor-used-as-pow">;
def Unsequenced : DiagGroup<"unsequenced">;
// GCC name for -Wunsequenced
@@ -543,6 +568,7 @@ def CoveredSwitchDefault : DiagGroup<"covered-switch-default">;
def SwitchBool : DiagGroup<"switch-bool">;
def SwitchEnum : DiagGroup<"switch-enum">;
def Switch : DiagGroup<"switch">;
+def EnumCompareConditional : DiagGroup<"enum-compare-conditional">;
def EnumCompareSwitch : DiagGroup<"enum-compare-switch">;
def EnumCompare : DiagGroup<"enum-compare", [EnumCompareSwitch]>;
def ImplicitFallthroughPerFunction :
@@ -620,7 +646,9 @@ def UnusedGetterReturnValue : DiagGroup<"unused-getter-return-value">;
def UsedButMarkedUnused : DiagGroup<"used-but-marked-unused">;
def UserDefinedLiterals : DiagGroup<"user-defined-literals">;
def UserDefinedWarnings : DiagGroup<"user-defined-warnings">;
-def Reorder : DiagGroup<"reorder">;
+def ReorderCtor : DiagGroup<"reorder-ctor">;
+def ReorderInitList : DiagGroup<"reorder-init-list">;
+def Reorder : DiagGroup<"reorder", [ReorderCtor, ReorderInitList]>;
def UndeclaredSelector : DiagGroup<"undeclared-selector">;
def ImplicitAtomic : DiagGroup<"implicit-atomic-properties">;
def CustomAtomic : DiagGroup<"custom-atomic-properties">;
@@ -710,6 +738,7 @@ def ParenthesesOnEquality : DiagGroup<"parentheses-equality">;
def Parentheses : DiagGroup<"parentheses",
[LogicalOpParentheses,
LogicalNotParentheses,
+ BitwiseConditionalParentheses,
BitwiseOpParentheses,
ShiftOpParentheses,
OverloadedShiftOpParentheses,
@@ -757,6 +786,7 @@ def FormatSecurity : DiagGroup<"format-security">;
def FormatNonStandard : DiagGroup<"format-non-iso">;
def FormatY2K : DiagGroup<"format-y2k">;
def FormatPedantic : DiagGroup<"format-pedantic">;
+def FormatTypeConfusion : DiagGroup<"format-type-confusion">;
def Format : DiagGroup<"format",
[FormatExtraArgs, FormatZeroLength, NonNull,
FormatSecurity, FormatY2K, FormatInvalidSpecifier]>,
@@ -800,6 +830,7 @@ def Most : DiagGroup<"most", [
Format,
Implicit,
InfiniteRecursion,
+ IntInBoolContext,
MismatchedTags,
MissingBraces,
Move,
@@ -890,7 +921,7 @@ def CXX17 : DiagGroup<"c++17-extensions">;
// A warning group for warnings about using C++2a features as extensions in
// earlier C++ versions.
-def CXX2a : DiagGroup<"c++2a-extensions">;
+def CXX2a : DiagGroup<"c++2a-extensions", [CXX2aDesignator]>;
def : DiagGroup<"c++0x-extensions", [CXX11]>;
def : DiagGroup<"c++1y-extensions", [CXX14]>;
@@ -903,7 +934,7 @@ def DelegatingCtorCycles :
def C11 : DiagGroup<"c11-extensions">;
// A warning group for warnings about using C99 features as extensions.
-def C99 : DiagGroup<"c99-extensions">;
+def C99 : DiagGroup<"c99-extensions", [C99Designator]>;
// A warning group for warnings about GCC extensions.
def GNU : DiagGroup<"gnu", [GNUAlignofExpression, GNUAnonymousStruct,
@@ -1001,6 +1032,12 @@ def ObjCLiteralComparison : DiagGroup<"objc-literal-compare", [
ObjCStringComparison
]>;
+def ObjCSignedCharBool : DiagGroup<"objc-signed-char-bool",
+ [ObjCSignedCharBoolImplicitIntConversion,
+ ObjCSignedCharBoolImplicitFloatConversion,
+ ObjCBoolConstantConversion,
+ TautologicalObjCBoolCompare]>;
+
// Inline ASM warnings.
def ASMOperandWidths : DiagGroup<"asm-operand-widths">;
def ASMIgnoredQualifier : DiagGroup<"asm-ignored-qualifier">;
@@ -1028,6 +1065,7 @@ def BackendOptimizationFailure : DiagGroup<"pass-failed">;
def ProfileInstrMissing : DiagGroup<"profile-instr-missing">;
def ProfileInstrOutOfDate : DiagGroup<"profile-instr-out-of-date">;
def ProfileInstrUnprofiled : DiagGroup<"profile-instr-unprofiled">;
+def MisExpect : DiagGroup<"misexpect">;
// AddressSanitizer frontend instrumentation remarks.
def SanitizeAddressRemarks : DiagGroup<"sanitize-address">;
diff --git a/include/clang/Basic/DiagnosticOptions.def b/include/clang/Basic/DiagnosticOptions.def
index baafd7ac723f6..6d1a1af92821b 100644
--- a/include/clang/Basic/DiagnosticOptions.def
+++ b/include/clang/Basic/DiagnosticOptions.def
@@ -49,6 +49,7 @@ DIAGOPT(Pedantic, 1, 0) /// -pedantic
DIAGOPT(PedanticErrors, 1, 0) /// -pedantic-errors
DIAGOPT(ShowColumn, 1, 1) /// Show column number on diagnostics.
DIAGOPT(ShowLocation, 1, 1) /// Show source location information.
+DIAGOPT(ShowLevel, 1, 1) /// Show diagnostic level.
DIAGOPT(AbsolutePath, 1, 0) /// Use absolute paths.
DIAGOPT(ShowCarets, 1, 1) /// Show carets in diagnostics.
DIAGOPT(ShowFixits, 1, 1) /// Show fixit information.
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index 8e6ced0dea54f..7c9f4da778a60 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -119,18 +119,16 @@ def warn_microsoft_qualifiers_ignored : Warning<
"qualifiers after comma in declarator list are ignored">,
InGroup<IgnoredAttributes>;
-def ext_c11_generic_selection : Extension<
- "generic selections are a C11-specific feature">, InGroup<C11>;
def err_duplicate_default_assoc : Error<
"duplicate default generic association">;
def note_previous_default_assoc : Note<
"previous default generic association is here">;
-def ext_c11_alignment : Extension<
- "%0 is a C11-specific feature">, InGroup<C11>;
+def ext_c99_feature : Extension<
+ "'%0' is a C99 extension">, InGroup<C99>;
+def ext_c11_feature : Extension<
+ "'%0' is a C11 extension">, InGroup<C11>;
-def ext_c11_noreturn : Extension<
- "_Noreturn functions are a C11-specific feature">, InGroup<C11>;
def err_c11_noreturn_misplaced : Error<
"'_Noreturn' keyword must precede function declarator">;
@@ -203,6 +201,7 @@ def err_invalid_token_after_declarator_suggest_equal : Error<
"invalid %0 at end of declaration; did you mean '='?">;
def err_expected_statement : Error<"expected statement">;
def err_expected_lparen_after : Error<"expected '(' after '%0'">;
+def err_expected_lbrace_after : Error<"expected '{' after '%0'">;
def err_expected_rparen_after : Error<"expected ')' after '%0'">;
def err_expected_punc : Error<"expected ')' or ',' after '%0'">;
def err_expected_less_after : Error<"expected '<' after '%0'">;
@@ -360,7 +359,8 @@ def err_typename_invalid_storageclass : Error<
def err_typename_invalid_functionspec : Error<
"type name does not allow function specifier to be specified">;
def err_typename_invalid_constexpr : Error<
- "type name does not allow %select{constexpr|consteval}0 specifier to be specified">;
+ "type name does not allow %sub{select_constexpr_spec_kind}0 specifier "
+ "to be specified">;
def err_typename_identifiers_only : Error<
"typename is allowed for identifiers only">;
@@ -374,8 +374,6 @@ def err_unexpected_token_in_nested_name_spec : Error<
"'%0' cannot be a part of nested name specifier; did you mean ':'?">;
def err_bool_redeclaration : Error<
"redeclaration of C++ built-in type 'bool'">;
-def ext_c11_static_assert : Extension<
- "_Static_assert is a C11-specific feature">, InGroup<C11>;
def warn_cxx98_compat_static_assert : Warning<
"static_assert declarations are incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
@@ -436,8 +434,6 @@ def err_objc_property_requires_field_name : Error<
"property requires fields to be named">;
def err_objc_property_bitfield : Error<"property name cannot be a bit-field">;
def err_objc_expected_property_attr : Error<"unknown property attribute %0">;
-def err_objc_properties_require_objc2 : Error<
- "properties are an Objective-C 2 feature">;
def err_objc_unexpected_attr : Error<
"prefix attribute must be followed by an interface, protocol, or implementation">;
def err_objc_postfix_attribute : Error <
@@ -976,11 +972,13 @@ def warn_pragma_missing_argument : Warning<
def warn_pragma_invalid_argument : Warning<
"unexpected argument '%0' to '#pragma %1'%select{|; expected %3}2">, InGroup<IgnoredPragmas>;
+def err_pragma_misplaced_in_decl : Error<"this pragma cannot appear in %0 declaration">;
+
// '#pragma clang section' related errors
def err_pragma_expected_clang_section_name : Error<
- "expected one of [bss|data|rodata|text] section kind in '#pragma %0'">;
+ "expected one of [bss|data|rodata|text|relro] section kind in '#pragma %0'">;
def err_pragma_clang_section_expected_equal : Error<
- "expected '=' following '#pragma clang section %select{invalid|bss|data|rodata|text}0'">;
+ "expected '=' following '#pragma clang section %select{invalid|bss|data|rodata|text|relro}0'">;
def warn_pragma_expected_section_name : Warning<
"expected a string literal for the section name in '#pragma %0' - ignored">,
InGroup<IgnoredPragmas>;
@@ -1180,8 +1178,8 @@ def err_omp_expected_identifier_for_critical : Error<
"expected identifier specifying the name of the 'omp critical' directive">;
def err_omp_expected_reduction_identifier : Error<
"expected identifier or one of the following operators: '+', '-', '*', '&', '|', '^', '&&', or '||'">;
-def err_omp_decl_in_declare_simd : Error<
- "function declaration is expected after 'declare simd' directive">;
+def err_omp_decl_in_declare_simd_variant : Error<
+ "function declaration is expected after 'declare %select{simd|variant}0' directive">;
def err_omp_unknown_map_type : Error<
"incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'">;
def err_omp_unknown_map_type_modifier : Error<
@@ -1195,13 +1193,36 @@ def err_omp_declare_simd_inbranch_notinbranch : Error<
def err_expected_end_declare_target : Error<
"expected '#pragma omp end declare target'">;
def err_omp_declare_target_unexpected_clause: Error<
- "unexpected '%0' clause, only 'to' or 'link' clauses expected">;
+ "unexpected '%0' clause, only %select{'to' or 'link'|'to', 'link' or 'device_type'}1 clauses expected">;
def err_omp_expected_clause: Error<
"expected at least one clause on '#pragma omp %0' directive">;
def err_omp_mapper_illegal_identifier : Error<
"illegal OpenMP user-defined mapper identifier">;
def err_omp_mapper_expected_declarator : Error<
"expected declarator on 'omp declare mapper' directive">;
+def err_omp_declare_variant_wrong_clause : Error<
+ "expected '%0' clause on 'omp declare variant' directive">;
+def err_omp_declare_variant_no_ctx_selector : Error<
+ "expected context selector in '%0' clause on 'omp declare variant' directive">;
+def err_omp_declare_variant_equal_expected : Error<
+ "expected '=' after '%0' context selector set name on 'omp declare variant' directive">;
+def warn_omp_declare_variant_cs_name_expected : Warning<
+ "unknown context selector in '%0' context selector set of 'omp declare variant' directive, ignored">,
+ InGroup<OpenMPClauses>;
+def err_omp_declare_variant_item_expected : Error<
+ "expected %0 in '%1' context selector of '%2' selector set of 'omp declare variant' directive">;
+def err_omp_declare_variant_ctx_set_mutiple_use : Error<
+ "context selector set '%0' is used already in the same 'omp declare variant' directive">;
+def note_omp_declare_variant_ctx_set_used_here : Note<
+ "previously context selector set '%0' used here">;
+def err_omp_expected_comma_brace : Error<"expected '}' or ',' after '%0'">;
+def err_omp_declare_variant_ctx_mutiple_use : Error<
+ "context trait selector '%0' is used already in the same '%1' context selector set of 'omp declare variant' directive">;
+def note_omp_declare_variant_ctx_used_here : Note<
+ "previously context trait selector '%0' used here">;
+def warn_omp_more_one_device_type_clause : Warning<
+ "more than one 'device_type' clause is specified">,
+ InGroup<OpenMPClauses>;
// Pragma loop support.
def err_pragma_loop_missing_argument : Error<
@@ -1210,7 +1231,7 @@ def err_pragma_loop_missing_argument : Error<
def err_pragma_loop_invalid_option : Error<
"%select{invalid|missing}0 option%select{ %1|}0; expected vectorize, "
"vectorize_width, interleave, interleave_count, unroll, unroll_count, "
- "pipeline, pipeline_initiation_interval, or distribute">;
+ "pipeline, pipeline_initiation_interval, vectorize_predicate, or distribute">;
def err_pragma_fp_invalid_option : Error<
"%select{invalid|missing}0 option%select{ %1|}0; expected contract">;
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index effcbad78b231..d802a92c42c04 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -12,7 +12,6 @@
let Component = "Sema" in {
let CategoryName = "Semantic Issue" in {
-
def note_previous_decl : Note<"%0 declared here">;
def note_entity_declared_at : Note<"%0 declared here">;
def note_callee_decl : Note<"%0 declared here">;
@@ -155,7 +154,7 @@ def err_variably_modified_new_type : Error<
// C99 Designated Initializers
def ext_designated_init : Extension<
- "designated initializers are a C99 feature">, InGroup<C99>;
+ "designated initializers are a C99 feature">, InGroup<C99Designator>;
def err_array_designator_negative : Error<
"array designator value '%0' is negative">;
def err_array_designator_empty_range : Error<
@@ -174,15 +173,17 @@ def err_field_designator_nonfield : Error<
def note_field_designator_found : Note<"field designator refers here">;
def err_designator_for_scalar_init : Error<
"designator in initializer for scalar type %0">;
-def warn_subobject_initializer_overrides : Warning<
- "subobject initialization overrides initialization of other fields "
- "within its enclosing subobject">, InGroup<InitializerOverrides>;
def warn_initializer_overrides : Warning<
- "initializer overrides prior initialization of this subobject">,
- InGroup<InitializerOverrides>;
+ "initializer %select{partially |}0overrides prior initialization of "
+ "this subobject">, InGroup<InitializerOverrides>;
+def ext_initializer_overrides : ExtWarn<warn_initializer_overrides.Text>,
+ InGroup<InitializerOverrides>, SFINAEFailure;
+def err_initializer_overrides_destructed : Error<
+ "initializer would partially override prior initialization of object of "
+ "type %1 with non-trivial destruction">;
def note_previous_initializer : Note<
"previous initialization %select{|with side effects }0is here"
- "%select{| (side effects may not occur at run time)}0">;
+ "%select{| (side effects will not occur at run time)}0">;
def err_designator_into_flexible_array_member : Error<
"designator into flexible array member subobject">;
def note_flexible_array_member : Note<
@@ -190,6 +191,28 @@ def note_flexible_array_member : Note<
def ext_flexible_array_init : Extension<
"flexible array initialization is a GNU extension">, InGroup<GNUFlexibleArrayInitializer>;
+// C++20 designated initializers
+def ext_cxx_designated_init : Extension<
+ "designated initializers are a C++20 extension">, InGroup<CXX2aDesignator>;
+def warn_cxx17_compat_designated_init : Warning<
+ "designated initializers are incompatible with C++ standards before C++20">,
+ InGroup<CXXPre2aCompatPedantic>, DefaultIgnore;
+def ext_designated_init_mixed : ExtWarn<
+ "mixture of designated and non-designated initializers in the same "
+ "initializer list is a C99 extension">, InGroup<C99Designator>;
+def note_designated_init_mixed : Note<
+ "first non-designated initializer is here">;
+def ext_designated_init_array : ExtWarn<
+ "array designators are a C99 extension">, InGroup<C99Designator>;
+def ext_designated_init_nested : ExtWarn<
+ "nested designators are a C99 extension">, InGroup<C99Designator>;
+def ext_designated_init_reordered : ExtWarn<
+ "ISO C++ requires field designators to be specified in declaration order; "
+ "field %1 will be initialized after field %0">, InGroup<ReorderInitList>,
+ SFINAEFailure;
+def note_previous_field_init : Note<
+ "previous initialization for field %0 is here">;
+
// Declarations.
def ext_plain_complex : ExtWarn<
"plain '_Complex' requires a type specifier; assuming '_Complex double'">;
@@ -598,6 +621,10 @@ def ext_implicit_lib_function_decl : ExtWarn<
def note_include_header_or_declare : Note<
"include the header <%0> or explicitly provide a declaration for '%1'">;
def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
+def warn_implicit_decl_no_jmp_buf
+ : Warning<"declaration of built-in function '%0' requires the declaration"
+ " of the 'jmp_buf' type, commonly provided in the header <setjmp.h>.">,
+ InGroup<DiagGroup<"incomplete-setjmp-declaration">>;
def warn_implicit_decl_requires_sysheader : Warning<
"declaration of built-in function '%1' requires inclusion of the header <%0>">,
InGroup<BuiltinRequiresHeader>;
@@ -2212,6 +2239,11 @@ def err_class_marked_final_used_as_base : Error<
"base %0 is marked '%select{final|sealed}1'">;
def warn_abstract_final_class : Warning<
"abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
+def warn_final_dtor_non_final_class : Warning<
+ "class with destructor marked '%select{final|sealed}0' cannot be inherited from">,
+ InGroup<FinalDtorNonFinalClass>;
+def note_final_dtor_non_final_class_silence : Note<
+ "mark %0 as '%select{final|sealed}1' to silence this warning">;
// C++11 attributes
def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
@@ -2326,18 +2358,24 @@ def warn_cxx14_compat_constexpr_not_const : Warning<
"in C++14; add 'const' to avoid a change in behavior">,
InGroup<DiagGroup<"constexpr-not-const">>;
def err_invalid_constexpr : Error<
- "%select{function parameter|typedef|non-static data member}0 "
- "cannot be %select{constexpr|consteval}1">;
+ "%select{function parameter|typedef}0 "
+ "cannot be %sub{select_constexpr_spec_kind}1">;
def err_invalid_constexpr_member : Error<"non-static data member cannot be "
"constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
def err_constexpr_tag : Error<
"%select{class|struct|interface|union|enum}0 "
- "cannot be marked %select{constexpr|consteval}1">;
+ "cannot be marked %sub{select_constexpr_spec_kind}1">;
def err_constexpr_dtor : Error<
- "destructor cannot be marked %select{constexpr|consteval}0">;
+ "destructor cannot be declared %sub{select_constexpr_spec_kind}0">;
+def err_constexpr_dtor_subobject : Error<
+ "destructor cannot be declared %sub{select_constexpr_spec_kind}0 because "
+ "%select{data member %2|base class %3}1 does not have a "
+ "constexpr destructor">;
+def note_constexpr_dtor_subobject : Note<
+ "%select{data member %1|base class %2}0 declared here">;
def err_constexpr_wrong_decl_kind : Error<
- "%select{constexpr|consteval}0 can only be used "
- "in %select{variable and |}0function declarations">;
+ "%sub{select_constexpr_spec_kind}0 can only be used "
+ "in %select{|variable and function|function|variable}0 declarations">;
def err_invalid_constexpr_var_decl : Error<
"constexpr variable declaration must be a definition">;
def err_constexpr_static_mem_var_requires_init : Error<
@@ -2346,6 +2384,8 @@ def err_constexpr_var_non_literal : Error<
"constexpr variable cannot have non-literal type %0">;
def err_constexpr_var_requires_const_init : Error<
"constexpr variable %0 must be initialized by a constant expression">;
+def err_constexpr_var_requires_const_destruction : Error<
+ "constexpr variable %0 must have constant destruction">;
def err_constexpr_redecl_mismatch : Error<
"%select{non-constexpr|constexpr|consteval}1 declaration of %0"
" follows %select{non-constexpr|constexpr|consteval}2 declaration">;
@@ -2406,9 +2446,13 @@ def err_constexpr_local_var_static : Error<
def err_constexpr_local_var_non_literal_type : Error<
"variable of non-literal type %1 cannot be defined in a constexpr "
"%select{function|constructor}0">;
-def err_constexpr_local_var_no_init : Error<
- "variables defined in a constexpr %select{function|constructor}0 must be "
- "initialized">;
+def ext_constexpr_local_var_no_init : ExtWarn<
+ "uninitialized variable in a constexpr %select{function|constructor}0 "
+ "is a C++20 extension">, InGroup<CXX2a>;
+def warn_cxx17_compat_constexpr_local_var_no_init : Warning<
+ "uninitialized variable in a constexpr %select{function|constructor}0 "
+ "is incompatible with C++ standards before C++20">,
+ InGroup<CXXPre2aCompat>, DefaultIgnore;
def ext_constexpr_function_never_constant_expr : ExtWarn<
"constexpr %select{function|constructor}0 never produces a "
"constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
@@ -2433,10 +2477,8 @@ def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
InGroup<CXXPre14Compat>, DefaultIgnore;
def note_constexpr_body_previous_return : Note<
"previous return statement is here">;
-def err_constexpr_function_try_block : Error<
- "function try block not allowed in constexpr %select{function|constructor}0">;
-// c++2a function try blocks in constexpr
+// C++2a function try blocks in constexpr
def ext_constexpr_function_try_block_cxx2a : ExtWarn<
"function try block in constexpr %select{function|constructor}0 is "
"a C++2a extension">, InGroup<CXX2a>;
@@ -2445,10 +2487,20 @@ def warn_cxx17_compat_constexpr_function_try_block : Warning<
"incompatible with C++ standards before C++2a">,
InGroup<CXXPre2aCompat>, DefaultIgnore;
-def err_constexpr_union_ctor_no_init : Error<
- "constexpr union constructor does not initialize any member">;
-def err_constexpr_ctor_missing_init : Error<
- "constexpr constructor must initialize all members">;
+def ext_constexpr_union_ctor_no_init : ExtWarn<
+ "constexpr union constructor that does not initialize any member "
+ "is a C++20 extension">, InGroup<CXX2a>;
+def warn_cxx17_compat_constexpr_union_ctor_no_init : Warning<
+ "constexpr union constructor that does not initialize any member "
+ "is incompatible with C++ standards before C++20">,
+ InGroup<CXXPre2aCompat>, DefaultIgnore;
+def ext_constexpr_ctor_missing_init : ExtWarn<
+ "constexpr constructor that does not initialize all members "
+ "is a C++20 extension">, InGroup<CXX2a>;
+def warn_cxx17_compat_constexpr_ctor_missing_init : Warning<
+ "constexpr constructor that does not initialize all members "
+ "is incompatible with C++ standards before C++20">,
+ InGroup<CXXPre2aCompat>, DefaultIgnore;
def note_constexpr_ctor_missing_init : Note<
"member not initialized by constructor">;
def note_non_literal_no_constexpr_ctors : Note<
@@ -2463,6 +2515,8 @@ def note_non_literal_user_provided_dtor : Note<
"%0 is not literal because it has a user-provided destructor">;
def note_non_literal_nontrivial_dtor : Note<
"%0 is not literal because it has a non-trivial destructor">;
+def note_non_literal_non_constexpr_dtor : Note<
+ "%0 is not literal because its destructor is not constexpr">;
def note_non_literal_lambda : Note<
"lambda closure types are non-literal types before C++17">;
def warn_private_extern : Warning<
@@ -2472,8 +2526,6 @@ def note_private_extern : Note<
"use __attribute__((visibility(\"hidden\"))) attribute instead">;
// C++ Concepts
-def err_concept_initialized_with_non_bool_type : Error<
- "constraint expression must be of type 'bool' but is of type %0">;
def err_concept_decls_may_only_appear_in_global_namespace_scope : Error<
"concept declarations may only appear in global or namespace scope">;
def err_concept_no_parameters : Error<
@@ -2485,9 +2537,14 @@ def err_concept_no_associated_constraints : Error<
"concept cannot have associated constraints">;
def err_concept_not_implemented : Error<
"sorry, unimplemented concepts feature %0 used">;
+def err_non_constant_constraint_expression : Error<
+ "substitution into constraint expression resulted in a non-constant "
+ "expression">;
+def err_non_bool_atomic_constraint : Error<
+ "atomic constraint must be of type 'bool' (found %0)">;
-def err_template_different_associated_constraints : Error<
- "associated constraints differ in template redeclaration">;
+def err_template_different_requires_clause : Error<
+ "requires clause differs in template redeclaration">;
// C++11 char16_t/char32_t
def warn_cxx98_compat_unicode_type : Warning<
@@ -2519,6 +2576,9 @@ def err_nsobject_attribute : Error<
"'NSObject' attribute is for pointer types only">;
def err_attributes_are_not_compatible : Error<
"%0 and %1 attributes are not compatible">;
+def err_attribute_invalid_argument : Error<
+ "%select{'void'|a reference type|an array type|a non-vector or "
+ "non-vectorizable scalar type}0 is an invalid argument to attribute %1">;
def err_attribute_wrong_number_arguments : Error<
"%0 attribute %plural{0:takes no arguments|1:takes one argument|"
":requires exactly %1 arguments}1">;
@@ -2567,8 +2627,6 @@ def err_attribute_argument_out_of_range : Error<
def err_init_priority_object_attr : Error<
"can only use 'init_priority' attribute on file-scope definitions "
"of objects of class type">;
-def err_attribute_argument_vec_type_hint : Error<
- "invalid attribute argument %0 - expecting a vector or vectorizable scalar type">;
def err_attribute_argument_out_of_bounds : Error<
"%0 attribute parameter %1 is out of bounds">;
def err_attribute_only_once_per_parameter : Error<
@@ -2778,6 +2836,11 @@ def err_no_accessor_for_property : Error<
def err_cannot_find_suitable_accessor : Error<
"cannot find suitable %select{getter|setter}0 for property %1">;
+def warn_alloca : Warning<
+ "use of function %0 is discouraged; there is no way to check for failure but "
+ "failure may still occur, resulting in a possibly exploitable security vulnerability">,
+ InGroup<DiagGroup<"alloca">>, DefaultIgnore;
+
def warn_alloca_align_alignof : Warning<
"second argument to __builtin_alloca_with_align is supposed to be in bits">,
InGroup<DiagGroup<"alloca-with-align-alignof">>;
@@ -2793,6 +2856,10 @@ def err_alignment_dependent_typedef_name : Error<
def err_attribute_aligned_too_great : Error<
"requested alignment must be %0 bytes or smaller">;
+def warn_assume_aligned_too_great
+ : Warning<"requested alignment must be %0 bytes or smaller; maximum "
+ "alignment assumed">,
+ InGroup<DiagGroup<"builtin-assume-aligned-alignment">>;
def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
"%q0 redeclared without %1 attribute: previous %1 ignored">,
InGroup<MicrosoftInconsistentDllImport>;
@@ -2950,6 +3017,10 @@ def warn_gnu_inline_attribute_requires_inline : Warning<
"'gnu_inline' attribute requires function to be marked 'inline',"
" attribute ignored">,
InGroup<IgnoredAttributes>;
+def warn_gnu_inline_cplusplus_without_extern : Warning<
+ "'gnu_inline' attribute without 'extern' in C++ treated as externally"
+ " available, this changed in Clang 10">,
+ InGroup<DiagGroup<"gnu-inline-cpp-without-extern">>;
def err_attribute_vecreturn_only_vector_member : Error<
"the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
def err_attribute_vecreturn_only_pod_record : Error<
@@ -2966,6 +3037,7 @@ def warn_cconv_unsupported : Warning<
"|on builtin function"
"}1">,
InGroup<IgnoredAttributes>;
+def error_cconv_unsupported : Error<warn_cconv_unsupported.Text>;
def err_cconv_knr : Error<
"function with no prototype cannot use the %0 calling convention">;
def warn_cconv_knr : Warning<
@@ -3251,9 +3323,9 @@ def warn_impcast_integer_precision_constant : Warning<
def warn_impcast_bitfield_precision_constant : Warning<
"implicit truncation from %2 to bit-field changes value from %0 to %1">,
InGroup<BitFieldConstantConversion>;
-def warn_impcast_constant_int_to_objc_bool : Warning<
- "implicit conversion from constant value %0 to BOOL; "
- "the only well defined values for BOOL are YES and NO">,
+def warn_impcast_constant_value_to_objc_bool : Warning<
+ "implicit conversion from constant value %0 to 'BOOL'; "
+ "the only well defined values for 'BOOL' are YES and NO">,
InGroup<ObjCBoolConstantConversion>;
def warn_impcast_fixed_point_range : Warning<
@@ -3269,6 +3341,20 @@ def warn_impcast_literal_float_to_integer_out_of_range : Warning<
def warn_impcast_float_integer : Warning<
"implicit conversion turns floating-point number into integer: %0 to %1">,
InGroup<FloatConversion>, DefaultIgnore;
+def warn_impcast_float_to_objc_signed_char_bool : Warning<
+ "implicit conversion from floating-point type %0 to 'BOOL'">,
+ InGroup<ObjCSignedCharBoolImplicitFloatConversion>;
+def warn_impcast_int_to_objc_signed_char_bool : Warning<
+ "implicit conversion from integral type %0 to 'BOOL'">,
+ InGroup<ObjCSignedCharBoolImplicitIntConversion>, DefaultIgnore;
+
+// Implicit int -> float conversion precision loss warnings.
+def warn_impcast_integer_float_precision : Warning<
+ "implicit conversion from %0 to %1 may lose precision">,
+ InGroup<ImplicitIntFloatConversion>, DefaultIgnore;
+def warn_impcast_integer_float_precision_constant : Warning<
+ "implicit conversion from %2 to %3 changes value from %0 to %1">,
+ InGroup<ImplicitIntFloatConversion>;
def warn_impcast_float_to_integer : Warning<
"implicit conversion from %0 to %1 changes value from %2 to %3">,
@@ -3292,6 +3378,10 @@ def warn_impcast_bool_to_null_pointer : Warning<
def warn_non_literal_null_pointer : Warning<
"expression which evaluates to zero treated as a null pointer constant of "
"type %0">, InGroup<NonLiteralNullConversion>;
+def warn_pointer_compare : Warning<
+ "comparing a pointer to a null character constant; did you mean "
+ "to compare to %select{NULL|(void *)0}0?">,
+ InGroup<DiagGroup<"pointer-compare">>;
def warn_impcast_null_pointer_to_integer : Warning<
"implicit conversion of %select{NULL|nullptr}0 constant to %1">,
InGroup<NullConversion>;
@@ -3318,6 +3408,18 @@ def warn_address_of_reference_bool_conversion : Warning<
"code; pointer may be assumed to always convert to true">,
InGroup<UndefinedBoolConversion>;
+def warn_xor_used_as_pow : Warning<
+ "result of '%0' is %1; did you mean exponentiation?">,
+ InGroup<XorUsedAsPow>;
+def warn_xor_used_as_pow_base_extra : Warning<
+ "result of '%0' is %1; did you mean '%2' (%3)?">,
+ InGroup<XorUsedAsPow>;
+def warn_xor_used_as_pow_base : Warning<
+ "result of '%0' is %1; did you mean '%2'?">,
+ InGroup<XorUsedAsPow>;
+def note_xor_used_as_pow_silence : Note<
+ "replace expression with '%0' %select{|or use 'xor' instead of '^' }1to silence this warning">;
+
def warn_null_pointer_compare : Warning<
"comparison of %select{address of|function|array}0 '%1' %select{not |}2"
"equal to a null pointer is always %select{true|false}2">,
@@ -3338,9 +3440,15 @@ def warn_address_of_reference_null_compare : Warning<
InGroup<TautologicalUndefinedCompare>;
def note_reference_is_return_value : Note<"%0 returns a reference">;
+def note_pointer_declared_here : Note<
+ "pointer %0 declared here">;
def warn_division_sizeof_ptr : Warning<
"'%0' will return the size of the pointer, not the array itself">,
InGroup<DiagGroup<"sizeof-pointer-div">>;
+def warn_division_sizeof_array : Warning<
+ "expression does not compute the number of elements in this array; element "
+ "type is %0, not %1">,
+ InGroup<DiagGroup<"sizeof-array-div">>;
def note_function_warning_silence : Note<
"prefix with the address-of operator to silence this warning">;
@@ -3661,7 +3769,8 @@ def note_ovl_too_many_candidates : Note<
"pass -fshow-overloads=all to show them">;
def select_ovl_candidate_kind : TextSubstitution<
- "%select{function|function|constructor|"
+ "%select{function|function|function (with reversed parameter order)|"
+ "constructor|"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
@@ -3855,10 +3964,7 @@ def note_implicit_member_target_infer_collision : Note<
def note_ambiguous_type_conversion: Note<
"because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
-def note_ovl_builtin_binary_candidate : Note<
- "built-in candidate %0">;
-def note_ovl_builtin_unary_candidate : Note<
- "built-in candidate %0">;
+def note_ovl_builtin_candidate : Note<"built-in candidate %0">;
def err_ovl_no_viable_function_in_init : Error<
"no matching constructor for initialization of %0">;
def err_ovl_no_conversion_in_cast : Error<
@@ -3885,6 +3991,13 @@ def err_ovl_ambiguous_oper_unary : Error<
"use of overloaded operator '%0' is ambiguous (operand type %1)">;
def err_ovl_ambiguous_oper_binary : Error<
"use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
+def ext_ovl_ambiguous_oper_binary_reversed : ExtWarn<
+ "ISO C++20 considers use of overloaded operator '%0' (with operand types %1 "
+ "and %2) to be ambiguous despite there being a unique best viable function">,
+ InGroup<DiagGroup<"ambiguous-reversed-operator">>, SFINAEFailure;
+def note_ovl_ambiguous_oper_binary_reversed_candidate : Note<
+ "ambiguity is between a regular call to this operator and a call with the "
+ "argument order reversed">;
def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
def err_ovl_deleted_oper : Error<
@@ -3892,6 +4005,9 @@ def err_ovl_deleted_oper : Error<
def err_ovl_deleted_special_oper : Error<
"object of type %0 cannot be %select{constructed|copied|moved|assigned|"
"assigned|destroyed}1 because its %sub{select_special_member_kind}1 is implicitly deleted">;
+def err_ovl_rewrite_equalequal_not_bool : Error<
+ "return type %0 of selected 'operator==' function for rewritten "
+ "'%1' comparison is not 'bool'">;
def err_ovl_no_viable_subscript :
Error<"no viable overloaded operator[] for type %0">;
def err_ovl_no_oper :
@@ -3934,6 +4050,8 @@ def err_ovl_no_viable_literal_operator : Error<
// C++ Template Declarations
def err_template_param_shadow : Error<
"declaration of %0 shadows template parameter">;
+def ext_template_param_shadow : ExtWarn<
+ err_template_param_shadow.Text>, InGroup<MicrosoftTemplate>;
def note_template_param_here : Note<"template parameter is declared here">;
def warn_template_export_unsupported : Warning<
"exported templates are unsupported">;
@@ -4392,6 +4510,10 @@ def note_prior_template_arg_substitution : Note<
" template parameter%1 %2">;
def note_template_default_arg_checking : Note<
"while checking a default template argument used here">;
+def note_concept_specialization_here : Note<
+ "while checking the satisfaction of concept '%0' requested here">;
+def note_constraint_substitution_here : Note<
+ "while substituting template arguments into constraint expression here">;
def note_instantiation_contexts_suppressed : Note<
"(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
"see all)">;
@@ -5334,9 +5456,6 @@ def err_arc_mismatched_cast : Error<
" to %3 is disallowed with ARC">;
def err_arc_nolifetime_behavior : Error<
"explicit ownership qualifier on cast result has no effect">;
-def err_arc_objc_object_in_tag : Error<
- "ARC forbids %select{Objective-C objects|blocks}0 in "
- "%select{struct|interface|union|<<ERROR>>|enum}1">;
def err_arc_objc_property_default_assign_on_object : Error<
"ARC forbids synthesizing a property of an Objective-C object "
"with unspecified ownership or storage attribute">;
@@ -5626,9 +5745,18 @@ def note_precedence_silence : Note<
def warn_precedence_conditional : Warning<
"operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
InGroup<Parentheses>;
+def warn_precedence_bitwise_conditional : Warning<
+ "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
+ InGroup<BitwiseConditionalParentheses>;
def note_precedence_conditional_first : Note<
"place parentheses around the '?:' expression to evaluate it first">;
+def warn_enum_constant_in_bool_context : Warning<
+ "converting the enum constant to a boolean">,
+ InGroup<IntInBoolContext>, DefaultIgnore;
+def warn_left_shift_in_bool_context : Warning<
+ "converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
+ InGroup<IntInBoolContext>, DefaultIgnore;
def warn_logical_instead_of_bitwise : Warning<
"use of logical '%0' with constant operand">,
InGroup<DiagGroup<"constant-logical-operand">>;
@@ -5638,10 +5766,10 @@ def note_logical_instead_of_bitwise_remove_constant : Note<
"remove constant to silence this warning">;
def warn_bitwise_op_in_bitwise_op : Warning<
- "'%0' within '%1'">, InGroup<BitwiseOpParentheses>;
+ "'%0' within '%1'">, InGroup<BitwiseOpParentheses>, DefaultIgnore;
def warn_logical_and_in_logical_or : Warning<
- "'&&' within '||'">, InGroup<LogicalOpParentheses>;
+ "'&&' within '||'">, InGroup<LogicalOpParentheses>, DefaultIgnore;
def warn_overloaded_shift_in_comparison :Warning<
"overloaded operator %select{>>|<<}0 has higher precedence than "
@@ -5718,6 +5846,9 @@ def err_arithmetic_nonfragile_interface : Error<
"arithmetic on pointer to interface %0, which is not a constant size for "
"this architecture and platform">;
+def warn_deprecated_comma_subscript : Warning<
+ "top-level comma expression in array subscript is deprecated">,
+ InGroup<DeprecatedCommaSubscript>;
def ext_subscript_non_lvalue : Extension<
"ISO C90 does not allow subscripting non-lvalue array">;
@@ -6038,8 +6169,8 @@ def warn_tautological_constant_compare : Warning<
"%select{%1|%3}0 is always %4">,
InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
def warn_tautological_compare_objc_bool : Warning<
- "result of comparison of constant %0 with expression of type BOOL"
- " is always %1, as the only well defined values for BOOL are YES and NO">,
+ "result of comparison of constant %0 with expression of type 'BOOL'"
+ " is always %1, as the only well defined values for 'BOOL' are YES and NO">,
InGroup<TautologicalObjCBoolCompare>;
def warn_mixed_sign_comparison : Warning<
@@ -6051,10 +6182,22 @@ def warn_out_of_range_compare : Warning<
InGroup<TautologicalOutOfRangeCompare>;
def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Text>,
InGroup<TautologicalConstantCompare>;
+def warn_integer_constants_in_conditional_always_true : Warning<
+ "converting the result of '?:' with integer constants to a boolean always "
+ "evaluates to 'true'">,
+ InGroup<TautologicalConstantCompare>;
+def warn_left_shift_always : Warning<
+ "converting the result of '<<' to a boolean always evaluates "
+ "to %select{false|true}0">,
+ InGroup<TautologicalConstantCompare>;
def warn_comparison_of_mixed_enum_types : Warning<
"comparison of two values with different enumeration types"
"%diff{ ($ and $)|}0,1">,
InGroup<EnumCompare>;
+def warn_conditional_mixed_enum_types : Warning<
+ "enumeration type mismatch in conditional expression"
+ "%diff{ ($ and $)|}0,1">,
+ InGroup<EnumCompareConditional>, DefaultIgnore;
def warn_comparison_of_mixed_enum_types_switch : Warning<
"comparison of two values with different enumeration types in switch statement"
"%diff{ ($ and $)|}0,1">,
@@ -6093,6 +6236,8 @@ def err_invalid_qualified_function_type : Error<
def err_compound_qualified_function_type : Error<
"%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
"cannot have '%3' qualifier">;
+def err_qualified_function_typeid : Error<
+ "type operand %0 of 'typeid' cannot have '%1' qualifier">;
def err_ref_qualifier_overload : Error<
"cannot overload a member function %select{without a ref-qualifier|with "
@@ -6517,6 +6662,10 @@ def note_member_declared_here : Note<
"member %0 declared here">;
def note_member_first_declared_here : Note<
"member %0 first declared here">;
+def warn_bitwise_negation_bool : Warning<
+ "bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 "
+ "did you mean logical negation?">,
+ InGroup<DiagGroup<"bool-operation">>;
def err_decrement_bool : Error<"cannot decrement expression of type bool">;
def warn_increment_bool : Warning<
"incrementing expression of type bool is deprecated and "
@@ -6526,6 +6675,26 @@ def ext_increment_bool : ExtWarn<
DefaultError, InGroup<IncrementBool>;
def err_increment_decrement_enum : Error<
"cannot %select{decrement|increment}0 expression of enum type %1">;
+
+def warn_deprecated_increment_decrement_volatile : Warning<
+ "%select{decrement|increment}0 of object of volatile-qualified type %1 "
+ "is deprecated">, InGroup<DeprecatedVolatile>;
+def warn_deprecated_simple_assign_volatile : Warning<
+ "use of result of assignment to object of volatile-qualified type %0 "
+ "is deprecated">, InGroup<DeprecatedVolatile>;
+def warn_deprecated_compound_assign_volatile : Warning<
+ "compound assignment to object of volatile-qualified type %0 is deprecated">,
+ InGroup<DeprecatedVolatile>;
+def warn_deprecated_volatile_return : Warning<
+ "volatile-qualified return type %0 is deprecated">,
+ InGroup<DeprecatedVolatile>;
+def warn_deprecated_volatile_param : Warning<
+ "volatile-qualified parameter type %0 is deprecated">,
+ InGroup<DeprecatedVolatile>;
+def warn_deprecated_volatile_structured_binding : Warning<
+ "volatile qualifier in structured binding declaration is deprecated">,
+ InGroup<DeprecatedVolatile>;
+
def err_catch_incomplete_ptr : Error<
"cannot catch pointer to incomplete type %0">;
def err_catch_incomplete_ref : Error<
@@ -7426,6 +7595,12 @@ def warn_unused_container_subscript_expr : Warning<
def warn_unused_call : Warning<
"ignoring return value of function declared with %0 attribute">,
InGroup<UnusedValue>;
+def warn_unused_constructor : Warning<
+ "ignoring temporary created by a constructor declared with %0 attribute">,
+ InGroup<UnusedValue>;
+def warn_unused_constructor_msg : Warning<
+ "ignoring temporary created by a constructor declared with %0 attribute: %1">,
+ InGroup<UnusedValue>;
def warn_side_effects_unevaluated_context : Warning<
"expression with side effects has no effect in an unevaluated context">,
InGroup<UnevaluatedExpression>;
@@ -7435,6 +7610,9 @@ def warn_side_effects_typeid : Warning<
def warn_unused_result : Warning<
"ignoring return value of function declared with %0 attribute">,
InGroup<UnusedResult>;
+def warn_unused_result_msg : Warning<
+ "ignoring return value of function declared with %0 attribute: %1">,
+ InGroup<UnusedResult>;
def warn_unused_volatile : Warning<
"expression result unused; assign into a variable to force a volatile load">,
InGroup<DiagGroup<"unused-volatile-lvalue">>;
@@ -7443,6 +7621,8 @@ def ext_cxx14_attr : Extension<
"use of the %0 attribute is a C++14 extension">, InGroup<CXX14>;
def ext_cxx17_attr : Extension<
"use of the %0 attribute is a C++17 extension">, InGroup<CXX17>;
+def ext_cxx2a_attr : Extension<
+ "use of the %0 attribute is a C++2a extension">, InGroup<CXX2a>;
def warn_unused_comparison : Warning<
"%select{equality|inequality|relational|three-way}0 comparison result unused">,
@@ -7453,10 +7633,30 @@ def note_inequality_comparison_to_or_assign : Note<
def err_incomplete_type_used_in_type_trait_expr : Error<
"incomplete type %0 used in type trait expression">;
+// C++20 constinit and require_constant_initialization attribute
+def warn_cxx20_compat_constinit : Warning<
+ "'constinit' specifier is incompatible with C++ standards before C++20">,
+ InGroup<CXX2aCompat>, DefaultIgnore;
+def err_constinit_local_variable : Error<
+ "local variable cannot be declared 'constinit'">;
def err_require_constant_init_failed : Error<
"variable does not have a constant initializer">;
def note_declared_required_constant_init_here : Note<
- "required by 'require_constant_initialization' attribute here">;
+ "required by %select{'require_constant_initialization' attribute|"
+ "'constinit' specifier}0 here">;
+def ext_constinit_missing : ExtWarn<
+ "'constinit' specifier missing on initializing declaration of %0">,
+ InGroup<DiagGroup<"missing-constinit">>;
+def note_constinit_specified_here : Note<"variable declared constinit here">;
+def err_constinit_added_too_late : Error<
+ "'constinit' specifier added after initialization of variable">;
+def warn_require_const_init_added_too_late : Warning<
+ "'require_constant_initialization' attribute added after initialization "
+ "of variable">, InGroup<IgnoredAttributes>;
+def note_constinit_missing_here : Note<
+ "add the "
+ "%select{'require_constant_initialization' attribute|'constinit' specifier}0 "
+ "to the initializing declaration here">;
def err_dimension_expr_not_constant_integer : Error<
"dimension expression does not evaluate to a constant unsigned int">;
@@ -7493,8 +7693,6 @@ let CategoryName = "Inline Assembly Issue" in {
"invalid lvalue in asm input for constraint '%0'">;
def err_asm_invalid_input_constraint : Error<
"invalid input constraint '%0' in asm">;
- def err_asm_immediate_expected : Error<"constraint '%0' expects "
- "an integer constant expression">;
def err_asm_tying_incompatible_types : Error<
"unsupported inline asm: input with type "
"%diff{$ matching output with type $|}0,1">;
@@ -7583,7 +7781,7 @@ def err_mem_init_not_member_or_class : Error<
def warn_initializer_out_of_order : Warning<
"%select{field|base class}0 %1 will be initialized after "
"%select{field|base}2 %3">,
- InGroup<Reorder>, DefaultIgnore;
+ InGroup<ReorderCtor>, DefaultIgnore;
def warn_abstract_vbase_init_ignored : Warning<
"initializer for virtual base class %0 of abstract class %1 "
"will never be used">,
@@ -7919,7 +8117,7 @@ def warn_array_index_precedes_bounds : Warning<
def warn_array_index_exceeds_bounds : Warning<
"array index %0 is past the end of the array (which contains %1 "
"element%s2)">, InGroup<ArrayBounds>;
-def note_array_index_out_of_bounds : Note<
+def note_array_declared_here : Note<
"array %0 declared here">;
def warn_printf_insufficient_data_args : Warning<
@@ -7940,16 +8138,17 @@ def warn_format_conversion_argument_type_mismatch : Warning<
"%select{type|underlying type}2 %1">,
InGroup<Format>;
def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
- "format specifies type %0 but the argument has "
- "%select{type|underlying type}2 %1">,
+ warn_format_conversion_argument_type_mismatch.Text>,
InGroup<FormatPedantic>;
+def warn_format_conversion_argument_type_mismatch_confusion : Warning<
+ warn_format_conversion_argument_type_mismatch.Text>,
+ InGroup<FormatTypeConfusion>, DefaultIgnore;
def warn_format_argument_needs_cast : Warning<
"%select{values of type|enum values with underlying type}2 '%0' should not "
"be used as format arguments; add an explicit cast to %1 instead">,
InGroup<Format>;
def warn_format_argument_needs_cast_pedantic : Warning<
- "%select{values of type|enum values with underlying type}2 '%0' should not "
- "be used as format arguments; add an explicit cast to %1 instead">,
+ warn_format_argument_needs_cast.Text>,
InGroup<FormatPedantic>, DefaultIgnore;
def warn_printf_positional_arg_exceeds_data_args : Warning <
"data argument position '%0' exceeds the number of data arguments (%1)">,
@@ -8023,6 +8222,9 @@ def warn_printf_invalid_objc_flag: Warning<
def warn_scanf_scanlist_incomplete : Warning<
"no closing ']' for '%%[' in scanf format string">,
InGroup<Format>;
+def warn_format_bool_as_character : Warning<
+ "using '%0' format specifier, but argument has boolean value">,
+ InGroup<Format>;
def note_format_string_defined : Note<"format string is defined here">;
def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
def note_printf_c_str: Note<"did you mean to call the %0 method?">;
@@ -8085,6 +8287,10 @@ def warn_dangling_member : Warning<
"%select{binds to|is}2 a temporary object "
"whose lifetime is shorter than the lifetime of the constructed object">,
InGroup<DanglingField>;
+def warn_dangling_lifetime_pointer_member : Warning<
+ "initializing pointer member %0 to point to a temporary object "
+ "whose lifetime is shorter than the lifetime of the constructed object">,
+ InGroup<DanglingGsl>;
def note_lifetime_extending_member_declared_here : Note<
"%select{%select{reference|'std::initializer_list'}0 member|"
"member with %select{reference|'std::initializer_list'}0 subobject}1 "
@@ -8103,6 +8309,10 @@ def warn_new_dangling_reference : Warning<
"temporary bound to reference member of allocated object "
"will be destroyed at the end of the full-expression">,
InGroup<DanglingField>;
+def warn_dangling_lifetime_pointer : Warning<
+ "object backing the pointer "
+ "will be destroyed at the end of the full-expression">,
+ InGroup<DanglingGsl>;
def warn_new_dangling_initializer_list : Warning<
"array backing "
"%select{initializer list subobject of the allocated object|"
@@ -8120,11 +8330,15 @@ def warn_unsupported_lifetime_extension : Warning<
// should result in a warning, since these always evaluate to a constant.
// Array comparisons have similar warnings
def warn_comparison_always : Warning<
- "%select{self-|array }0comparison always evaluates to %select{a constant|%2}1">,
+ "%select{self-|array }0comparison always evaluates to "
+ "%select{a constant|true|false|'std::strong_ordering::equal'}1">,
InGroup<TautologicalCompare>;
def warn_comparison_bitwise_always : Warning<
"bitwise comparison always evaluates to %select{false|true}0">,
- InGroup<TautologicalCompare>;
+ InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
+def warn_comparison_bitwise_or : Warning<
+ "bitwise or with non-zero value always evaluates to true">,
+ InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
def warn_tautological_overlap_comparison : Warning<
"overlapping comparisons always evaluate to %select{false|true}0">,
InGroup<TautologicalOverlapCompare>, DefaultIgnore;
@@ -8503,10 +8717,11 @@ def warn_sync_fetch_and_nand_semantics_change : Warning<
InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
// Type
-def ext_invalid_sign_spec : Extension<"'%0' cannot be signed or unsigned">;
+def ext_wchar_t_sign_spec : ExtWarn<"'%0' cannot be signed or unsigned">,
+ InGroup<DiagGroup<"signed-unsigned-wchar">>, DefaultError;
def warn_receiver_forward_class : Warning<
- "receiver %0 is a forward class and corresponding @interface may not exist">,
- InGroup<ForwardClassReceiver>;
+ "receiver %0 is a forward class and corresponding @interface may not exist">,
+ InGroup<ForwardClassReceiver>;
def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
def ext_missing_declspec : ExtWarn<
"declaration specifier missing, defaulting to 'int'">;
@@ -8984,7 +9199,7 @@ def ext_omp_loop_not_canonical_init : ExtWarn<
"('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
def err_omp_loop_not_canonical_cond : Error<
"condition of OpenMP for loop must be a relational comparison "
- "('<', '<=', '>', or '>=') of loop variable %0">;
+ "('<', '<=', '>', %select{or '>='|'>=', or '!='}0) of loop variable %1">;
def err_omp_loop_not_canonical_incr : Error<
"increment clause of OpenMP for loop must perform simple addition "
"or subtraction on loop variable %0">;
@@ -9101,10 +9316,10 @@ def err_omp_single_copyprivate_with_nowait : Error<
"the 'copyprivate' clause must not be used with the 'nowait' clause">;
def note_omp_nowait_clause_here : Note<
"'nowait' clause is here">;
-def err_omp_single_decl_in_declare_simd : Error<
- "single declaration is expected after 'declare simd' directive">;
+def err_omp_single_decl_in_declare_simd_variant : Error<
+ "single declaration is expected after 'declare %select{simd|variant}0' directive">;
def err_omp_function_expected : Error<
- "'#pragma omp declare simd' can only be applied to functions">;
+ "'#pragma omp declare %select{simd|variant}0' can only be applied to functions">;
def err_omp_wrong_cancel_region : Error<
"one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
def err_omp_parent_cancel_region_nowait : Error<
@@ -9286,6 +9501,44 @@ def err_omp_wrong_dependency_iterator_type : Error<
"expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">;
def err_omp_unsupported_type : Error <
"host requires %0 bit size %1 type support, but device '%2' does not support it">;
+def err_omp_lambda_capture_in_declare_target_not_to : Error<
+ "variable captured in declare target region must appear in a to clause">;
+def err_omp_device_type_mismatch : Error<
+ "'device_type(%0)' does not match previously specified 'device_type(%1)' for the same declaration">;
+def err_omp_wrong_device_function_call : Error<
+ "function with 'device_type(%0)' is not available on %select{device|host}1">;
+def note_omp_marked_device_type_here : Note<"marked as 'device_type(%0)' here">;
+def warn_omp_declare_target_after_first_use : Warning<
+ "declaration marked as declare target after first use, it may lead to incorrect results">,
+ InGroup<OpenMPTarget>;
+def err_omp_declare_variant_incompat_attributes : Error<
+ "'#pragma omp declare variant' is not compatible with any target-specific attributes">;
+def warn_omp_declare_variant_after_used : Warning<
+ "'#pragma omp declare variant' cannot be applied for function after first "
+ "usage; the original function might be used">, InGroup<SourceUsesOpenMP>;
+def warn_omp_declare_variant_after_emitted : Warning<
+ "'#pragma omp declare variant' cannot be applied to the function that was defined already;"
+ " the original function might be used">, InGroup<SourceUsesOpenMP>;
+def err_omp_declare_variant_noproto : Error<
+ "function with '#pragma omp declare variant' must have a prototype">;
+def note_omp_declare_variant_specified_here : Note<
+ "'#pragma omp declare variant' for function specified here">;
+def err_omp_declare_variant_doesnt_support : Error<
+ "'#pragma omp declare variant' does not "
+ "support %select{function templates|virtual functions|"
+ "deduced return types|constructors|destructors|deleted functions|"
+ "defaulted functions|constexpr functions|consteval function}0">;
+def err_omp_declare_variant_diff : Error<
+ "function with '#pragma omp declare variant' has a different %select{calling convention"
+ "|return type|constexpr specification|inline specification|storage class|"
+ "linkage}0">;
+def err_omp_declare_variant_incompat_types : Error<
+ "variant in '#pragma omp declare variant' with type %0 is incompatible with type %1"
+ >;
+def warn_omp_declare_variant_marked_as_declare_variant : Warning<
+ "variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'"
+ >, InGroup<SourceUsesOpenMP>;
+def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">;
} // end of OpenMP category
let CategoryName = "Related Result Type Issue" in {
@@ -9725,6 +9978,8 @@ def err_std_compare_type_not_supported : Error<
"member '%2' is missing|"
"the type is not trivially copyable|"
"the type does not have the expected form}1">;
+def note_rewriting_operator_as_spaceship : Note<
+ "while rewriting comparison as call to 'operator<=>' declared here">;
// Memory Tagging Extensions (MTE) diagnostics
def err_memtag_arg_null_or_pointer : Error<
@@ -9735,8 +9990,6 @@ def err_memtag_arg_must_be_pointer : Error<
"%0 argument of MTE builtin function must be a pointer (%1 invalid)">;
def err_memtag_arg_must_be_integer : Error<
"%0 argument of MTE builtin function must be an integer type (%1 invalid)">;
-def err_memtag_arg_must_be_unsigned : Error<
- "%0 argument of MTE builtin function must be an unsigned integer type (%1 invalid)">;
def warn_dereference_of_noderef_type : Warning<
"dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
@@ -9751,6 +10004,11 @@ def err_builtin_launder_invalid_arg : Error<
"%select{non-pointer|function pointer|void pointer}0 argument to "
"'__builtin_launder' is not allowed">;
+def err_preserve_field_info_not_field : Error<
+ "__builtin_preserve_field_info argument %0 not a field access">;
+def err_preserve_field_info_not_const: Error<
+ "__builtin_preserve_field_info argument %0 not a constant">;
+
def err_bit_cast_non_trivially_copyable : Error<
"__builtin_bit_cast %select{source|destination}0 type must be trivially copyable">;
def err_bit_cast_type_size_mismatch : Error<
diff --git a/include/clang/Basic/DiagnosticSerializationKinds.td b/include/clang/Basic/DiagnosticSerializationKinds.td
index 43ba19b5853e2..757dbbeee3cc0 100644
--- a/include/clang/Basic/DiagnosticSerializationKinds.td
+++ b/include/clang/Basic/DiagnosticSerializationKinds.td
@@ -18,13 +18,16 @@ def err_fe_pch_malformed : Error<
def err_fe_pch_malformed_block : Error<
"malformed block record in PCH file: '%0'">, DefaultFatal;
def err_fe_pch_file_modified : Error<
- "file '%0' has been modified since the precompiled header '%1' was built">,
+ "file '%0' has been modified since the precompiled header '%1' was built"
+ ": %select{size|mtime|content}2 changed">,
DefaultFatal;
def err_fe_module_file_modified : Error<
- "file '%0' has been modified since the module file '%1' was built">,
+ "file '%0' has been modified since the module file '%1' was built"
+ ": %select{size|mtime|content}2 changed">,
DefaultFatal;
def err_fe_ast_file_modified : Error<
- "file '%0' has been modified since the AST file '%1' was built">,
+ "file '%0' has been modified since the AST file '%1' was built"
+ ": %select{size|mtime|content}2 changed">,
DefaultFatal;
def err_fe_pch_file_overridden : Error<
"file '%0' from the precompiled header has been overridden">;
@@ -77,13 +80,13 @@ def remark_module_import : Remark<
InGroup<ModuleImport>;
def err_imported_module_not_found : Error<
- "module '%0' in AST file '%1' (imported by AST file '%2') "
+ "module '%0' in AST file '%1' %select{(imported by AST file '%2') |}4"
"is not defined in any loaded module map file; "
"maybe you need to load '%3'?">, DefaultFatal;
def note_imported_by_pch_module_not_found : Note<
"consider adding '%0' to the header search path">;
def err_imported_module_modmap_changed : Error<
- "module '%0' imported by AST file '%1' found in a different module map file"
+ "module '%0' %select{in|imported by}4 AST file '%1' found in a different module map file"
" (%2) than when the importing AST file was built (%3)">, DefaultFatal;
def err_imported_module_relocated : Error<
"module '%0' was built in directory '%1' but now resides in "
@@ -399,6 +402,8 @@ def warn_module_uses_date_time : Warning<
def err_module_no_size_mtime_for_header : Error<
"cannot emit module %0: %select{size|mtime}1 must be explicitly specified "
"for missing header file \"%2\"">;
+def err_module_unable_to_hash_content : Error<
+ "failed to hash content for '%0' because memory buffer cannot be retrieved">;
} // let CategoryName
} // let Component
diff --git a/include/clang/Basic/Features.def b/include/clang/Basic/Features.def
index 7081c02e83eac..28eb694ba9a89 100644
--- a/include/clang/Basic/Features.def
+++ b/include/clang/Basic/Features.def
@@ -39,6 +39,8 @@
FEATURE(address_sanitizer,
LangOpts.Sanitize.hasOneOf(SanitizerKind::Address |
SanitizerKind::KernelAddress))
+FEATURE(leak_sanitizer,
+ LangOpts.Sanitize.has(SanitizerKind::Leak))
FEATURE(hwaddress_sanitizer,
LangOpts.Sanitize.hasOneOf(SanitizerKind::HWAddress |
SanitizerKind::KernelHWAddress))
@@ -187,7 +189,7 @@ FEATURE(cxx_variable_templates, LangOpts.CPlusPlus14)
// FEATURE(raw_invocation_type, LangOpts.CPlusPlus)
// Type traits
// N.B. Additional type traits should not be added to the following list.
-// Instead, they should be detected by has_extension.
+// Instead, they should be detected by has_builtin.
FEATURE(has_nothrow_assign, LangOpts.CPlusPlus)
FEATURE(has_nothrow_copy, LangOpts.CPlusPlus)
FEATURE(has_nothrow_constructor, LangOpts.CPlusPlus)
diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h
index 96983475f454c..28cd058180871 100644
--- a/include/clang/Basic/FileManager.h
+++ b/include/clang/Basic/FileManager.h
@@ -45,12 +45,31 @@ class FileSystemStatCache;
class DirectoryEntry {
friend class FileManager;
+ // FIXME: We should not be storing a directory entry name here.
StringRef Name; // Name of the directory.
public:
StringRef getName() const { return Name; }
};
+/// A reference to a \c DirectoryEntry that includes the name of the directory
+/// as it was accessed by the FileManager's client.
+class DirectoryEntryRef {
+public:
+ const DirectoryEntry &getDirEntry() const { return *Entry->getValue(); }
+
+ StringRef getName() const { return Entry->getKey(); }
+
+private:
+ friend class FileManager;
+
+ DirectoryEntryRef(
+ llvm::StringMapEntry<llvm::ErrorOr<DirectoryEntry &>> *Entry)
+ : Entry(Entry) {}
+
+ const llvm::StringMapEntry<llvm::ErrorOr<DirectoryEntry &>> *Entry;
+};
+
/// Cached information about one file (either on disk
/// or in the virtual file system).
///
@@ -64,8 +83,8 @@ class FileEntry {
off_t Size; // File size in bytes.
time_t ModTime; // Modification time of file.
const DirectoryEntry *Dir; // Directory file lives in.
- unsigned UID; // A unique (small) ID for the file.
llvm::sys::fs::UniqueID UniqueID;
+ unsigned UID; // A unique (small) ID for the file.
bool IsNamedPipe;
bool IsValid; // Is this \c FileEntry initialized and valid?
@@ -106,6 +125,42 @@ public:
bool isOpenForTests() const { return File != nullptr; }
};
+/// A reference to a \c FileEntry that includes the name of the file as it was
+/// accessed by the FileManager's client.
+class FileEntryRef {
+public:
+ FileEntryRef() = delete;
+ FileEntryRef(StringRef Name, const FileEntry &Entry)
+ : Name(Name), Entry(&Entry) {}
+
+ const StringRef getName() const { return Name; }
+
+ bool isValid() const { return Entry->isValid(); }
+
+ const FileEntry &getFileEntry() const { return *Entry; }
+
+ off_t getSize() const { return Entry->getSize(); }
+
+ unsigned getUID() const { return Entry->getUID(); }
+
+ const llvm::sys::fs::UniqueID &getUniqueID() const {
+ return Entry->getUniqueID();
+ }
+
+ time_t getModificationTime() const { return Entry->getModificationTime(); }
+
+ friend bool operator==(const FileEntryRef &LHS, const FileEntryRef &RHS) {
+ return LHS.Entry == RHS.Entry && LHS.Name == RHS.Name;
+ }
+ friend bool operator!=(const FileEntryRef &LHS, const FileEntryRef &RHS) {
+ return !(LHS == RHS);
+ }
+
+private:
+ StringRef Name;
+ const FileEntry *Entry;
+};
+
/// Implements support for file system lookup, file system caching,
/// and directory search management.
///
@@ -131,21 +186,41 @@ class FileManager : public RefCountedBase<FileManager> {
/// The virtual files that we have allocated.
SmallVector<std::unique_ptr<FileEntry>, 4> VirtualFileEntries;
+ /// A set of files that bypass the maps and uniquing. They can have
+ /// conflicting filenames.
+ SmallVector<std::unique_ptr<FileEntry>, 0> BypassFileEntries;
+
/// A cache that maps paths to directory entries (either real or
- /// virtual) we have looked up
+ /// virtual) we have looked up, or an error that occurred when we looked up
+ /// the directory.
///
/// The actual Entries for real directories/files are
/// owned by UniqueRealDirs/UniqueRealFiles above, while the Entries
/// for virtual directories/files are owned by
/// VirtualDirectoryEntries/VirtualFileEntries above.
///
- llvm::StringMap<DirectoryEntry*, llvm::BumpPtrAllocator> SeenDirEntries;
+ llvm::StringMap<llvm::ErrorOr<DirectoryEntry &>, llvm::BumpPtrAllocator>
+ SeenDirEntries;
+
+ /// A reference to the file entry that is associated with a particular
+ /// filename, or a reference to another filename that should be looked up
+ /// instead of the accessed filename.
+ ///
+ /// The reference to another filename is specifically useful for Redirecting
+ /// VFSs that use external names. In that case, the \c FileEntryRef returned
+ /// by the \c FileManager will have the external name, and not the name that
+ /// was used to lookup the file.
+ using SeenFileEntryOrRedirect =
+ llvm::PointerUnion<FileEntry *, const StringRef *>;
/// A cache that maps paths to file entries (either real or
- /// virtual) we have looked up.
+ /// virtual) we have looked up, or an error that occurred when we looked up
+ /// the file.
///
/// \see SeenDirEntries
- llvm::StringMap<FileEntry*, llvm::BumpPtrAllocator> SeenFileEntries;
+ llvm::StringMap<llvm::ErrorOr<SeenFileEntryOrRedirect>,
+ llvm::BumpPtrAllocator>
+ SeenFileEntries;
/// The canonical names of directories.
llvm::DenseMap<const DirectoryEntry *, llvm::StringRef> CanonicalDirNames;
@@ -157,15 +232,12 @@ class FileManager : public RefCountedBase<FileManager> {
///
unsigned NextFileUID;
- // Statistics.
- unsigned NumDirLookups, NumFileLookups;
- unsigned NumDirCacheMisses, NumFileCacheMisses;
-
// Caching.
std::unique_ptr<FileSystemStatCache> StatCache;
- bool getStatValue(StringRef Path, llvm::vfs::Status &Status, bool isFile,
- std::unique_ptr<llvm::vfs::File> *F);
+ std::error_code getStatValue(StringRef Path, llvm::vfs::Status &Status,
+ bool isFile,
+ std::unique_ptr<llvm::vfs::File> *F);
/// Add all ancestors of the given path (pointing to either a file
/// or a directory) as virtual directories.
@@ -195,27 +267,86 @@ public:
/// Removes the FileSystemStatCache object from the manager.
void clearStatCache();
+ /// Returns the number of unique real file entries cached by the file manager.
+ size_t getNumUniqueRealFiles() const { return UniqueRealFiles.size(); }
+
/// Lookup, cache, and verify the specified directory (real or
/// virtual).
///
- /// This returns NULL if the directory doesn't exist.
+ /// This returns a \c std::error_code if there was an error reading the
+ /// directory. On success, returns the reference to the directory entry
+ /// together with the exact path that was used to access a file by a
+ /// particular call to getDirectoryRef.
///
/// \param CacheFailure If true and the file does not exist, we'll cache
/// the failure to find this file.
- const DirectoryEntry *getDirectory(StringRef DirName,
- bool CacheFailure = true);
+ llvm::Expected<DirectoryEntryRef> getDirectoryRef(StringRef DirName,
+ bool CacheFailure = true);
+
+ /// Get a \c DirectoryEntryRef if it exists, without doing anything on error.
+ llvm::Optional<DirectoryEntryRef>
+ getOptionalDirectoryRef(StringRef DirName, bool CacheFailure = true) {
+ return llvm::expectedToOptional(getDirectoryRef(DirName, CacheFailure));
+ }
+
+ /// Lookup, cache, and verify the specified directory (real or
+ /// virtual).
+ ///
+ /// This function is deprecated and will be removed at some point in the
+ /// future, new clients should use
+ /// \c getDirectoryRef.
+ ///
+ /// This returns a \c std::error_code if there was an error reading the
+ /// directory. If there is no error, the DirectoryEntry is guaranteed to be
+ /// non-NULL.
+ ///
+ /// \param CacheFailure If true and the file does not exist, we'll cache
+ /// the failure to find this file.
+ llvm::ErrorOr<const DirectoryEntry *>
+ getDirectory(StringRef DirName, bool CacheFailure = true);
/// Lookup, cache, and verify the specified file (real or
/// virtual).
///
- /// This returns NULL if the file doesn't exist.
+ /// This function is deprecated and will be removed at some point in the
+ /// future, new clients should use
+ /// \c getFileRef.
+ ///
+ /// This returns a \c std::error_code if there was an error loading the file.
+ /// If there is no error, the FileEntry is guaranteed to be non-NULL.
///
/// \param OpenFile if true and the file exists, it will be opened.
///
/// \param CacheFailure If true and the file does not exist, we'll cache
/// the failure to find this file.
- const FileEntry *getFile(StringRef Filename, bool OpenFile = false,
- bool CacheFailure = true);
+ llvm::ErrorOr<const FileEntry *>
+ getFile(StringRef Filename, bool OpenFile = false, bool CacheFailure = true);
+
+ /// Lookup, cache, and verify the specified file (real or virtual). Return the
+ /// reference to the file entry together with the exact path that was used to
+ /// access a file by a particular call to getFileRef. If the underlying VFS is
+ /// a redirecting VFS that uses external file names, the returned FileEntryRef
+ /// will use the external name instead of the filename that was passed to this
+ /// method.
+ ///
+ /// This returns a \c std::error_code if there was an error loading the file,
+ /// or a \c FileEntryRef otherwise.
+ ///
+ /// \param OpenFile if true and the file exists, it will be opened.
+ ///
+ /// \param CacheFailure If true and the file does not exist, we'll cache
+ /// the failure to find this file.
+ llvm::Expected<FileEntryRef> getFileRef(StringRef Filename,
+ bool OpenFile = false,
+ bool CacheFailure = true);
+
+ /// Get a FileEntryRef if it exists, without doing anything on error.
+ llvm::Optional<FileEntryRef> getOptionalFileRef(StringRef Filename,
+ bool OpenFile = false,
+ bool CacheFailure = true) {
+ return llvm::expectedToOptional(
+ getFileRef(Filename, OpenFile, CacheFailure));
+ }
/// Returns the current file system options
FileSystemOptions &getFileSystemOpts() { return FileSystemOpts; }
@@ -223,6 +354,10 @@ public:
llvm::vfs::FileSystem &getVirtualFileSystem() const { return *FS; }
+ void setVirtualFileSystem(IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) {
+ this->FS = std::move(FS);
+ }
+
/// Retrieve a file entry for a "virtual" file that acts as
/// if there were a file with the given name on disk.
///
@@ -230,24 +365,38 @@ public:
const FileEntry *getVirtualFile(StringRef Filename, off_t Size,
time_t ModificationTime);
+ /// Retrieve a FileEntry that bypasses VFE, which is expected to be a virtual
+ /// file entry, to access the real file. The returned FileEntry will have
+ /// the same filename as FE but a different identity and its own stat.
+ ///
+ /// This should be used only for rare error recovery paths because it
+ /// bypasses all mapping and uniquing, blindly creating a new FileEntry.
+ /// There is no attempt to deduplicate these; if you bypass the same file
+ /// twice, you get two new file entries.
+ llvm::Optional<FileEntryRef> getBypassFile(FileEntryRef VFE);
+
/// Open the specified file as a MemoryBuffer, returning a new
/// MemoryBuffer if successful, otherwise returning null.
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
- getBufferForFile(const FileEntry *Entry, bool isVolatile = false,
- bool ShouldCloseOpenFile = true);
+ getBufferForFile(const FileEntry *Entry, bool isVolatile = false);
+ llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
+ getBufferForFile(StringRef Filename, bool isVolatile = false) {
+ return getBufferForFileImpl(Filename, /*FileSize=*/-1, isVolatile);
+ }
+
+private:
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
- getBufferForFile(StringRef Filename, bool isVolatile = false);
+ getBufferForFileImpl(StringRef Filename, int64_t FileSize, bool isVolatile);
+public:
/// Get the 'stat' information for the given \p Path.
///
/// If the path is relative, it will be resolved against the WorkingDir of the
/// FileManager's FileSystemOptions.
///
- /// \returns false on success, true on error.
- bool getNoncachedStatValue(StringRef Path, llvm::vfs::Status &Result);
-
- /// Remove the real file \p Entry from the cache.
- void invalidateCache(const FileEntry *Entry);
+ /// \returns a \c std::error_code describing an error, if there was one
+ std::error_code getNoncachedStatValue(StringRef Path,
+ llvm::vfs::Status &Result);
/// If path is not absolute and FileSystemOptions set the working
/// directory, the path is modified to be relative to the given
@@ -265,11 +414,6 @@ public:
void GetUniqueIDMapping(
SmallVectorImpl<const FileEntry *> &UIDToFiles) const;
- /// Modifies the size and modification time of a previously created
- /// FileEntry. Use with caution.
- static void modifyFileEntry(FileEntry *File, off_t Size,
- time_t ModificationTime);
-
/// Retrieve the canonical name for a given directory.
///
/// This is a very expensive operation, despite its results being cached,
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h
index 465486ede7151..37d7198c64017 100644
--- a/include/clang/Basic/IdentifierTable.h
+++ b/include/clang/Basic/IdentifierTable.h
@@ -750,6 +750,12 @@ public:
return getIdentifierInfoFlag() == ZeroArg;
}
+ /// If this selector is the specific keyword selector described by Names.
+ bool isKeywordSelector(ArrayRef<StringRef> Names) const;
+
+ /// If this selector is the specific unary selector described by Name.
+ bool isUnarySelector(StringRef Name) const;
+
unsigned getNumArgs() const;
/// Retrieve the identifier at a given position in the selector.
diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def
index 31aca2b0d6950..a423654d5e038 100644
--- a/include/clang/Basic/LangOptions.def
+++ b/include/clang/Basic/LangOptions.def
@@ -111,6 +111,7 @@ BENIGN_LANGOPT(DollarIdents , 1, 1, "'$' in identifiers")
BENIGN_LANGOPT(AsmPreprocessor, 1, 0, "preprocessor in asm mode")
LANGOPT(GNUMode , 1, 1, "GNU extensions")
LANGOPT(GNUKeywords , 1, 1, "GNU keywords")
+VALUE_LANGOPT(GNUCVersion , 32, 0, "GNU C compatibility version")
BENIGN_LANGOPT(ImplicitInt, 1, !C99 && !CPlusPlus, "C89 implicit 'int'")
LANGOPT(Digraphs , 1, 0, "digraphs")
BENIGN_LANGOPT(HexFloats , 1, C99, "C99 hexadecimal float constants")
@@ -119,7 +120,8 @@ LANGOPT(AppleKext , 1, 0, "Apple kext support")
BENIGN_LANGOPT(PascalStrings, 1, 0, "Pascal string support")
LANGOPT(WritableStrings , 1, 0, "writable string support")
LANGOPT(ConstStrings , 1, 0, "const-qualified string support")
-LANGOPT(LaxVectorConversions , 1, 1, "lax vector conversions")
+ENUM_LANGOPT(LaxVectorConversions, LaxVectorConversionKind, 2,
+ LaxVectorConversionKind::All, "lax vector conversions")
LANGOPT(AltiVec , 1, 0, "AltiVec-style vector initializers")
LANGOPT(ZVector , 1, 0, "System z vector extensions")
LANGOPT(Exceptions , 1, 0, "exception handling")
@@ -128,6 +130,7 @@ LANGOPT(CXXExceptions , 1, 0, "C++ exceptions")
LANGOPT(DWARFExceptions , 1, 0, "dwarf exception handling")
LANGOPT(SjLjExceptions , 1, 0, "setjmp-longjump exception handling")
LANGOPT(SEHExceptions , 1, 0, "SEH .xdata exception handling")
+LANGOPT(WasmExceptions , 1, 0, "WebAssembly exception handling")
LANGOPT(ExternCNoUnwind , 1, 0, "Assume extern C functions don't unwind")
LANGOPT(TraditionalCPP , 1, 0, "traditional CPP emulation")
LANGOPT(RTTI , 1, 1, "run-time type information")
@@ -224,6 +227,8 @@ LANGOPT(GPURelocatableDeviceCode, 1, 0, "generate relocatable device code")
LANGOPT(SYCLIsDevice , 1, 0, "Generate code for SYCL device")
+LANGOPT(HIPUseNewLaunchAPI, 1, 0, "Use new kernel launching API for HIP")
+
LANGOPT(SizedDeallocation , 1, 0, "sized deallocation")
LANGOPT(AlignedAllocation , 1, 0, "aligned allocation")
LANGOPT(AlignedAllocationUnavailable, 1, 0, "aligned allocation functions are unavailable")
@@ -288,6 +293,10 @@ BENIGN_LANGOPT(ConstexprCallDepth, 32, 512,
"maximum constexpr call depth")
BENIGN_LANGOPT(ConstexprStepLimit, 32, 1048576,
"maximum constexpr evaluation steps")
+BENIGN_LANGOPT(EnableNewConstInterp, 1, 0,
+ "enable the experimental new constant interpreter")
+BENIGN_LANGOPT(ForceNewConstInterp, 1, 0,
+ "force the use of the experimental new constant interpreter")
BENIGN_LANGOPT(BracketDepth, 32, 256,
"maximum bracket nesting depth")
BENIGN_LANGOPT(NumLargeByValueCopy, 32, 0,
diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h
index 8099eed28c5e0..5f808f04e9ae7 100644
--- a/include/clang/Basic/LangOptions.h
+++ b/include/clang/Basic/LangOptions.h
@@ -138,6 +138,12 @@ public:
/// rather than returning the required alignment.
Ver7,
+ /// Attempt to be ABI-compatible with code generated by Clang 9.0.x
+ /// (SVN r351319). This causes vectors of __int128 to be passed in memory
+ /// instead of passing in multiple scalar registers on x86_64 on Linux and
+ /// NetBSD.
+ Ver9,
+
/// Conform to the underlying platform's C and C++ ABIs as closely
/// as we can.
Latest
@@ -178,6 +184,16 @@ public:
FEA_On
};
+ enum class LaxVectorConversionKind {
+ /// Permit no implicit vector bitcasts.
+ None,
+ /// Permit vector bitcasts between integer vectors with different numbers
+ /// of elements but the same total bit-width.
+ Integer,
+ /// Permit vector bitcasts between all vectors with the same total
+ /// bit-width.
+ All,
+ };
public:
/// Set of enabled sanitizers.
diff --git a/include/clang/Basic/LangStandard.h b/include/clang/Basic/LangStandard.h
new file mode 100644
index 0000000000000..e7deb7d64638c
--- /dev/null
+++ b/include/clang/Basic/LangStandard.h
@@ -0,0 +1,136 @@
+//===--- LangStandard.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_BASIC_LANGSTANDARD_H
+#define LLVM_CLANG_BASIC_LANGSTANDARD_H
+
+#include "clang/Basic/LLVM.h"
+#include "llvm/ADT/StringRef.h"
+
+namespace clang {
+
+/// The language for the input, used to select and validate the language
+/// standard and possible actions.
+enum class Language : uint8_t {
+ Unknown,
+
+ /// Assembly: we accept this only so that we can preprocess it.
+ Asm,
+
+ /// LLVM IR: we accept this so that we can run the optimizer on it,
+ /// and compile it to assembly or object code.
+ LLVM_IR,
+
+ ///@{ Languages that the frontend can parse and compile.
+ C,
+ CXX,
+ ObjC,
+ ObjCXX,
+ OpenCL,
+ CUDA,
+ RenderScript,
+ HIP,
+ ///@}
+};
+
+enum LangFeatures {
+ LineComment = (1 << 0),
+ C99 = (1 << 1),
+ C11 = (1 << 2),
+ C17 = (1 << 3),
+ C2x = (1 << 4),
+ CPlusPlus = (1 << 5),
+ CPlusPlus11 = (1 << 6),
+ CPlusPlus14 = (1 << 7),
+ CPlusPlus17 = (1 << 8),
+ CPlusPlus2a = (1 << 9),
+ Digraphs = (1 << 10),
+ GNUMode = (1 << 11),
+ HexFloat = (1 << 12),
+ ImplicitInt = (1 << 13),
+ OpenCL = (1 << 14)
+};
+
+/// LangStandard - Information about the properties of a particular language
+/// standard.
+struct LangStandard {
+ enum Kind {
+#define LANGSTANDARD(id, name, lang, desc, features) \
+ lang_##id,
+#include "clang/Basic/LangStandards.def"
+ lang_unspecified
+ };
+
+ const char *ShortName;
+ const char *Description;
+ unsigned Flags;
+ clang::Language Language;
+
+public:
+ /// getName - Get the name of this standard.
+ const char *getName() const { return ShortName; }
+
+ /// getDescription - Get the description of this standard.
+ const char *getDescription() const { return Description; }
+
+ /// Get the language that this standard describes.
+ clang::Language getLanguage() const { return Language; }
+
+ /// Language supports '//' comments.
+ bool hasLineComments() const { return Flags & LineComment; }
+
+ /// isC99 - Language is a superset of C99.
+ bool isC99() const { return Flags & C99; }
+
+ /// isC11 - Language is a superset of C11.
+ bool isC11() const { return Flags & C11; }
+
+ /// isC17 - Language is a superset of C17.
+ bool isC17() const { return Flags & C17; }
+
+ /// isC2x - Language is a superset of C2x.
+ bool isC2x() const { return Flags & C2x; }
+
+ /// isCPlusPlus - Language is a C++ variant.
+ bool isCPlusPlus() const { return Flags & CPlusPlus; }
+
+ /// isCPlusPlus11 - Language is a C++11 variant (or later).
+ bool isCPlusPlus11() const { return Flags & CPlusPlus11; }
+
+ /// isCPlusPlus14 - Language is a C++14 variant (or later).
+ bool isCPlusPlus14() const { return Flags & CPlusPlus14; }
+
+ /// isCPlusPlus17 - Language is a C++17 variant (or later).
+ bool isCPlusPlus17() const { return Flags & CPlusPlus17; }
+
+ /// isCPlusPlus2a - Language is a post-C++17 variant (or later).
+ bool isCPlusPlus2a() const { return Flags & CPlusPlus2a; }
+
+ /// hasDigraphs - Language supports digraphs.
+ bool hasDigraphs() const { return Flags & Digraphs; }
+
+ /// isGNUMode - Language includes GNU extensions.
+ bool isGNUMode() const { return Flags & GNUMode; }
+
+ /// hasHexFloats - Language supports hexadecimal float constants.
+ bool hasHexFloats() const { return Flags & HexFloat; }
+
+ /// hasImplicitInt - Language allows variables to be typed as int implicitly.
+ bool hasImplicitInt() const { return Flags & ImplicitInt; }
+
+ /// isOpenCL - Language is a OpenCL variant.
+ bool isOpenCL() const { return Flags & OpenCL; }
+
+ static Kind getLangKind(StringRef Name);
+ static const LangStandard &getLangStandardForKind(Kind K);
+ static const LangStandard *getLangStandardForName(StringRef Name);
+};
+
+} // end namespace clang
+
+#endif
diff --git a/include/clang/Basic/LangStandards.def b/include/clang/Basic/LangStandards.def
new file mode 100644
index 0000000000000..427691fb71e94
--- /dev/null
+++ b/include/clang/Basic/LangStandards.def
@@ -0,0 +1,189 @@
+//===-- LangStandards.def - Language Standard Data --------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LANGSTANDARD
+#error "LANGSTANDARD must be defined before including this file"
+#endif
+
+/// LANGSTANDARD(IDENT, NAME, LANG, DESC, FEATURES)
+///
+/// \param IDENT - The name of the standard as a C++ identifier.
+/// \param NAME - The name of the standard.
+/// \param LANG - The Language for which this is a standard.
+/// \param DESC - A short description of the standard.
+/// \param FEATURES - The standard features as flags, these are enums from the
+/// clang::frontend namespace, which is assumed to be be available.
+
+/// LANGSTANDARD_ALIAS(IDENT, ALIAS)
+/// \param IDENT - The name of the standard as a C++ identifier.
+/// \param ALIAS - The alias of the standard.
+
+/// LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS)
+/// Same as LANGSTANDARD_ALIAS, but for a deprecated alias.
+
+#ifndef LANGSTANDARD_ALIAS
+#define LANGSTANDARD_ALIAS(IDENT, ALIAS)
+#endif
+
+#ifndef LANGSTANDARD_ALIAS_DEPR
+#define LANGSTANDARD_ALIAS_DEPR(IDENT, ALIAS) LANGSTANDARD_ALIAS(IDENT, ALIAS)
+#endif
+
+// C89-ish modes.
+LANGSTANDARD(c89, "c89",
+ C, "ISO C 1990",
+ ImplicitInt)
+LANGSTANDARD_ALIAS(c89, "c90")
+LANGSTANDARD_ALIAS(c89, "iso9899:1990")
+
+LANGSTANDARD(c94, "iso9899:199409",
+ C, "ISO C 1990 with amendment 1",
+ Digraphs | ImplicitInt)
+
+LANGSTANDARD(gnu89, "gnu89",
+ C, "ISO C 1990 with GNU extensions",
+ LineComment | Digraphs | GNUMode | ImplicitInt)
+LANGSTANDARD_ALIAS(gnu89, "gnu90")
+
+// C99-ish modes
+LANGSTANDARD(c99, "c99",
+ C, "ISO C 1999",
+ LineComment | C99 | Digraphs | HexFloat)
+LANGSTANDARD_ALIAS(c99, "iso9899:1999")
+LANGSTANDARD_ALIAS_DEPR(c99, "c9x")
+LANGSTANDARD_ALIAS_DEPR(c99, "iso9899:199x")
+
+LANGSTANDARD(gnu99, "gnu99",
+ C, "ISO C 1999 with GNU extensions",
+ LineComment | C99 | Digraphs | GNUMode | HexFloat)
+LANGSTANDARD_ALIAS_DEPR(gnu99, "gnu9x")
+
+// C11 modes
+LANGSTANDARD(c11, "c11",
+ C, "ISO C 2011",
+ LineComment | C99 | C11 | Digraphs | HexFloat)
+LANGSTANDARD_ALIAS(c11, "iso9899:2011")
+LANGSTANDARD_ALIAS_DEPR(c11, "c1x")
+LANGSTANDARD_ALIAS_DEPR(c11, "iso9899:201x")
+
+LANGSTANDARD(gnu11, "gnu11",
+ C, "ISO C 2011 with GNU extensions",
+ LineComment | C99 | C11 | Digraphs | GNUMode | HexFloat)
+LANGSTANDARD_ALIAS_DEPR(gnu11, "gnu1x")
+
+// C17 modes
+LANGSTANDARD(c17, "c17",
+ C, "ISO C 2017",
+ LineComment | C99 | C11 | C17 | Digraphs | HexFloat)
+LANGSTANDARD_ALIAS(c17, "iso9899:2017")
+LANGSTANDARD_ALIAS(c17, "c18")
+LANGSTANDARD_ALIAS(c17, "iso9899:2018")
+LANGSTANDARD(gnu17, "gnu17",
+ C, "ISO C 2017 with GNU extensions",
+ LineComment | C99 | C11 | C17 | Digraphs | GNUMode | HexFloat)
+LANGSTANDARD_ALIAS(gnu17, "gnu18")
+
+// C2x modes
+LANGSTANDARD(c2x, "c2x",
+ C, "Working Draft for ISO C2x",
+ LineComment | C99 | C11 | C17 | C2x | Digraphs | HexFloat)
+LANGSTANDARD(gnu2x, "gnu2x",
+ C, "Working Draft for ISO C2x with GNU extensions",
+ LineComment | C99 | C11 | C17 | C2x | Digraphs | GNUMode | HexFloat)
+
+// C++ modes
+LANGSTANDARD(cxx98, "c++98",
+ CXX, "ISO C++ 1998 with amendments",
+ LineComment | CPlusPlus | Digraphs)
+LANGSTANDARD_ALIAS(cxx98, "c++03")
+
+LANGSTANDARD(gnucxx98, "gnu++98",
+ CXX, "ISO C++ 1998 with amendments and GNU extensions",
+ LineComment | CPlusPlus | Digraphs | GNUMode)
+LANGSTANDARD_ALIAS(gnucxx98, "gnu++03")
+
+LANGSTANDARD(cxx11, "c++11",
+ CXX, "ISO C++ 2011 with amendments",
+ LineComment | CPlusPlus | CPlusPlus11 | Digraphs)
+LANGSTANDARD_ALIAS_DEPR(cxx11, "c++0x")
+
+LANGSTANDARD(gnucxx11, "gnu++11", CXX,
+ "ISO C++ 2011 with amendments and GNU extensions",
+ LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode)
+LANGSTANDARD_ALIAS_DEPR(gnucxx11, "gnu++0x")
+
+LANGSTANDARD(cxx14, "c++14",
+ CXX, "ISO C++ 2014 with amendments",
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs)
+LANGSTANDARD_ALIAS_DEPR(cxx14, "c++1y")
+
+LANGSTANDARD(gnucxx14, "gnu++14",
+ CXX, "ISO C++ 2014 with amendments and GNU extensions",
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs |
+ GNUMode)
+LANGSTANDARD_ALIAS_DEPR(gnucxx14, "gnu++1y")
+
+LANGSTANDARD(cxx17, "c++17",
+ CXX, "ISO C++ 2017 with amendments",
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
+ Digraphs | HexFloat)
+LANGSTANDARD_ALIAS_DEPR(cxx17, "c++1z")
+
+LANGSTANDARD(gnucxx17, "gnu++17",
+ CXX, "ISO C++ 2017 with amendments and GNU extensions",
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
+ Digraphs | HexFloat | GNUMode)
+LANGSTANDARD_ALIAS_DEPR(gnucxx17, "gnu++1z")
+
+LANGSTANDARD(cxx2a, "c++2a",
+ CXX, "Working draft for ISO C++ 2020",
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
+ CPlusPlus2a | Digraphs | HexFloat)
+
+LANGSTANDARD(gnucxx2a, "gnu++2a",
+ CXX, "Working draft for ISO C++ 2020 with GNU extensions",
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
+ CPlusPlus2a | Digraphs | HexFloat | GNUMode)
+
+// OpenCL
+LANGSTANDARD(opencl10, "cl1.0",
+ OpenCL, "OpenCL 1.0",
+ LineComment | C99 | Digraphs | HexFloat | OpenCL)
+LANGSTANDARD_ALIAS_DEPR(opencl10, "cl")
+
+LANGSTANDARD(opencl11, "cl1.1",
+ OpenCL, "OpenCL 1.1",
+ LineComment | C99 | Digraphs | HexFloat | OpenCL)
+LANGSTANDARD(opencl12, "cl1.2",
+ OpenCL, "OpenCL 1.2",
+ LineComment | C99 | Digraphs | HexFloat | OpenCL)
+LANGSTANDARD(opencl20, "cl2.0",
+ OpenCL, "OpenCL 2.0",
+ LineComment | C99 | Digraphs | HexFloat | OpenCL)
+LANGSTANDARD(openclcpp, "clc++",
+ OpenCL, "C++ for OpenCL",
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
+ Digraphs | HexFloat | OpenCL)
+
+LANGSTANDARD_ALIAS_DEPR(opencl10, "CL")
+LANGSTANDARD_ALIAS_DEPR(opencl11, "CL1.1")
+LANGSTANDARD_ALIAS_DEPR(opencl12, "CL1.2")
+LANGSTANDARD_ALIAS_DEPR(opencl20, "CL2.0")
+LANGSTANDARD_ALIAS_DEPR(openclcpp, "CLC++")
+
+// CUDA
+LANGSTANDARD(cuda, "cuda", CUDA, "NVIDIA CUDA(tm)",
+ LineComment | CPlusPlus | Digraphs)
+
+// HIP
+LANGSTANDARD(hip, "hip", HIP, "HIP",
+ LineComment | CPlusPlus | Digraphs)
+
+#undef LANGSTANDARD
+#undef LANGSTANDARD_ALIAS
+#undef LANGSTANDARD_ALIAS_DEPR
diff --git a/include/clang/Basic/Linkage.h b/include/clang/Basic/Linkage.h
index 696f85b185356..f4d442c084cfe 100644
--- a/include/clang/Basic/Linkage.h
+++ b/include/clang/Basic/Linkage.h
@@ -82,6 +82,12 @@ inline bool isDiscardableGVALinkage(GVALinkage L) {
return L <= GVA_DiscardableODR;
}
+/// Do we know that this will be the only definition of this symbol (excluding
+/// inlining-only definitions)?
+inline bool isUniqueGVALinkage(GVALinkage L) {
+ return L == GVA_Internal || L == GVA_StrongExternal;
+}
+
inline bool isExternallyVisible(Linkage L) {
return L >= VisibleNoLinkage;
}
diff --git a/include/clang/Basic/OpenCLOptions.h b/include/clang/Basic/OpenCLOptions.h
index 47310da1d6d95..15661154eab54 100644
--- a/include/clang/Basic/OpenCLOptions.h
+++ b/include/clang/Basic/OpenCLOptions.h
@@ -42,7 +42,7 @@ public:
// Is supported as either an extension or an (optional) core feature for
// OpenCL version \p CLVer.
- bool isSupported(llvm::StringRef Ext, LangOptions LO) const {
+ bool isSupported(llvm::StringRef Ext, const LangOptions &LO) const {
// In C++ mode all extensions should work at least as in v2.0.
auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
auto I = OptMap.find(Ext)->getValue();
@@ -51,7 +51,7 @@ public:
// Is supported (optional) OpenCL core features for OpenCL version \p CLVer.
// For supported extension, return false.
- bool isSupportedCore(llvm::StringRef Ext, LangOptions LO) const {
+ bool isSupportedCore(llvm::StringRef Ext, const LangOptions &LO) const {
// In C++ mode all extensions should work at least as in v2.0.
auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
auto I = OptMap.find(Ext)->getValue();
@@ -60,7 +60,7 @@ public:
// Is supported OpenCL extension for OpenCL version \p CLVer.
// For supported (optional) core feature, return false.
- bool isSupportedExtension(llvm::StringRef Ext, LangOptions LO) const {
+ bool isSupportedExtension(llvm::StringRef Ext, const LangOptions &LO) const {
// In C++ mode all extensions should work at least as in v2.0.
auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
auto I = OptMap.find(Ext)->getValue();
diff --git a/include/clang/Basic/OpenMPKinds.def b/include/clang/Basic/OpenMPKinds.def
index 9685af4cade8b..ff8f07aa5def4 100644
--- a/include/clang/Basic/OpenMPKinds.def
+++ b/include/clang/Basic/OpenMPKinds.def
@@ -92,6 +92,15 @@
#ifndef OPENMP_TASKLOOP_SIMD_CLAUSE
# define OPENMP_TASKLOOP_SIMD_CLAUSE(Name)
#endif
+#ifndef OPENMP_MASTER_TASKLOOP_CLAUSE
+# define OPENMP_MASTER_TASKLOOP_CLAUSE(Name)
+#endif
+#ifndef OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE
+# define OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(Name)
+#endif
+#ifndef OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE
+# define OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(Name)
+#endif
#ifndef OPENMP_CRITICAL_CLAUSE
# define OPENMP_CRITICAL_CLAUSE(Name)
#endif
@@ -191,6 +200,15 @@
#ifndef OPENMP_ALLOCATE_CLAUSE
# define OPENMP_ALLOCATE_CLAUSE(Name)
#endif
+#ifndef OPENMP_DEVICE_TYPE_KIND
+#define OPENMP_DEVICE_TYPE_KIND(Name)
+#endif
+#ifndef OPENMP_DECLARE_VARIANT_CLAUSE
+#define OPENMP_DECLARE_VARIANT_CLAUSE(Name)
+#endif
+#ifndef OPENMP_MATCH_KIND
+#define OPENMP_MATCH_KIND(Name)
+#endif
// OpenMP directives.
OPENMP_DIRECTIVE(threadprivate)
@@ -248,6 +266,10 @@ OPENMP_DIRECTIVE_EXT(target_teams_distribute_parallel_for, "target teams distrib
OPENMP_DIRECTIVE_EXT(target_teams_distribute_parallel_for_simd, "target teams distribute parallel for simd")
OPENMP_DIRECTIVE_EXT(target_teams_distribute_simd, "target teams distribute simd")
OPENMP_DIRECTIVE(allocate)
+OPENMP_DIRECTIVE_EXT(declare_variant, "declare variant")
+OPENMP_DIRECTIVE_EXT(master_taskloop, "master taskloop")
+OPENMP_DIRECTIVE_EXT(parallel_master_taskloop, "parallel master taskloop")
+OPENMP_DIRECTIVE_EXT(master_taskloop_simd, "master taskloop simd")
// OpenMP clauses.
OPENMP_CLAUSE(allocator, OMPAllocatorClause)
@@ -656,6 +678,69 @@ OPENMP_TASKLOOP_SIMD_CLAUSE(reduction)
OPENMP_TASKLOOP_SIMD_CLAUSE(in_reduction)
OPENMP_TASKLOOP_SIMD_CLAUSE(allocate)
+// Clauses allowed for OpenMP directive 'master taskloop'.
+OPENMP_MASTER_TASKLOOP_CLAUSE(if)
+OPENMP_MASTER_TASKLOOP_CLAUSE(shared)
+OPENMP_MASTER_TASKLOOP_CLAUSE(private)
+OPENMP_MASTER_TASKLOOP_CLAUSE(firstprivate)
+OPENMP_MASTER_TASKLOOP_CLAUSE(lastprivate)
+OPENMP_MASTER_TASKLOOP_CLAUSE(default)
+OPENMP_MASTER_TASKLOOP_CLAUSE(collapse)
+OPENMP_MASTER_TASKLOOP_CLAUSE(final)
+OPENMP_MASTER_TASKLOOP_CLAUSE(untied)
+OPENMP_MASTER_TASKLOOP_CLAUSE(mergeable)
+OPENMP_MASTER_TASKLOOP_CLAUSE(priority)
+OPENMP_MASTER_TASKLOOP_CLAUSE(grainsize)
+OPENMP_MASTER_TASKLOOP_CLAUSE(nogroup)
+OPENMP_MASTER_TASKLOOP_CLAUSE(num_tasks)
+OPENMP_MASTER_TASKLOOP_CLAUSE(reduction)
+OPENMP_MASTER_TASKLOOP_CLAUSE(in_reduction)
+OPENMP_MASTER_TASKLOOP_CLAUSE(allocate)
+
+// Clauses allowed for OpenMP directive 'master taskloop simd'.
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(if)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(shared)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(private)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(firstprivate)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(lastprivate)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(default)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(collapse)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(final)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(untied)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(mergeable)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(priority)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(linear)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(aligned)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(safelen)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(simdlen)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(grainsize)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(nogroup)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(num_tasks)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(reduction)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(in_reduction)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(allocate)
+
+// Clauses allowed for OpenMP directive 'parallel master taskloop'.
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(if)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(shared)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(private)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(firstprivate)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(lastprivate)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(default)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(collapse)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(final)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(untied)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(mergeable)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(priority)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(grainsize)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(nogroup)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(num_tasks)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(reduction)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(allocate)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(num_threads)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(proc_bind)
+OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(copyin)
+
// Clauses allowed for OpenMP directive 'critical'.
OPENMP_CRITICAL_CLAUSE(hint)
@@ -950,9 +1035,27 @@ OPENMP_TASKGROUP_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'declare mapper'.
OPENMP_DECLARE_MAPPER_CLAUSE(map)
+// Device types for 'device_type' clause.
+OPENMP_DEVICE_TYPE_KIND(host)
+OPENMP_DEVICE_TYPE_KIND(nohost)
+OPENMP_DEVICE_TYPE_KIND(any)
+
+// Clauses allowed for OpenMP directive 'declare variant'.
+OPENMP_DECLARE_VARIANT_CLAUSE(match)
+
+// Context selectors for 'match' clause.
+// TODO: add other context selectors.
+OPENMP_MATCH_KIND(implementation)
+
+#undef OPENMP_MATCH_KIND
+#undef OPENMP_DECLARE_VARIANT_CLAUSE
+#undef OPENMP_DEVICE_TYPE_KIND
#undef OPENMP_ALLOCATE_CLAUSE
#undef OPENMP_DECLARE_MAPPER_CLAUSE
#undef OPENMP_TASKGROUP_CLAUSE
+#undef OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE
+#undef OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE
+#undef OPENMP_MASTER_TASKLOOP_CLAUSE
#undef OPENMP_TASKLOOP_SIMD_CLAUSE
#undef OPENMP_TASKLOOP_CLAUSE
#undef OPENMP_LINEAR_KIND
diff --git a/include/clang/Basic/OpenMPKinds.h b/include/clang/Basic/OpenMPKinds.h
index d8dee2310ec21..4129cca0fe682 100644
--- a/include/clang/Basic/OpenMPKinds.h
+++ b/include/clang/Basic/OpenMPKinds.h
@@ -35,6 +35,8 @@ enum OpenMPClauseKind {
#include "clang/Basic/OpenMPKinds.def"
OMPC_threadprivate,
OMPC_uniform,
+ OMPC_device_type,
+ OMPC_match,
OMPC_unknown
};
@@ -152,6 +154,14 @@ enum OpenMPAtomicDefaultMemOrderClauseKind {
OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown
};
+/// OpenMP device type for 'device_type' clause.
+enum OpenMPDeviceType {
+#define OPENMP_DEVICE_TYPE_KIND(Name) \
+ OMPC_DEVICE_TYPE_##Name,
+#include "clang/Basic/OpenMPKinds.def"
+ OMPC_DEVICE_TYPE_unknown
+};
+
/// Scheduling data for loop-based OpenMP directives.
struct OpenMPScheduleTy final {
OpenMPScheduleClauseKind Schedule = OMPC_SCHEDULE_unknown;
@@ -259,7 +269,8 @@ bool isOpenMPPrivate(OpenMPClauseKind Kind);
bool isOpenMPThreadPrivate(OpenMPClauseKind Kind);
/// Checks if the specified directive kind is one of tasking directives - task,
-/// taskloop or taksloop simd.
+/// taskloop, taksloop simd, master taskloop, parallel master taskloop or master
+/// taskloop simd.
bool isOpenMPTaskingDirective(OpenMPDirectiveKind Kind);
/// Checks if the specified directive kind is one of the composite or combined
diff --git a/include/clang/Basic/OperatorKinds.h b/include/clang/Basic/OperatorKinds.h
index 9757acaa53009..d661891445115 100644
--- a/include/clang/Basic/OperatorKinds.h
+++ b/include/clang/Basic/OperatorKinds.h
@@ -30,6 +30,25 @@ enum OverloadedOperatorKind : int {
/// the preceding "operator" keyword.
const char *getOperatorSpelling(OverloadedOperatorKind Operator);
+/// Get the other overloaded operator that the given operator can be rewritten
+/// into, if any such operator exists.
+inline OverloadedOperatorKind
+getRewrittenOverloadedOperator(OverloadedOperatorKind Kind) {
+ switch (Kind) {
+ case OO_Less:
+ case OO_LessEqual:
+ case OO_Greater:
+ case OO_GreaterEqual:
+ return OO_Spaceship;
+
+ case OO_ExclaimEqual:
+ return OO_EqualEqual;
+
+ default:
+ return OO_None;
+ }
+}
+
} // end namespace clang
#endif
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index e32f749ae6abd..3185ca0f4a25c 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -140,9 +140,9 @@ namespace SrcMgr {
/// exist.
unsigned BufferOverridden : 1;
- /// True if this content cache was initially created for a source
- /// file considered as a system one.
- unsigned IsSystemFile : 1;
+ /// True if this content cache was initially created for a source file
+ /// considered to be volatile (likely to change between stat and open).
+ unsigned IsFileVolatile : 1;
/// True if this file may be transient, that is, if it might not
/// exist at some later point in time when this content entry is used,
@@ -152,15 +152,15 @@ namespace SrcMgr {
ContentCache(const FileEntry *Ent = nullptr) : ContentCache(Ent, Ent) {}
ContentCache(const FileEntry *Ent, const FileEntry *contentEnt)
- : Buffer(nullptr, false), OrigEntry(Ent), ContentsEntry(contentEnt),
- BufferOverridden(false), IsSystemFile(false), IsTransient(false) {}
+ : Buffer(nullptr, false), OrigEntry(Ent), ContentsEntry(contentEnt),
+ BufferOverridden(false), IsFileVolatile(false), IsTransient(false) {}
/// The copy ctor does not allow copies where source object has either
/// a non-NULL Buffer or SourceLineCache. Ownership of allocated memory
/// is not transferred, so this is a logical error.
ContentCache(const ContentCache &RHS)
- : Buffer(nullptr, false), BufferOverridden(false), IsSystemFile(false),
- IsTransient(false) {
+ : Buffer(nullptr, false), BufferOverridden(false),
+ IsFileVolatile(false), IsTransient(false) {
OrigEntry = RHS.OrigEntry;
ContentsEntry = RHS.ContentsEntry;
@@ -185,7 +185,7 @@ namespace SrcMgr {
///
/// \param Invalid If non-NULL, will be set \c true if an error occurred.
const llvm::MemoryBuffer *getBuffer(DiagnosticsEngine &Diag,
- const SourceManager &SM,
+ FileManager &FM,
SourceLocation Loc = SourceLocation(),
bool *Invalid = nullptr) const;
@@ -265,16 +265,21 @@ namespace SrcMgr {
llvm::PointerIntPair<const ContentCache*, 3, CharacteristicKind>
ContentAndKind;
+ /// The filename that is used to access the file entry represented by the
+ /// content cache.
+ StringRef Filename;
+
public:
/// Return a FileInfo object.
static FileInfo get(SourceLocation IL, const ContentCache *Con,
- CharacteristicKind FileCharacter) {
+ CharacteristicKind FileCharacter, StringRef Filename) {
FileInfo X;
X.IncludeLoc = IL.getRawEncoding();
X.NumCreatedFIDs = 0;
X.HasLineDirectives = false;
X.ContentAndKind.setPointer(Con);
X.ContentAndKind.setInt(FileCharacter);
+ X.Filename = Filename;
return X;
}
@@ -299,6 +304,10 @@ namespace SrcMgr {
void setHasLineDirectives() {
HasLineDirectives = true;
}
+
+ /// Returns the name of the file that was used when the file was loaded from
+ /// the underlying file system.
+ StringRef getName() const { return Filename; }
};
/// Each ExpansionInfo encodes the expansion location - where
@@ -821,7 +830,18 @@ public:
const SrcMgr::ContentCache *IR =
getOrCreateContentCache(SourceFile, isSystem(FileCharacter));
assert(IR && "getOrCreateContentCache() cannot return NULL");
- return createFileID(IR, IncludePos, FileCharacter, LoadedID, LoadedOffset);
+ return createFileID(IR, SourceFile->getName(), IncludePos, FileCharacter,
+ LoadedID, LoadedOffset);
+ }
+
+ FileID createFileID(FileEntryRef SourceFile, SourceLocation IncludePos,
+ SrcMgr::CharacteristicKind FileCharacter,
+ int LoadedID = 0, unsigned LoadedOffset = 0) {
+ const SrcMgr::ContentCache *IR = getOrCreateContentCache(
+ &SourceFile.getFileEntry(), isSystem(FileCharacter));
+ assert(IR && "getOrCreateContentCache() cannot return NULL");
+ return createFileID(IR, SourceFile.getName(), IncludePos, FileCharacter,
+ LoadedID, LoadedOffset);
}
/// Create a new FileID that represents the specified memory buffer.
@@ -832,9 +852,10 @@ public:
SrcMgr::CharacteristicKind FileCharacter = SrcMgr::C_User,
int LoadedID = 0, unsigned LoadedOffset = 0,
SourceLocation IncludeLoc = SourceLocation()) {
+ StringRef Name = Buffer->getBufferIdentifier();
return createFileID(
createMemBufferContentCache(Buffer.release(), /*DoNotFree*/ false),
- IncludeLoc, FileCharacter, LoadedID, LoadedOffset);
+ Name, IncludeLoc, FileCharacter, LoadedID, LoadedOffset);
}
enum UnownedTag { Unowned };
@@ -847,8 +868,9 @@ public:
SrcMgr::CharacteristicKind FileCharacter = SrcMgr::C_User,
int LoadedID = 0, unsigned LoadedOffset = 0,
SourceLocation IncludeLoc = SourceLocation()) {
- return createFileID(createMemBufferContentCache(Buffer, /*DoNotFree*/true),
- IncludeLoc, FileCharacter, LoadedID, LoadedOffset);
+ return createFileID(createMemBufferContentCache(Buffer, /*DoNotFree*/ true),
+ Buffer->getBufferIdentifier(), IncludeLoc,
+ FileCharacter, LoadedID, LoadedOffset);
}
/// Get the FileID for \p SourceFile if it exists. Otherwise, create a
@@ -930,11 +952,12 @@ public:
return false;
}
- /// Disable overridding the contents of a file, previously enabled
- /// with #overrideFileContents.
+ /// Bypass the overridden contents of a file. This creates a new FileEntry
+ /// and initializes the content cache for it. Returns nullptr if there is no
+ /// such file in the filesystem.
///
/// This should be called before parsing has begun.
- void disableFileContentsOverride(const FileEntry *File);
+ const FileEntry *bypassFileContentsOverride(const FileEntry &File);
/// Specify that a file is transient.
void setFileIsTransient(const FileEntry *SourceFile);
@@ -964,8 +987,8 @@ public:
return getFakeBufferForRecovery();
}
- return Entry.getFile().getContentCache()->getBuffer(Diag, *this, Loc,
- Invalid);
+ return Entry.getFile().getContentCache()->getBuffer(Diag, getFileManager(),
+ Loc, Invalid);
}
const llvm::MemoryBuffer *getBuffer(FileID FID,
@@ -979,9 +1002,8 @@ public:
return getFakeBufferForRecovery();
}
- return Entry.getFile().getContentCache()->getBuffer(Diag, *this,
- SourceLocation(),
- Invalid);
+ return Entry.getFile().getContentCache()->getBuffer(
+ Diag, getFileManager(), SourceLocation(), Invalid);
}
/// Returns the FileEntry record for the provided FileID.
@@ -997,6 +1019,19 @@ public:
return Content->OrigEntry;
}
+ /// Returns the FileEntryRef for the provided FileID.
+ Optional<FileEntryRef> getFileEntryRefForID(FileID FID) const {
+ bool Invalid = false;
+ const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid);
+ if (Invalid || !Entry.isFile())
+ return None;
+
+ const SrcMgr::ContentCache *Content = Entry.getFile().getContentCache();
+ if (!Content || !Content->OrigEntry)
+ return None;
+ return FileEntryRef(Entry.getFile().getName(), *Content->OrigEntry);
+ }
+
/// Returns the FileEntry record for the provided SLocEntry.
const FileEntry *getFileEntryForSLocEntry(const SrcMgr::SLocEntry &sloc) const
{
@@ -1785,10 +1820,10 @@ private:
///
/// This works regardless of whether the ContentCache corresponds to a
/// file or some other input source.
- FileID createFileID(const SrcMgr::ContentCache* File,
+ FileID createFileID(const SrcMgr::ContentCache *File, StringRef Filename,
SourceLocation IncludePos,
- SrcMgr::CharacteristicKind DirCharacter,
- int LoadedID, unsigned LoadedOffset);
+ SrcMgr::CharacteristicKind DirCharacter, int LoadedID,
+ unsigned LoadedOffset);
const SrcMgr::ContentCache *
getOrCreateContentCache(const FileEntry *SourceFile,
diff --git a/include/clang/Basic/Specifiers.h b/include/clang/Basic/Specifiers.h
index d1236e798e5d2..fad97a26d9572 100644
--- a/include/clang/Basic/Specifiers.h
+++ b/include/clang/Basic/Specifiers.h
@@ -32,7 +32,8 @@ namespace clang {
enum ConstexprSpecKind {
CSK_unspecified,
CSK_constexpr,
- CSK_consteval
+ CSK_consteval,
+ CSK_constinit
};
/// Specifies the width of a type, e.g., short, long, or long long.
diff --git a/include/clang/Basic/Stack.h b/include/clang/Basic/Stack.h
index e0b04099de58d..3418c3bad11bd 100644
--- a/include/clang/Basic/Stack.h
+++ b/include/clang/Basic/Stack.h
@@ -16,11 +16,40 @@
#include <cstddef>
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/Compiler.h"
+
namespace clang {
/// The amount of stack space that Clang would like to be provided with.
/// If less than this much is available, we may be unable to reach our
/// template instantiation depth limit and other similar limits.
constexpr size_t DesiredStackSize = 8 << 20;
+
+ /// Call this once on each thread, as soon after starting the thread as
+ /// feasible, to note the approximate address of the bottom of the stack.
+ void noteBottomOfStack();
+
+ /// Determine whether the stack is nearly exhausted.
+ bool isStackNearlyExhausted();
+
+ void runWithSufficientStackSpaceSlow(llvm::function_ref<void()> Diag,
+ llvm::function_ref<void()> Fn);
+
+ /// Run a given function on a stack with "sufficient" space. If stack space
+ /// is insufficient, calls Diag to emit a diagnostic before calling Fn.
+ inline void runWithSufficientStackSpace(llvm::function_ref<void()> Diag,
+ llvm::function_ref<void()> Fn) {
+#ifdef LLVM_ENABLE_THREADS
+ if (LLVM_UNLIKELY(isStackNearlyExhausted()))
+ runWithSufficientStackSpaceSlow(Diag, Fn);
+ else
+ Fn();
+#else
+ if (LLVM_UNLIKELY(isStackNearlyExhausted()))
+ Diag();
+ Fn();
+#endif
+ }
} // end namespace clang
#endif // LLVM_CLANG_BASIC_STACK_H
diff --git a/include/clang/Basic/StmtNodes.td b/include/clang/Basic/StmtNodes.td
index be364de1a76cf..59444b2919a95 100644
--- a/include/clang/Basic/StmtNodes.td
+++ b/include/clang/Basic/StmtNodes.td
@@ -114,6 +114,7 @@ def GNUNullExpr : DStmt<Expr>;
// C++ Expressions.
def CXXOperatorCallExpr : DStmt<CallExpr>;
def CXXMemberCallExpr : DStmt<CallExpr>;
+def CXXRewrittenBinaryOperator : DStmt<Expr>;
def CXXNamedCastExpr : DStmt<ExplicitCastExpr, 1>;
def CXXStaticCastExpr : DStmt<CXXNamedCastExpr>;
def CXXDynamicCastExpr : DStmt<CXXNamedCastExpr>;
@@ -163,6 +164,9 @@ def CoawaitExpr : DStmt<CoroutineSuspendExpr>;
def DependentCoawaitExpr : DStmt<Expr>;
def CoyieldExpr : DStmt<CoroutineSuspendExpr>;
+// C++2a Concepts expressions
+def ConceptSpecializationExpr : DStmt<Expr>;
+
// Obj-C Expressions.
def ObjCStringLiteral : DStmt<Expr>;
def ObjCBoxedExpr : DStmt<Expr>;
@@ -242,6 +246,9 @@ def OMPCancellationPointDirective : DStmt<OMPExecutableDirective>;
def OMPCancelDirective : DStmt<OMPExecutableDirective>;
def OMPTaskLoopDirective : DStmt<OMPLoopDirective>;
def OMPTaskLoopSimdDirective : DStmt<OMPLoopDirective>;
+def OMPMasterTaskLoopDirective : DStmt<OMPLoopDirective>;
+def OMPMasterTaskLoopSimdDirective : DStmt<OMPLoopDirective>;
+def OMPParallelMasterTaskLoopDirective : DStmt<OMPLoopDirective>;
def OMPDistributeDirective : DStmt<OMPLoopDirective>;
def OMPDistributeParallelForDirective : DStmt<OMPLoopDirective>;
def OMPDistributeParallelForSimdDirective : DStmt<OMPLoopDirective>;
diff --git a/include/clang/Basic/SyncScope.h b/include/clang/Basic/SyncScope.h
index 15af02d83cde1..ce8fb9cbed131 100644
--- a/include/clang/Basic/SyncScope.h
+++ b/include/clang/Basic/SyncScope.h
@@ -144,7 +144,7 @@ AtomicScopeModel::create(AtomicScopeModelKind K) {
case AtomicScopeModelKind::None:
return std::unique_ptr<AtomicScopeModel>{};
case AtomicScopeModelKind::OpenCL:
- return llvm::make_unique<AtomicScopeOpenCLModel>();
+ return std::make_unique<AtomicScopeOpenCLModel>();
}
llvm_unreachable("Invalid atomic scope model kind");
}
diff --git a/include/clang/Basic/TargetBuiltins.h b/include/clang/Basic/TargetBuiltins.h
index 50262fa310ce7..0e2f0753b0c59 100644
--- a/include/clang/Basic/TargetBuiltins.h
+++ b/include/clang/Basic/TargetBuiltins.h
@@ -52,6 +52,16 @@ namespace clang {
};
}
+ /// BPF builtins
+ namespace BPF {
+ enum {
+ LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
+ #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
+ #include "clang/Basic/BuiltinsBPF.def"
+ LastTSBuiltin
+ };
+ }
+
/// PPC builtins
namespace PPC {
enum {
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index 7a8384f5fbc01..9a3bb986930ef 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -19,14 +19,15 @@
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TargetCXXABI.h"
#include "clang/Basic/TargetOptions.h"
+#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
-#include "llvm/IR/DataLayout.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/VersionTuple.h"
#include <cassert>
@@ -35,6 +36,7 @@
namespace llvm {
struct fltSemantics;
+class DataLayout;
}
namespace clang {
@@ -193,12 +195,12 @@ protected:
unsigned IsRenderScriptTarget : 1;
+ unsigned HasAArch64SVETypes : 1;
+
// TargetInfo Constructor. Default initializes all fields.
TargetInfo(const llvm::Triple &T);
- void resetDataLayout(StringRef DL) {
- DataLayout.reset(new llvm::DataLayout(DL));
- }
+ void resetDataLayout(StringRef DL);
public:
/// Construct a target for the given options.
@@ -789,6 +791,10 @@ public:
/// Returns true for RenderScript.
bool isRenderScriptTarget() const { return IsRenderScriptTarget; }
+ /// Returns whether or not the AArch64 SVE built-in types are
+ /// available on this target.
+ bool hasAArch64SVETypes() const { return HasAArch64SVETypes; }
+
/// Returns whether the passed in string is a valid clobber in an
/// inline asm statement.
///
@@ -1249,15 +1255,9 @@ public:
bool isBigEndian() const { return BigEndian; }
bool isLittleEndian() const { return !BigEndian; }
- enum CallingConvMethodType {
- CCMT_Unknown,
- CCMT_Member,
- CCMT_NonMember
- };
-
/// Gets the default calling convention for the given target and
/// declaration context.
- virtual CallingConv getDefaultCallingConv(CallingConvMethodType MT) const {
+ virtual CallingConv getDefaultCallingConv() const {
// Not all targets will specify an explicit calling convention that we can
// express. This will always do the right thing, even though it's not
// an explicit calling convention.
@@ -1268,6 +1268,7 @@ public:
CCCR_OK,
CCCR_Warning,
CCCR_Ignore,
+ CCCR_Error,
};
/// Determines whether a given calling convention is valid for the
diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def
index 55e94d387c9d4..94fe1ba63a9f6 100644
--- a/include/clang/Basic/TokenKinds.def
+++ b/include/clang/Basic/TokenKinds.def
@@ -68,6 +68,9 @@
#ifndef ANNOTATION
#define ANNOTATION(X) TOK(annot_ ## X)
#endif
+#ifndef PRAGMA_ANNOTATION
+#define PRAGMA_ANNOTATION(X) ANNOTATION(X)
+#endif
//===----------------------------------------------------------------------===//
// Preprocessor keywords.
@@ -386,6 +389,7 @@ MODULES_KEYWORD(import)
// C++20 keywords.
CXX2A_KEYWORD(char8_t , CHAR8SUPPORT)
CXX2A_KEYWORD(consteval , 0)
+CXX2A_KEYWORD(constinit , 0)
// C11 Extension
KEYWORD(_Float16 , KEYALL)
@@ -446,16 +450,18 @@ TYPE_TRAIT_N(__is_nothrow_constructible, IsNothrowConstructible, KEYCXX)
// MSVC14.0 / VS2015 Type Traits
TYPE_TRAIT_2(__is_assignable, IsAssignable, KEYCXX)
+// MSVC Type Traits of unknown vintage
+TYPE_TRAIT_1(__has_nothrow_move_assign, HasNothrowMoveAssign, KEYCXX)
+TYPE_TRAIT_1(__has_trivial_move_assign, HasTrivialMoveAssign, KEYCXX)
+TYPE_TRAIT_1(__has_trivial_move_constructor, HasTrivialMoveConstructor, KEYCXX)
+
// GNU and MS Type Traits
TYPE_TRAIT_1(__has_nothrow_assign, HasNothrowAssign, KEYCXX)
-TYPE_TRAIT_1(__has_nothrow_move_assign, HasNothrowMoveAssign, KEYCXX)
TYPE_TRAIT_1(__has_nothrow_copy, HasNothrowCopy, KEYCXX)
TYPE_TRAIT_1(__has_nothrow_constructor, HasNothrowConstructor, KEYCXX)
TYPE_TRAIT_1(__has_trivial_assign, HasTrivialAssign, KEYCXX)
-TYPE_TRAIT_1(__has_trivial_move_assign, HasTrivialMoveAssign, KEYCXX)
TYPE_TRAIT_1(__has_trivial_copy, HasTrivialCopy, KEYCXX)
TYPE_TRAIT_1(__has_trivial_constructor, HasTrivialDefaultConstructor, KEYCXX)
-TYPE_TRAIT_1(__has_trivial_move_constructor, HasTrivialMoveConstructor, KEYCXX)
TYPE_TRAIT_1(__has_trivial_destructor, HasTrivialDestructor, KEYCXX)
TYPE_TRAIT_1(__has_virtual_destructor, HasVirtualDestructor, KEYCXX)
TYPE_TRAIT_1(__is_abstract, IsAbstract, KEYCXX)
@@ -472,17 +478,18 @@ TYPE_TRAIT_1(__is_literal, IsLiteral, KEYCXX)
ALIAS("__is_literal_type", __is_literal, KEYCXX)
TYPE_TRAIT_1(__is_pod, IsPOD, KEYCXX)
TYPE_TRAIT_1(__is_polymorphic, IsPolymorphic, KEYCXX)
+TYPE_TRAIT_1(__is_standard_layout, IsStandardLayout, KEYCXX)
TYPE_TRAIT_1(__is_trivial, IsTrivial, KEYCXX)
+TYPE_TRAIT_2(__is_trivially_assignable, IsTriviallyAssignable, KEYCXX)
+TYPE_TRAIT_N(__is_trivially_constructible, IsTriviallyConstructible, KEYCXX)
+TYPE_TRAIT_1(__is_trivially_copyable, IsTriviallyCopyable, KEYCXX)
TYPE_TRAIT_1(__is_union, IsUnion, KEYCXX)
TYPE_TRAIT_1(__has_unique_object_representations,
HasUniqueObjectRepresentations, KEYCXX)
+KEYWORD(__underlying_type , KEYCXX)
// Clang-only C++ Type Traits
-TYPE_TRAIT_N(__is_trivially_constructible, IsTriviallyConstructible, KEYCXX)
-TYPE_TRAIT_1(__is_trivially_copyable, IsTriviallyCopyable, KEYCXX)
-TYPE_TRAIT_2(__is_trivially_assignable, IsTriviallyAssignable, KEYCXX)
TYPE_TRAIT_2(__reference_binds_to_temporary, ReferenceBindsToTemporary, KEYCXX)
-KEYWORD(__underlying_type , KEYCXX)
// Embarcadero Expression Traits
KEYWORD(__is_lvalue_expr , KEYCXX)
@@ -509,7 +516,6 @@ TYPE_TRAIT_1(__is_member_function_pointer, IsMemberFunctionPointer, KEYCXX)
TYPE_TRAIT_1(__is_member_pointer, IsMemberPointer, KEYCXX)
TYPE_TRAIT_1(__is_const, IsConst, KEYCXX)
TYPE_TRAIT_1(__is_volatile, IsVolatile, KEYCXX)
-TYPE_TRAIT_1(__is_standard_layout, IsStandardLayout, KEYCXX)
TYPE_TRAIT_1(__is_signed, IsSigned, KEYCXX)
TYPE_TRAIT_1(__is_unsigned, IsUnsigned, KEYCXX)
@@ -722,6 +728,11 @@ ANNOTATION(typename) // annotation for a C typedef name, a C++ (possibly
ANNOTATION(template_id) // annotation for a C++ template-id that names a
// function template specialization (not a type),
// e.g., "std::swap<int>"
+ANNOTATION(non_type) // annotation for a single non-type declaration
+ANNOTATION(non_type_undeclared) // annotation for an undeclared identifier that
+ // was assumed to be an ADL-only function name
+ANNOTATION(non_type_dependent) // annotation for an assumed non-type member of
+ // a dependent base class
ANNOTATION(primary_expr) // annotation for a primary expression
ANNOTATION(decltype) // annotation for a decltype expression,
// e.g., "decltype(foo.bar())"
@@ -729,103 +740,103 @@ ANNOTATION(decltype) // annotation for a decltype expression,
// Annotation for #pragma unused(...)
// For each argument inside the parentheses the pragma handler will produce
// one 'pragma_unused' annotation token followed by the argument token.
-ANNOTATION(pragma_unused)
+PRAGMA_ANNOTATION(pragma_unused)
// Annotation for #pragma GCC visibility...
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_vis)
+PRAGMA_ANNOTATION(pragma_vis)
// Annotation for #pragma pack...
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_pack)
+PRAGMA_ANNOTATION(pragma_pack)
// Annotation for #pragma clang __debug parser_crash...
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_parser_crash)
+PRAGMA_ANNOTATION(pragma_parser_crash)
// Annotation for #pragma clang __debug captured...
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_captured)
+PRAGMA_ANNOTATION(pragma_captured)
// Annotation for #pragma clang __debug dump...
// The lexer produces these so that the parser and semantic analysis can
// look up and dump the operand.
-ANNOTATION(pragma_dump)
+PRAGMA_ANNOTATION(pragma_dump)
// Annotation for #pragma ms_struct...
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_msstruct)
+PRAGMA_ANNOTATION(pragma_msstruct)
// Annotation for #pragma align...
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_align)
+PRAGMA_ANNOTATION(pragma_align)
// Annotation for #pragma weak id
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_weak)
+PRAGMA_ANNOTATION(pragma_weak)
// Annotation for #pragma weak id = id
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_weakalias)
+PRAGMA_ANNOTATION(pragma_weakalias)
// Annotation for #pragma redefine_extname...
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_redefine_extname)
+PRAGMA_ANNOTATION(pragma_redefine_extname)
// Annotation for #pragma STDC FP_CONTRACT...
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_fp_contract)
+PRAGMA_ANNOTATION(pragma_fp_contract)
// Annotation for #pragma STDC FENV_ACCESS
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_fenv_access)
+PRAGMA_ANNOTATION(pragma_fenv_access)
// Annotation for #pragma pointers_to_members...
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_ms_pointers_to_members)
+PRAGMA_ANNOTATION(pragma_ms_pointers_to_members)
// Annotation for #pragma vtordisp...
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_ms_vtordisp)
+PRAGMA_ANNOTATION(pragma_ms_vtordisp)
// Annotation for all microsoft #pragmas...
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_ms_pragma)
+PRAGMA_ANNOTATION(pragma_ms_pragma)
// Annotation for #pragma OPENCL EXTENSION...
// The lexer produces these so that they only take effect when the parser
// handles them.
-ANNOTATION(pragma_opencl_extension)
+PRAGMA_ANNOTATION(pragma_opencl_extension)
// Annotations for OpenMP pragma directives - #pragma omp ...
// The lexer produces these so that they only take effect when the parser
// handles #pragma omp ... directives.
-ANNOTATION(pragma_openmp)
-ANNOTATION(pragma_openmp_end)
+PRAGMA_ANNOTATION(pragma_openmp)
+PRAGMA_ANNOTATION(pragma_openmp_end)
// Annotations for loop pragma directives #pragma clang loop ...
// The lexer produces these so that they only take effect when the parser
// handles #pragma loop ... directives.
-ANNOTATION(pragma_loop_hint)
+PRAGMA_ANNOTATION(pragma_loop_hint)
-ANNOTATION(pragma_fp)
+PRAGMA_ANNOTATION(pragma_fp)
// Annotation for the attribute pragma directives - #pragma clang attribute ...
-ANNOTATION(pragma_attribute)
+PRAGMA_ANNOTATION(pragma_attribute)
// Annotations for module import translated from #include etc.
ANNOTATION(module_include)
@@ -836,6 +847,7 @@ ANNOTATION(module_end)
// into the name of a header unit.
ANNOTATION(header_unit)
+#undef PRAGMA_ANNOTATION
#undef ANNOTATION
#undef TESTING_KEYWORD
#undef OBJC_AT_KEYWORD
diff --git a/include/clang/Basic/TokenKinds.h b/include/clang/Basic/TokenKinds.h
index 1d5be5f9152eb..c25181e6827c7 100644
--- a/include/clang/Basic/TokenKinds.h
+++ b/include/clang/Basic/TokenKinds.h
@@ -90,13 +90,10 @@ inline bool isLiteral(TokenKind K) {
}
/// Return true if this is any of tok::annot_* kinds.
-inline bool isAnnotation(TokenKind K) {
-#define ANNOTATION(NAME) \
- if (K == tok::annot_##NAME) \
- return true;
-#include "clang/Basic/TokenKinds.def"
- return false;
-}
+bool isAnnotation(TokenKind K);
+
+/// Return true if this is an annotation token representing a pragma.
+bool isPragmaAnnotation(TokenKind K);
} // end namespace tok
} // end namespace clang
diff --git a/include/clang/Basic/TypeNodes.td b/include/clang/Basic/TypeNodes.td
new file mode 100644
index 0000000000000..b2554de24aaf4
--- /dev/null
+++ b/include/clang/Basic/TypeNodes.td
@@ -0,0 +1,106 @@
+class Type<bit abstract = 0> {
+ bit Abstract = abstract;
+}
+
+class DerivedType<Type base, bit abstract = 0> : Type<abstract> {
+ Type Base = base;
+}
+
+/// A type node that is only used to represent dependent types in C++. For
+/// example, DependentTemplateSpecializationType is used to represent types
+/// where the base template-id is dependent (such as `T::foo<U>`). Code
+/// that only works with non-dependent types can ignore these type nodes.
+class AlwaysDependent {}
+
+/// A type node that is never used to represent a canonical type, which is to
+/// say that it always represents some sort of type "sugar" which can
+/// (supposedly) be erased without affecting the formal behavior of the
+/// language. For example, in standard C/C++, typedefs do not introduce new
+/// types and do not affect the semantics of the program. Code that only
+/// works with canonical types can ignore these type nodes.
+///
+/// Note that this simple story about non-canonical types is not the whole
+/// truth. Languages and extensions often have formation rules which differ
+/// based on how a type is spelled and which therefore are not consistent
+/// with immediately stipping away type sugar. More critically, attributes on
+/// typedefs can have semantic impacts in ways that are only reflected in our
+/// AST by preserving the typedef sugar; for example, we do not otherwise
+/// represent the alignment attribute on typedefs, and so it is necessary to
+/// preserve typedef structure into most parts of IR generation.
+class NeverCanonical {}
+
+/// A type node that only represents a canonical type in some dependent cases.
+/// For example, `std::vector<int>` (a TemplateSpecializationType) is
+/// considered to be a non-canonical representation for the RecordType
+/// referencing the concrete ClassTemplateSpecializationDecl; but
+/// `std::vector<T>` cannot be resolved to a concrete specialization
+/// and so remains canonical. Code which only works with non-dependent
+/// canonical types can ignore these nodes.
+class NeverCanonicalUnlessDependent {}
+
+/// A type node which never has component type structure. Some code may be
+/// able to operate on leaf types faster than they can on non-leaf types.
+///
+/// For example, the function type `void (int)` is not a leaf type because it
+/// is structurally composed of component types (`void` and `int`).
+///
+/// A struct type is a leaf type because its field types are not part of its
+/// type-expression.
+///
+/// Nodes like `TypedefType` which are syntactically leaves but can desugar
+/// to types that may not be leaves should not declare this.
+class LeafType {}
+
+def BuiltinType : Type, LeafType;
+def ComplexType : Type;
+def PointerType : Type;
+def BlockPointerType : Type;
+def ReferenceType : Type<1>;
+def LValueReferenceType : DerivedType<ReferenceType>;
+def RValueReferenceType : DerivedType<ReferenceType>;
+def MemberPointerType : Type;
+def ArrayType : Type<1>;
+def ConstantArrayType : DerivedType<ArrayType>;
+def IncompleteArrayType : DerivedType<ArrayType>;
+def VariableArrayType : DerivedType<ArrayType>;
+def DependentSizedArrayType : DerivedType<ArrayType>, AlwaysDependent;
+def DependentSizedExtVectorType : Type, AlwaysDependent;
+def DependentAddressSpaceType : Type, AlwaysDependent;
+def VectorType : Type;
+def DependentVectorType : Type, AlwaysDependent;
+def ExtVectorType : DerivedType<VectorType>;
+def FunctionType : Type<1>;
+def FunctionProtoType : DerivedType<FunctionType>;
+def FunctionNoProtoType : DerivedType<FunctionType>;
+def UnresolvedUsingType : Type, AlwaysDependent;
+def ParenType : Type, NeverCanonical;
+def TypedefType : Type, NeverCanonical;
+def MacroQualifiedType : Type, NeverCanonical;
+def AdjustedType : Type, NeverCanonical;
+def DecayedType : DerivedType<AdjustedType>, NeverCanonical;
+def TypeOfExprType : Type, NeverCanonicalUnlessDependent;
+def TypeOfType : Type, NeverCanonicalUnlessDependent;
+def DecltypeType : Type, NeverCanonicalUnlessDependent;
+def UnaryTransformType : Type, NeverCanonicalUnlessDependent;
+def TagType : Type<1>;
+def RecordType : DerivedType<TagType>, LeafType;
+def EnumType : DerivedType<TagType>, LeafType;
+def ElaboratedType : Type, NeverCanonical;
+def AttributedType : Type, NeverCanonical;
+def TemplateTypeParmType : Type, AlwaysDependent, LeafType;
+def SubstTemplateTypeParmType : Type, NeverCanonical;
+def SubstTemplateTypeParmPackType : Type, AlwaysDependent;
+def TemplateSpecializationType : Type, NeverCanonicalUnlessDependent;
+def DeducedType : Type<1>;
+def AutoType : DerivedType<DeducedType>;
+def DeducedTemplateSpecializationType : DerivedType<DeducedType>;
+def InjectedClassNameType : Type, AlwaysDependent, LeafType;
+def DependentNameType : Type, AlwaysDependent;
+def DependentTemplateSpecializationType : Type, AlwaysDependent;
+def PackExpansionType : Type, NeverCanonicalUnlessDependent;
+def ObjCTypeParamType : Type, NeverCanonical;
+def ObjCObjectType : Type;
+def ObjCInterfaceType : DerivedType<ObjCObjectType>, LeafType;
+def ObjCObjectPointerType : Type;
+def PipeType : Type;
+def AtomicType : Type;
diff --git a/include/clang/Basic/X86Target.def b/include/clang/Basic/X86Target.def
index 94ccb9fd8b2f5..ba4e5981e7dcc 100644
--- a/include/clang/Basic/X86Target.def
+++ b/include/clang/Basic/X86Target.def
@@ -173,6 +173,10 @@ PROC(IcelakeClient, "icelake-client", PROC_64_BIT)
/// Icelake server microarchitecture based processors.
PROC(IcelakeServer, "icelake-server", PROC_64_BIT)
+/// \name Tigerlake
+/// Tigerlake microarchitecture based processors.
+PROC(Tigerlake, "tigerlake", PROC_64_BIT)
+
/// \name Knights Landing
/// Knights Landing processor.
PROC_WITH_FEAT(KNL, "knl", PROC_64_BIT, FEATURE_AVX512F)
@@ -297,6 +301,7 @@ FEATURE(FEATURE_VPCLMULQDQ)
FEATURE(FEATURE_AVX512VNNI)
FEATURE(FEATURE_AVX512BITALG)
FEATURE(FEATURE_AVX512BF16)
+FEATURE(FEATURE_AVX512VP2INTERSECT)
// FIXME: When commented out features are supported in LLVM, enable them here.
diff --git a/include/clang/Basic/arm_neon.td b/include/clang/Basic/arm_neon.td
index 428c22d1a0111..a52ed496580d6 100644
--- a/include/clang/Basic/arm_neon.td
+++ b/include/clang/Basic/arm_neon.td
@@ -1651,10 +1651,10 @@ let ArchGuard = "defined(__ARM_FEATURE_DOTPROD) && defined(__aarch64__)" in {
// v8.2-A FP16 fused multiply-add long instructions.
let ArchGuard = "defined(__ARM_FEATURE_FP16FML) && defined(__aarch64__)" in {
- def VFMLAL_LOW : SInst<"vfmlal_low", "ffHH", "hQh">;
- def VFMLSL_LOW : SInst<"vfmlsl_low", "ffHH", "hQh">;
- def VFMLAL_HIGH : SInst<"vfmlal_high", "ffHH", "hQh">;
- def VFMLSL_HIGH : SInst<"vfmlsl_high", "ffHH", "hQh">;
+ def VFMLAL_LOW : SInst<"vfmlal_low", "nndd", "hQh">;
+ def VFMLSL_LOW : SInst<"vfmlsl_low", "nndd", "hQh">;
+ def VFMLAL_HIGH : SInst<"vfmlal_high", "nndd", "hQh">;
+ def VFMLSL_HIGH : SInst<"vfmlsl_high", "nndd", "hQh">;
def VFMLAL_LANE_LOW : SOpInst<"vfmlal_lane_low", "ffH0i", "hQh", OP_FMLAL_LN>;
def VFMLSL_LANE_LOW : SOpInst<"vfmlsl_lane_low", "ffH0i", "hQh", OP_FMLSL_LN>;