diff options
Diffstat (limited to 'include/clang/Basic')
68 files changed, 1969 insertions, 511 deletions
diff --git a/include/clang/Basic/ABI.h b/include/clang/Basic/ABI.h index 9e8ef2e..bd24679 100644 --- a/include/clang/Basic/ABI.h +++ b/include/clang/Basic/ABI.h @@ -13,8 +13,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef CLANG_BASIC_ABI_H -#define CLANG_BASIC_ABI_H +#ifndef LLVM_CLANG_BASIC_ABI_H +#define LLVM_CLANG_BASIC_ABI_H #include "llvm/Support/DataTypes.h" @@ -24,14 +24,15 @@ namespace clang { enum CXXCtorType { Ctor_Complete, ///< Complete object ctor Ctor_Base, ///< Base object ctor - Ctor_CompleteAllocating ///< Complete object allocating ctor + Ctor_Comdat ///< The COMDAT used for ctors }; /// \brief C++ destructor types. enum CXXDtorType { Dtor_Deleting, ///< Deleting dtor Dtor_Complete, ///< Complete object dtor - Dtor_Base ///< Base object dtor + Dtor_Base, ///< Base object dtor + Dtor_Comdat ///< The COMDAT used for dtors }; /// \brief A return adjustment. @@ -204,4 +205,4 @@ struct ThunkInfo { } // end namespace clang -#endif // CLANG_BASIC_ABI_H +#endif diff --git a/include/clang/Basic/AddressSpaces.h b/include/clang/Basic/AddressSpaces.h index 4b1cea5..8dd7566 100644 --- a/include/clang/Basic/AddressSpaces.h +++ b/include/clang/Basic/AddressSpaces.h @@ -30,6 +30,7 @@ enum ID { opencl_global = Offset, opencl_local, opencl_constant, + opencl_generic, cuda_device, cuda_constant, diff --git a/include/clang/Basic/AllDiagnostics.h b/include/clang/Basic/AllDiagnostics.h index 7304c8f..18a2b8a 100644 --- a/include/clang/Basic/AllDiagnostics.h +++ b/include/clang/Basic/AllDiagnostics.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_ALL_DIAGNOSTICS_H -#define LLVM_CLANG_ALL_DIAGNOSTICS_H +#ifndef LLVM_CLANG_BASIC_ALLDIAGNOSTICS_H +#define LLVM_CLANG_BASIC_ALLDIAGNOSTICS_H #include "clang/AST/ASTDiagnostic.h" #include "clang/AST/CommentDiagnostic.h" diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 704a375..8437461 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -115,6 +115,10 @@ def DeclBase : AttrSubject; def FunctionLike : SubsetSubject<DeclBase, [{S->getFunctionType(false) != NULL}]>; +def OpenCLKernelFunction : SubsetSubject<Function, [{ + S->hasAttr<OpenCLKernelAttr>() +}]>; + // HasFunctionProto is a more strict version of FunctionLike, so it should // never be specified in a Subjects list along with FunctionLike (due to the // inclusive nature of subject testing). @@ -186,10 +190,11 @@ class Spelling<string name, string variety> { class GNU<string name> : Spelling<name, "GNU">; class Declspec<string name> : Spelling<name, "Declspec">; -class CXX11<string namespace, string name> : Spelling<name, "CXX11"> { +class CXX11<string namespace, string name, int version = 1> + : Spelling<name, "CXX11"> { string Namespace = namespace; -} -class Keyword<string name> : Spelling<name, "Keyword">; + int Version = version; +} class Keyword<string name> : Spelling<name, "Keyword">; class Pragma<string namespace, string name> : Spelling<name, "Pragma"> { string Namespace = namespace; } @@ -219,12 +224,14 @@ class SubjectList<list<AttrSubject> subjects, SubjectDiag diag = WarnDiag, string CustomDiag = customDiag; } -class LangOpt<string name> { +class LangOpt<string name, bit negated = 0> { string Name = name; + bit Negated = negated; } def MicrosoftExt : LangOpt<"MicrosoftExt">; def Borland : LangOpt<"Borland">; def CUDA : LangOpt<"CUDA">; +def COnly : LangOpt<"CPlusPlus", 1>; // Defines targets for target-specific attributes. The list of strings should // specify architectures for which the target applies, based off the ArchType @@ -354,6 +361,24 @@ def Aligned : InheritableAttr { let Documentation = [Undocumented]; } +def AlignValue : Attr { + let Spellings = [ + // Unfortunately, this is semantically an assertion, not a directive + // (something else must ensure the alignment), so aligned_value is a + // probably a better name. We might want to add an aligned_value spelling in + // the future (and a corresponding C++ attribute), but this can be done + // later once we decide if we also want them to have slightly-different + // semantics than Intel's align_value. + GNU<"align_value"> + // Intel's compiler on Windows also supports: + // , Declspec<"align_value"> + ]; + let Args = [ExprArgument<"Alignment">]; + let Subjects = SubjectList<[Var, TypedefName], WarnDiag, + "ExpectedVariableOrTypedef">; + let Documentation = [AlignValueDocs]; +} + def AlignMac68k : InheritableAttr { // This attribute has no spellings as it is only ever created implicitly. let Spellings = []; @@ -434,7 +459,8 @@ def Bounded : IgnoredAttr { } def CarriesDependency : InheritableParamAttr { - let Spellings = [GNU<"carries_dependency">, CXX11<"","carries_dependency">]; + let Spellings = [GNU<"carries_dependency">, + CXX11<"","carries_dependency", 200809>]; let Subjects = SubjectList<[ParmVar, ObjCMethod, Function], ErrorDiag>; let Documentation = [CarriesDependencyDocs]; } @@ -541,6 +567,13 @@ def CUDAHost : InheritableAttr { let Documentation = [Undocumented]; } +def CUDAInvalidTarget : InheritableAttr { + let Spellings = []; + let Subjects = SubjectList<[Function]>; + let LangOpts = [CUDA]; + let Documentation = [Undocumented]; +} + def CUDALaunchBounds : InheritableAttr { let Spellings = [GNU<"launch_bounds">]; let Args = [IntArgument<"MaxThreads">, DefaultIntArgument<"MinBlocks", 0>]; @@ -568,7 +601,7 @@ def C11NoReturn : InheritableAttr { } def CXX11NoReturn : InheritableAttr { - let Spellings = [CXX11<"","noreturn">]; + let Spellings = [CXX11<"","noreturn", 200809>]; let Subjects = SubjectList<[Function], ErrorDiag>; let Documentation = [CXX11NoReturnDocs]; } @@ -597,27 +630,32 @@ def OpenCLImageAccess : Attr { def OpenCLPrivateAddressSpace : TypeAttr { let Spellings = [Keyword<"__private">, Keyword<"private">]; - let Documentation = [Undocumented]; + let Documentation = [OpenCLAddressSpacePrivateDocs]; } def OpenCLGlobalAddressSpace : TypeAttr { let Spellings = [Keyword<"__global">, Keyword<"global">]; - let Documentation = [Undocumented]; + let Documentation = [OpenCLAddressSpaceGlobalDocs]; } def OpenCLLocalAddressSpace : TypeAttr { let Spellings = [Keyword<"__local">, Keyword<"local">]; - let Documentation = [Undocumented]; + let Documentation = [OpenCLAddressSpaceLocalDocs]; } def OpenCLConstantAddressSpace : TypeAttr { let Spellings = [Keyword<"__constant">, Keyword<"constant">]; - let Documentation = [Undocumented]; + let Documentation = [OpenCLAddressSpaceConstantDocs]; +} + +def OpenCLGenericAddressSpace : TypeAttr { + let Spellings = [Keyword<"__generic">, Keyword<"generic">]; + let Documentation = [OpenCLAddressSpaceGenericDocs]; } def Deprecated : InheritableAttr { let Spellings = [GCC<"deprecated">, Declspec<"deprecated">, - CXX11<"","deprecated">]; + CXX11<"","deprecated", 201309>]; let Args = [StringArgument<"Message", 1>]; let Documentation = [Undocumented]; } @@ -655,7 +693,7 @@ def FastCall : InheritableAttr { let Spellings = [GCC<"fastcall">, Keyword<"__fastcall">, Keyword<"_fastcall">]; // let Subjects = [Function, ObjCMethod]; - let Documentation = [Undocumented]; + let Documentation = [FastCallDocs]; } def Final : InheritableAttr { @@ -671,6 +709,25 @@ def MinSize : InheritableAttr { let Documentation = [Undocumented]; } +def FlagEnum : InheritableAttr { + let Spellings = [GNU<"flag_enum">]; + let Subjects = SubjectList<[Enum]>; + let Documentation = [FlagEnumDocs]; + let LangOpts = [COnly]; + let AdditionalMembers = [{ +private: + llvm::APInt FlagBits; +public: + llvm::APInt &getFlagBits() { + return FlagBits; + } + + const llvm::APInt &getFlagBits() const { + return FlagBits; + } +}]; +} + def Flatten : InheritableAttr { let Spellings = [GCC<"flatten">]; let Subjects = SubjectList<[Function], ErrorDiag>; @@ -754,7 +811,7 @@ def MayAlias : InheritableAttr { def MSABI : InheritableAttr { let Spellings = [GCC<"ms_abi">]; // let Subjects = [Function, ObjCMethod]; - let Documentation = [Undocumented]; + let Documentation = [MSABIDocs]; } def MSP430Interrupt : InheritableAttr, TargetSpecificAttr<TargetMSP430> { @@ -810,7 +867,7 @@ def NoCommon : InheritableAttr { } def NoDebug : InheritableAttr { - let Spellings = [GNU<"nodebug">]; + let Spellings = [GCC<"nodebug">]; let Documentation = [Undocumented]; } @@ -832,6 +889,38 @@ def NoMips16 : InheritableAttr, TargetSpecificAttr<TargetMips> { let Documentation = [Undocumented]; } +// This is not a TargetSpecificAttr so that is silently accepted and +// ignored on other targets as encouraged by the OpenCL spec. +// +// See OpenCL 1.2 6.11.5: "It is our intention that a particular +// implementation of OpenCL be free to ignore all attributes and the +// resulting executable binary will produce the same result." +// +// However, only AMD GPU targets will emit the corresponding IR +// attribute. +// +// FIXME: This provides a sub-optimal error message if you attempt to +// use this in CUDA, since CUDA does not use the same terminology. +def AMDGPUNumVGPR : InheritableAttr { + let Spellings = [GNU<"amdgpu_num_vgpr">]; + let Args = [UnsignedArgument<"NumVGPR">]; + let Documentation = [AMDGPUNumVGPRDocs]; + +// FIXME: This should be for OpenCLKernelFunction, but is not to +// workaround needing to see kernel attribute before others to know if +// this should be rejected on non-kernels. + let Subjects = SubjectList<[Function], ErrorDiag, + "ExpectedKernelFunction">; +} + +def AMDGPUNumSGPR : InheritableAttr { + let Spellings = [GNU<"amdgpu_num_sgpr">]; + let Args = [UnsignedArgument<"NumSGPR">]; + let Documentation = [AMDGPUNumSGPRDocs]; + let Subjects = SubjectList<[Function], ErrorDiag, + "ExpectedKernelFunction">; +} + def NoSplitStack : InheritableAttr { let Spellings = [GCC<"no_split_stack">]; let Subjects = SubjectList<[Function], ErrorDiag>; @@ -845,11 +934,15 @@ def NonNull : InheritableAttr { let Args = [VariadicUnsignedArgument<"Args">]; let AdditionalMembers = [{bool isNonNull(unsigned idx) const { + if (!args_size()) + return true; for (const auto &V : args()) if (V == idx) return true; return false; } }]; + // FIXME: We should merge duplicates into a single nonnull attribute. + let DuplicatesAllowedWhileMerging = 1; let Documentation = [Undocumented]; } @@ -860,6 +953,13 @@ def ReturnsNonNull : InheritableAttr { let Documentation = [Undocumented]; } +def AssumeAligned : InheritableAttr { + let Spellings = [GCC<"assume_aligned">]; + let Subjects = SubjectList<[ObjCMethod, Function]>; + let Args = [ExprArgument<"Alignment">, ExprArgument<"Offset", 1>]; + let Documentation = [AssumeAlignedDocs]; +} + def NoReturn : InheritableAttr { let Spellings = [GCC<"noreturn">, Declspec<"noreturn">]; // FIXME: Does GCC allow this on the function instead? @@ -1068,7 +1168,7 @@ def Pure : InheritableAttr { def Regparm : TypeAttr { let Spellings = [GCC<"regparm">]; let Args = [UnsignedArgument<"NumParams">]; - let Documentation = [Undocumented]; + let Documentation = [RegparmDocs]; } def ReqdWorkGroupSize : InheritableAttr { @@ -1115,7 +1215,7 @@ def Sentinel : InheritableAttr { def StdCall : InheritableAttr { let Spellings = [GCC<"stdcall">, Keyword<"__stdcall">, Keyword<"_stdcall">]; // let Subjects = [Function, ObjCMethod]; - let Documentation = [Undocumented]; + let Documentation = [StdCallDocs]; } def SysVABI : InheritableAttr { @@ -1128,7 +1228,14 @@ def ThisCall : InheritableAttr { let Spellings = [GCC<"thiscall">, Keyword<"__thiscall">, Keyword<"_thiscall">]; // let Subjects = [Function, ObjCMethod]; - let Documentation = [Undocumented]; + let Documentation = [ThisCallDocs]; +} + +def VectorCall : InheritableAttr { + let Spellings = [GNU<"vectorcall">, Keyword<"__vectorcall">, + Keyword<"_vectorcall">]; +// let Subjects = [Function, ObjCMethod]; + let Documentation = [VectorCallDocs]; } def Pascal : InheritableAttr { @@ -1784,14 +1891,21 @@ def Unaligned : IgnoredAttr { } def LoopHint : Attr { - /// vectorize: vectorizes loop operations if 'value != 0'. - /// vectorize_width: vectorize loop operations with width 'value'. - /// interleave: interleave multiple loop iterations if 'value != 0'. - /// interleave_count: interleaves 'value' loop interations. - /// unroll: unroll loop if 'value != 0'. - /// unroll_count: unrolls loop 'value' times. - - let Spellings = [Pragma<"clang", "loop">, Pragma<"", "unroll">]; + /// #pragma clang loop <option> directive + /// vectorize: vectorizes loop operations if State == Enable. + /// vectorize_width: vectorize loop operations with width 'Value'. + /// interleave: interleave multiple loop iterations if State == Enable. + /// interleave_count: interleaves 'Value' loop interations. + /// unroll: fully unroll loop if State == Enable. + /// unroll_count: unrolls loop 'Value' times. + + /// #pragma unroll <argument> directive + /// <no arg>: fully unrolls loop. + /// boolean: fully unrolls loop if State == Enable. + /// expression: unrolls loop 'Value' times. + + let Spellings = [Pragma<"clang", "loop">, Pragma<"", "unroll">, + Pragma<"", "nounroll">]; /// State of the loop optimization specified by the spelling. let Args = [EnumArgument<"Option", "OptionType", @@ -1799,10 +1913,13 @@ def LoopHint : Attr { "unroll", "unroll_count"], ["Vectorize", "VectorizeWidth", "Interleave", "InterleaveCount", "Unroll", "UnrollCount"]>, - DefaultIntArgument<"Value", 1>]; + EnumArgument<"State", "LoopHintState", + ["default", "enable", "disable"], + ["Default", "Enable", "Disable"]>, + ExprArgument<"Value">]; let AdditionalMembers = [{ - static StringRef getOptionName(int Option) { + static const char *getOptionName(int Option) { switch(Option) { case Vectorize: return "vectorize"; case VectorizeWidth: return "vectorize_width"; @@ -1814,59 +1931,68 @@ def LoopHint : Attr { llvm_unreachable("Unhandled LoopHint option."); } - static StringRef getValueName(int Value) { - if (Value) - return "enable"; - return "disable"; - } - void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const { unsigned SpellingIndex = getSpellingListIndex(); - if (SpellingIndex == Pragma_unroll) { - // String "unroll" of "#pragma unroll" is already emitted as the - // pragma name. - if (option == UnrollCount) - printArgument(OS); + // For "#pragma unroll" and "#pragma nounroll" the string "unroll" or + // "nounroll" is already emitted as the pragma name. + if (SpellingIndex == Pragma_nounroll) { OS << "\n"; return; } + else if (SpellingIndex == Pragma_unroll) { + OS << getValueString(Policy) << "\n"; + return; + } + assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling"); - OS << getOptionName(option); - printArgument(OS); - OS << "\n"; + OS << getOptionName(option) << getValueString(Policy) << "\n"; } - // Prints the loop hint argument including the enclosing parentheses to OS. - void printArgument(raw_ostream &OS) const { + // Return a string containing the loop hint argument including the + // enclosing parentheses. + std::string getValueString(const PrintingPolicy &Policy) const { + std::string ValueName; + llvm::raw_string_ostream OS(ValueName); OS << "("; if (option == VectorizeWidth || option == InterleaveCount || option == UnrollCount) - OS << value; - else if (value) - OS << "enable"; + value->printPretty(OS, nullptr, Policy); + else if (state == Default) + return ""; + else if (state == Enable) + OS << (option == Unroll ? "full" : "enable"); else OS << "disable"; OS << ")"; + return OS.str(); } // Return a string suitable for identifying this attribute in diagnostics. - std::string getDiagnosticName() const { - std::string DiagnosticName; - llvm::raw_string_ostream OS(DiagnosticName); + std::string getDiagnosticName(const PrintingPolicy &Policy) const { unsigned SpellingIndex = getSpellingListIndex(); - if (SpellingIndex == Pragma_unroll && option == Unroll) - OS << "#pragma unroll"; - else if (SpellingIndex == Pragma_unroll && option == UnrollCount) { - OS << "#pragma unroll"; - printArgument(OS); - } else { - assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling"); - OS << getOptionName(option); - printArgument(OS); - } - return OS.str(); + if (SpellingIndex == Pragma_nounroll) + return "#pragma nounroll"; + else if (SpellingIndex == Pragma_unroll) + return "#pragma unroll" + getValueString(Policy); + + assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling"); + return getOptionName(option) + getValueString(Policy); } }]; let Documentation = [LoopHintDocs, UnrollHintDocs]; } + +def CapturedRecord : InheritableAttr { + // This attribute has no spellings as it is only ever created implicitly. + let Spellings = []; + let SemaHandler = 0; + let Documentation = [Undocumented]; +} + +def OMPThreadPrivateDecl : InheritableAttr { + // This attribute has no spellings as it is only ever created implicitly. + let Spellings = []; + let SemaHandler = 0; + let Documentation = [Undocumented]; +} diff --git a/include/clang/Basic/AttrDocs.td b/include/clang/Basic/AttrDocs.td index e6d6a33..918abb6 100644 --- a/include/clang/Basic/AttrDocs.td +++ b/include/clang/Basic/AttrDocs.td @@ -72,9 +72,9 @@ def ThreadDocs : Documentation { let Content = [{ The ``__declspec(thread)`` attribute declares a variable with thread local storage. It is available under the ``-fms-extensions`` flag for MSVC -compatibility. Documentation for the Visual C++ attribute is available on MSDN_. +compatibility. See the documentation for `__declspec(thread)`_ on MSDN. -.. _MSDN: http://msdn.microsoft.com/en-us/library/9w1sdazb.aspx +.. _`__declspec(thread)`: http://msdn.microsoft.com/en-us/library/9w1sdazb.aspx In Clang, ``__declspec(thread)`` is generally equivalent in functionality to the GNU ``__thread`` keyword. The variable must not have a destructor and must have @@ -154,6 +154,30 @@ def ReleaseCapabilityDocs : Documentation { Marks a function as releasing a capability. }]; } + +def AssumeAlignedDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +Use ``__attribute__((assume_aligned(<alignment>[,<offset>]))`` on a function +declaration to specify that the return value of the function (which must be a +pointer type) has the specified offset, in bytes, from an address with the +specified alignment. The offset is taken to be zero if omitted. + +.. code-block:: c++ + + // The returned pointer value has 32-byte alignment. + void *a() __attribute__((assume_aligned (32))); + + // The returned pointer value is 4 bytes greater than an address having + // 32-byte alignment. + void *b() __attribute__((assume_aligned (32, 4))); + +Note that this attribute provides information to the compiler regarding a +condition that the code already ensures is true. It does not cause the compiler +to enforce the provided alignment assumption. + }]; +} + def EnableIfDocs : Documentation { let Category = DocCatFunction; let Content = [{ @@ -649,15 +673,180 @@ The semantics are as follows: }]; } +def DocCatAMDGPURegisterAttributes : + DocumentationCategory<"AMD GPU Register Attributes"> { + let Content = [{ +Clang supports attributes for controlling register usage on AMD GPU +targets. These attributes may be attached to a kernel function +definition and is an optimization hint to the backend for the maximum +number of registers to use. This is useful in cases where register +limited occupancy is known to be an important factor for the +performance for the kernel. + +The semantics are as follows: + +- The backend will attempt to limit the number of used registers to + the specified value, but the exact number used is not + guaranteed. The number used may be rounded up to satisfy the + allocation requirements or ABI constraints of the subtarget. For + example, on Southern Islands VGPRs may only be allocated in + increments of 4, so requesting a limit of 39 VGPRs will really + attempt to use up to 40. Requesting more registers than the + subtarget supports will truncate to the maximum allowed. The backend + may also use fewer registers than requested whenever possible. + +- 0 implies the default no limit on register usage. + +- Ignored on older VLIW subtargets which did not have separate scalar + and vector registers, R600 through Northern Islands. + +}]; +} + + +def AMDGPUNumVGPRDocs : Documentation { + let Category = DocCatAMDGPURegisterAttributes; + let Content = [{ +Clang supports the +``__attribute__((amdgpu_num_vgpr(<num_registers>)))`` attribute on AMD +Southern Islands GPUs and later for controlling the number of vector +registers. A typical value would be between 4 and 256 in increments +of 4. +}]; +} + +def AMDGPUNumSGPRDocs : Documentation { + let Category = DocCatAMDGPURegisterAttributes; + let Content = [{ + +Clang supports the +``__attribute__((amdgpu_num_sgpr(<num_registers>)))`` attribute on AMD +Southern Islands GPUs and later for controlling the number of scalar +registers. A typical value would be between 8 and 104 in increments of +8. + +Due to common instruction constraints, an additional 2-4 SGPRs are +typically required for internal use depending on features used. This +value is a hint for the total number of SGPRs to use, and not the +number of user SGPRs, so no special consideration needs to be given +for these. +}]; +} + +def DocCatCallingConvs : DocumentationCategory<"Calling Conventions"> { + let Content = [{ +Clang supports several different calling conventions, depending on the target +platform and architecture. The calling convention used for a function determines +how parameters are passed, how results are returned to the caller, and other +low-level details of calling a function. + }]; +} + def PcsDocs : Documentation { - let Category = DocCatFunction; + let Category = DocCatCallingConvs; let Content = [{ -On ARM targets, this can attribute can be used to select calling conventions, +On ARM targets, this attribute can be used to select calling conventions similar to ``stdcall`` on x86. Valid parameter values are "aapcs" and "aapcs-vfp". }]; } +def RegparmDocs : Documentation { + let Category = DocCatCallingConvs; + let Content = [{ +On 32-bit x86 targets, the regparm attribute causes the compiler to pass +the first three integer parameters in EAX, EDX, and ECX instead of on the +stack. This attribute has no effect on variadic functions, and all parameters +are passed via the stack as normal. + }]; +} + +def SysVABIDocs : Documentation { + let Category = DocCatCallingConvs; + let Content = [{ +On Windows x86_64 targets, this attribute changes the calling convention of a +function to match the default convention used on Sys V targets such as Linux, +Mac, and BSD. This attribute has no effect on other targets. + }]; +} + +def MSABIDocs : Documentation { + let Category = DocCatCallingConvs; + let Content = [{ +On non-Windows x86_64 targets, this attribute changes the calling convention of +a function to match the default convention used on Windows x86_64. This +attribute has no effect on Windows targets or non-x86_64 targets. + }]; +} + +def StdCallDocs : Documentation { + let Category = DocCatCallingConvs; + let Content = [{ +On 32-bit x86 targets, this attribute changes the calling convention of a +function to clear parameters off of the stack on return. This convention does +not support variadic calls or unprototyped functions in C, and has no effect on +x86_64 targets. This calling convention is used widely by the Windows API and +COM applications. See the documentation for `__stdcall`_ on MSDN. + +.. _`__stdcall`: http://msdn.microsoft.com/en-us/library/zxk0tw93.aspx + }]; +} + +def FastCallDocs : Documentation { + let Category = DocCatCallingConvs; + let Content = [{ +On 32-bit x86 targets, this attribute changes the calling convention of a +function to use ECX and EDX as register parameters and clear parameters off of +the stack on return. This convention does not support variadic calls or +unprototyped functions in C, and has no effect on x86_64 targets. This calling +convention is supported primarily for compatibility with existing code. Users +seeking register parameters should use the ``regparm`` attribute, which does +not require callee-cleanup. See the documentation for `__fastcall`_ on MSDN. + +.. _`__fastcall`: http://msdn.microsoft.com/en-us/library/6xa169sk.aspx + }]; +} + +def ThisCallDocs : Documentation { + let Category = DocCatCallingConvs; + let Content = [{ +On 32-bit x86 targets, this attribute changes the calling convention of a +function to use ECX for the first parameter (typically the implicit ``this`` +parameter of C++ methods) and clear parameters off of the stack on return. This +convention does not support variadic calls or unprototyped functions in C, and +has no effect on x86_64 targets. See the documentation for `__thiscall`_ on +MSDN. + +.. _`__thiscall`: http://msdn.microsoft.com/en-us/library/ek8tkfbw.aspx + }]; +} + +def VectorCallDocs : Documentation { + let Category = DocCatCallingConvs; + let Content = [{ +On 32-bit x86 *and* x86_64 targets, this attribute changes the calling +convention of a function to pass vector parameters in SSE registers. + +On 32-bit x86 targets, this calling convention is similar to ``__fastcall``. +The first two integer parameters are passed in ECX and EDX. Subsequent integer +parameters are passed in memory, and callee clears the stack. On x86_64 +targets, the callee does *not* clear the stack, and integer parameters are +passed in RCX, RDX, R8, and R9 as is done for the default Windows x64 calling +convention. + +On both 32-bit x86 and x86_64 targets, vector and floating point arguments are +passed in XMM0-XMM5. Homogenous vector aggregates of up to four elements are +passed in sequential SSE registers if enough are available. If AVX is enabled, +256 bit vectors are passed in YMM0-YMM5. Any vector or aggregate type that +cannot be passed in registers for any reason is passed by reference, which +allows the caller to align the parameter memory. + +See the documentation for `__vectorcall`_ on MSDN for more details. + +.. _`__vectorcall`: http://msdn.microsoft.com/en-us/library/dn375768.aspx + }]; +} + def DocCatConsumed : DocumentationCategory<"Consumed Annotation Checking"> { let Content = [{ Clang supports additional attributes for checking basic resource management @@ -987,6 +1176,36 @@ Clang implements two kinds of checks with this attribute. }]; } +def AlignValueDocs : Documentation { + let Category = DocCatType; + let Content = [{ +The align_value attribute can be added to the typedef of a pointer type or the +declaration of a variable of pointer or reference type. It specifies that the +pointer will point to, or the reference will bind to, only objects with at +least the provided alignment. This alignment value must be some positive power +of 2. + + .. code-block:: c + + typedef double * aligned_double_ptr __attribute__((align_value(64))); + void foo(double & x __attribute__((align_value(128)), + aligned_double_ptr y) { ... } + +If the pointer value does not have the specified alignment at runtime, the +behavior of the program is undefined. + }]; +} + +def FlagEnumDocs : Documentation { + let Category = DocCatType; + let Content = [{ +This attribute can be added to an enumerator to signal to the compiler that it +is intended to be used as a flag type. This will cause the compiler to assume +that the range of the type includes all of the values that you can get by +manipulating bits of the enumerator when issuing warnings. + }]; +} + def MSInheritanceDocs : Documentation { let Category = DocCatType; let Heading = "__single_inhertiance, __multiple_inheritance, __virtual_inheritance"; @@ -1045,12 +1264,14 @@ entire application without optimization. Avoiding optimization on the specified function can improve the quality of the debugging information for that function. -This attribute is incompatible with the ``always_inline`` attribute. +This attribute is incompatible with the ``always_inline`` and ``minsize`` +attributes. }]; } def LoopHintDocs : Documentation { let Category = DocCatStmt; + let Heading = "#pragma clang loop"; let Content = [{ The ``#pragma clang loop`` directive allows loop optimization hints to be specified for the subsequent loop. The directive allows vectorization, @@ -1064,10 +1285,11 @@ for details. def UnrollHintDocs : Documentation { let Category = DocCatStmt; + let Heading = "#pragma unroll, #pragma nounroll"; let Content = [{ -Loop unrolling optimization hints can be specified with ``#pragma unroll``. The -pragma is placed immediately before a for, while, do-while, or c++11 range-based -for loop. +Loop unrolling optimization hints can be specified with ``#pragma unroll`` and +``#pragma nounroll``. The pragma is placed immediately before a for, while, +do-while, or c++11 range-based for loop. Specifying ``#pragma unroll`` without a parameter directs the loop unroller to attempt to fully unroll the loop if the trip count is known at compile time: @@ -1095,11 +1317,107 @@ enclosed in parentheses: ... } +Specifying ``#pragma nounroll`` indicates that the loop should not be unrolled: + +.. code-block:: c++ + + #pragma nounroll + for (...) { + ... + } + ``#pragma unroll`` and ``#pragma unroll _value_`` have identical semantics to -``#pragma clang loop unroll(enable)`` and ``#pragma clang loop -unroll_count(_value_)`` respectively. See `language extensions +``#pragma clang loop unroll(full)`` and +``#pragma clang loop unroll_count(_value_)`` respectively. ``#pragma nounroll`` +is equivalent to ``#pragma clang loop unroll(disable)``. See +`language extensions <http://clang.llvm.org/docs/LanguageExtensions.html#extensions-for-loop-hint-optimizations>`_ for further details including limitations of the unroll hints. }]; } +def DocOpenCLAddressSpaces : DocumentationCategory<"OpenCL Address Spaces"> { + let Content = [{ +The address space qualifier may be used to specify the region of memory that is +used to allocate the object. OpenCL supports the following address spaces: +__generic(generic), __global(global), __local(local), __private(private), +__constant(constant). + + .. code-block:: c + + __constant int c = ...; + + __generic int* foo(global int* g) { + __local int* l; + private int p; + ... + return l; + } + +More details can be found in the OpenCL C language Spec v2.0, Section 6.5. + }]; +} + +def OpenCLAddressSpaceGenericDocs : Documentation { + let Category = DocOpenCLAddressSpaces; + let Heading = "__generic(generic)"; + let Content = [{ +The generic address space attribute is only available with OpenCL v2.0 and later. +It can be used with pointer types. Variables in global and local scope and +function parameters in non-kernel functions can have the generic address space +type attribute. It is intended to be a placeholder for any other address space +except for '__constant' in OpenCL code which can be used with multiple address +spaces. + }]; +} + +def OpenCLAddressSpaceConstantDocs : Documentation { + let Category = DocOpenCLAddressSpaces; + let Heading = "__constant(constant)"; + let Content = [{ +The constant address space attribute signals that an object is located in +a constant (non-modifiable) memory region. It is available to all work items. +Any type can be annotated with the constant address space attribute. Objects +with the constant address space qualifier can be declared in any scope and must +have an initializer. + }]; +} + +def OpenCLAddressSpaceGlobalDocs : Documentation { + let Category = DocOpenCLAddressSpaces; + let Heading = "__global(global)"; + let Content = [{ +The global address space attribute specifies that an object is allocated in +global memory, which is accessible by all work items. The content stored in this +memory area persists between kernel executions. Pointer types to the global +address space are allowed as function parameters or local variables. Starting +with OpenCL v2.0, the global address space can be used with global (program +scope) variables and static local variable as well. + }]; +} + +def OpenCLAddressSpaceLocalDocs : Documentation { + let Category = DocOpenCLAddressSpaces; + let Heading = "__local(local)"; + let Content = [{ +The local address space specifies that an object is allocated in the local (work +group) memory area, which is accessible to all work items in the same work +group. The content stored in this memory region is not accessible after +the kernel execution ends. In a kernel function scope, any variable can be in +the local address space. In other scopes, only pointer types to the local address +space are allowed. Local address space variables cannot have an initializer. + }]; +} + +def OpenCLAddressSpacePrivateDocs : Documentation { + let Category = DocOpenCLAddressSpaces; + let Heading = "__private(private)"; + let Content = [{ +The private address space specifies that an object is allocated in the private +(work item) memory. Other work items cannot access the same memory area and its +content is destroyed after work item execution ends. Local variables can be +declared in the private address space. Function arguments are always in the +private address space. Kernel function arguments of a pointer or an array type +cannot point to the private address space. + }]; +} diff --git a/include/clang/Basic/AttrKinds.h b/include/clang/Basic/AttrKinds.h index 150a30e..f0b0a64 100644 --- a/include/clang/Basic/AttrKinds.h +++ b/include/clang/Basic/AttrKinds.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_ATTRKINDS_H -#define LLVM_CLANG_ATTRKINDS_H +#ifndef LLVM_CLANG_BASIC_ATTRKINDS_H +#define LLVM_CLANG_BASIC_ATTRKINDS_H namespace clang { diff --git a/include/clang/Basic/Attributes.h b/include/clang/Basic/Attributes.h index 5783b3b..a64dd56 100644 --- a/include/clang/Basic/Attributes.h +++ b/include/clang/Basic/Attributes.h @@ -10,16 +10,14 @@ #ifndef LLVM_CLANG_BASIC_ATTRIBUTES_H #define LLVM_CLANG_BASIC_ATTRIBUTES_H -#include "llvm/ADT/Triple.h" #include "clang/Basic/LangOptions.h" +#include "llvm/ADT/Triple.h" namespace clang { class IdentifierInfo; enum class AttrSyntax { - /// Is the attribute identifier generally known for any syntax? - Generic, /// Is the identifier known as a GNU-style attribute? GNU, /// Is the identifier known as a __declspec-style attribute? @@ -30,11 +28,11 @@ enum class AttrSyntax { Pragma }; -/// \brief Return true if we recognize and implement the attribute specified by -/// the given information. -bool hasAttribute(AttrSyntax Syntax, const IdentifierInfo *Scope, - const IdentifierInfo *Attr, const llvm::Triple &T, - const LangOptions &LangOpts); +/// \brief Return the version number associated with the attribute if we +/// recognize and implement the attribute specified by the given information. +int hasAttribute(AttrSyntax Syntax, const IdentifierInfo *Scope, + const IdentifierInfo *Attr, const llvm::Triple &T, + const LangOptions &LangOpts); } // end namespace clang diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index e705382..098f5da 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -412,6 +412,7 @@ BUILTIN(__builtin_va_start, "vA.", "nt") BUILTIN(__builtin_va_end, "vA", "n") BUILTIN(__builtin_va_copy, "vAA", "n") BUILTIN(__builtin_stdarg_start, "vA.", "n") +BUILTIN(__builtin_assume_aligned, "v*vC*z.", "nc") BUILTIN(__builtin_bcmp, "iv*v*z", "n") BUILTIN(__builtin_bcopy, "vv*v*z", "n") BUILTIN(__builtin_bzero, "vv*z", "nF") @@ -496,6 +497,7 @@ BUILTIN(__builtin_unreachable, "v", "nr") BUILTIN(__builtin_shufflevector, "v." , "nc") BUILTIN(__builtin_convertvector, "v." , "nct") BUILTIN(__builtin_alloca, "v*z" , "n") +BUILTIN(__builtin_call_with_static_chain, "v.", "nt") // "Overloaded" Atomic operator builtins. These are overloaded to support data // types of i8, i16, i32, i64, and i128. The front-end sees calls to the @@ -540,6 +542,12 @@ BUILTIN(__sync_fetch_and_xor_4, "iiD*i.", "tn") BUILTIN(__sync_fetch_and_xor_8, "LLiLLiD*LLi.", "tn") BUILTIN(__sync_fetch_and_xor_16, "LLLiLLLiD*LLLi.", "tn") +BUILTIN(__sync_fetch_and_nand, "v.", "t") +BUILTIN(__sync_fetch_and_nand_1, "ccD*c.", "tn") +BUILTIN(__sync_fetch_and_nand_2, "ssD*s.", "tn") +BUILTIN(__sync_fetch_and_nand_4, "iiD*i.", "tn") +BUILTIN(__sync_fetch_and_nand_8, "LLiLLiD*LLi.", "tn") +BUILTIN(__sync_fetch_and_nand_16, "LLLiLLLiD*LLLi.", "tn") BUILTIN(__sync_add_and_fetch, "v.", "t") BUILTIN(__sync_add_and_fetch_1, "ccD*c.", "tn") @@ -576,6 +584,13 @@ BUILTIN(__sync_xor_and_fetch_4, "iiD*i.", "tn") BUILTIN(__sync_xor_and_fetch_8, "LLiLLiD*LLi.", "tn") BUILTIN(__sync_xor_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") +BUILTIN(__sync_nand_and_fetch, "v.", "t") +BUILTIN(__sync_nand_and_fetch_1, "ccD*c.", "tn") +BUILTIN(__sync_nand_and_fetch_2, "ssD*s.", "tn") +BUILTIN(__sync_nand_and_fetch_4, "iiD*i.", "tn") +BUILTIN(__sync_nand_and_fetch_8, "LLiLLiD*LLi.", "tn") +BUILTIN(__sync_nand_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") + BUILTIN(__sync_bool_compare_and_swap, "v.", "t") BUILTIN(__sync_bool_compare_and_swap_1, "bcD*cc.", "tn") BUILTIN(__sync_bool_compare_and_swap_2, "bsD*ss.", "tn") @@ -689,6 +704,7 @@ LANGBUILTIN(_InterlockedDecrement, "LiLiD*", "n", ALL_MS_LANGUAGES) LANGBUILTIN(_InterlockedExchangeAdd, "LiLiD*Li", "n", ALL_MS_LANGUAGES) LANGBUILTIN(_InterlockedExchangePointer, "v*v*D*v*", "n", ALL_MS_LANGUAGES) LANGBUILTIN(_InterlockedExchange, "LiLiD*Li", "n", ALL_MS_LANGUAGES) +LANGBUILTIN(__readfsdword, "ULiULi", "n", ALL_MS_LANGUAGES) // C99 library functions // C99 stdlib.h @@ -1173,6 +1189,9 @@ LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h", ALL_LANGUAGES) // Annotation function BUILTIN(__builtin_annotation, "v.", "tn") +// Invariants +BUILTIN(__builtin_assume, "vb", "n") + // Multiprecision Arithmetic Builtins. BUILTIN(__builtin_addcb, "UcUcCUcCUcCUc*", "n") BUILTIN(__builtin_addcs, "UsUsCUsCUsCUs*", "n") diff --git a/include/clang/Basic/Builtins.h b/include/clang/Basic/Builtins.h index f9d30e4..3ce2255 100644 --- a/include/clang/Basic/Builtins.h +++ b/include/clang/Basic/Builtins.h @@ -29,7 +29,7 @@ namespace clang { class ASTContext; class QualType; class LangOptions; - + enum LanguageID { GNU_LANG = 0x1, // builtin requires GNU mode. C_LANG = 0x2, // builtin for c only. @@ -40,7 +40,7 @@ namespace clang { ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode. ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG // builtin requires MS mode. }; - + namespace Builtin { enum ID { NotBuiltin = 0, // This is not a builtin function. diff --git a/include/clang/Basic/BuiltinsAArch64.def b/include/clang/Basic/BuiltinsAArch64.def index 695ecf9..9d223c3 100644 --- a/include/clang/Basic/BuiltinsAArch64.def +++ b/include/clang/Basic/BuiltinsAArch64.def @@ -50,4 +50,7 @@ BUILTIN(__builtin_arm_dmb, "vUi", "nc") BUILTIN(__builtin_arm_dsb, "vUi", "nc") BUILTIN(__builtin_arm_isb, "vUi", "nc") +// Prefetch +BUILTIN(__builtin_arm_prefetch, "vvC*UiUiUiUi", "nc") + #undef BUILTIN diff --git a/include/clang/Basic/BuiltinsARM.def b/include/clang/Basic/BuiltinsARM.def index 2e5eac6..9091ad4 100644 --- a/include/clang/Basic/BuiltinsARM.def +++ b/include/clang/Basic/BuiltinsARM.def @@ -74,13 +74,19 @@ BUILTIN(__builtin_arm_wfe, "v", "") BUILTIN(__builtin_arm_wfi, "v", "") BUILTIN(__builtin_arm_sev, "v", "") BUILTIN(__builtin_arm_sevl, "v", "") +BUILTIN(__builtin_arm_dbg, "vUi", "") // Data barrier BUILTIN(__builtin_arm_dmb, "vUi", "nc") BUILTIN(__builtin_arm_dsb, "vUi", "nc") BUILTIN(__builtin_arm_isb, "vUi", "nc") +// Prefetch +BUILTIN(__builtin_arm_prefetch, "vvC*UiUi", "nc") + // MSVC +LANGBUILTIN(__emit, "vIUiC", "", ALL_MS_LANGUAGES) + LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES) LANGBUILTIN(__wfe, "v", "", ALL_MS_LANGUAGES) LANGBUILTIN(__wfi, "v", "", ALL_MS_LANGUAGES) diff --git a/include/clang/Basic/BuiltinsLe64.def b/include/clang/Basic/BuiltinsLe64.def new file mode 100644 index 0000000..5328606 --- /dev/null +++ b/include/clang/Basic/BuiltinsLe64.def @@ -0,0 +1,19 @@ +//==- BuiltinsLe64.def - Le64 Builtin function database ----------*- C++ -*-==// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the Le64-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. + +BUILTIN(__clear_cache, "vv*v*", "i") + +#undef BUILTIN diff --git a/include/clang/Basic/BuiltinsNVPTX.def b/include/clang/Basic/BuiltinsNVPTX.def index 7e9b5ee..9c920dc 100644 --- a/include/clang/Basic/BuiltinsNVPTX.def +++ b/include/clang/Basic/BuiltinsNVPTX.def @@ -139,8 +139,8 @@ BUILTIN(__nvvm_brev64, "ULLiULLi", "") // Sad -BUILTIN(__nvvm_sad_i, "iii", "") -BUILTIN(__nvvm_sad_ui, "UiUiUi", "") +BUILTIN(__nvvm_sad_i, "iiii", "") +BUILTIN(__nvvm_sad_ui, "UiUiUiUi", "") // Floor, Ceil @@ -255,19 +255,19 @@ BUILTIN(__nvvm_rsqrt_approx_d, "dd", "") // Add -BUILTIN(__nvvm_add_rn_ftz_f, "ff", "") -BUILTIN(__nvvm_add_rn_f, "ff", "") -BUILTIN(__nvvm_add_rz_ftz_f, "ff", "") -BUILTIN(__nvvm_add_rz_f, "ff", "") -BUILTIN(__nvvm_add_rm_ftz_f, "ff", "") -BUILTIN(__nvvm_add_rm_f, "ff", "") -BUILTIN(__nvvm_add_rp_ftz_f, "ff", "") -BUILTIN(__nvvm_add_rp_f, "ff", "") - -BUILTIN(__nvvm_add_rn_d, "dd", "") -BUILTIN(__nvvm_add_rz_d, "dd", "") -BUILTIN(__nvvm_add_rm_d, "dd", "") -BUILTIN(__nvvm_add_rp_d, "dd", "") +BUILTIN(__nvvm_add_rn_ftz_f, "fff", "") +BUILTIN(__nvvm_add_rn_f, "fff", "") +BUILTIN(__nvvm_add_rz_ftz_f, "fff", "") +BUILTIN(__nvvm_add_rz_f, "fff", "") +BUILTIN(__nvvm_add_rm_ftz_f, "fff", "") +BUILTIN(__nvvm_add_rm_f, "fff", "") +BUILTIN(__nvvm_add_rp_ftz_f, "fff", "") +BUILTIN(__nvvm_add_rp_f, "fff", "") + +BUILTIN(__nvvm_add_rn_d, "ddd", "") +BUILTIN(__nvvm_add_rz_d, "ddd", "") +BUILTIN(__nvvm_add_rm_d, "ddd", "") +BUILTIN(__nvvm_add_rp_d, "ddd", "") // Convert diff --git a/include/clang/Basic/BuiltinsPPC.def b/include/clang/Basic/BuiltinsPPC.def index 8a751e4..e42af42 100644 --- a/include/clang/Basic/BuiltinsPPC.def +++ b/include/clang/Basic/BuiltinsPPC.def @@ -204,6 +204,25 @@ BUILTIN(__builtin_altivec_vcmpgtsw_p, "iiV4SiV4Si", "") BUILTIN(__builtin_altivec_vcmpgtuw_p, "iiV4UiV4Ui", "") BUILTIN(__builtin_altivec_vcmpgtfp_p, "iiV4fV4f", "") +// VSX built-ins. + +BUILTIN(__builtin_vsx_lxvd2x, "V2divC*", "") +BUILTIN(__builtin_vsx_lxvw4x, "V4iivC*", "") + +BUILTIN(__builtin_vsx_stxvd2x, "vV2div*", "") +BUILTIN(__builtin_vsx_stxvw4x, "vV4iiv*", "") + +BUILTIN(__builtin_vsx_xvmaxdp, "V2dV2dV2d", "") +BUILTIN(__builtin_vsx_xvmaxsp, "V4fV4fV4f", "") +BUILTIN(__builtin_vsx_xsmaxdp, "ddd", "") + +BUILTIN(__builtin_vsx_xvmindp, "V2dV2dV2d", "") +BUILTIN(__builtin_vsx_xvminsp, "V4fV4fV4f", "") +BUILTIN(__builtin_vsx_xsmindp, "ddd", "") + +BUILTIN(__builtin_vsx_xvdivdp, "V2dV2dV2d", "") +BUILTIN(__builtin_vsx_xvdivsp, "V4fV4fV4f", "") + // FIXME: Obviously incomplete. #undef BUILTIN diff --git a/include/clang/Basic/BuiltinsR600.def b/include/clang/Basic/BuiltinsR600.def index 49135cc..84fc4fa 100644 --- a/include/clang/Basic/BuiltinsR600.def +++ b/include/clang/Basic/BuiltinsR600.def @@ -16,8 +16,8 @@ BUILTIN(__builtin_amdgpu_div_scale, "dddbb*", "n") BUILTIN(__builtin_amdgpu_div_scalef, "fffbb*", "n") -BUILTIN(__builtin_amdgpu_div_fmas, "dddd", "nc") -BUILTIN(__builtin_amdgpu_div_fmasf, "ffff", "nc") +BUILTIN(__builtin_amdgpu_div_fmas, "ddddb", "nc") +BUILTIN(__builtin_amdgpu_div_fmasf, "ffffb", "nc") BUILTIN(__builtin_amdgpu_div_fixup, "dddd", "nc") BUILTIN(__builtin_amdgpu_div_fixupf, "ffff", "nc") BUILTIN(__builtin_amdgpu_trig_preop, "ddi", "nc") @@ -28,5 +28,9 @@ BUILTIN(__builtin_amdgpu_rsq, "dd", "nc") BUILTIN(__builtin_amdgpu_rsqf, "ff", "nc") BUILTIN(__builtin_amdgpu_rsq_clamped, "dd", "nc") BUILTIN(__builtin_amdgpu_rsq_clampedf, "ff", "nc") +BUILTIN(__builtin_amdgpu_ldexp, "ddi", "nc") +BUILTIN(__builtin_amdgpu_ldexpf, "ffi", "nc") +BUILTIN(__builtin_amdgpu_class, "bdi", "nc") +BUILTIN(__builtin_amdgpu_classf, "bfi", "nc") #undef BUILTIN diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index 1f377a8..eb6803b 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -187,13 +187,45 @@ BUILTIN(__builtin_ia32_ucomisdgt, "iV2dV2d", "") BUILTIN(__builtin_ia32_ucomisdge, "iV2dV2d", "") BUILTIN(__builtin_ia32_ucomisdneq, "iV2dV2d", "") BUILTIN(__builtin_ia32_cmpps, "V4fV4fV4fIc", "") +BUILTIN(__builtin_ia32_cmpeqps, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpltps, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpleps, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpunordps, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpneqps, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpnltps, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpnleps, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpordps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmpss, "V4fV4fV4fIc", "") +BUILTIN(__builtin_ia32_cmpeqss, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpltss, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpless, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpunordss, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpneqss, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpnltss, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpnless, "V4fV4fV4f", "") +BUILTIN(__builtin_ia32_cmpordss, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_minps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_maxps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_minss, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_maxss, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_cmppd, "V2dV2dV2dIc", "") +BUILTIN(__builtin_ia32_cmpeqpd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmpltpd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmplepd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmpunordpd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmpneqpd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmpnltpd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmpnlepd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmpordpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_cmpsd, "V2dV2dV2dIc", "") +BUILTIN(__builtin_ia32_cmpeqsd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmpltsd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmplesd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmpunordsd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmpneqsd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmpnltsd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmpnlesd, "V2dV2dV2d", "") +BUILTIN(__builtin_ia32_cmpordsd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_minpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_maxpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_minsd, "V2dV2dV2d", "") @@ -303,12 +335,12 @@ BUILTIN(__builtin_ia32_monitor, "vv*UiUi", "") BUILTIN(__builtin_ia32_mwait, "vUiUi", "") BUILTIN(__builtin_ia32_lddqu, "V16ccC*", "") BUILTIN(__builtin_ia32_palignr128, "V16cV16cV16cIc", "") -BUILTIN(__builtin_ia32_insertps128, "V4fV4fV4fi", "") +BUILTIN(__builtin_ia32_insertps128, "V4fV4fV4fIc", "") BUILTIN(__builtin_ia32_pblendvb128, "V16cV16cV16cV16c", "") -BUILTIN(__builtin_ia32_pblendw128, "V8sV8sV8sIi", "") -BUILTIN(__builtin_ia32_blendpd, "V2dV2dV2dIi", "") -BUILTIN(__builtin_ia32_blendps, "V4fV4fV4fIi", "") +BUILTIN(__builtin_ia32_pblendw128, "V8sV8sV8sIc", "") +BUILTIN(__builtin_ia32_blendpd, "V2dV2dV2dIc", "") +BUILTIN(__builtin_ia32_blendps, "V4fV4fV4fIc", "") BUILTIN(__builtin_ia32_blendvpd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_blendvps, "V4fV4fV4fV4f", "") @@ -339,13 +371,13 @@ BUILTIN(__builtin_ia32_roundps, "V4fV4fi", "") BUILTIN(__builtin_ia32_roundss, "V4fV4fV4fi", "") BUILTIN(__builtin_ia32_roundsd, "V2dV2dV2di", "") BUILTIN(__builtin_ia32_roundpd, "V2dV2di", "") -BUILTIN(__builtin_ia32_dpps, "V4fV4fV4fi", "") -BUILTIN(__builtin_ia32_dppd, "V2dV2dV2di", "") +BUILTIN(__builtin_ia32_dpps, "V4fV4fV4fIc", "") +BUILTIN(__builtin_ia32_dppd, "V2dV2dV2dIc", "") BUILTIN(__builtin_ia32_movntdqa, "V2LLiV2LLi*", "") BUILTIN(__builtin_ia32_ptestz128, "iV2LLiV2LLi", "") BUILTIN(__builtin_ia32_ptestc128, "iV2LLiV2LLi", "") BUILTIN(__builtin_ia32_ptestnzc128, "iV2LLiV2LLi", "") -BUILTIN(__builtin_ia32_mpsadbw128, "V16cV16cV16ci", "") +BUILTIN(__builtin_ia32_mpsadbw128, "V16cV16cV16cIc", "") BUILTIN(__builtin_ia32_phminposuw128, "V8sV8s", "") // SSE 4.2 @@ -404,13 +436,13 @@ BUILTIN(__builtin_ia32_vpermilvarpd, "V2dV2dV2LLi", "") BUILTIN(__builtin_ia32_vpermilvarps, "V4fV4fV4i", "") BUILTIN(__builtin_ia32_vpermilvarpd256, "V4dV4dV4LLi", "") BUILTIN(__builtin_ia32_vpermilvarps256, "V8fV8fV8i", "") -BUILTIN(__builtin_ia32_blendpd256, "V4dV4dV4dIi", "") -BUILTIN(__builtin_ia32_blendps256, "V8fV8fV8fIi", "") +BUILTIN(__builtin_ia32_blendpd256, "V4dV4dV4dIc", "") +BUILTIN(__builtin_ia32_blendps256, "V8fV8fV8fIc", "") BUILTIN(__builtin_ia32_blendvpd256, "V4dV4dV4dV4d", "") BUILTIN(__builtin_ia32_blendvps256, "V8fV8fV8fV8f", "") -BUILTIN(__builtin_ia32_dpps256, "V8fV8fV8fIi", "") -BUILTIN(__builtin_ia32_cmppd256, "V4dV4dV4dc", "") -BUILTIN(__builtin_ia32_cmpps256, "V8fV8fV8fc", "") +BUILTIN(__builtin_ia32_dpps256, "V8fV8fV8fIc", "") +BUILTIN(__builtin_ia32_cmppd256, "V4dV4dV4dIc", "") +BUILTIN(__builtin_ia32_cmpps256, "V8fV8fV8fIc", "") BUILTIN(__builtin_ia32_vextractf128_pd256, "V2dV4dIc", "") BUILTIN(__builtin_ia32_vextractf128_ps256, "V4fV8fIc", "") BUILTIN(__builtin_ia32_vextractf128_si256, "V4iV8iIc", "") @@ -472,7 +504,7 @@ BUILTIN(__builtin_ia32_maskstorepd256, "vV4d*V4dV4d", "") BUILTIN(__builtin_ia32_maskstoreps256, "vV8f*V8fV8f", "") // AVX2 -BUILTIN(__builtin_ia32_mpsadbw256, "V32cV32cV32ci", "") +BUILTIN(__builtin_ia32_mpsadbw256, "V32cV32cV32cIc", "") BUILTIN(__builtin_ia32_pabsb256, "V32cV32c", "") BUILTIN(__builtin_ia32_pabsw256, "V16sV16s", "") BUILTIN(__builtin_ia32_pabsd256, "V8iV8i", "") @@ -492,7 +524,7 @@ BUILTIN(__builtin_ia32_palignr256, "V32cV32cV32cIc", "") BUILTIN(__builtin_ia32_pavgb256, "V32cV32cV32c", "") BUILTIN(__builtin_ia32_pavgw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_pblendvb256, "V32cV32cV32cV32c", "") -BUILTIN(__builtin_ia32_pblendw256, "V16sV16sV16sIi", "") +BUILTIN(__builtin_ia32_pblendw256, "V16sV16sV16sIc", "") BUILTIN(__builtin_ia32_phaddw256, "V16sV16sV16s", "") BUILTIN(__builtin_ia32_phaddd256, "V8iV8iV8i", "") BUILTIN(__builtin_ia32_phaddsw256, "V16sV16sV16s", "") @@ -559,8 +591,8 @@ BUILTIN(__builtin_ia32_vbroadcastss_ps, "V4fV4f", "") BUILTIN(__builtin_ia32_vbroadcastss_ps256, "V8fV4f", "") BUILTIN(__builtin_ia32_vbroadcastsd_pd256, "V4dV2d", "") BUILTIN(__builtin_ia32_vbroadcastsi256, "V4LLiV2LLi", "") -BUILTIN(__builtin_ia32_pblendd128, "V4iV4iV4iIi", "") -BUILTIN(__builtin_ia32_pblendd256, "V8iV8iV8iIi", "") +BUILTIN(__builtin_ia32_pblendd128, "V4iV4iV4iIc", "") +BUILTIN(__builtin_ia32_pblendd256, "V8iV8iV8iIc", "") BUILTIN(__builtin_ia32_pbroadcastb256, "V32cV16c", "") BUILTIN(__builtin_ia32_pbroadcastw256, "V16sV8s", "") BUILTIN(__builtin_ia32_pbroadcastd256, "V8iV4i", "") @@ -615,14 +647,34 @@ BUILTIN(__builtin_ia32_gatherq_d256, "V4iV4iV4iC*V4LLiV4iIc", "") // F16C BUILTIN(__builtin_ia32_vcvtps2ph, "V8sV4fIi", "") BUILTIN(__builtin_ia32_vcvtps2ph256, "V8sV8fIi", "") +BUILTIN(__builtin_ia32_vcvtps2ph512, "V16sV16fIi", "") BUILTIN(__builtin_ia32_vcvtph2ps, "V4fV8s", "") BUILTIN(__builtin_ia32_vcvtph2ps256, "V8fV8s", "") +BUILTIN(__builtin_ia32_vcvtph2ps512, "V16fV16s", "") // RDRAND BUILTIN(__builtin_ia32_rdrand16_step, "UiUs*", "") BUILTIN(__builtin_ia32_rdrand32_step, "UiUi*", "") BUILTIN(__builtin_ia32_rdrand64_step, "UiULLi*", "") +// FSGSBASE +BUILTIN(__builtin_ia32_rdfsbase32, "Ui", "") +BUILTIN(__builtin_ia32_rdfsbase64, "ULLi", "") +BUILTIN(__builtin_ia32_rdgsbase32, "Ui", "") +BUILTIN(__builtin_ia32_rdgsbase64, "ULLi", "") +BUILTIN(__builtin_ia32_wrfsbase32, "vUi", "") +BUILTIN(__builtin_ia32_wrfsbase64, "vULLi", "") +BUILTIN(__builtin_ia32_wrgsbase32, "vUi", "") +BUILTIN(__builtin_ia32_wrgsbase64, "vULLi", "") + +// ADX +BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "") +BUILTIN(__builtin_ia32_addcarryx_u64, "UcUcULLiULLiULLi*", "") +BUILTIN(__builtin_ia32_addcarry_u32, "UcUcUiUiUi*", "") +BUILTIN(__builtin_ia32_addcarry_u64, "UcUcULLiULLiULLi*", "") +BUILTIN(__builtin_ia32_subborrow_u32, "UcUcUiUiUi*", "") +BUILTIN(__builtin_ia32_subborrow_u64, "UcUcULLiULLiULLi*", "") + // RDSEED BUILTIN(__builtin_ia32_rdseed16_step, "UiUs*", "") BUILTIN(__builtin_ia32_rdseed32_step, "UiUi*", "") @@ -653,7 +705,7 @@ BUILTIN(__builtin_ia32_sha256rnds2, "V4iV4iV4iV4i", "") BUILTIN(__builtin_ia32_sha256msg1, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_sha256msg2, "V4iV4iV4i", "") -// FMA4 +// FMA BUILTIN(__builtin_ia32_vfmaddps, "V4fV4fV4fV4f", "") BUILTIN(__builtin_ia32_vfmaddpd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_vfmaddss, "V4fV4fV4fV4f", "") @@ -686,6 +738,12 @@ BUILTIN(__builtin_ia32_vfmaddsubps256, "V8fV8fV8fV8f", "") BUILTIN(__builtin_ia32_vfmaddsubpd256, "V4dV4dV4dV4d", "") BUILTIN(__builtin_ia32_vfmsubaddps256, "V8fV8fV8fV8f", "") BUILTIN(__builtin_ia32_vfmsubaddpd256, "V4dV4dV4dV4d", "") +BUILTIN(__builtin_ia32_vfmaddpd512_mask, "V8dV8dV8dV8dUci", "") +BUILTIN(__builtin_ia32_vfmsubpd512_mask, "V8dV8dV8dV8dUci", "") +BUILTIN(__builtin_ia32_vfnmaddpd512_mask, "V8dV8dV8dV8dUci", "") +BUILTIN(__builtin_ia32_vfmaddps512_mask, "V16fV16fV16fV16fUsi", "") +BUILTIN(__builtin_ia32_vfmsubps512_mask, "V16fV16fV16fV16fUsi", "") +BUILTIN(__builtin_ia32_vfnmaddps512_mask, "V16fV16fV16fV16fUsi", "") // XOP BUILTIN(__builtin_ia32_vpmacssww, "V8sV8sV8sV8s", "") @@ -761,4 +819,119 @@ BUILTIN(__builtin_ia32_rdpmc, "ULLii", "") BUILTIN(__builtin_ia32_rdtsc, "ULLi", "") BUILTIN(__builtin_ia32_rdtscp, "ULLiUi*", "") +// AVX-512 +BUILTIN(__builtin_ia32_sqrtpd512_mask, "V8dV8dV8dUciC", "") +BUILTIN(__builtin_ia32_sqrtps512_mask, "V16fV16fV16fUsiC", "") +BUILTIN(__builtin_ia32_rsqrt14sd_mask, "V2dV2dV2dV2dUc", "") +BUILTIN(__builtin_ia32_rsqrt14ss_mask, "V4fV4fV4fV4fUc", "") +BUILTIN(__builtin_ia32_rsqrt14pd512_mask, "V8dV8dV8dUc", "") +BUILTIN(__builtin_ia32_rsqrt14ps512_mask, "V16fV16fV16fUs", "") +BUILTIN(__builtin_ia32_rsqrt28sd_mask, "V2dV2dV2dV2dUciC", "") +BUILTIN(__builtin_ia32_rsqrt28ss_mask, "V4fV4fV4fV4fUciC", "") +BUILTIN(__builtin_ia32_rsqrt28pd_mask, "V8dV8dV8dUciC", "") +BUILTIN(__builtin_ia32_rsqrt28ps_mask, "V16fV16fV16fUsiC", "") +BUILTIN(__builtin_ia32_rcp14sd_mask, "V2dV2dV2dV2dUc", "") +BUILTIN(__builtin_ia32_rcp14ss_mask, "V4fV4fV4fV4fUc", "") +BUILTIN(__builtin_ia32_rcp14pd512_mask, "V8dV8dV8dUc", "") +BUILTIN(__builtin_ia32_rcp14ps512_mask, "V16fV16fV16fUs", "") +BUILTIN(__builtin_ia32_rcp28sd_mask, "V2dV2dV2dV2dUciC", "") +BUILTIN(__builtin_ia32_rcp28ss_mask, "V4fV4fV4fV4fUciC", "") +BUILTIN(__builtin_ia32_rcp28pd_mask, "V8dV8dV8dUciC", "") +BUILTIN(__builtin_ia32_rcp28ps_mask, "V16fV16fV16fUsiC", "") +BUILTIN(__builtin_ia32_cvttps2dq512_mask, "V16iV16fV16iUsiC", "") +BUILTIN(__builtin_ia32_cvttps2udq512_mask, "V16iV16fV16iUsiC", "") +BUILTIN(__builtin_ia32_cvttpd2dq512_mask, "V8iV8dV8iUciC", "") +BUILTIN(__builtin_ia32_cvttpd2udq512_mask, "V8iV8dV8iUciC", "") +BUILTIN(__builtin_ia32_cmpps512_mask, "UsV16fV16fiCUsi", "") +BUILTIN(__builtin_ia32_pcmpeqb512_mask, "LLiV64cV64cLLi", "") +BUILTIN(__builtin_ia32_pcmpeqd512_mask, "sV16iV16is", "") +BUILTIN(__builtin_ia32_pcmpeqq512_mask, "cV8LLiV8LLic", "") +BUILTIN(__builtin_ia32_pcmpeqw512_mask, "iV32sV32si", "") +BUILTIN(__builtin_ia32_pcmpeqb256_mask, "iV32cV32ci", "") +BUILTIN(__builtin_ia32_pcmpeqd256_mask, "cV8iV8ic", "") +BUILTIN(__builtin_ia32_pcmpeqq256_mask, "cV4LLiV4LLic", "") +BUILTIN(__builtin_ia32_pcmpeqw256_mask, "sV16sV16ss", "") +BUILTIN(__builtin_ia32_pcmpeqb128_mask, "sV16cV16cs", "") +BUILTIN(__builtin_ia32_pcmpeqd128_mask, "cV4iV4ic", "") +BUILTIN(__builtin_ia32_pcmpeqq128_mask, "cV2LLiV2LLic", "") +BUILTIN(__builtin_ia32_pcmpeqw128_mask, "cV8sV8sc", "") +BUILTIN(__builtin_ia32_cmppd512_mask, "UcV8dV8diCUci", "") +BUILTIN(__builtin_ia32_rndscaleps_mask, "V16fV16fiCV16fUsiC", "") +BUILTIN(__builtin_ia32_rndscalepd_mask, "V8dV8diCV8dUciC", "") +BUILTIN(__builtin_ia32_cvtps2dq512_mask, "V16iV16fV16iUsiC", "") +BUILTIN(__builtin_ia32_cvtpd2dq512_mask, "V8iV8dV8iUciC", "") +BUILTIN(__builtin_ia32_cvtps2udq512_mask, "V16iV16fV16iUsiC", "") +BUILTIN(__builtin_ia32_cvtpd2udq512_mask, "V8iV8dV8iUciC", "") +BUILTIN(__builtin_ia32_minps512_mask, "V16fV16fV16fV16fUsiC", "") +BUILTIN(__builtin_ia32_minpd512_mask, "V8dV8dV8dV8dUciC", "") +BUILTIN(__builtin_ia32_maxps512_mask, "V16fV16fV16fV16fUsiC", "") +BUILTIN(__builtin_ia32_maxpd512_mask, "V8dV8dV8dV8dUciC", "") +BUILTIN(__builtin_ia32_cvtdq2ps512_mask, "V16fV16iV16fUsiC", "") +BUILTIN(__builtin_ia32_cvtudq2ps512_mask, "V16fV16iV16fUsiC", "") +BUILTIN(__builtin_ia32_cvtdq2pd512_mask, "V8dV8iV8dUc", "") +BUILTIN(__builtin_ia32_cvtudq2pd512_mask, "V8dV8iV8dUc", "") +BUILTIN(__builtin_ia32_cvtpd2ps512_mask, "V8fV8dV8fUciC", "") +BUILTIN(__builtin_ia32_vcvtps2ph512_mask, "V16sV16fiCV16sUs", "") +BUILTIN(__builtin_ia32_vcvtph2ps512_mask, "V16fV16sV16fUsiC", "") +BUILTIN(__builtin_ia32_pabsd512_mask, "V16iV16iV16iUs", "") +BUILTIN(__builtin_ia32_pabsq512_mask, "V8LLiV8LLiV8LLiUc", "") +BUILTIN(__builtin_ia32_pmaxsd512_mask, "V16iV16iV16iV16iUs", "") +BUILTIN(__builtin_ia32_pmaxsq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") +BUILTIN(__builtin_ia32_pmaxud512_mask, "V16iV16iV16iV16iUs", "") +BUILTIN(__builtin_ia32_pmaxuq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") +BUILTIN(__builtin_ia32_pminsd512_mask, "V16iV16iV16iV16iUs", "") +BUILTIN(__builtin_ia32_pminsq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") +BUILTIN(__builtin_ia32_pminud512_mask, "V16iV16iV16iV16iUs", "") +BUILTIN(__builtin_ia32_pminuq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") +BUILTIN(__builtin_ia32_pmuldq512_mask, "V8LLiV16iV16iV8LLiUc", "") +BUILTIN(__builtin_ia32_pmuludq512_mask, "V8LLiV16iV16iV8LLiUc", "") +BUILTIN(__builtin_ia32_blendmd_512_mask, "V16iV16iV16iUs", "") +BUILTIN(__builtin_ia32_blendmq_512_mask, "V8LLiV8LLiV8LLiUc", "") +BUILTIN(__builtin_ia32_blendmps_512_mask, "V16fV16fV16fUs", "") +BUILTIN(__builtin_ia32_blendmpd_512_mask, "V8dV8dV8dUc", "") +BUILTIN(__builtin_ia32_ptestmd512, "UsV16iV16iUs", "") +BUILTIN(__builtin_ia32_ptestmq512, "UcV8LLiV8LLiUc", "") +BUILTIN(__builtin_ia32_pbroadcastd512_gpr_mask, "V16iiV16iUs", "") +BUILTIN(__builtin_ia32_pbroadcastq512_gpr_mask, "V8LLiLLiV8LLiUc", "") +BUILTIN(__builtin_ia32_pbroadcastq512_mem_mask, "V8LLiLLiV8LLiUc", "") +BUILTIN(__builtin_ia32_loaddqusi512_mask, "V16ivC*V16iUs", "") +BUILTIN(__builtin_ia32_loaddqudi512_mask, "V8LLivC*V8LLiUc", "") +BUILTIN(__builtin_ia32_loadups512_mask, "V16fvC*V16fUs", "") +BUILTIN(__builtin_ia32_loadupd512_mask, "V8dvC*V8dUc", "") +BUILTIN(__builtin_ia32_storedqudi512_mask, "vv*V8LLiUc", "") +BUILTIN(__builtin_ia32_storedqusi512_mask, "vv*V16iUs", "") +BUILTIN(__builtin_ia32_storeupd512_mask, "vv*V8dUc", "") +BUILTIN(__builtin_ia32_storeups512_mask, "vv*V16fUs", "") +BUILTIN(__builtin_ia32_vpermt2vard512_mask, "V16iV16iV16iV16iUs", "") +BUILTIN(__builtin_ia32_vpermt2varq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "") +BUILTIN(__builtin_ia32_vpermt2varps512_mask, "V16fV16iV16fV16fUs", "") +BUILTIN(__builtin_ia32_vpermt2varpd512_mask, "V8dV8LLiV8dV8dUc", "") +BUILTIN(__builtin_ia32_alignq512_mask, "V8LLiV8LLiV8LLiUcV8LLiUc", "") +BUILTIN(__builtin_ia32_alignd512_mask, "V16iV16iV16iUcV16iUc", "") +BUILTIN(__builtin_ia32_gathersiv8df, "V8dV8dvC*V8iUciC", "") +BUILTIN(__builtin_ia32_gathersiv16sf, "V16fV16fvC*UsiC", "") +BUILTIN(__builtin_ia32_gatherdiv8df, "V8dV8dvC*V8LLiUciC", "") +BUILTIN(__builtin_ia32_gatherdiv16sf, "V8fV8fvC*V8LLiUciC", "") +BUILTIN(__builtin_ia32_gathersiv8di, "V8LLiV8LLivC*V8iUciC", "") +BUILTIN(__builtin_ia32_gathersiv16si, "V16iV16ivC*UsiC", "") +BUILTIN(__builtin_ia32_gatherdiv8di, "V8LLiV8LLivC*V8LLiUciC", "") +BUILTIN(__builtin_ia32_gatherdiv16si, "V8iV8ivC*V8LLiUciC", "") +BUILTIN(__builtin_ia32_scattersiv8df, "vv*UcV8iV8diC", "") +BUILTIN(__builtin_ia32_scattersiv16sf, "vv*UsV16iV16fiC", "") +BUILTIN(__builtin_ia32_scatterdiv8df, "vv*UcV8LLiV8diC", "") +BUILTIN(__builtin_ia32_scatterdiv16sf, "vv*UcV8LLiV8fiC", "") +BUILTIN(__builtin_ia32_scattersiv8di, "vv*UcV8iV8LLiiC", "") +BUILTIN(__builtin_ia32_scattersiv16si, "vv*UsV16iV16iiC", "") +BUILTIN(__builtin_ia32_scatterdiv8di, "vv*UcV8LLiV8LLiiC", "") +BUILTIN(__builtin_ia32_scatterdiv16si, "vv*UcV8LLiV8iiC", "") +BUILTIN(__builtin_ia32_gatherpfdpd, "vUcV8ivC*iCiC", "") +BUILTIN(__builtin_ia32_gatherpfdps, "vUsV16ivC*iCiC", "") +BUILTIN(__builtin_ia32_gatherpfqpd, "vUcV8LLivC*iCiC", "") +BUILTIN(__builtin_ia32_gatherpfqps, "vUcV8LLivC*iCiC", "") +BUILTIN(__builtin_ia32_scatterpfdpd, "vUcV8iv*iCiC", "") +BUILTIN(__builtin_ia32_scatterpfdps, "vUsV16iv*iCiC", "") +BUILTIN(__builtin_ia32_scatterpfqpd, "vUcV8LLiv*iCiC", "") +BUILTIN(__builtin_ia32_scatterpfqps, "vUcV8LLiv*iCiC", "") +BUILTIN(__builtin_ia32_knothi, "UsUs", "") + #undef BUILTIN diff --git a/include/clang/Basic/CharInfo.h b/include/clang/Basic/CharInfo.h index d0afda4..dd9c554 100644 --- a/include/clang/Basic/CharInfo.h +++ b/include/clang/Basic/CharInfo.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef CLANG_BASIC_CHARINFO_H -#define CLANG_BASIC_CHARINFO_H +#ifndef LLVM_CLANG_BASIC_CHARINFO_H +#define LLVM_CLANG_BASIC_CHARINFO_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/StringRef.h" diff --git a/include/clang/Basic/CommentOptions.h b/include/clang/Basic/CommentOptions.h index 7991875..92419f9 100644 --- a/include/clang/Basic/CommentOptions.h +++ b/include/clang/Basic/CommentOptions.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_COMMENTOPTIONS_H -#define LLVM_CLANG_COMMENTOPTIONS_H +#ifndef LLVM_CLANG_BASIC_COMMENTOPTIONS_H +#define LLVM_CLANG_BASIC_COMMENTOPTIONS_H #include <string> #include <vector> diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index a7b2ba2..91e94db 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_DIAGNOSTIC_H -#define LLVM_CLANG_DIAGNOSTIC_H +#ifndef LLVM_CLANG_BASIC_DIAGNOSTIC_H +#define LLVM_CLANG_BASIC_DIAGNOSTIC_H #include "clang/Basic/DiagnosticIDs.h" #include "clang/Basic/DiagnosticOptions.h" @@ -187,7 +187,7 @@ private: IntrusiveRefCntPtr<DiagnosticIDs> Diags; IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts; DiagnosticConsumer *Client; - bool OwnsDiagClient; + std::unique_ptr<DiagnosticConsumer> Owner; SourceManager *SourceMgr; /// \brief Mapping information for diagnostics. @@ -302,7 +302,6 @@ private: unsigned NumWarnings; ///< Number of warnings reported unsigned NumErrors; ///< Number of errors reported - unsigned NumErrorsSuppressed; ///< Number of errors suppressed /// \brief A function pointer that converts an opaque diagnostic /// argument to a strings. @@ -369,14 +368,11 @@ public: const DiagnosticConsumer *getClient() const { return Client; } /// \brief Determine whether this \c DiagnosticsEngine object own its client. - bool ownsClient() const { return OwnsDiagClient; } - + bool ownsClient() const { return Owner != nullptr; } + /// \brief Return the current diagnostic client along with ownership of that /// client. - DiagnosticConsumer *takeClient() { - OwnsDiagClient = false; - return Client; - } + std::unique_ptr<DiagnosticConsumer> takeClient() { return std::move(Owner); } bool hasSourceManager() const { return SourceMgr != nullptr; } SourceManager &getSourceManager() const { diff --git a/include/clang/Basic/DiagnosticASTKinds.td b/include/clang/Basic/DiagnosticASTKinds.td index 8d5a1c7..d353b45 100644 --- a/include/clang/Basic/DiagnosticASTKinds.td +++ b/include/clang/Basic/DiagnosticASTKinds.td @@ -141,6 +141,13 @@ def note_constexpr_calls_suppressed : Note< "(skipping %0 call%s0 in backtrace; use -fconstexpr-backtrace-limit=0 to " "see all)">; def note_constexpr_call_here : Note<"in call to '%0'">; +def note_constexpr_baa_insufficient_alignment : Note< + "%select{alignment of|offset of the aligned pointer from}0 the base pointee " + "object (%1 %plural{1:byte|:bytes}1) is %select{less than|not a multiple of}0 the " + "asserted %2 %plural{1:byte|:bytes}2">; +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 warn_integer_constant_overflow : Warning< "overflow in expression; result is %0 with type %1">, diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td index b3c77b8..ff9ed69 100644 --- a/include/clang/Basic/DiagnosticCommonKinds.td +++ b/include/clang/Basic/DiagnosticCommonKinds.td @@ -81,6 +81,8 @@ def err_deleted_non_function : Error< "only functions can have deleted definitions">; def err_module_not_found : Error<"module '%0' not found">, DefaultFatal; def err_module_not_built : Error<"could not build module '%0'">, DefaultFatal; +def err_module_lock_failure : Error< + "could not acquire lock file for module '%0'">, DefaultFatal; def err_module_cycle : Error<"cyclic dependency in module '%0': %1">, DefaultFatal; def note_pragma_entered_here : Note<"#pragma entered here">; @@ -102,10 +104,12 @@ def ext_cxx11_longlong : Extension< def warn_cxx98_compat_longlong : Warning< "'long long' is incompatible with C++98">, InGroup<CXX98CompatPedantic>, DefaultIgnore; -def err_integer_too_large : Error< - "integer constant is larger than the largest unsigned integer type">; -def ext_integer_too_large_for_signed : ExtWarn< - "integer constant is larger than the largest signed integer type">, +def err_integer_literal_too_large : Error< + "integer literal is too large to be represented in any %select{signed |}0" + "integer type">; +def ext_integer_literal_too_large_for_signed : ExtWarn< + "integer literal is too large to be represented in a signed integer type, " + "interpreting as unsigned">, InGroup<DiagGroup<"implicitly-unsigned-literal">>; // Sema && AST @@ -121,6 +125,8 @@ def err_target_unknown_abi : Error<"unknown target ABI '%0'">; def err_target_unknown_fpmath : Error<"unknown FP unit '%0'">; def err_target_unsupported_fpmath : Error< "the '%0' unit is not supported with this instruction set">; +def err_target_unsupported_unaligned : Error< + "the %0 sub-architecture does not support unaligned accesses">; // Source manager def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal; diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index cd26a6a..41c78ee 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -22,6 +22,8 @@ def err_drv_unknown_stdin_type_clang_cl : Error< def err_drv_unknown_language : Error<"language not recognized: '%0'">; def err_drv_invalid_arch_name : Error< "invalid arch name '%0'">; +def err_drv_invalid_thread_model_for_target : Error< + "invalid thread model '%0' in '%1' for this target">; def err_drv_invalid_linker_name : Error< "invalid linker name in argument '%0'">; def err_drv_invalid_rtlib_name : Error< @@ -100,10 +102,6 @@ def err_drv_cc_print_options_failure : Error< "unable to open CC_PRINT_OPTIONS file: %0">; def err_drv_preamble_format : Error< "incorrect format for -preamble-bytes=N,END">; -def err_drv_conflicting_deployment_targets : Error< - "conflicting deployment targets, both '%0' and '%1' are present in environment">; -def err_drv_invalid_arch_for_deployment_target : Error< - "invalid architecture '%0' for deployment target '%1'">; def err_drv_objc_gc_arr : Error< "cannot specify both '-fobjc-arc' and '%0'">; def err_arc_unsupported_on_runtime : Error< @@ -124,7 +122,7 @@ def warn_O4_is_O3 : Warning<"-O4 is equivalent to -O3">, InGroup<Deprecated>; def warn_drv_optimization_value : Warning<"optimization level '%0' is not supported; using '%1%2' instead">, InGroup<InvalidCommandLineArgument>; def warn_ignored_gcc_optimization : Warning<"optimization flag '%0' is not supported">, - InGroup<InvalidCommandLineArgument>; + InGroup<IgnoredOptimizationArgument>; def warn_c_kext : Warning< "ignoring -fapple-kext which is valid for C++ and Objective-C++ only">; def warn_drv_input_file_unused : Warning< @@ -165,9 +163,11 @@ def warn_debug_compression_unavailable : Warning<"cannot compress debug sections def note_drv_command_failed_diag_msg : Note< "diagnostic msg: %0">; -def note_drv_t_option_is_global : - Note<"The last /TC or /TP option takes precedence over earlier instances">; - +def note_drv_t_option_is_global : Note< + "The last /TC or /TP option takes precedence over earlier instances">; +def note_drv_address_sanitizer_debug_runtime : Note< + "AddressSanitizer doesn't support linking with debug runtime libraries yet">; + def err_analyzer_config_no_value : Error< "analyzer-config option '%0' has a key but no value">; def err_analyzer_config_multiple_values : Error< @@ -175,7 +175,7 @@ def err_analyzer_config_multiple_values : Error< def err_drv_modules_validate_once_requires_timestamp : Error< "option '-fmodules-validate-once-per-build-session' requires " - "'-fbuild-session-timestamp=<seconds since Epoch>'">; + "'-fbuild-session-timestamp=<seconds since Epoch>' or '-fbuild-session-file=<file>'">; def warn_drv_invoking_fallback : Warning<"falling back to %0">, InGroup<Fallback>; diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index ae704c4..15f74b11 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -46,6 +46,16 @@ def warn_fe_backend_optimization_failure : Warning<"%0">, BackendInfo, def note_fe_backend_optimization_remark_invalid_loc : Note<"could " "not determine the original source location for %0:%1:%2">; +def remark_sanitize_address_insert_extra_padding_accepted : Remark< + "-fsanitize-address-field-padding applied to %0">, ShowInSystemHeader, + InGroup<SanitizeAddressRemarks>; +def remark_sanitize_address_insert_extra_padding_rejected : Remark< + "-fsanitize-address-field-padding ignored for %0 because it " + "%select{is not C++|is packed|is a union|is trivially copyable|" + "has trivial destructor|is standard layout|is in a blacklisted file|" + "is blacklisted}1">, ShowInSystemHeader, + InGroup<SanitizeAddressRemarks>; + 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">, @@ -85,9 +95,12 @@ def err_fe_no_pch_in_dir : Error< def err_fe_action_not_available : Error< "action %0 not compiled in">; +def warn_fe_serialized_diag_merge_failure : Warning< + "unable to merge a subprocess's serialized diagnostics">, + InGroup<SerializedDiagnostics>; def warn_fe_serialized_diag_failure : Warning< "unable to open file %0 for serializing diagnostics (%1)">, - InGroup<DiagGroup<"serialized-diagnostics">>; + InGroup<SerializedDiagnostics>; def err_verify_missing_line : Error< "missing or invalid line number following '@' in expected %0">; @@ -135,12 +148,15 @@ def warn_unknown_warning_specifier : Warning< def err_unknown_analyzer_checker : Error< "no analyzer checkers are associated with '%0'">; +def note_suggest_disabling_all_checkers : Note< + "use -analyzer-disable-all-checks to disable all static analyzer checkers">; + def warn_incompatible_analyzer_plugin_api : Warning< "checker plugin '%0' is not compatible with this version of the analyzer">, InGroup<DiagGroup<"analyzer-incompatible-plugin"> >; def note_incompatible_analyzer_plugin_api : Note< "current API version is '%0', but plugin was compiled with version '%1'">; - + def err_module_map_not_found : Error<"module map file '%0' not found">, DefaultFatal; def err_missing_module_name : Error< @@ -167,7 +183,19 @@ def warn_module_config_macro_undef : Warning< def note_module_def_undef_here : Note< "macro was %select{defined|#undef'd}0 here">; def remark_module_build : Remark<"building module '%0' as '%1'">, - InGroup<DiagGroup<"module-build">>; + InGroup<ModuleBuild>; +def remark_module_build_done : Remark<"finished building module '%0'">, + InGroup<ModuleBuild>; + +def err_conflicting_module_names : Error< + "conflicting module names specified: '-fmodule-name=%0' and " + "'-fmodule-implementation-of %1'">; +def err_conflicting_module_files : Error< + "module '%0' is defined in both '%1' and '%2'">; +def err_module_file_not_found : Error< + "file '%0' is not a precompiled module file">, DefaultFatal; +def err_module_file_not_module : Error< + "AST file '%0' was not built as a module">, DefaultFatal; def err_missing_vfs_overlay_file : Error< "virtual filesystem overlay file '%0' not found">, DefaultFatal; diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 58dee48..75d40b1 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -60,7 +60,7 @@ def ExternCCompat : DiagGroup<"extern-c-compat">; def KeywordCompat : DiagGroup<"keyword-compat">; def GNUCaseRange : DiagGroup<"gnu-case-range">; def CastAlign : DiagGroup<"cast-align">; -def : DiagGroup<"cast-qual">; +def CastQual : DiagGroup<"cast-qual">; def : DiagGroup<"char-align">; def Comment : DiagGroup<"comment">; def GNUComplexInteger : DiagGroup<"gnu-complex-integer">; @@ -71,6 +71,7 @@ def GNUDesignator : DiagGroup<"gnu-designator">; def GNUStringLiteralOperatorTemplate : DiagGroup<"gnu-string-literal-operator-template">; +def DeleteIncomplete : DiagGroup<"delete-incomplete">; def DeleteNonVirtualDtor : DiagGroup<"delete-non-virtual-dtor">; def AbstractFinalClass : DiagGroup<"abstract-final-class">; @@ -118,9 +119,9 @@ def FormatExtraArgs : DiagGroup<"format-extra-args">; def FormatZeroLength : DiagGroup<"format-zero-length">; // Warnings for C++1y code which is not compatible with prior C++ standards. -def CXXPre1yCompat : DiagGroup<"c++98-c++11-compat">; -def CXXPre1yCompatPedantic : DiagGroup<"c++98-c++11-compat-pedantic", - [CXXPre1yCompat]>; +def CXXPre14Compat : DiagGroup<"c++98-c++11-compat">; +def CXXPre14CompatPedantic : DiagGroup<"c++98-c++11-compat-pedantic", + [CXXPre14Compat]>; def CXXPre1zCompat : DiagGroup<"c++98-c++11-c++14-compat">; def CXXPre1zCompatPedantic : DiagGroup<"c++98-c++11-c++14-compat-pedantic", [CXXPre1zCompat]>; @@ -133,19 +134,21 @@ def CXX98CompatUnnamedTypeTemplateArgs : DiagGroup<"c++98-compat-unnamed-type-template-args">; def CXX98Compat : DiagGroup<"c++98-compat", - [CXX98CompatBindToTemporaryCopy, - CXX98CompatLocalTypeTemplateArgs, + [CXX98CompatLocalTypeTemplateArgs, CXX98CompatUnnamedTypeTemplateArgs, - CXXPre1yCompat, + CXXPre14Compat, CXXPre1zCompat]>; // Warnings for C++11 features which are Extensions in C++98 mode. def CXX98CompatPedantic : DiagGroup<"c++98-compat-pedantic", [CXX98Compat, - CXXPre1yCompatPedantic, + CXX98CompatBindToTemporaryCopy, + CXXPre14CompatPedantic, CXXPre1zCompatPedantic]>; def CXX11Narrowing : DiagGroup<"c++11-narrowing">; +def CXX11WarnOverrideMethod : DiagGroup<"inconsistent-missing-override">; + // Original name of this warning in Clang def : DiagGroup<"c++0x-narrowing", [CXX11Narrowing]>; @@ -162,11 +165,11 @@ def CXX11Compat : DiagGroup<"c++11-compat", [CXX11Narrowing, CXX11CompatReservedUserDefinedLiteral, CXX11CompatDeprecatedWritableStr, - CXXPre1yCompat, + CXXPre14Compat, CXXPre1zCompat]>; def : DiagGroup<"c++0x-compat", [CXX11Compat]>; def CXX11CompatPedantic : DiagGroup<"c++11-compat-pedantic", - [CXXPre1yCompatPedantic, + [CXXPre14CompatPedantic, CXXPre1zCompatPedantic]>; def CXX14Compat : DiagGroup<"c++14-compat", [CXXPre1zCompat]>; @@ -187,6 +190,7 @@ def OverloadedShiftOpParentheses: DiagGroup<"overloaded-shift-op-parentheses">; def DanglingElse: DiagGroup<"dangling-else">; def DanglingField : DiagGroup<"dangling-field">; def DistributedObjectModifiers : DiagGroup<"distributed-object-modifiers">; +def FlagEnum : DiagGroup<"flag-enum">; def InfiniteRecursion : DiagGroup<"infinite-recursion">; def GNUImaginaryConstant : DiagGroup<"gnu-imaginary-constant">; def IgnoredQualifiers : DiagGroup<"ignored-qualifiers">; @@ -198,11 +202,13 @@ def IncompatiblePointerTypes : DiagGroup<"incompatible-pointer-types", [IncompatiblePointerTypesDiscardsQualifiers]>; def IncompleteUmbrella : DiagGroup<"incomplete-umbrella">; -def IncompleteModule : DiagGroup<"incomplete-module", [IncompleteUmbrella]>; def NonModularIncludeInFrameworkModule : DiagGroup<"non-modular-include-in-framework-module">; def NonModularIncludeInModule : DiagGroup<"non-modular-include-in-module", [NonModularIncludeInFrameworkModule]>; +def IncompleteModule : DiagGroup<"incomplete-module", + [IncompleteUmbrella, NonModularIncludeInModule]>; + def InvalidNoreturn : DiagGroup<"invalid-noreturn">; def InvalidSourceEncoding : DiagGroup<"invalid-source-encoding">; def KNRPromotedParameter : DiagGroup<"knr-promoted-parameter">; @@ -231,6 +237,7 @@ def MismatchedParameterTypes : DiagGroup<"mismatched-parameter-types">; def MismatchedReturnTypes : DiagGroup<"mismatched-return-types">; def MismatchedTags : DiagGroup<"mismatched-tags">; def MissingFieldInitializers : DiagGroup<"missing-field-initializers">; +def ModuleBuild : DiagGroup<"module-build">; def ModuleConflict : DiagGroup<"module-conflict">; def NewlineEOF : DiagGroup<"newline-eof">; def NullArithmetic : DiagGroup<"null-arithmetic">; @@ -267,7 +274,9 @@ def ObjCInvalidIBOutletProperty : DiagGroup<"invalid-iboutlet">; def ObjCRootClass : DiagGroup<"objc-root-class">; def ObjCPointerIntrospectPerformSelector : DiagGroup<"deprecated-objc-pointer-introspection-performSelector">; def ObjCPointerIntrospect : DiagGroup<"deprecated-objc-pointer-introspection", [ObjCPointerIntrospectPerformSelector]>; +def ObjCMultipleMethodNames : DiagGroup<"objc-multiple-method-names">; def DeprecatedObjCIsaUsage : DiagGroup<"deprecated-objc-isa-usage">; +def ExplicitInitializeCall : DiagGroup<"explicit-initialize-call">; def Packed : DiagGroup<"packed">; def Padded : DiagGroup<"padded">; def PointerArith : DiagGroup<"pointer-arith">; @@ -285,6 +294,7 @@ def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy", [CXX98CompatBindToTemporaryCopy]>; def SelfAssignmentField : DiagGroup<"self-assign-field">; def SelfAssignment : DiagGroup<"self-assign", [SelfAssignmentField]>; +def SelfMove : DiagGroup<"self-move">; def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">; def Sentinel : DiagGroup<"sentinel">; def MissingMethodReturnType : DiagGroup<"missing-method-return-type">; @@ -329,6 +339,8 @@ def : DiagGroup<"sequence-point", [Unsequenced]>; // Preprocessor warnings. def AmbiguousMacro : DiagGroup<"ambiguous-macro">; +def KeywordAsMacro : DiagGroup<"keyword-macro">; +def ReservedIdAsMacro : DiagGroup<"reserved-id-macro">; // Just silence warnings about -Wstrict-aliasing for now. def : DiagGroup<"strict-aliasing=0">; @@ -349,6 +361,7 @@ def InvalidOffsetof : DiagGroup<"invalid-offsetof">; def : DiagGroup<"strict-prototypes">; def StrictSelector : DiagGroup<"strict-selector-match">; def MethodDuplicate : DiagGroup<"duplicate-method-match">; +def ObjCCStringFormat : DiagGroup<"cstring-format-directive">; def CoveredSwitchDefault : DiagGroup<"covered-switch-default">; def SwitchBool : DiagGroup<"switch-bool">; def SwitchEnum : DiagGroup<"switch-enum">; @@ -383,7 +396,9 @@ def UnnamedTypeTemplateArgs : DiagGroup<"unnamed-type-template-args", def UnsupportedFriend : DiagGroup<"unsupported-friend">; def UnusedArgument : DiagGroup<"unused-argument">; def UnusedCommandLineArgument : DiagGroup<"unused-command-line-argument">; -def InvalidCommandLineArgument : DiagGroup<"invalid-command-line-argument">; +def IgnoredOptimizationArgument : DiagGroup<"ignored-optimization-argument">; +def InvalidCommandLineArgument : DiagGroup<"invalid-command-line-argument", + [IgnoredOptimizationArgument]>; def UnusedComparison : DiagGroup<"unused-comparison">; def UnusedExceptionParameter : DiagGroup<"unused-exception-parameter">; def UnneededInternalDecl : DiagGroup<"unneeded-internal-declaration">; @@ -395,11 +410,17 @@ def UnusedMemberFunction : DiagGroup<"unused-member-function", def UnusedLabel : DiagGroup<"unused-label">; def UnusedParameter : DiagGroup<"unused-parameter">; def UnusedResult : DiagGroup<"unused-result">; -def UnusedValue : DiagGroup<"unused-value", [UnusedComparison, UnusedResult]>; +def PotentiallyEvaluatedExpression : DiagGroup<"potentially-evaluated-expression">; +def UnevaluatedExpression : DiagGroup<"unevaluated-expression", + [PotentiallyEvaluatedExpression]>; +def UnusedValue : DiagGroup<"unused-value", [UnusedComparison, UnusedResult, + UnevaluatedExpression]>; def UnusedConstVariable : DiagGroup<"unused-const-variable">; def UnusedVariable : DiagGroup<"unused-variable", [UnusedConstVariable]>; +def UnusedLocalTypedef : DiagGroup<"unused-local-typedef">; def UnusedPropertyIvar : DiagGroup<"unused-property-ivar">; +def UnusedGetterReturnValue : DiagGroup<"unused-getter-return-value">; def UsedButMarkedUnused : DiagGroup<"used-but-marked-unused">; def UserDefinedLiterals : DiagGroup<"user-defined-literals">; def Reorder : DiagGroup<"reorder">; @@ -408,8 +429,6 @@ def ImplicitAtomic : DiagGroup<"implicit-atomic-properties">; def CustomAtomic : DiagGroup<"custom-atomic-properties">; def AtomicProperties : DiagGroup<"atomic-properties", [ImplicitAtomic, CustomAtomic]>; -// FIXME: Remove arc-abi once an Xcode is released that doesn't pass this flag. -def : DiagGroup<"arc-abi">; def ARCUnsafeRetainedAssign : DiagGroup<"arc-unsafe-retained-assign">; def ARCRetainCycles : DiagGroup<"arc-retain-cycles">; def ARCNonPodMemAccess : DiagGroup<"arc-non-pod-memaccess">; @@ -426,6 +445,9 @@ def DeallocInCategory:DiagGroup<"dealloc-in-category">; def SelectorTypeMismatch : DiagGroup<"selector-type-mismatch">; def Selector : DiagGroup<"selector", [SelectorTypeMismatch]>; def Protocol : DiagGroup<"protocol">; +def AtProtocol : DiagGroup<"at-protocol">; +def PropertyAccessDotSyntax: DiagGroup<"property-access-dot-syntax">; +def PropertyAttr : DiagGroup<"property-attribute-mismatch">; def SuperSubClassMismatch : DiagGroup<"super-class-method-mismatch">; def OverridingMethodMismatch : DiagGroup<"overriding-method-mismatch">; def VariadicMacros : DiagGroup<"variadic-macros">; @@ -520,7 +542,7 @@ def Unused : DiagGroup<"unused", [UnusedArgument, UnusedFunction, UnusedLabel, // UnusedParameter, (matches GCC's behavior) // UnusedMemberFunction, (clean-up llvm before enabling) - UnusedPrivateField, + UnusedPrivateField, UnusedLocalTypedef, UnusedValue, UnusedVariable, UnusedPropertyIvar]>, DiagCategory<"Unused Entity Issue">; @@ -565,6 +587,7 @@ def Most : DiagGroup<"most", [ Reorder, ReturnType, SelfAssignment, + SelfMove, SizeofArrayArgument, SizeofArrayDecay, StringPlusInt, @@ -585,10 +608,14 @@ def Most : DiagGroup<"most", [ def ThreadSafetyAttributes : DiagGroup<"thread-safety-attributes">; def ThreadSafetyAnalysis : DiagGroup<"thread-safety-analysis">; def ThreadSafetyPrecise : DiagGroup<"thread-safety-precise">; +def ThreadSafetyReference : DiagGroup<"thread-safety-reference">; +def ThreadSafetyNegative : DiagGroup<"thread-safety-negative">; def ThreadSafety : DiagGroup<"thread-safety", [ThreadSafetyAttributes, ThreadSafetyAnalysis, - ThreadSafetyPrecise]>; + ThreadSafetyPrecise, + ThreadSafetyReference]>; +def ThreadSafetyVerbose : DiagGroup<"thread-safety-verbose">; def ThreadSafetyBeta : DiagGroup<"thread-safety-beta">; // Uniqueness Analysis warnings @@ -614,6 +641,8 @@ def : DiagGroup<"int-conversions", [IntConversion]>; // -Wint-conversions = -Wint-conversion def : DiagGroup<"vector-conversions", [VectorConversion]>; // -Wvector-conversions = -Wvector-conversion +def : DiagGroup<"unused-local-typedefs", [UnusedLocalTypedef]>; + // -Wunused-local-typedefs = -Wunused-local-typedef // A warning group for warnings that we want to have on by default in clang, // but which aren't on by default in GCC. @@ -624,15 +653,17 @@ def NonGCC : DiagGroup<"non-gcc", // earlier C++ versions. def CXX11 : DiagGroup<"c++11-extensions", [CXX11ExtraSemi, CXX11LongLong]>; -// A warning group for warnings about using C++1y features as extensions in +// A warning group for warnings about using C++14 features as extensions in // earlier C++ versions. -def CXX1y : DiagGroup<"c++1y-extensions">; +def CXX14 : DiagGroup<"c++14-extensions">; // A warning group for warnings about using C++1z features as extensions in // earlier C++ versions. def CXX1z : DiagGroup<"c++1z-extensions">; def : DiagGroup<"c++0x-extensions", [CXX11]>; +def : DiagGroup<"c++1y-extensions", [CXX14]>; + def DelegatingCtorCycles : DiagGroup<"delegating-ctor-cycles">; @@ -710,6 +741,12 @@ def BackendOptimizationFailure : DiagGroup<"pass-failed">; def ProfileInstrOutOfDate : DiagGroup<"profile-instr-out-of-date">; def ProfileInstrUnprofiled : DiagGroup<"profile-instr-unprofiled">; +// AddressSanitizer frontent instrumentation remarks. +def SanitizeAddressRemarks : DiagGroup<"sanitize-address">; + +// Issues with serialized diagnostics. +def SerializedDiagnostics : DiagGroup<"serialized-diagnostics">; + // A warning group for warnings about code that clang accepts when // compiling CUDA C/C++ but which is not compatible with the CUDA spec. def CudaCompat : DiagGroup<"cuda-compat">; diff --git a/include/clang/Basic/DiagnosticIDs.h b/include/clang/Basic/DiagnosticIDs.h index bfb0f0d..99b469d 100644 --- a/include/clang/Basic/DiagnosticIDs.h +++ b/include/clang/Basic/DiagnosticIDs.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_DIAGNOSTICIDS_H -#define LLVM_CLANG_DIAGNOSTICIDS_H +#ifndef LLVM_CLANG_BASIC_DIAGNOSTICIDS_H +#define LLVM_CLANG_BASIC_DIAGNOSTICIDS_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" @@ -33,7 +33,7 @@ namespace clang { DIAG_START_SERIALIZATION = DIAG_START_FRONTEND + 100, DIAG_START_LEX = DIAG_START_SERIALIZATION + 120, DIAG_START_PARSE = DIAG_START_LEX + 300, - DIAG_START_AST = DIAG_START_PARSE + 400, + DIAG_START_AST = DIAG_START_PARSE + 500, DIAG_START_COMMENT = DIAG_START_AST + 100, DIAG_START_SEMA = DIAG_START_COMMENT + 100, DIAG_START_ANALYSIS = DIAG_START_SEMA + 3000, diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index 86def87..93cc7c2 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -161,8 +161,8 @@ def err_invalid_suffix_integer_constant : Error< def err_invalid_suffix_float_constant : Error< "invalid suffix '%0' on floating constant">; def warn_cxx11_compat_digit_separator : Warning< - "digit separators are incompatible with C++ standards before C++1y">, - InGroup<CXXPre1yCompat>, DefaultIgnore; + "digit separators are incompatible with C++ standards before C++14">, + InGroup<CXXPre14Compat>, DefaultIgnore; def err_digit_separator_not_between_digits : Error< "digit separator cannot appear at %select{start|end}0 of digit sequence">; def warn_extraneous_char_constant : Warning< @@ -182,11 +182,11 @@ def ext_hexconstant_invalid : Extension< "hexadecimal floating constants are a C99 feature">, InGroup<C99>; def ext_binary_literal : Extension< "binary integer literals are a GNU extension">, InGroup<GNUBinaryLiteral>; -def ext_binary_literal_cxx1y : Extension< - "binary integer literals are a C++1y extension">, InGroup<CXX1y>; +def ext_binary_literal_cxx14 : Extension< + "binary integer literals are a C++14 extension">, InGroup<CXX14>; def warn_cxx11_compat_binary_literal : Warning< - "binary integer literals are incompatible with C++ standards before C++1y">, - InGroup<CXXPre1yCompatPedantic>, DefaultIgnore; + "binary integer literals are incompatible with C++ standards before C++14">, + InGroup<CXXPre14CompatPedantic>, DefaultIgnore; def err_pascal_string_too_long : Error<"Pascal string is too long">; def err_octal_escape_too_large : Error<"octal escape sequence out of range">; def err_hex_escape_too_large : Error<"hex escape sequence out of range">; @@ -201,6 +201,9 @@ def warn_c99_compat_unicode_literal : Warning< def warn_cxx98_compat_unicode_literal : Warning< "unicode literals are incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; +def warn_cxx14_compat_u8_character_literal : Warning< + "unicode literals are incompatible with C++ standards before C++1z">, + InGroup<CXXPre1zCompat>, DefaultIgnore; def warn_cxx11_compat_user_defined_literal : Warning< "identifier after literal will be treated as a user-defined literal suffix " "in C++11">, InGroup<CXX11Compat>, DefaultIgnore; @@ -287,6 +290,11 @@ def note_pp_ambiguous_macro_chosen : Note< "expanding this definition of %0">; def note_pp_ambiguous_macro_other : Note< "other definition of %0">; +def warn_pp_macro_hides_keyword : Extension< + "keyword is hidden by macro definition">, InGroup<KeywordAsMacro>; +def warn_pp_macro_is_reserved_id : Warning< + "macro name is a reserved identifier">, DefaultIgnore, + InGroup<ReservedIdAsMacro>; def pp_invalid_string_literal : Warning< "invalid string literal, ignoring final '\\'">; @@ -324,7 +332,7 @@ def warn_cxx98_compat_variadic_macro : Warning< InGroup<CXX98CompatPedantic>, DefaultIgnore; def ext_named_variadic_macro : Extension< "named variadic macros are a GNU extension">, InGroup<VariadicMacros>; -def err_embedded_include : Error< +def err_embedded_directive : Error< "embedding a #%0 directive within macro arguments is not supported">; def ext_embedded_directive : Extension< "embedding a directive within macro arguments has undefined behavior">, @@ -615,9 +623,6 @@ def warn_auto_module_import : Warning< def warn_uncovered_module_header : Warning< "umbrella header for module '%0' does not include header '%1'">, InGroup<IncompleteUmbrella>; -def warn_forgotten_module_header : Warning< - "header '%0' is included in module '%1' but not listed in module map">, - InGroup<IncompleteModule>, DefaultIgnore; def err_expected_id_building_module : Error< "expected a module name in '__building_module' expression">; def error_use_of_private_header_outside_module : Error< diff --git a/include/clang/Basic/DiagnosticOptions.def b/include/clang/Basic/DiagnosticOptions.def index a360a5a..fdd3254 100644 --- a/include/clang/Basic/DiagnosticOptions.def +++ b/include/clang/Basic/DiagnosticOptions.def @@ -81,6 +81,8 @@ VALUE_DIAGOPT(MacroBacktraceLimit, 32, DefaultMacroBacktraceLimit) VALUE_DIAGOPT(TemplateBacktraceLimit, 32, DefaultTemplateBacktraceLimit) /// Limit depth of constexpr backtrace. VALUE_DIAGOPT(ConstexprBacktraceLimit, 32, DefaultConstexprBacktraceLimit) +/// Limit number of times to perform spell checking. +VALUE_DIAGOPT(SpellCheckingLimit, 32, DefaultSpellCheckingLimit) VALUE_DIAGOPT(TabStop, 32, DefaultTabStop) /// The distance between tab stops. /// Column limit for formatting message diagnostics, or 0 if unused. @@ -92,4 +94,3 @@ VALUE_DIAGOPT(MessageLength, 32, 0) #undef SEMANTIC_DIAGOPT #undef SEMANTIC_ENUM_DIAGOPT #undef SEMANTIC_VALUE_DIAGOPT - diff --git a/include/clang/Basic/DiagnosticOptions.h b/include/clang/Basic/DiagnosticOptions.h index 3e4d0ee..058e00f 100644 --- a/include/clang/Basic/DiagnosticOptions.h +++ b/include/clang/Basic/DiagnosticOptions.h @@ -33,7 +33,8 @@ public: enum { DefaultTabStop = 8, MaxTabStop = 100, DefaultMacroBacktraceLimit = 6, DefaultTemplateBacktraceLimit = 10, - DefaultConstexprBacktraceLimit = 10 }; + DefaultConstexprBacktraceLimit = 10, + DefaultSpellCheckingLimit = 50 }; // Define simple diagnostic options (with no accessors). #define DIAGOPT(Name, Bits, Default) unsigned Name : Bits; diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index b1305e1..239d4d2 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -108,6 +108,9 @@ def ext_alignof_expr : ExtWarn< def warn_microsoft_dependent_exists : Warning< "dependent %select{__if_not_exists|__if_exists}0 declarations are ignored">, InGroup<DiagGroup<"microsoft-exists">>; +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>; @@ -121,11 +124,15 @@ def ext_c11_alignment : Extension< 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">; def ext_gnu_indirect_goto : Extension< "use of GNU indirect-goto extension">, InGroup<GNULabelsAsValue>; def ext_gnu_address_of_label : Extension< "use of GNU address-of-label extension">, InGroup<GNULabelsAsValue>; +def err_stmtexpr_file_scope : Error< + "statement expression not allowed at file scope">; def ext_gnu_statement_expr : Extension< "use of GNU statement expression extension">, InGroup<GNUStatementExpression>; def ext_gnu_conditional_expr : Extension< @@ -167,6 +174,9 @@ def err_expected_fn_body : Error< def warn_attribute_on_function_definition : Warning< "GCC does not allow %0 attribute in this position on a function definition">, InGroup<GccCompat>; +def warn_gcc_attribute_location : Warning< + "GCC does not allow an attribute in this position on a function declaration">, + InGroup<GccCompat>; def warn_attribute_no_decl : Warning< "attribute %0 ignored, because it is not attached to a declaration">, InGroup<IgnoredAttributes>; @@ -194,11 +204,19 @@ def err_expected_semi_after_namespace_name : Error< "expected ';' after namespace name">; def err_unexpected_namespace_attributes_alias : Error< "attributes cannot be specified on namespace alias">; +def err_unexpected_nested_namespace_attribute : Error< + "attributes cannot be specified on a nested namespace definition">; def err_inline_namespace_alias : Error<"namespace alias cannot be inline">; def err_namespace_nonnamespace_scope : Error< "namespaces can only be defined in global or namespace scope">; -def err_nested_namespaces_with_double_colon : Error< - "nested namespace definition must define each namespace separately">; +def ext_nested_namespace_definition : ExtWarn< + "nested namespace definition is a C++1z extension; " + "define each namespace separately">, InGroup<CXX1z>; +def warn_cxx14_compat_nested_namespace_definition : Warning< + "nested namespace definition is incompatible with C++ standards before C++1z">, + InGroup<CXXPre1zCompat>, DefaultIgnore; +def err_inline_nested_namespace_definition : Error< + "nested namespace definition cannot be 'inline'">; def err_expected_semi_after_attribute_list : Error< "expected ';' after attribute list">; def err_expected_semi_after_static_assert : Error< @@ -268,22 +286,17 @@ def ext_auto_storage_class : ExtWarn< "'auto' storage class specifier is not permitted in C++11, and will not " "be supported in future releases">, InGroup<DiagGroup<"auto-storage-class">>; def ext_decltype_auto_type_specifier : ExtWarn< - "'decltype(auto)' type specifier is a C++1y extension">, InGroup<CXX1y>; + "'decltype(auto)' type specifier is a C++14 extension">, InGroup<CXX14>; def warn_cxx11_compat_decltype_auto_type_specifier : Warning< "'decltype(auto)' type specifier is incompatible with C++ standards before " - "C++1y">, InGroup<CXXPre1yCompat>, DefaultIgnore; + "C++14">, InGroup<CXXPre14Compat>, DefaultIgnore; def ext_for_range : ExtWarn< "range-based for loop is a C++11 extension">, InGroup<CXX11>; def warn_cxx98_compat_for_range : Warning< "range-based for loop is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; -def ext_for_range_identifier : ExtWarn< - "range-based for loop with implicit deduced type is a C++1z extension">, - InGroup<CXX1z>; -def warn_cxx1y_compat_for_range_identifier : Warning< - "range-based for loop with implicit deduced type is incompatible with " - "C++ standards before C++1z">, - InGroup<CXXPre1zCompat>, DefaultIgnore; +def err_for_range_identifier : Error< + "range-based for loop requires type for loop variable">; def err_for_range_expected_decl : Error< "for range declaration must declare a variable">; def err_argument_required_after_attribute : Error< @@ -303,6 +316,8 @@ def err_expected_class_name_not_template : Error<"'typename' is redundant; base classes are implicitly types">; def err_unspecified_vla_size_with_static : Error< "'static' may not be used with an unspecified variable length array size">; +def err_unspecified_size_with_static : Error< + "'static' may not be used without an array size">; def warn_deprecated_register : Warning< "'register' storage class specifier is deprecated">, InGroup<DeprecatedRegister>; @@ -332,10 +347,12 @@ def err_invalid_vector_decl_spec_combination : Error< def err_invalid_pixel_decl_spec_combination : Error< "'__pixel' must be preceded by '__vector'. " "'%0' declaration specifier not allowed here">; -def err_invalid_vector_decl_spec : Error< - "cannot use '%0' with '__vector'">; def err_invalid_vector_bool_decl_spec : Error< "cannot use '%0' with '__vector bool'">; +def err_invalid_vector_double_decl_spec : Error < + "use of 'double' with '__vector' requires VSX support to be enabled (available on the POWER7 or later)">; +def err_invalid_vector_long_double_decl_spec : Error< + "cannot use 'long double' with '__vector'">; def warn_vector_long_decl_spec_combination : Warning< "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>; def err_friend_invalid_in_context : Error< @@ -363,6 +380,8 @@ def err_function_definition_not_allowed : Error< "function definition is not allowed here">; def err_expected_end_of_enumerator : Error< "expected '= constant-expression' or end of enumerator definition">; +def err_expected_coloncolon_after_super : Error< + "expected '::' after '__super'">; /// Objective-C parser diagnostics def err_expected_minus_or_plus : Error< @@ -477,6 +496,8 @@ def ext_ellipsis_exception_spec : Extension< InGroup<Microsoft>; def err_dynamic_and_noexcept_specification : Error< "cannot have both throw() and noexcept() clause on the same function">; +def err_except_spec_unparsed : Error< + "unexpected end of exception specification">; def warn_cxx98_compat_noexcept_decl : Warning< "noexcept specifications are incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; @@ -487,6 +508,8 @@ def err_constructor_bad_name : Error< "missing return type for function %0; did you mean the constructor name %1?">; def err_destructor_tilde_identifier : Error< "expected a class name after '~' to name a destructor">; +def err_destructor_tilde_scope : Error< + "'~' in destructor name should be after nested name specifier">; def err_destructor_template_id : Error< "destructor name %0 does not refer to a template">; def err_default_arg_unparsed : Error< @@ -498,11 +521,24 @@ def note_bracket_depth : Note< def err_misplaced_ellipsis_in_declaration : Error< "'...' must %select{immediately precede declared identifier|" "be innermost component of anonymous pack declaration}0">; +def warn_misplaced_ellipsis_vararg : Warning< + "'...' in this location creates a C-style varargs function" + "%select{, not a function parameter pack|}0">, + InGroup<DiagGroup<"ambiguous-ellipsis">>; +def note_misplaced_ellipsis_vararg_existing_ellipsis : Note< + "preceding '...' declares a function parameter pack">; +def note_misplaced_ellipsis_vararg_add_ellipsis : Note< + "place '...' %select{immediately before declared identifier|here}0 " + "to declare a function parameter pack">; +def note_misplaced_ellipsis_vararg_add_comma : Note< + "insert ',' before '...' to silence this warning">; def ext_abstract_pack_declarator_parens : ExtWarn< "ISO C++11 requires a parenthesized pack declaration to have a name">, InGroup<DiagGroup<"anonymous-pack-parens">>; def err_function_is_not_record : Error< "unexpected %0 in function call; perhaps remove the %0?">; +def err_super_in_using_declaration : Error< + "'__super' cannot be used with a using declaration">; // C++ derived classes def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">; @@ -529,6 +565,10 @@ def warn_cxx98_compat_noexcept_expr : Warning< def warn_cxx98_compat_nullptr : Warning< "'nullptr' is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; +def warn_cxx14_compat_attribute : Warning< + "attributes on %select{a namespace|an enumerator}0 declaration are " + "incompatible with C++ standards before C++1z">, + InGroup<CXXPre1zCompat>, DefaultIgnore; def warn_cxx98_compat_alignas : Warning<"'alignas' is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; def warn_cxx98_compat_attribute : Warning< @@ -564,6 +604,8 @@ def err_ms_property_expected_accessor_name : Error< "expected name of accessor method">; def err_ms_property_expected_comma_or_rparen : Error< "expected ',' or ')' at end of property accessor list">; +def err_ms_property_initializer : Error< + "property declaration cannot have an in-class initializer">; /// C++ Templates def err_expected_template : Error<"expected template">; @@ -576,7 +618,7 @@ def err_class_on_template_template_param : Error< def ext_template_template_param_typename : ExtWarn< "template template parameter using 'typename' is a C++1z extension">, InGroup<CXX1z>; -def warn_cxx1y_compat_template_template_param_typename : Warning< +def warn_cxx14_compat_template_template_param_typename : Warning< "template template parameter using 'typename' is " "incompatible with C++ standards before C++1z">, InGroup<CXXPre1zCompat>, DefaultIgnore; @@ -597,14 +639,16 @@ def warn_cxx11_right_shift_in_template_arg : Warning< def warn_cxx98_compat_two_right_angle_brackets : Warning< "consecutive right angle brackets are incompatible with C++98 (use '> >')">, InGroup<CXX98Compat>, DefaultIgnore; +def err_templated_invalid_declaration : Error< + "a static_assert declaration cannot be a template">; def err_multiple_template_declarators : Error< - "%select{|a template declaration|an explicit template specialization|" - "an explicit template instantiation}0 can " - "only %select{|declare|declare|instantiate}0 a single entity">; + "%select{|a template declaration|an explicit template specialization|" + "an explicit template instantiation}0 can " + "only %select{|declare|declare|instantiate}0 a single entity">; def err_explicit_instantiation_with_definition : Error< - "explicit template instantiation cannot have a definition; if this " - "definition is meant to be an explicit specialization, add '<>' after the " - "'template' keyword">; + "explicit template instantiation cannot have a definition; if this " + "definition is meant to be an explicit specialization, add '<>' after the " + "'template' keyword">; def err_template_defn_explicit_instantiation : Error< "%select{function|class|variable}0 cannot be defined in an explicit instantiation; if this " "declaration is meant to be a %select{function|class|variable}0 definition, remove the 'template' keyword">; @@ -612,7 +656,7 @@ def err_friend_explicit_instantiation : Error< "friend cannot be declared in an explicit instantiation; if this " "declaration is meant to be a friend declaration, remove the 'template' keyword">; def err_explicit_instantiation_enum : Error< - "enumerations cannot be explicitly instantiated">; + "enumerations cannot be explicitly instantiated">; def err_expected_template_parameter : Error<"expected template parameter">; def err_missing_dependent_template_keyword : Error< @@ -654,7 +698,18 @@ def err_explicit_spec_non_template : Error< def err_default_template_template_parameter_not_template : Error< "default template argument for a template template parameter must be a class " "template">; - + +def ext_fold_expression : ExtWarn< + "pack fold expression is a C++1z extension">, + InGroup<CXX1z>; +def warn_cxx14_compat_fold_expression : Warning< + "pack fold expression is incompatible with C++ standards before C++1z">, + InGroup<CXXPre1zCompat>, DefaultIgnore; +def err_expected_fold_operator : Error< + "expected a foldable binary operator in fold expression">; +def err_fold_operator_mismatch : Error< + "operators in fold expression must be the same">; + def err_ctor_init_missing_comma : Error< "missing ',' between base or member initializers">; @@ -699,7 +754,7 @@ def err_alias_declaration_not_identifier : Error< "name defined in alias declaration must be an identifier">; def err_alias_declaration_specialization : Error< "%select{partial specialization|explicit specialization|explicit instantiation}0 of alias templates is not permitted">; - + // C++11 override control def ext_override_control_keyword : ExtWarn< "'%0' keyword is a C++11 extension">, InGroup<CXX11>; @@ -751,6 +806,9 @@ def err_lambda_missing_parens : Error< // Availability attribute def err_expected_version : Error< "expected a version of the form 'major[.minor[.subminor]]'">; +def warn_expected_consistent_version_separator : Warning< + "use same version number separators '_' or '.'; as in " + "'major[.minor[.subminor]]'">, InGroup<Availability>; def err_zero_version : Error< "version number must have non-zero major, minor, or sub-minor version">; def err_availability_expected_platform : Error< @@ -818,7 +876,7 @@ def warn_pragma_expected_non_wide_string : Warning< "expected non-wide string literal in '#pragma %0'">, InGroup<IgnoredPragmas>; // - Generic errors def err_pragma_missing_argument : Error< - "missing argument to '#pragma %0'; expected %1">; + "missing argument to '#pragma %0'%select{|; expected %2}1">; // - #pragma options def warn_pragma_options_expected_align : Warning< "expected 'align' following '#pragma options' - ignored">, @@ -878,8 +936,8 @@ def err_pragma_optimize_extra_argument : Error< "unexpected extra argument '%0' to '#pragma clang optimize'">; // OpenCL Section 6.8.g -def err_not_opencl_storage_class_specifier : Error< - "OpenCL does not support the '%0' storage class specifier">; +def err_opencl_unknown_type_specifier : Error< + "OpenCL does not support the '%0' %select{type qualifier|storage class specifier}1">; // OpenCL EXTENSION pragma (OpenCL 1.1 [9.1]) def warn_pragma_expected_colon : Warning< @@ -923,9 +981,14 @@ def err_omp_expected_identifier_for_critical : Error< "expected identifier specifying the name of the 'omp critical' directive">; // Pragma loop support. +def err_pragma_loop_missing_argument : Error< + "missing argument; expected %select{an integer value|" + "'%select{enable|full}1' or 'disable'}0">; def err_pragma_loop_invalid_option : Error< "%select{invalid|missing}0 option%select{ %1|}0; expected vectorize, " "vectorize_width, interleave, interleave_count, unroll, or unroll_count">; +def err_pragma_invalid_keyword : Error< + "invalid argument; expected '%select{enable|full}0' or 'disable'">; // Pragma unroll support. def warn_pragma_unroll_cuda_value_in_parens : Warning< diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 1665a45..8966c55 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -64,6 +64,9 @@ def err_typecheck_converted_constant_expression : Error< "value of type %0 is not implicitly convertible to %1">; def err_typecheck_converted_constant_expression_disallowed : Error< "conversion from %0 to %1 is not allowed in a converted constant expression">; +def err_typecheck_converted_constant_expression_indirect : Error< + "conversion from %0 to %1 in converted constant expression would " + "bind reference to a temporary">; def err_expr_not_cce : Error< "%select{case value|enumerator value|non-type template argument|array size}0 " "is not a constant expression">; @@ -84,6 +87,9 @@ def note_ice_conversion_here : Note< def err_ice_ambiguous_conversion : Error< "ambiguous conversion from type %0 to an integral or unscoped " "enumeration type">; +def err_ice_too_large : Error< + "integer constant expression evaluates to value %0 that cannot be " + "represented in a %1-bit %select{signed|unsigned}2 integer type">; // Semantic analysis of constant literals. def ext_predef_outside_function : Warning< @@ -172,6 +178,9 @@ def warn_unused_parameter : Warning<"unused parameter %0">, InGroup<UnusedParameter>, DefaultIgnore; def warn_unused_variable : Warning<"unused variable %0">, InGroup<UnusedVariable>, DefaultIgnore; +def warn_unused_local_typedef : Warning< + "unused %select{typedef|type alias}0 %1">, + InGroup<UnusedLocalTypedef>, DefaultIgnore; def warn_unused_property_backing_ivar : Warning<"ivar %0 which backs the property is not " "referenced in this property's accessor">, @@ -445,9 +454,13 @@ def note_strncat_wrong_size : Note< "the terminating null byte">; def warn_assume_side_effects : Warning< - "the argument to __assume has side effects that will be discarded">, + "the argument to %0 has side effects that will be discarded">, InGroup<DiagGroup<"assume">>; +def warn_memcpy_chk_overflow : Warning< + "%0 will always overflow destination buffer">, + InGroup<DiagGroup<"builtin-memcpy-chk-size">>; + /// main() // static main() is not an error in C, just in C++. def warn_static_main : Warning<"'main' should not be declared static">, @@ -521,6 +534,11 @@ def warn_cxx_ms_struct : "with base classes or virtual functions">, DefaultError, InGroup<IncompatibleMSStruct>; def err_section_conflict : Error<"%0 causes a section type conflict with %1">; +def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">; +def err_invalid_super_scope : Error<"invalid use of '__super', " + "this keyword can only be used inside class or member function scope">; +def err_super_in_lambda_unsupported : Error< + "use of '__super' inside a lambda is unsupported">; def warn_pragma_unused_undeclared_var : Warning< "undeclared variable %0 used as an argument for '#pragma unused'">, @@ -536,10 +554,10 @@ def err_pragma_pop_visibility_mismatch : Error< "#pragma visibility pop with no matching #pragma visibility push">; def note_surrounding_namespace_starts_here : Note< "surrounding namespace with visibility attribute starts here">; -def err_pragma_loop_invalid_value : Error< - "invalid argument; expected a positive integer value">; -def err_pragma_loop_invalid_keyword : Error< - "invalid argument; expected 'enable' or 'disable'">; +def err_pragma_loop_invalid_argument_type : Error< + "invalid argument of type %0; expected an integer type">; +def err_pragma_loop_invalid_argument_value : Error< + "%select{invalid value '%0'; must be positive|value '%0' is too large}1">; def err_pragma_loop_compatibility : Error< "%select{incompatible|duplicate}0 directives '%1' and '%2'">; def err_pragma_loop_precedes_nonloop : Error< @@ -563,14 +581,19 @@ def err_protocol_has_circular_dependency : Error< "protocol has circular dependency">; def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">; def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">; +def warn_atprotocol_protocol : Warning< + "@protocol is using a forward protocol declaration of %0">, InGroup<AtProtocol>; def warn_readonly_property : Warning< "attribute 'readonly' of property %0 restricts attribute " - "'readwrite' of property inherited from %1">; + "'readwrite' of property inherited from %1">, + InGroup<PropertyAttr>; def warn_property_attribute : Warning< - "'%1' attribute on property %0 does not match the property inherited from %2">; + "'%1' attribute on property %0 does not match the property inherited from %2">, + InGroup<PropertyAttr>; def warn_property_types_are_incompatible : Warning< - "property type %0 is incompatible with type %1 inherited from %2">; + "property type %0 is incompatible with type %1 inherited from %2">, + InGroup<DiagGroup<"incompatible-property-type">>; def warn_protocol_property_mismatch : Warning< "property of type %0 was selected for synthesis">, InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>; @@ -587,6 +610,8 @@ def note_class_declared : Note< "class is declared here">; def note_receiver_class_declared : Note< "receiver is instance of class declared here">; +def note_receiver_expr_here : Note< + "receiver expression is here">; def note_receiver_is_id : Note< "receiver is treated with 'id' type for purpose of method lookup">; def note_suppressed_class_declare : Note< @@ -696,7 +721,8 @@ def warn_implements_nscopying : Warning< "default assign attribute on property %0 which implements " "NSCopying protocol is not appropriate with -fobjc-gc[-only]">; -def warn_multiple_method_decl : Warning<"multiple methods named %0 found">; +def warn_multiple_method_decl : Warning<"multiple methods named %0 found">, + InGroup<ObjCMultipleMethodNames>; def warn_strict_multiple_method_decl : Warning< "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore; def warn_accessor_property_type_mismatch : Warning< @@ -710,6 +736,11 @@ def err_duplicate_method_decl : Error<"duplicate declaration of method %0">; def warn_duplicate_method_decl : Warning<"multiple declarations of method %0 found and ignored">, InGroup<MethodDuplicate>, DefaultIgnore; +def warn_objc_cdirective_format_string : + Warning<"using %0 directive in %select{NSString|CFString}1 " + "which is being passed as a formatting argument to the formatting " + "%select{method|CFfunction}2">, + InGroup<ObjCCStringFormat>, DefaultIgnore; def err_objc_var_decl_inclass : Error<"cannot declare variable inside @interface or @protocol">; def error_missing_method_context : Error< @@ -738,7 +769,8 @@ def warn_objc_property_default_assign_on_object : Warning< "default property attribute 'assign' not appropriate for non-GC object">, InGroup<ObjCPropertyNoAttribute>; def warn_property_attr_mismatch : Warning< - "property attribute in class extension does not match the primary class">; + "property attribute in class extension does not match the primary class">, + InGroup<PropertyAttr>; def warn_property_implicitly_mismatched : Warning < "primary property declaration is implicitly strong while redeclaration " "in class extension is weak">, @@ -778,6 +810,11 @@ def warn_no_autosynthesis_property : Warning< "%0 because it is 'readwrite' but it will be synthesized 'readonly' " "via another property">, InGroup<ObjCNoPropertyAutoSynthesis>; +def warn_autosynthesis_property_in_superclass : Warning< + "auto property synthesis will not synthesize property " + "%0; it will be implemented by its superclass, use @dynamic to " + "acknowledge intention">, + InGroup<ObjCNoPropertyAutoSynthesis>; def warn_autosynthesis_property_ivar_match :Warning< "autosynthesized property %0 will use %select{|synthesized}1 instance variable " "%2, not existing instance variable %3">, @@ -927,7 +964,7 @@ def err_static_assert_expression_is_not_constant : Error< def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">; def ext_static_assert_no_message : ExtWarn< "static_assert with no message is a C++1z extension">, InGroup<CXX1z>; -def warn_cxx1y_compat_static_assert_no_message : Warning< +def warn_cxx14_compat_static_assert_no_message : Warning< "static_assert with no message is incompatible with C++ standards before C++1z">, DefaultIgnore, InGroup<CXXPre1zCompat>; @@ -1085,6 +1122,8 @@ def warn_missing_exception_specification : Warning< "%0 is missing exception specification '%1'">; def err_noexcept_needs_constant_expression : Error< "argument to noexcept specifier must be a constant expression">; +def err_exception_spec_not_parsed : Error< + "exception specification is not available until end of class definition">; // C++ access checking def err_class_redeclared_with_different_access : Error< @@ -1098,7 +1137,7 @@ def ext_ms_using_declaration_inaccessible : ExtWarn< def err_access_ctor : Error< "calling a %select{private|protected}0 constructor of class %2">, AccessControl; -def ext_rvalue_to_reference_access_ctor : ExtWarn< +def ext_rvalue_to_reference_access_ctor : Extension< "C++98 requires an accessible copy constructor for class %2 when binding " "a reference to a temporary; was %select{private|protected}0">, AccessControl, InGroup<BindToTemporaryCopy>; @@ -1462,6 +1501,9 @@ def note_uninit_reference_member : Note< "uninitialized reference member is here">; def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">, InGroup<Uninitialized>; +def warn_base_class_is_uninit : Warning< + "base class %0 is uninitialized when used here to access %q1">, + InGroup<Uninitialized>; def warn_reference_field_is_uninit : Warning< "reference %0 is not yet bound to a value when used here">, InGroup<Uninitialized>; @@ -1505,6 +1547,9 @@ def note_block_var_fixit_add_initialization : Note< def note_in_omitted_aggregate_initializer : Note< "in implicit initialization of %select{array element %1|field %1}0 " "with omitted initializer">; +def note_in_reference_temporary_list_initializer : Note< + "in initialization of temporary of type %0 created to " + "list-initialize this reference">; def note_var_fixit_add_initialization : Note< "initialize the variable %0 to silence this warning">; def note_uninit_fixit_remove_cond : Note< @@ -1522,7 +1567,7 @@ def err_temp_copy_no_viable : Error< "returning object|throwing object|copying member subobject|copying array " "element|allocating object|copying temporary|initializing base subobject|" "initializing vector element|capturing value}0 of type %1">; -def ext_rvalue_to_reference_temp_copy_no_viable : ExtWarn< +def ext_rvalue_to_reference_temp_copy_no_viable : Extension< "no viable constructor %select{copying variable|copying parameter|" "returning object|throwing object|copying member subobject|copying array " "element|allocating object|copying temporary|initializing base subobject|" @@ -1594,9 +1639,9 @@ def err_auto_new_ctor_multiple_expressions : Error< "new expression for type %0 contains multiple constructor arguments">; def err_auto_missing_trailing_return : Error< "'auto' return without trailing return type; deduced return types are a " - "C++1y extension">; + "C++14 extension">; def err_deduced_return_type : Error< - "deduced return types are a C++1y extension">; + "deduced return types are a C++14 extension">; def err_trailing_return_without_auto : Error< "function with trailing return type must specify return type 'auto', not %0">; def err_trailing_return_in_parens : Error< @@ -1656,6 +1701,9 @@ def override_keyword_hides_virtual_member_function : Error< "%select{function|functions}1">; def err_function_marked_override_not_overriding : Error< "%0 marked 'override' but does not override any member functions">; +def warn_function_marked_not_override_overriding : Warning < + "%0 overrides a member function but is not marked 'override'">, + InGroup<CXX11WarnOverrideMethod>; def err_class_marked_final_used_as_base : Error< "base %0 is marked '%select{final|sealed}1'">; def warn_abstract_final_class : Warning< @@ -1745,10 +1793,10 @@ def note_for_range_begin_end : Note< def warn_cxx98_compat_constexpr : Warning< "'constexpr' specifier is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; -// FIXME: Maybe this should also go in -Wc++1y-compat? -def warn_cxx1y_compat_constexpr_not_const : Warning< +// FIXME: Maybe this should also go in -Wc++14-compat? +def warn_cxx14_compat_constexpr_not_const : Warning< "'constexpr' non-static member function will not be implicitly 'const' " - "in C++1y; add 'const' to avoid a change in behavior">, + "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 " @@ -1790,28 +1838,28 @@ def err_constexpr_body_invalid_stmt : Error< "statement not allowed in constexpr %select{function|constructor}0">; def ext_constexpr_body_invalid_stmt : ExtWarn< "use of this statement in a constexpr %select{function|constructor}0 " - "is a C++1y extension">, InGroup<CXX1y>; + "is a C++14 extension">, InGroup<CXX14>; def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning< "use of this statement in a constexpr %select{function|constructor}0 " - "is incompatible with C++ standards before C++1y">, - InGroup<CXXPre1yCompat>, DefaultIgnore; + "is incompatible with C++ standards before C++14">, + InGroup<CXXPre14Compat>, DefaultIgnore; def ext_constexpr_type_definition : ExtWarn< "type definition in a constexpr %select{function|constructor}0 " - "is a C++1y extension">, InGroup<CXX1y>; + "is a C++14 extension">, InGroup<CXX14>; def warn_cxx11_compat_constexpr_type_definition : Warning< "type definition in a constexpr %select{function|constructor}0 " - "is incompatible with C++ standards before C++1y">, - InGroup<CXXPre1yCompat>, DefaultIgnore; + "is incompatible with C++ standards before C++14">, + InGroup<CXXPre14Compat>, DefaultIgnore; def err_constexpr_vla : Error< "variably-modified type %0 cannot be used in a constexpr " "%select{function|constructor}1">; def ext_constexpr_local_var : ExtWarn< "variable declaration in a constexpr %select{function|constructor}0 " - "is a C++1y extension">, InGroup<CXX1y>; + "is a C++14 extension">, InGroup<CXX14>; def warn_cxx11_compat_constexpr_local_var : Warning< "variable declaration in a constexpr %select{function|constructor}0 " - "is incompatible with C++ standards before C++1y">, - InGroup<CXXPre1yCompat>, DefaultIgnore; + "is incompatible with C++ standards before C++14">, + InGroup<CXXPre14Compat>, DefaultIgnore; def err_constexpr_local_var_static : Error< "%select{static|thread_local}1 variable not permitted in a constexpr " "%select{function|constructor}0">; @@ -1828,16 +1876,18 @@ def err_enable_if_never_constant_expr : Error< "'enable_if' attribute expression never produces a constant expression">; def err_constexpr_body_no_return : Error< "no return statement in constexpr function">; +def err_constexpr_return_missing_expr : Error< + "non-void constexpr function %0 should return a value">; def warn_cxx11_compat_constexpr_body_no_return : Warning< "constexpr function with no return statements is incompatible with C++ " - "standards before C++1y">, InGroup<CXXPre1yCompat>, DefaultIgnore; + "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore; def ext_constexpr_body_multiple_return : ExtWarn< - "multiple return statements in constexpr function is a C++1y extension">, - InGroup<CXX1y>; + "multiple return statements in constexpr function is a C++14 extension">, + InGroup<CXX14>; def warn_cxx11_compat_constexpr_body_multiple_return : Warning< "multiple return statements in constexpr function " - "is incompatible with C++ standards before C++1y">, - InGroup<CXXPre1yCompat>, DefaultIgnore; + "is incompatible with C++ standards before C++14">, + InGroup<CXXPre14Compat>, DefaultIgnore; def note_constexpr_body_previous_return : Note< "previous return statement is here">; def err_constexpr_function_try_block : Error< @@ -1848,8 +1898,6 @@ def err_constexpr_ctor_missing_init : Error< "constexpr constructor must initialize all members">; def note_constexpr_ctor_missing_init : Note< "member not initialized by constructor">; -def err_constexpr_method_non_literal : Error< - "non-literal type %0 cannot have constexpr members">; def note_non_literal_no_constexpr_ctors : Note< "%0 is not literal because it is not an aggregate and has no constexpr " "constructors other than copy or move constructors">; @@ -1897,8 +1945,12 @@ def err_attribute_bad_neon_vector_size : Error< "Neon vector size must be 64 or 128 bits">; def err_attribute_unsupported : Error< "%0 attribute is not supported for this target">; +// The err_*_attribute_argument_not_int are seperate because they're used by +// VerifyIntegerConstantExpression. def err_aligned_attribute_argument_not_int : Error< "'aligned' attribute requires integer constant">; +def err_align_value_attribute_argument_not_int : Error< + "'align_value' attribute requires integer constant">; def err_alignas_attribute_wrong_decl_type : Error< "%0 attribute cannot be applied to a %select{function parameter|" "variable with 'register' storage class|'catch' variable|bit-field}1">; @@ -1934,12 +1986,22 @@ def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Text>; def warn_attribute_return_pointers_only : Warning< "%0 attribute only applies to return values that are pointers">, InGroup<IgnoredAttributes>; +def warn_attribute_return_pointers_refs_only : Warning< + "%0 attribute only applies to return values that are pointers or references">, + InGroup<IgnoredAttributes>; +def warn_attribute_pointer_or_reference_only : Warning< + "%0 attribute only applies to a pointer or reference (%1 is invalid)">, + InGroup<IgnoredAttributes>; def err_attribute_no_member_pointers : Error< "%0 attribute cannot be used with pointers to members">; def err_attribute_invalid_implicit_this_argument : Error< "%0 attribute is invalid for the implicit this argument">; def err_ownership_type : Error< "%0 attribute only applies to %select{pointer|integer}1 arguments">; +def err_ownership_returns_index_mismatch : Error< + "'ownership_returns' attribute index does not match; here it is %0">; +def note_ownership_returns_index_mismatch : Note< + "declared with index %0 here">; def err_format_strftime_third_parameter : Error< "strftime format attribute requires 3rd parameter to be 0">; def err_format_attribute_requires_variadic : Error< @@ -2054,14 +2116,22 @@ def err_no_accessor_for_property : Error< def error_cannot_find_suitable_accessor : Error< "cannot find suitable %select{getter|setter}0 for property %1">; -def err_attribute_aligned_not_power_of_two : Error< +def err_alignment_not_power_of_two : Error< "requested alignment is not a power of 2">; + def err_attribute_aligned_too_great : Error< "requested alignment must be %0 bytes or smaller">; def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning< - "%q0 redeclared without %1 attribute: previous %1 ignored">; + "%q0 redeclared without %1 attribute: previous %1 ignored">, + InGroup<DiagGroup<"inconsistent-dllimport">>; +def warn_dllimport_dropped_from_inline_function : Warning< + "%q0 redeclared inline; %1 attribute ignored">, + InGroup<IgnoredAttributes>; def warn_attribute_ignored : Warning<"%0 attribute ignored">, InGroup<IgnoredAttributes>; +def warn_attribute_ignored_on_inline : + Warning<"%0 attribute ignored on inline function">, + InGroup<IgnoredAttributes>; def warn_attribute_after_definition_ignored : Warning< "attribute %0 after definition is ignored">, InGroup<IgnoredAttributes>; @@ -2110,6 +2180,8 @@ def err_declspec_thread_on_thread_variable : Error< "thread-local storage specifier">; def err_attribute_dll_not_extern : Error< "%q0 must have external linkage when declared %q1">; +def err_attribute_dll_thread_local : Error< + "%q0 cannot be thread local when declared %q1">; def warn_attribute_invalid_on_definition : Warning< "'%0' attribute cannot be specified on a definition">, InGroup<IgnoredAttributes>; @@ -2139,7 +2211,7 @@ def warn_attribute_dll_instantiated_base_class : Warning< "propagating dll attribute to %select{already instantiated|explicitly specialized}0 " "base class template " "%select{without dll attribute|with different dll attribute}1 is not supported">, - InGroup<DiagGroup<"unsupported-dll-base-class-template">>; + InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore; def err_attribute_weakref_not_static : Error< "weakref declaration must have internal linkage">; def err_attribute_weakref_not_global_context : Error< @@ -2164,22 +2236,25 @@ def warn_attribute_wrong_decl_type : Warning< "%0 attribute only applies to %select{functions|unions|" "variables and functions|functions and methods|parameters|" "functions, methods and blocks|functions, methods, and classes|" - "functions, methods, and parameters|classes|variables|methods|" + "functions, methods, and parameters|classes|enums|variables|methods|" "variables, functions and labels|fields and global variables|structs|" - "variables, functions and tag types|thread-local variables|" + "variables and typedefs|thread-local variables|" "variables and fields|variables, data members and tag types|" "types and namespaces|Objective-C interfaces|methods and properties|" "struct or union|struct, union or class|types|" "Objective-C instance methods|init methods of interface or class extension declarations|" "variables, functions and classes|Objective-C protocols|" "functions and global variables|structs or typedefs|" - "interface or protocol declarations}1">, + "interface or protocol declarations|kernel functions}1">, InGroup<IgnoredAttributes>; def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>; def warn_type_attribute_wrong_type : Warning< "'%0' only applies to %select{function|pointer|" "Objective-C object or block pointer}1 types; type here is %2">, InGroup<IgnoredAttributes>; +def warn_incomplete_encoded_type : Warning< + "encoding of %0 type is incomplete because %1 component has unknown encoding">, + InGroup<DiagGroup<"encode-type">>; def warn_attribute_requires_functions_or_static_globals : Warning< "%0 only applies to variables with static storage duration and functions">, InGroup<IgnoredAttributes>; @@ -2197,7 +2272,10 @@ def err_cconv_change : Error< def warn_cconv_ignored : Warning< "calling convention %0 ignored for this target">, InGroup<IgnoredAttributes>; def err_cconv_knr : Error< - "function with no prototype cannot use %0 calling convention">; + "function with no prototype cannot use the %0 calling convention">; +def warn_cconv_knr : Warning< + err_cconv_knr.Text>, + InGroup<DiagGroup<"missing-prototype-for-cc">>; def err_cconv_varargs : Error< "variadic function cannot use %0 calling convention">; def warn_cconv_varargs : Warning< @@ -2307,6 +2385,21 @@ def warn_cannot_resolve_lock : Warning< "cannot resolve lock expression">, InGroup<ThreadSafetyAnalysis>, DefaultIgnore; +// Thread safety warnings negative capabilities +def warn_acquire_requires_negative_cap : Warning< + "acquiring %0 '%1' requires negative capability '%2'">, + InGroup<ThreadSafetyNegative>, DefaultIgnore; + +// Thread safety warnings on pass by reference +def warn_guarded_pass_by_reference : Warning< + "passing variable '%1' by reference requires holding %0 " + "%select{'%2'|'%2' exclusively}3">, + InGroup<ThreadSafetyReference>, DefaultIgnore; +def warn_pt_guarded_pass_by_reference : Warning< + "passing the value that '%1' points to by reference requires holding %0 " + "%select{'%2'|'%2' exclusively}3">, + InGroup<ThreadSafetyReference>, DefaultIgnore; + // Imprecise thread safety warnings def warn_variable_requires_lock : Warning< "%select{reading|writing}3 variable '%1' requires holding %0 " @@ -2332,9 +2425,15 @@ def warn_fun_requires_lock_precise : InGroup<ThreadSafetyPrecise>, DefaultIgnore; def note_found_mutex_near_match : Note<"found near match '%0'">; +// Verbose thread safety warnings +def warn_thread_safety_verbose : Warning<"Thread safety verbose warning.">, + InGroup<ThreadSafetyVerbose>, DefaultIgnore; +def note_thread_warning_in_fun : Note<"Thread warning in function '%0'">; +def note_guarded_by_declared_here : Note<"Guarded_by declared here.">; + // Dummy warning that will trigger "beta" warnings from the analysis if enabled. -def warn_thread_safety_beta : Warning< - "Thread safety beta warning.">, InGroup<ThreadSafetyBeta>, DefaultIgnore; +def warn_thread_safety_beta : Warning<"Thread safety beta warning.">, + InGroup<ThreadSafetyBeta>, DefaultIgnore; // Consumed warnings def warn_use_in_invalid_state : Warning< @@ -2408,7 +2507,7 @@ 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_impcast_null_pointer_to_integer : Warning< - "implicit conversion of NULL constant to %0">, + "implicit conversion of %select{NULL|nullptr}0 constant to %1">, InGroup<NullConversion>; def warn_impcast_floating_point_to_bool : Warning< "implicit conversion turns floating-point number into bool: %0 to %1">, @@ -2418,6 +2517,10 @@ def warn_impcast_pointer_to_bool : Warning< "address of%select{| function| array}0 '%1' will always evaluate to " "'true'">, InGroup<PointerBoolConversion>; +def warn_cast_nonnull_to_bool : Warning< + "nonnull parameter '%0' will evaluate to " + "'true' on first encounter">, + InGroup<PointerBoolConversion>; def warn_this_bool_conversion : Warning< "'this' pointer cannot be null in well-defined C++ code; pointer may be " "assumed to always convert to true">, InGroup<UndefinedBoolConversion>; @@ -2430,6 +2533,10 @@ 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">, InGroup<TautologicalPointerCompare>; +def warn_nonnull_parameter_compare : Warning< + "comparison of nonnull parameter '%0' %select{not |}1" + "equal to a null pointer is %select{true|false}1 on first encounter">, + InGroup<TautologicalPointerCompare>; def warn_this_null_compare : Warning< "'this' pointer cannot be null in well-defined C++ code; comparison may be " "assumed to always evaluate to %select{true|false}0">, @@ -2500,6 +2607,7 @@ def warn_attribute_protected_visibility : InGroup<DiagGroup<"unsupported-visibility">>; def err_mismatched_visibility: Error<"visibility does not match previous declaration">; def note_previous_attribute : Note<"previous attribute is here">; +def note_conflicting_attribute : Note<"conflicting attribute is here">; def note_attribute : Note<"attribute is here">; def err_mismatched_ms_inheritance : Error< "inheritance model does not match %select{definition|previous declaration}0">; @@ -2739,6 +2847,9 @@ def note_ovl_candidate : Note<"candidate " "|volatile and restrict|const, volatile, and restrict}4)}2">; def note_ovl_candidate_inherited_constructor : Note<"inherited from here">; +def note_ovl_candidate_illegal_constructor : Note< + "candidate %select{constructor|template}0 ignored: " + "instantiation %select{takes|would take}0 its own class type by value">; def note_ovl_candidate_bad_deduction : Note< "candidate template ignored: failed template argument deduction">; def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: " @@ -2756,7 +2867,7 @@ def note_ovl_candidate_instantiation_depth : Note< "candidate template ignored: substitution exceeded maximum template " "instantiation depth">; def note_ovl_candidate_underqualified : Note< - "candidate template ignored: can't deduce a type for %0 which would " + "candidate template ignored: can't deduce a type for %0 that would " "make %2 equal %1">; def note_ovl_candidate_substitution_failure : Note< "candidate template ignored: substitution failure%0%1">; @@ -2962,8 +3073,18 @@ def note_ovl_candidate_bad_target : Note< "function (the implicit copy assignment operator)|" "function (the implicit move assignment operator)|" "constructor (inherited)}0 not viable: call to " - "%select{__device__|__global__|__host__|__host__ __device__}1 function from" - " %select{__device__|__global__|__host__|__host__ __device__}2 function">; + "%select{__device__|__global__|__host__|__host__ __device__|invalid}1 function from" + " %select{__device__|__global__|__host__|__host__ __device__|invalid}2 function">; +def note_implicit_member_target_infer_collision : Note< + "implicit %select{" + "default constructor|" + "copy constructor|" + "move constructor|" + "copy assignment operator|" + "move assignment operator|" + "destructor}0 inferred target collision: call to both " + "%select{__device__|__global__|__host__|__host__ __device__}1 and " + "%select{__device__|__global__|__host__|__host__ __device__}2 members">; def note_ambiguous_type_conversion: Note< "because of ambiguity in conversion %diff{of $ to $|between types}0,1">; @@ -3103,11 +3224,11 @@ def err_template_parameter_default_friend_template : Error< def err_template_template_parm_no_parms : Error< "template template parameter must have its own template parameters">; -def ext_variable_template : ExtWarn<"variable templates are a C++1y extension">, - InGroup<CXX1y>; +def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">, + InGroup<CXX14>; def warn_cxx11_compat_variable_template : Warning< - "variable templates are incompatible with C++ standards before C++1y">, - InGroup<CXXPre1yCompat>, DefaultIgnore; + "variable templates are incompatible with C++ standards before C++14">, + InGroup<CXXPre14Compat>, DefaultIgnore; def err_template_variable_noparams : Error< "extraneous 'template<>' in declaration of variable %0">; def err_template_member : Error<"member %0 declared as a template">; @@ -3181,6 +3302,10 @@ def err_template_arg_wrongtype_null_constant : Error< def err_deduced_non_type_template_arg_type_mismatch : Error< "deduced non-type template argument does not have the same type as the " "its corresponding template parameter%diff{ ($ vs $)|}0,1">; +def err_non_type_template_arg_subobject : Error< + "non-type template argument refers to subobject '%0'">; +def err_non_type_template_arg_addr_label_diff : Error< + "template argument / label address difference / what did you expect?">; def err_template_arg_not_convertible : Error< "non-type template argument of type %0 cannot be converted to a value " "of type %1">; @@ -3232,6 +3357,9 @@ def err_template_arg_not_object_or_func : Error< "non-type template argument does not refer to an object or function">; def err_template_arg_not_pointer_to_member_form : Error< "non-type template argument is not a pointer to member constant">; +def err_template_arg_member_ptr_base_derived_not_supported : Error< + "sorry, non-type template argument of pointer-to-member type %1 that refers " + "to member %q0 of a different class is not supported yet">; def ext_template_arg_extra_parens : ExtWarn< "address non-type template argument cannot be surrounded by parentheses">; def warn_cxx98_compat_template_arg_extra_parens : Warning< @@ -3435,6 +3563,8 @@ def note_template_variable_def_here : Note< "in instantiation of variable template specialization %q0 requested here">; def note_template_enum_def_here : Note< "in instantiation of enumeration %q0 requested here">; +def note_template_nsdmi_here : Note< + "in instantiation of default member initializer %q0 requested here">; def note_template_type_alias_instantiation_here : Note< "in instantiation of template type alias %0 requested here">; def note_template_exception_spec_instantiation_here : Note< @@ -3559,6 +3689,11 @@ def err_invalid_var_template_spec_type : Error<"type %2 " "of %select{explicit instantiation|explicit specialization|" "partial specialization|redeclaration}0 of %1 does not match" " expected type %3">; +def err_mismatched_exception_spec_explicit_instantiation : Error< + "exception specification in explicit instantiation does not match instantiated one">; +def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn< + "exception specification in explicit instantiation does not match instantiated one">, + InGroup<Microsoft>; // C++ typename-specifiers def err_typename_nested_not_found : Error<"no type named %0 in %1">; @@ -3680,6 +3815,14 @@ def err_ellipsis_in_declarator_not_parameter : Error< def err_sizeof_pack_no_pack_name : Error< "%0 does not refer to the name of a parameter pack">; +def err_fold_expression_packs_both_sides : Error< + "binary fold expression has unexpanded parameter packs in both operands">; +def err_fold_expression_empty : Error< + "unary fold expression has empty expansion for operator '%0' " + "with no fallback value">; +def err_fold_expression_bad_operand : Error< + "expression not permitted as operand of fold expression">; + def err_unexpected_typedef : Error< "unexpected type name %0: expected expression">; def err_unexpected_namespace : Error< @@ -3706,6 +3849,9 @@ def warn_property_method_deprecated : InGroup<DeprecatedDeclarations>; def warn_deprecated_message : Warning<"%0 is deprecated: %1">, InGroup<DeprecatedDeclarations>; +def warn_deprecated_anonymous_namespace : Warning< + "'deprecated' attribute on anonymous namespace ignored">, + InGroup<IgnoredAttributes>; def warn_deprecated_fwdclass_message : Warning< "%0 may be deprecated because the receiver type is unknown">, InGroup<DeprecatedDeclarations>; @@ -3854,6 +4000,10 @@ def err_redefinition_different_type : Error< "redefinition of %0 with a different type%diff{: $ vs $|}1,2">; def err_redefinition_different_kind : Error< "redefinition of %0 as different kind of symbol">; +def err_redefinition_different_namespace_alias : Error< + "redefinition of %0 as an alias for a different namespace">; +def note_previous_namespace_alias : Note< + "previously defined as an alias for %0">; def warn_forward_class_redefinition : Warning< "redefinition of forward class %0 of a typedef name of an object type is ignored">, InGroup<DiagGroup<"objc-forward-class-redefinition">>; @@ -3909,6 +4059,9 @@ def ext_enum_too_large : ExtWarn< def ext_enumerator_increment_too_large : ExtWarn< "incremented enumerator value %0 is not representable in the " "largest integer type">, InGroup<EnumTooLarge>; +def warn_flag_enum_constant_out_of_range : Warning< + "enumeration value %0 is out of range of flags in enumeration type %1">, + InGroup<FlagEnum>; def warn_illegal_constant_array_size : Extension< "size of static array must be an integer constant expression">; @@ -4067,28 +4220,35 @@ def warn_missing_braces : Warning< def err_redefinition_of_label : Error<"redefinition of label %0">; def err_undeclared_label_use : Error<"use of undeclared label %0">; +def err_goto_ms_asm_label : Error< + "cannot jump from this goto statement to label %0 inside an inline assembly block">; +def note_goto_ms_asm_label : Note< + "inline assembly label %0 declared here">; def warn_unused_label : Warning<"unused label %0">, InGroup<UnusedLabel>, DefaultIgnore; -def err_goto_into_protected_scope : Error<"goto into protected scope">; -def ext_goto_into_protected_scope : ExtWarn<"goto into protected scope">, +def err_goto_into_protected_scope : Error< + "cannot jump from this goto statement to its label">; +def ext_goto_into_protected_scope : ExtWarn< + "jump from this goto statement to its label is a Microsoft extension">, InGroup<Microsoft>; def warn_cxx98_compat_goto_into_protected_scope : Warning< - "goto would jump into protected scope in C++98">, + "jump from this goto statement to its label is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; def err_switch_into_protected_scope : Error< - "switch case is in protected scope">; + "cannot jump from switch statement to this case label">; def warn_cxx98_compat_switch_into_protected_scope : Warning< - "switch case would be in a protected scope in C++98">, + "jump from switch statement to this case label is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; def err_indirect_goto_without_addrlabel : Error< "indirect goto in function with no address-of-label expressions">; def err_indirect_goto_in_protected_scope : Error< - "indirect goto might cross protected scopes">; + "cannot jump from this indirect goto statement to one of its possible targets">; def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning< - "indirect goto might cross protected scopes in C++98">, - InGroup<CXX98Compat>, DefaultIgnore; -def note_indirect_goto_target : Note<"possible target of indirect goto">; + "jump from this indirect goto statement to one of its possible targets " + "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; +def note_indirect_goto_target : Note< + "possible target of indirect goto statement">; def note_protected_by_variable_init : Note< "jump bypasses variable initialization">; def note_protected_by_variable_nontriv_destructor : Note< @@ -4528,7 +4688,7 @@ def warn_logical_and_in_logical_or : Warning< "'&&' within '||'">, InGroup<LogicalOpParentheses>; def warn_overloaded_shift_in_comparison :Warning< - "overloaded operator %select{>>|<<}0 has lower precedence than " + "overloaded operator %select{>>|<<}0 has higher precedence than " "comparison operator">, InGroup<OverloadedShiftOpParentheses>; def note_evaluate_comparison_first :Note< @@ -4541,6 +4701,9 @@ def warn_addition_in_bitshift : Warning< def warn_self_assignment : Warning< "explicitly assigning value of variable of type %0 to itself">, InGroup<SelfAssignment>, DefaultIgnore; +def warn_self_move : Warning< + "explicitly moving variable of type %0 to itself">, + InGroup<SelfMove>, DefaultIgnore; def warn_string_plus_int : Warning< "adding %0 to a string does not append to the string">, @@ -4819,9 +4982,11 @@ def err_typecheck_comparison_of_distinct_pointers : Error< def ext_typecheck_comparison_of_distinct_pointers_nonstandard : ExtWarn< "comparison of distinct pointer types (%0 and %1) uses non-standard " "composite pointer type %2">, InGroup<CompareDistinctPointerType>; +def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error< + "%select{comparison between %diff{ ($ and $)|}0,1" + "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1}2" + " which are pointers to non-overlapping address spaces">; def err_typecheck_assign_const : Error<"read-only variable is not assignable">; -def err_stmtexpr_file_scope : Error< - "statement expression not allowed at file scope">; def warn_mixed_sign_comparison : Warning< "comparison of integers of different signs: %0 and %1">, InGroup<SignCompare>, DefaultIgnore; @@ -5128,7 +5293,7 @@ def err_bad_cxx_cast_member_pointer_size : Error< "cannot %select{||reinterpret_cast||C-style cast|}0 from member pointer " "type %1 to member pointer type %2 of different size">; def err_bad_reinterpret_cast_reference : Error< - "reinterpret_cast of a %0 to %1 needs its address which is not allowed">; + "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">; def warn_undefined_reinterpret_cast : Warning< "reinterpret_cast from %0 to %1 has undefined behavior">, InGroup<UndefinedReinterpretCast>, DefaultIgnore; @@ -5162,6 +5327,7 @@ def err_uuidof_without_guid : Error< def err_uuidof_with_multiple_guids : Error< "cannot call operator __uuidof on a type with multiple GUIDs">; def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">; +def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">; def err_static_illegal_in_new : Error< "the 'static' modifier for the array size is not legal in new expressions">; def err_array_new_needs_size : Error< @@ -5206,15 +5372,18 @@ def err_address_space_qualified_delete : Error< def err_default_init_const : Error< "default initialization of an object of const type %0" - "%select{| requires a user-provided default constructor}1">; + "%select{| without a user-provided default constructor}1">; +def note_add_initializer : Note< + "add an explicit initializer to initialize %0">; def err_delete_operand : Error<"cannot delete expression of type %0">; def ext_delete_void_ptr_operand : ExtWarn< - "cannot delete expression with pointer-to-'void' type %0">; + "cannot delete expression with pointer-to-'void' type %0">, + InGroup<DeleteIncomplete>; def err_ambiguous_delete_operand : Error< "ambiguous conversion of delete expression of type %0 to a pointer">; def warn_delete_incomplete : Warning< "deleting pointer to incomplete type %0 may cause undefined behavior">, - InGroup<DiagGroup<"delete-incomplete">>; + InGroup<DeleteIncomplete>; def err_delete_incomplete_class_type : Error< "deleting incomplete class type %0; no conversions to pointer type">; def err_delete_explicit_conversion : Error< @@ -5323,9 +5492,6 @@ let CategoryName = "Lambda Issue" in { "'this' cannot be %select{implicitly |}0captured in this context">; def err_lambda_capture_anonymous_var : Error< "unnamed variable cannot be implicitly captured in a lambda expression">; - def err_lambda_capture_vm_type : Error< - "variable %0 with variably modified type cannot be captured in " - "a lambda expression">; def err_lambda_capture_flexarray_type : Error< "variable %0 with flexible array member cannot be captured in " "a lambda expression">; @@ -5361,12 +5527,12 @@ let CategoryName = "Lambda Issue" in { "implicit capture of lambda object due to conversion to block pointer " "here">; - // C++1y lambda init-captures. + // C++14 lambda init-captures. def warn_cxx11_compat_init_capture : Warning< "initialized lambda captures are incompatible with C++ standards " - "before C++1y">, InGroup<CXXPre1yCompat>, DefaultIgnore; + "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore; def ext_init_capture : ExtWarn< - "initialized lambda captures are a C++1y extension">, InGroup<CXX1y>; + "initialized lambda captures are a C++14 extension">, InGroup<CXX14>; def err_init_capture_no_expression : Error< "initializer missing for lambda capture %0">; def err_init_capture_multiple_expressions : Error< @@ -5936,13 +6102,19 @@ def warn_unused_voidptr : Warning< InGroup<UnusedValue>; def warn_unused_property_expr : Warning< "property access result unused - getters should not be used for side effects">, - InGroup<UnusedValue>; + InGroup<UnusedGetterReturnValue>; def warn_unused_container_subscript_expr : Warning< "container access result unused - container access should not be used for side effects">, InGroup<UnusedValue>; def warn_unused_call : Warning< "ignoring return value of function declared with %0 attribute">, InGroup<UnusedValue>; +def warn_side_effects_unevaluated_context : Warning< + "expression with side effects has no effect in an unevaluated context">, + InGroup<UnevaluatedExpression>; +def warn_side_effects_typeid : Warning< + "expression with side effects will be evaluated despite being used as an " + "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>; def warn_unused_result : Warning< "ignoring return value of function declared with warn_unused_result " "attribute">, InGroup<DiagGroup<"unused-result">>; @@ -5974,11 +6146,15 @@ def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0" def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0" "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">, InGroup<ExternCCompat>; +def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and " + "volatile qualifiers|const qualifier|volatile qualifier}2">, + InGroup<CastQual>, DefaultIgnore; +def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate " + "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore; } // End of general sema category. // inline asm. let CategoryName = "Inline Assembly Issue" in { - def err_asm_wide_character : Error<"wide string is invalid in 'asm'">; def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">; def err_asm_invalid_output_constraint : Error< "invalid output constraint '%0' in asm">; @@ -5991,14 +6167,20 @@ let CategoryName = "Inline Assembly Issue" in { def err_asm_tying_incompatible_types : Error< "unsupported inline asm: input with type " "%diff{$ matching output with type $|}0,1">; + def err_asm_unexpected_constraint_alternatives : Error< + "asm constraint has an unexpected number of alternatives: %0 vs %1">; def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">; def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">; def err_asm_bad_register_type : Error<"bad type for named register variable">; def err_asm_invalid_input_size : Error< "invalid input size for constraint '%0'">; + def err_asm_invalid_output_size : Error< + "invalid output size for constraint '%0'">; def err_invalid_asm_cast_lvalue : Error< "invalid use of a cast in a inline asm context requiring an l-value: " "remove the cast or build with -fheinous-gnu-extensions">; + def err_invalid_asm_value_for_constraint + : Error <"value '%0' out of range for constraint '%1'">; def warn_asm_label_on_auto_decl : Warning< "ignored asm label '%0' on automatic variable">; @@ -6010,6 +6192,9 @@ let CategoryName = "Inline Assembly Issue" in { "value size does not match register size specified by the constraint " "and modifier">, InGroup<ASMOperandWidths>; + + def note_asm_missing_constraint_modifier : Note< + "use constraint modifier \"%0\"">; } let CategoryName = "Semantic Issue" in { @@ -6080,9 +6265,12 @@ def err_in_class_initializer_literal_type : Error< "'constexpr' specifier">; def err_in_class_initializer_non_constant : Error< "in-class initializer for static data member is not a constant expression">; -def err_in_class_initializer_references_def_ctor : Error< - "defaulted default constructor of %0 cannot be used by non-static data " - "member initializer which appears before end of class definition">; +def err_in_class_initializer_not_yet_parsed + : Error<"cannot use defaulted default constructor of %0 within the class " + "outside of member functions because %1 has an initializer">; +def err_in_class_initializer_not_yet_parsed_outer_class + : Error<"cannot use defaulted default constructor of %0 within " + "%1 outside of member functions because %2 has an initializer">; def ext_in_class_initializer_non_constant : Extension< "in-class initializer for static data member is not a constant expression; " @@ -6130,8 +6318,9 @@ def err_anonymous_record_bad_member : Error< def err_anonymous_record_nonpublic_member : Error< "anonymous %select{struct|union}0 cannot contain a " "%select{private|protected}1 data member">; -def ext_ms_anonymous_struct : ExtWarn< - "anonymous structs are a Microsoft extension">, InGroup<Microsoft>; +def ext_ms_anonymous_record : ExtWarn< + "anonymous %select{structs|unions}0 are a Microsoft extension">, + InGroup<Microsoft>; // C++ local classes def err_reference_to_local_var_in_enclosing_function : Error< @@ -6267,7 +6456,13 @@ def err_conv_function_to_array : Error< def err_conv_function_to_function : Error< "conversion function cannot convert to a function type">; def err_conv_function_with_complex_decl : Error< - "must use a typedef to declare a conversion to %0">; + "cannot specify any part of a return type in the " + "declaration of a conversion function" + "%select{" + "; put the complete type after 'operator'|" + "; use a typedef to declare a conversion to %1|" + "; use an alias template to declare a conversion to %1|" + "}0">; def err_conv_function_redeclared : Error< "conversion function cannot be redeclared">; def warn_conv_to_self_not_used : Warning< @@ -6435,7 +6630,7 @@ 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?">; def warn_null_arg : Warning< - "null passed to a callee which requires a non-null argument">, + "null passed to a callee that requires a non-null argument">, InGroup<NonNull>; def warn_null_ret : Warning< "null returned from %select{function|method}0 that requires a non-null return value">, @@ -6744,6 +6939,17 @@ def err_convertvector_non_vector_type : Error< def err_convertvector_incompatible_vector : Error< "first two arguments to __builtin_convertvector must have the same number of elements">; +def err_first_argument_to_cwsc_not_call : Error< + "first argument to __builtin_call_with_static_chain must be a non-member call expression">; +def err_first_argument_to_cwsc_block_call : Error< + "first argument to __builtin_call_with_static_chain must not be a block call">; +def err_first_argument_to_cwsc_builtin_call : Error< + "first argument to __builtin_call_with_static_chain must not be a builtin call">; +def err_first_argument_to_cwsc_pdtor_call : Error< + "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">; +def err_second_argument_to_cwsc_not_pointer : Error< + "second argument to __builtin_call_with_static_chain must be of pointer type">; + def err_vector_incorrect_num_initializers : Error< "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">; def err_altivec_empty_initializer : Error<"expected initializer">; @@ -6801,6 +7007,11 @@ def warn_duplicate_attribute : Warning< "attribute %0 is already applied with different parameters">, InGroup<IgnoredAttributes>; +def warn_sync_fetch_and_nand_semantics_change : Warning< + "the semantics of this intrinsic changed with GCC " + "version 4.4 - the newer semantics are provided here">, + InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>; + // Type def ext_invalid_sign_spec : Extension<"'%0' cannot be signed or unsigned">; def warn_receiver_forward_class : Warning< @@ -6842,6 +7053,13 @@ def err_invalid_protocol_qualifiers : Error< def warn_ivar_use_hidden : Warning< "local declaration of %0 hides instance variable">, InGroup<DiagGroup<"shadow-ivar">>; +def warn_direct_initialize_call : Warning< + "explicit call to +initialize results in duplicate call to +initialize">, + InGroup<ExplicitInitializeCall>; +def warn_direct_super_initialize_call : Warning< + "explicit call to [super initialize] should only be in implementation " + "of +initialize">, + InGroup<ExplicitInitializeCall>; def error_ivar_use_in_class_method : Error< "instance variable %0 accessed in class method">; def error_implicit_ivar_access : Error< @@ -6891,6 +7109,9 @@ def err_property_not_found_suggest : Error< "property %0 not found on object of type %1; did you mean %2?">; def err_ivar_access_using_property_syntax_suggest : Error< "property %0 not found on object of type %1; did you mean to access instance variable %2?">; +def warn_property_access_suggest : Warning< +"property %0 not found on object of type %1; did you mean to access property %2?">, +InGroup<PropertyAccessDotSyntax>; def err_property_found_suggest : Error< "property %0 found on object of type %1; did you mean to access " "it with the \".\" operator?">; @@ -6938,6 +7159,11 @@ def err_unknown_any_function : Error< def err_filter_expression_integral : Error< "filter expression type should be an integral value not %0">; +def err_non_asm_stmt_in_naked_function : Error< + "non-ASM statement in naked function is not supported">; +def err_asm_naked_parm_ref : Error< + "parameter references not allowed in naked functions">; + // OpenCL warnings and errors. def err_invalid_astype_of_different_size : Error< "invalid reinterpretation: sizes of %0 and %1 must match">; @@ -7000,7 +7226,7 @@ def err_omp_var_scope : Error< def err_omp_var_used : Error< "'#pragma omp %0' must precede all references to variable %q1">; def err_omp_var_thread_local : Error< - "variable %0 cannot be threadprivate because it is thread-local">; + "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">; def err_omp_private_incomplete_type : Error< "a private variable with incomplete type %0">; def err_omp_firstprivate_incomplete_type : Error< @@ -7015,8 +7241,8 @@ def err_omp_expected_var_name : Error< "expected variable name">; def err_omp_required_method : Error< "%0 variable must have an accessible, unambiguous %select{default constructor|copy constructor|copy assignment operator|'%2'|destructor}1">; -def err_omp_task_predetermined_firstprivate_required_method : Error< - "predetermined as a firstprivate in a task construct variable must have an accessible, unambiguous %select{copy constructor|destructor}0">; +def note_omp_task_predetermined_firstprivate_here : Note< + "predetermined as a firstprivate in a task construct here">; def err_omp_clause_ref_type_arg : Error< "arguments of OpenMP clause '%0' cannot be of reference type %1">; def err_omp_task_predetermined_firstprivate_ref_type_arg : Error< @@ -7044,6 +7270,8 @@ def note_omp_implicit_dsa : Note< "implicitly determined as %0">; def err_omp_loop_var_dsa : Error< "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">; +def err_omp_global_loop_var_dsa : Error< + "loop iteration variable in the associated loop of 'omp %1' directive may not be a variable with global storage without being explicitly marked as %0">; def err_omp_not_for : Error< "%select{statement after '#pragma omp %1' must be a for loop|" "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">; @@ -7075,6 +7303,9 @@ def err_omp_linear_expected_int_or_ptr : Error< def warn_omp_linear_step_zero : Warning< "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">, InGroup<OpenMPClauses>; +def warn_omp_alignment_not_power_of_two : Warning< + "aligned clause will be ignored because the requested alignment is not a power of 2">, + InGroup<OpenMPClauses>; def err_omp_aligned_expected_array_or_ptr : Error< "argument of aligned clause should be array" "%select{ or pointer|, pointer, reference to array or reference to pointer}1" @@ -7102,10 +7333,16 @@ def err_omp_loop_incr_not_compatible : Error< "on each iteration of OpenMP for loop">; def note_omp_loop_cond_requres_compatible_incr : Note< "loop step is expected to be %select{negative|positive}0 due to this condition">; +def err_omp_loop_diff_cxx : Error< + "could not calculate number of iterations calling 'operator-' with " + "upper and lower loop bounds">; def err_omp_loop_cannot_use_stmt : Error< "'%0' statement cannot be used in OpenMP for loop">; def err_omp_simd_region_cannot_use_stmt : Error< "'%0' statement cannot be used in OpenMP simd region">; +def warn_omp_loop_64_bit_var : Warning< + "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">, + InGroup<OpenMPLoopForm>; def err_omp_unknown_reduction_identifier : Error< "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'">; def err_omp_reduction_type_array : Error< @@ -7126,9 +7363,13 @@ def err_omp_reduction_id_not_compatible : Error< "variable of type %0 is not valid for specified reduction operation">; def err_omp_prohibited_region : Error< "region cannot be%select{| closely}0 nested inside '%1' region" - "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?}2">; + "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|" + "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|" + "; perhaps you forget to enclose 'omp %3' directive into a target region?}2">; def err_omp_prohibited_region_simd : Error< "OpenMP constructs may not be nested inside a simd region">; +def err_omp_prohibited_region_atomic : Error< + "OpenMP constructs may not be nested inside an atomic region">; def err_omp_prohibited_region_critical_same_name : Error< "cannot nest 'critical' regions having the same name %0">; def note_omp_previous_critical_region : Note< @@ -7146,6 +7387,35 @@ def err_omp_parallel_sections_substmt_not_section : Error< "statement in 'omp parallel sections' directive must be enclosed into a section region">; def err_omp_parallel_reduction_in_task_firstprivate : Error< "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">; +def err_omp_atomic_read_not_expression_statement : Error< + "the statement for 'atomic read' must be an expression statement of form 'v = x;'," + " where v and x are both lvalue expressions with scalar type">; +def note_omp_atomic_read_write: Note< + "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">; +def err_omp_atomic_write_not_expression_statement : Error< + "the statement for 'atomic write' must be an expression statement of form 'x = expr;'," + " where x is a lvalue expression with scalar type">; +def err_omp_atomic_update_not_expression_statement : Error< + "the statement for 'atomic%select{| update}0' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x'," + " where x is an l-value expression with scalar type">; +def err_omp_atomic_capture_not_expression_statement : Error< + "the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x'," + " where x and v are both l-value expressions with scalar type">; +def err_omp_atomic_capture_not_compound_statement : Error< + "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}'," + " '{v = x; x = x binop expr;}', '{v = x; x = expr binop x;}', '{x = x binop expr; v = x;}', '{x = expr binop x; v = x;}' or '{v = x; x = expr;}'," + " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'" + " where x is an l-value expression with scalar type">; +def err_omp_atomic_several_clauses : Error< + "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause">; +def note_omp_atomic_previous_clause : Note< + "'%0' clause used here">; +def err_omp_target_contains_not_only_teams : Error< + "target construct with nested teams region contains statements outside of the teams construct">; +def note_omp_nested_teams_construct_here : Note< + "nested teams construct here">; +def note_omp_nested_statement_here : Note< + "%select{statement|directive}0 outside teams construct here">; } // end of OpenMP category let CategoryName = "Related Result Type Issue" in { @@ -7197,6 +7467,8 @@ def err_module_import_not_at_top_level : Error< def note_module_import_not_at_top_level : Note<"%0 begins here">; def err_module_self_import : Error< "import of module '%0' appears within same top-level module '%1'">; +def err_module_import_in_implementation : Error< + "@import of module '%0' in implementation of '%1'; use #import">; } let CategoryName = "Documentation Issue" in { diff --git a/include/clang/Basic/DiagnosticSerializationKinds.td b/include/clang/Basic/DiagnosticSerializationKinds.td index be9d2bd..a685db0 100644 --- a/include/clang/Basic/DiagnosticSerializationKinds.td +++ b/include/clang/Basic/DiagnosticSerializationKinds.td @@ -52,10 +52,18 @@ def err_pch_with_compiler_errors : Error< "PCH file contains compiler errors">; def err_imported_module_not_found : Error< - "module '%0' imported by AST file '%1' not found">, DefaultFatal; + "module '%0' in AST file '%1' (imported by AST file '%2') " + "is not defined in any loaded module map file; " + "maybe you need to load '%3'?">, DefaultFatal; def err_imported_module_modmap_changed : Error< "module '%0' imported by 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 " + "directory '%2'">, DefaultFatal; +def err_module_different_modmap : Error< + "module '%0' %select{uses|does not use}1 additional module map '%2'" + "%select{| not}1 used when the module was built">; def warn_module_conflict : Warning< "module '%0' conflicts with already-imported module '%1': %2">, InGroup<ModuleConflict>; diff --git a/include/clang/Basic/ExceptionSpecificationType.h b/include/clang/Basic/ExceptionSpecificationType.h index edd89ec..132b5ba 100644 --- a/include/clang/Basic/ExceptionSpecificationType.h +++ b/include/clang/Basic/ExceptionSpecificationType.h @@ -26,7 +26,8 @@ enum ExceptionSpecificationType { EST_BasicNoexcept, ///< noexcept EST_ComputedNoexcept, ///< noexcept(expression) EST_Unevaluated, ///< not evaluated yet, for special member function - EST_Uninstantiated ///< not instantiated yet + EST_Uninstantiated, ///< not instantiated yet + EST_Unparsed ///< not parsed yet }; inline bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType) { diff --git a/include/clang/Basic/ExpressionTraits.h b/include/clang/Basic/ExpressionTraits.h index e877715..0363a1d 100644 --- a/include/clang/Basic/ExpressionTraits.h +++ b/include/clang/Basic/ExpressionTraits.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_EXPRESSIONTRAITS_H -#define LLVM_CLANG_EXPRESSIONTRAITS_H +#ifndef LLVM_CLANG_BASIC_EXPRESSIONTRAITS_H +#define LLVM_CLANG_BASIC_EXPRESSIONTRAITS_H namespace clang { diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h index 0ad53c4..bd3f27a 100644 --- a/include/clang/Basic/FileManager.h +++ b/include/clang/Basic/FileManager.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_FILEMANAGER_H -#define LLVM_CLANG_FILEMANAGER_H +#ifndef LLVM_CLANG_BASIC_FILEMANAGER_H +#define LLVM_CLANG_BASIC_FILEMANAGER_H #include "clang/Basic/FileSystemOptions.h" #include "clang/Basic/LLVM.h" @@ -59,7 +59,7 @@ public: /// If the 'File' member is valid, then this FileEntry has an open file /// descriptor for the file. class FileEntry { - std::string Name; // Name of the file. + const char *Name; // Name of the file. off_t Size; // File size in bytes. time_t ModTime; // Modification time of file. const DirectoryEntry *Dir; // Directory file lives in. @@ -93,7 +93,7 @@ public: assert(!isValid() && "Cannot copy an initialized FileEntry"); } - const char *getName() const { return Name.c_str(); } + const char *getName() const { return Name; } bool isValid() const { return IsValid; } off_t getSize() const { return Size; } unsigned getUID() const { return UID; } @@ -194,7 +194,8 @@ public: /// \param AtBeginning whether this new stat cache must be installed at the /// beginning of the chain of stat caches. Otherwise, it will be added to /// the end of the chain. - void addStatCache(FileSystemStatCache *statCache, bool AtBeginning = false); + void addStatCache(std::unique_ptr<FileSystemStatCache> statCache, + bool AtBeginning = false); /// \brief Removes the specified FileSystemStatCache object from the manager. void removeStatCache(FileSystemStatCache *statCache); @@ -240,12 +241,11 @@ public: /// \brief Open the specified file as a MemoryBuffer, returning a new /// MemoryBuffer if successful, otherwise returning null. - llvm::MemoryBuffer *getBufferForFile(const FileEntry *Entry, - std::string *ErrorStr = nullptr, - bool isVolatile = false, - bool ShouldCloseOpenFile = true); - llvm::MemoryBuffer *getBufferForFile(StringRef Filename, - std::string *ErrorStr = nullptr); + llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> + getBufferForFile(const FileEntry *Entry, bool isVolatile = false, + bool ShouldCloseOpenFile = true); + llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> + getBufferForFile(StringRef Filename); /// \brief Get the 'stat' information for the given \p Path. /// @@ -274,6 +274,9 @@ public: static void modifyFileEntry(FileEntry *File, off_t Size, time_t ModificationTime); + /// \brief Remove any './' components from a path. + static bool removeDotPaths(SmallVectorImpl<char> &Path); + /// \brief 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/FileSystemStatCache.h b/include/clang/Basic/FileSystemStatCache.h index 9be8b10..cad9189 100644 --- a/include/clang/Basic/FileSystemStatCache.h +++ b/include/clang/Basic/FileSystemStatCache.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_FILESYSTEMSTATCACHE_H -#define LLVM_CLANG_FILESYSTEMSTATCACHE_H +#ifndef LLVM_CLANG_BASIC_FILESYSTEMSTATCACHE_H +#define LLVM_CLANG_BASIC_FILESYSTEMSTATCACHE_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/StringMap.h" @@ -74,8 +74,8 @@ public: /// \brief Sets the next stat call cache in the chain of stat caches. /// Takes ownership of the given stat cache. - void setNextStatCache(FileSystemStatCache *Cache) { - NextStatCache.reset(Cache); + void setNextStatCache(std::unique_ptr<FileSystemStatCache> Cache) { + NextStatCache = std::move(Cache); } /// \brief Retrieve the next stat call cache in the chain. @@ -84,7 +84,9 @@ public: /// \brief Retrieve the next stat call cache in the chain, transferring /// ownership of this cache (and, transitively, all of the remaining caches) /// to the caller. - FileSystemStatCache *takeNextStatCache() { return NextStatCache.release(); } + std::unique_ptr<FileSystemStatCache> takeNextStatCache() { + return std::move(NextStatCache); + } protected: // FIXME: The pointer here is a non-owning/optional reference to the diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index 0c278a1..1de9dd1 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -249,6 +249,9 @@ public: } bool isCPlusPlusOperatorKeyword() const { return IsCPPOperatorKeyword; } + /// \brief Return true if this token is a keyword in the specified language. + bool isKeyword(const LangOptions &LangOpts); + /// getFETokenInfo/setFETokenInfo - The language front-end is allowed to /// associate arbitrary metadata with this token. template<typename T> @@ -444,26 +447,21 @@ public: /// \brief Return the identifier token info for the specified named /// identifier. IdentifierInfo &get(StringRef Name) { - llvm::StringMapEntry<IdentifierInfo*> &Entry = - HashTable.GetOrCreateValue(Name); + auto &Entry = *HashTable.insert(std::make_pair(Name, nullptr)).first; - IdentifierInfo *II = Entry.getValue(); + IdentifierInfo *&II = Entry.second; if (II) return *II; // No entry; if we have an external lookup, look there first. if (ExternalLookup) { II = ExternalLookup->get(Name); - if (II) { - // Cache in the StringMap for subsequent lookups. - Entry.setValue(II); + if (II) return *II; - } } // Lookups failed, make a new IdentifierInfo. void *Mem = getAllocator().Allocate<IdentifierInfo>(); II = new (Mem) IdentifierInfo(); - Entry.setValue(II); // Make sure getName() knows how to find the IdentifierInfo // contents. @@ -486,25 +484,23 @@ public: /// introduce or modify an identifier. If they called get(), they would /// likely end up in a recursion. IdentifierInfo &getOwn(StringRef Name) { - llvm::StringMapEntry<IdentifierInfo*> &Entry = - HashTable.GetOrCreateValue(Name); - - IdentifierInfo *II = Entry.getValue(); - if (!II) { - - // Lookups failed, make a new IdentifierInfo. - void *Mem = getAllocator().Allocate<IdentifierInfo>(); - II = new (Mem) IdentifierInfo(); - Entry.setValue(II); - - // Make sure getName() knows how to find the IdentifierInfo - // contents. - II->Entry = &Entry; - - // If this is the 'import' contextual keyword, mark it as such. - if (Name.equals("import")) - II->setModulesImport(true); - } + auto &Entry = *HashTable.insert(std::make_pair(Name, nullptr)).first; + + IdentifierInfo *&II = Entry.second; + if (II) + return *II; + + // Lookups failed, make a new IdentifierInfo. + void *Mem = getAllocator().Allocate<IdentifierInfo>(); + II = new (Mem) IdentifierInfo(); + + // Make sure getName() knows how to find the IdentifierInfo + // contents. + II->Entry = &Entry; + + // If this is the 'import' contextual keyword, mark it as such. + if (Name.equals("import")) + II->setModulesImport(true); return *II; } @@ -563,6 +559,7 @@ enum ObjCMethodFamily { OMF_retain, OMF_retainCount, OMF_self, + OMF_initialize, // performSelector families OMF_performSelector @@ -588,6 +585,12 @@ enum ObjCInstanceTypeFamily { OIT_ReturnsSelf }; +enum ObjCStringFormatFamily { + SFF_None, + SFF_NSString, + SFF_CFString +}; + /// \brief Smart pointer class that efficiently represents Objective-C method /// names. /// @@ -633,6 +636,8 @@ class Selector { } static ObjCMethodFamily getMethodFamilyImpl(Selector sel); + + static ObjCStringFormatFamily getStringFormatFamilyImpl(Selector sel); public: friend class SelectorTable; // only the SelectorTable can create these @@ -703,7 +708,11 @@ public: ObjCMethodFamily getMethodFamily() const { return getMethodFamilyImpl(*this); } - + + ObjCStringFormatFamily getStringFormatFamily() const { + return getStringFormatFamilyImpl(*this); + } + static Selector getEmptyMarker() { return Selector(uintptr_t(-1)); } diff --git a/include/clang/Basic/LLVM.h b/include/clang/Basic/LLVM.h index 5a71fa8..3e01d25 100644 --- a/include/clang/Basic/LLVM.h +++ b/include/clang/Basic/LLVM.h @@ -13,8 +13,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef CLANG_BASIC_LLVM_H -#define CLANG_BASIC_LLVM_H +#ifndef LLVM_CLANG_BASIC_LLVM_H +#define LLVM_CLANG_BASIC_LLVM_H // Do not proliferate #includes here, require clients to #include their // dependencies. diff --git a/include/clang/Basic/Lambda.h b/include/clang/Basic/Lambda.h index 280ae94..e676e72 100644 --- a/include/clang/Basic/Lambda.h +++ b/include/clang/Basic/Lambda.h @@ -34,7 +34,8 @@ enum LambdaCaptureDefault { enum LambdaCaptureKind { LCK_This, ///< Capturing the \c this pointer LCK_ByCopy, ///< Capturing by copy (a.k.a., by value) - LCK_ByRef ///< Capturing by reference + LCK_ByRef, ///< Capturing by reference + LCK_VLAType ///< Capturing variable-length array type }; } // end namespace clang diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def index a297a4c..cf9638d 100644 --- a/include/clang/Basic/LangOptions.def +++ b/include/clang/Basic/LangOptions.def @@ -9,26 +9,40 @@ // // This file defines the language options. Users of this file must // define the LANGOPT macro to make use of this information. -// Optionally, the user may also define BENIGN_LANGOPT -// (for options that don't affect the construction of the AST in an -// incompatible way), ENUM_LANGOPT (for options that have enumeration, -// rather than unsigned, type), BENIGN_ENUM_LANGOPT (for benign -// options that have enumeration type), and VALUE_LANGOPT is a language option -// that describes a value rather than a flag. // +// Optionally, the user may also define: +// +// BENIGN_LANGOPT: for options that don't affect the construction of the AST in +// any way (that is, the value can be different between an implicit module +// and the user of that module). +// +// COMPATIBLE_LANGOPT: for options that affect the construction of the AST in +// a way that doesn't prevent interoperability (that is, the value can be +// different between an explicit module and the user of that module). +// +// ENUM_LANGOPT: for options that have enumeration, rather than unsigned, type. +// +// VALUE_LANGOPT: for options that describe a value rather than a flag. +// +// BENIGN_ENUM_LANGOPT, COMPATIBLE_ENUM_LANGOPT: combinations of the above. +// +// FIXME: Clients should be able to more easily select whether they want +// different levels of compatibility versus how to handle different kinds +// of option. //===----------------------------------------------------------------------===// + #ifndef LANGOPT # error Define the LANGOPT macro to handle language options #endif -#ifndef VALUE_LANGOPT -# define VALUE_LANGOPT(Name, Bits, Default, Description) \ +#ifndef COMPATIBLE_LANGOPT +# define COMPATIBLE_LANGOPT(Name, Bits, Default, Description) \ LANGOPT(Name, Bits, Default, Description) #endif #ifndef BENIGN_LANGOPT # define BENIGN_LANGOPT(Name, Bits, Default, Description) \ - LANGOPT(Name, Bits, Default, Description) + COMPATIBLE_LANGOPT(Name, Bits, Default, Description) #endif #ifndef ENUM_LANGOPT @@ -36,11 +50,22 @@ LANGOPT(Name, Bits, Default, Description) #endif +#ifndef COMPATIBLE_ENUM_LANGOPT +# define COMPATIBLE_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ + ENUM_LANGOPT(Name, Type, Bits, Default, Description) +#endif + #ifndef BENIGN_ENUM_LANGOPT # define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ - ENUM_LANGOPT(Name, Type, Bits, Default, Description) + COMPATIBLE_ENUM_LANGOPT(Name, Type, Bits, Default, Description) #endif +#ifndef VALUE_LANGOPT +# define VALUE_LANGOPT(Name, Bits, Default, Description) \ + LANGOPT(Name, Bits, Default, Description) +#endif + +// FIXME: A lot of the BENIGN_ options should be COMPATIBLE_ instead. LANGOPT(C99 , 1, 0, "C99") LANGOPT(C11 , 1, 0, "C11") LANGOPT(MSVCCompat , 1, 0, "Microsoft Visual C++ full compatibility mode") @@ -49,7 +74,7 @@ LANGOPT(AsmBlocks , 1, 0, "Microsoft inline asm blocks") LANGOPT(Borland , 1, 0, "Borland extensions") LANGOPT(CPlusPlus , 1, 0, "C++") LANGOPT(CPlusPlus11 , 1, 0, "C++11") -LANGOPT(CPlusPlus1y , 1, 0, "C++1y") +LANGOPT(CPlusPlus14 , 1, 0, "C++14") LANGOPT(CPlusPlus1z , 1, 0, "C++1z") LANGOPT(ObjC1 , 1, 0, "Objective-C 1") LANGOPT(ObjC2 , 1, 0, "Objective-C 2") @@ -101,16 +126,19 @@ LANGOPT(ModulesDeclUse , 1, 0, "require declaration of module uses") LANGOPT(ModulesSearchAll , 1, 1, "search even non-imported modules to find unresolved references") LANGOPT(ModulesStrictDeclUse, 1, 0, "require declaration of module uses and all headers to be in modules") LANGOPT(ModulesErrorRecovery, 1, 1, "automatically import modules as needed when performing error recovery") -LANGOPT(Optimize , 1, 0, "__OPTIMIZE__ predefined macro") -LANGOPT(OptimizeSize , 1, 0, "__OPTIMIZE_SIZE__ predefined macro") +BENIGN_LANGOPT(ModulesImplicitMaps, 1, 1, "use files called module.modulemap implicitly as module maps") +COMPATIBLE_LANGOPT(Optimize , 1, 0, "__OPTIMIZE__ predefined macro") +COMPATIBLE_LANGOPT(OptimizeSize , 1, 0, "__OPTIMIZE_SIZE__ predefined macro") LANGOPT(Static , 1, 0, "__STATIC__ predefined macro (as opposed to __DYNAMIC__)") VALUE_LANGOPT(PackStruct , 32, 0, "default struct packing maximum alignment") +VALUE_LANGOPT(MaxTypeAlign , 32, 0, + "default maximum alignment for types") VALUE_LANGOPT(PICLevel , 2, 0, "__PIC__ level") VALUE_LANGOPT(PIELevel , 2, 0, "__PIE__ level") LANGOPT(GNUInline , 1, 0, "GNU inline semantics") -LANGOPT(NoInlineDefine , 1, 0, "__NO_INLINE__ predefined macro") -LANGOPT(Deprecated , 1, 0, "__DEPRECATED predefined macro") +COMPATIBLE_LANGOPT(NoInlineDefine , 1, 0, "__NO_INLINE__ predefined macro") +COMPATIBLE_LANGOPT(Deprecated , 1, 0, "__DEPRECATED predefined macro") LANGOPT(FastMath , 1, 0, "__FAST_MATH__ predefined macro") LANGOPT(FiniteMathOnly , 1, 0, "__FINITE_MATH_ONLY__ predefined macro") @@ -126,8 +154,10 @@ LANGOPT(ShortEnums , 1, 0, "short enum types") LANGOPT(OpenCL , 1, 0, "OpenCL") LANGOPT(OpenCLVersion , 32, 0, "OpenCL version") LANGOPT(NativeHalfType , 1, 0, "Native half type support") +LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns") LANGOPT(CUDA , 1, 0, "CUDA") LANGOPT(OpenMP , 1, 0, "OpenMP support") +LANGOPT(CUDAIsDevice , 1, 0, "Compiling for CUDA device") LANGOPT(AssumeSaneOperatorNew , 1, 1, "implicit __attribute__((malloc)) for C++'s new operators") LANGOPT(SizedDeallocation , 1, 0, "enable sized deallocation functions") @@ -187,9 +217,15 @@ LANGOPT(ApplePragmaPack, 1, 0, "Apple gcc-compatible #pragma pack handling") LANGOPT(RetainCommentsFromSystemHeaders, 1, 0, "retain documentation comments from system headers in the AST") +LANGOPT(SanitizeAddressFieldPadding, 2, 0, "controls how aggressive is ASan " + "field padding (0: none, 1:least " + "aggressive, 2: more aggressive)") + #undef LANGOPT -#undef VALUE_LANGOPT +#undef COMPATIBLE_LANGOPT #undef BENIGN_LANGOPT #undef ENUM_LANGOPT +#undef COMPATIBLE_ENUM_LANGOPT #undef BENIGN_ENUM_LANGOPT +#undef VALUE_LANGOPT diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h index 9bffc7c..5ac96c5 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -12,25 +12,18 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_LANGOPTIONS_H -#define LLVM_CLANG_LANGOPTIONS_H +#ifndef LLVM_CLANG_BASIC_LANGOPTIONS_H +#define LLVM_CLANG_BASIC_LANGOPTIONS_H #include "clang/Basic/CommentOptions.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/ObjCRuntime.h" +#include "clang/Basic/Sanitizers.h" #include "clang/Basic/Visibility.h" #include <string> namespace clang { -struct SanitizerOptions { -#define SANITIZER(NAME, ID) unsigned ID : 1; -#include "clang/Basic/Sanitizers.def" - - /// \brief Cached set of sanitizer options with all sanitizers disabled. - static const SanitizerOptions Disabled; -}; - /// Bitfields of LangOptions, split out from LangOptions in order to ensure that /// this large collection of bitfields is a trivial class type. class LangOptionsBase { @@ -40,7 +33,6 @@ public: #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) #include "clang/Basic/LangOptions.def" - SanitizerOptions Sanitize; protected: // Define language options of enumeration type. These are private, and will // have accessors (below). @@ -75,6 +67,13 @@ public: enum AddrSpaceMapMangling { ASMM_Target, ASMM_On, ASMM_Off }; public: + /// \brief Set of enabled sanitizers. + SanitizerSet Sanitize; + + /// \brief Path to blacklist file specifying which objects + /// (files, functions, variables) should not be instrumented. + std::string SanitizerBlacklistFile; + clang::ObjCRuntime ObjCRuntime; std::string ObjCConstantStringClass; @@ -88,6 +87,11 @@ public: /// \brief The name of the current module. std::string CurrentModule; + /// \brief The name of the module that the translation unit is an + /// implementation of. Prevents semantic imports, but does not otherwise + /// treat this as the CurrentModule. + std::string ImplementationOfModule; + /// \brief Options for parsing comments. CommentOptions CommentOpts; diff --git a/include/clang/Basic/Module.h b/include/clang/Basic/Module.h index 9b66840..e3953a4 100644 --- a/include/clang/Basic/Module.h +++ b/include/clang/Basic/Module.h @@ -56,17 +56,11 @@ public: /// module. Module *Parent; - /// \brief The module map file that (along with the module name) uniquely - /// identifies this module. - /// - /// The particular module that \c Name refers to may depend on how the module - /// was found in header search. However, the combination of \c Name and - /// \c ModuleMap will be globally unique for top-level modules. In the case of - /// inferred modules, \c ModuleMap will contain the module map that allowed - /// the inference (e.g. contained 'Module *') rather than the virtual - /// inferred module map file. - const FileEntry *ModuleMap; - + /// \brief The build directory of this module. This is the directory in + /// which the module is notionally built, and relative to which its headers + /// are found. + const DirectoryEntry *Directory; + /// \brief The umbrella header or directory. llvm::PointerUnion<const DirectoryEntry *, const FileEntry *> Umbrella; @@ -92,18 +86,28 @@ private: mutable llvm::DenseSet<const Module*> VisibleModulesCache; public: - /// \brief The headers that are part of this module. - SmallVector<const FileEntry *, 2> NormalHeaders; - - /// \brief The headers that are explicitly excluded from this module. - SmallVector<const FileEntry *, 2> ExcludedHeaders; - - /// \brief The headers that are private to this module. - SmallVector<const FileEntry *, 2> PrivateHeaders; + enum HeaderKind { + HK_Normal, + HK_Textual, + HK_Private, + HK_PrivateTextual, + HK_Excluded + }; + static const int NumHeaderKinds = HK_Excluded + 1; /// \brief Information about a header directive as found in the module map /// file. - struct HeaderDirective { + struct Header { + std::string NameAsWritten; + const FileEntry *Entry; + }; + + /// \brief The headers that are part of this module. + SmallVector<Header, 2> Headers[5]; + + /// \brief Stored information about a header directive that was found in the + /// module map file but has not been resolved to a file. + struct UnresolvedHeaderDirective { SourceLocation FileNameLoc; std::string FileName; bool IsUmbrella; @@ -111,7 +115,7 @@ public: /// \brief Headers that are mentioned in the module map file but could not be /// found on the file system. - SmallVector<HeaderDirective, 1> MissingHeaders; + SmallVector<UnresolvedHeaderDirective, 1> MissingHeaders; /// \brief An individual requirement: a feature name and a flag indicating /// the required state of that feature. @@ -283,10 +287,8 @@ public: std::vector<Conflict> Conflicts; /// \brief Construct a new module or submodule. - /// - /// For an explanation of \p ModuleMap, see Module::ModuleMap. Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent, - const FileEntry *ModuleMap, bool IsFramework, bool IsExplicit); + bool IsFramework, bool IsExplicit); ~Module(); @@ -308,7 +310,7 @@ public: bool isAvailable(const LangOptions &LangOpts, const TargetInfo &Target, Requirement &Req, - HeaderDirective &MissingHeader) const; + UnresolvedHeaderDirective &MissingHeader) const; /// \brief Determine whether this module is a submodule. bool isSubModule() const { return Parent != nullptr; } diff --git a/include/clang/Basic/ObjCRuntime.h b/include/clang/Basic/ObjCRuntime.h index fa375f4..e33587d 100644 --- a/include/clang/Basic/ObjCRuntime.h +++ b/include/clang/Basic/ObjCRuntime.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_OBJCRUNTIME_H -#define LLVM_CLANG_OBJCRUNTIME_H +#ifndef LLVM_CLANG_BASIC_OBJCRUNTIME_H +#define LLVM_CLANG_BASIC_OBJCRUNTIME_H #include "clang/Basic/VersionTuple.h" #include "llvm/ADT/Triple.h" diff --git a/include/clang/Basic/OpenMPKinds.def b/include/clang/Basic/OpenMPKinds.def index 6cfa5ea..0145db0 100644 --- a/include/clang/Basic/OpenMPKinds.def +++ b/include/clang/Basic/OpenMPKinds.def @@ -30,6 +30,9 @@ #ifndef OPENMP_FOR_CLAUSE # define OPENMP_FOR_CLAUSE(Name) #endif +#ifndef OPENMP_FOR_SIMD_CLAUSE +# define OPENMP_FOR_SIMD_CLAUSE(Name) +#endif #ifndef OPENMP_SECTIONS_CLAUSE # define OPENMP_SECTIONS_CLAUSE(Name) #endif @@ -39,12 +42,24 @@ #ifndef OPENMP_PARALLEL_FOR_CLAUSE # define OPENMP_PARALLEL_FOR_CLAUSE(Name) #endif +#ifndef OPENMP_PARALLEL_FOR_SIMD_CLAUSE +# define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name) +#endif #ifndef OPENMP_PARALLEL_SECTIONS_CLAUSE # define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name) #endif #ifndef OPENMP_TASK_CLAUSE # define OPENMP_TASK_CLAUSE(Name) #endif +#ifndef OPENMP_ATOMIC_CLAUSE +# define OPENMP_ATOMIC_CLAUSE(Name) +#endif +#ifndef OPENMP_TARGET_CLAUSE +# define OPENMP_TARGET_CLAUSE(Name) +#endif +#ifndef OPENMP_TEAMS_CLAUSE +# define OPENMP_TEAMS_CLAUSE(Name) +#endif #ifndef OPENMP_DEFAULT_KIND # define OPENMP_DEFAULT_KIND(Name) #endif @@ -70,8 +85,14 @@ OPENMP_DIRECTIVE(taskyield) OPENMP_DIRECTIVE(barrier) OPENMP_DIRECTIVE(taskwait) OPENMP_DIRECTIVE(flush) +OPENMP_DIRECTIVE(ordered) +OPENMP_DIRECTIVE(atomic) +OPENMP_DIRECTIVE(target) +OPENMP_DIRECTIVE(teams) OPENMP_DIRECTIVE_EXT(parallel_for, "parallel for") +OPENMP_DIRECTIVE_EXT(parallel_for_simd, "parallel for simd") OPENMP_DIRECTIVE_EXT(parallel_sections, "parallel sections") +OPENMP_DIRECTIVE_EXT(for_simd, "for simd") // OpenMP clauses. OPENMP_CLAUSE(if, OMPIfClause) @@ -96,6 +117,11 @@ OPENMP_CLAUSE(nowait, OMPNowaitClause) OPENMP_CLAUSE(untied, OMPUntiedClause) OPENMP_CLAUSE(mergeable, OMPMergeableClause) OPENMP_CLAUSE(flush, OMPFlushClause) +OPENMP_CLAUSE(read, OMPReadClause) +OPENMP_CLAUSE(write, OMPWriteClause) +OPENMP_CLAUSE(update, OMPUpdateClause) +OPENMP_CLAUSE(capture, OMPCaptureClause) +OPENMP_CLAUSE(seq_cst, OMPSeqCstClause) // Clauses allowed for OpenMP directive 'parallel'. OPENMP_PARALLEL_CLAUSE(if) @@ -127,6 +153,18 @@ OPENMP_FOR_CLAUSE(schedule) OPENMP_FOR_CLAUSE(ordered) OPENMP_FOR_CLAUSE(nowait) +// Clauses allowed for directive 'omp for simd'. +OPENMP_FOR_SIMD_CLAUSE(private) +OPENMP_FOR_SIMD_CLAUSE(firstprivate) +OPENMP_FOR_SIMD_CLAUSE(lastprivate) +OPENMP_FOR_SIMD_CLAUSE(reduction) +OPENMP_FOR_SIMD_CLAUSE(schedule) +OPENMP_FOR_SIMD_CLAUSE(collapse) +OPENMP_FOR_SIMD_CLAUSE(nowait) +OPENMP_FOR_SIMD_CLAUSE(safelen) +OPENMP_FOR_SIMD_CLAUSE(linear) +OPENMP_FOR_SIMD_CLAUSE(aligned) + // Clauses allowed for OpenMP directive 'omp sections'. OPENMP_SECTIONS_CLAUSE(private) OPENMP_SECTIONS_CLAUSE(lastprivate) @@ -171,6 +209,23 @@ OPENMP_PARALLEL_FOR_CLAUSE(collapse) OPENMP_PARALLEL_FOR_CLAUSE(schedule) OPENMP_PARALLEL_FOR_CLAUSE(ordered) +// Clauses allowed for OpenMP directive 'parallel for simd'. +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(if) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(num_threads) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(default) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(proc_bind) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(private) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(firstprivate) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(shared) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(reduction) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(copyin) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(lastprivate) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(collapse) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(schedule) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(safelen) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(linear) +OPENMP_PARALLEL_FOR_SIMD_CLAUSE(aligned) + // Clauses allowed for OpenMP directive 'parallel sections'. OPENMP_PARALLEL_SECTIONS_CLAUSE(if) OPENMP_PARALLEL_SECTIONS_CLAUSE(num_threads) @@ -193,6 +248,25 @@ OPENMP_TASK_CLAUSE(shared) OPENMP_TASK_CLAUSE(untied) OPENMP_TASK_CLAUSE(mergeable) +// Clauses allowed for OpenMP directive 'atomic'. +OPENMP_ATOMIC_CLAUSE(read) +OPENMP_ATOMIC_CLAUSE(write) +OPENMP_ATOMIC_CLAUSE(update) +OPENMP_ATOMIC_CLAUSE(capture) +OPENMP_ATOMIC_CLAUSE(seq_cst) + +// Clauses allowed for OpenMP directive 'target'. +// TODO More clauses for 'target' directive. +OPENMP_TARGET_CLAUSE(if) + +// Clauses allowed for OpenMP directive 'teams'. +// TODO More clauses for 'teams' directive. +OPENMP_TEAMS_CLAUSE(default) +OPENMP_TEAMS_CLAUSE(private) +OPENMP_TEAMS_CLAUSE(firstprivate) +OPENMP_TEAMS_CLAUSE(shared) +OPENMP_TEAMS_CLAUSE(reduction) + #undef OPENMP_SCHEDULE_KIND #undef OPENMP_PROC_BIND_KIND #undef OPENMP_DEFAULT_KIND @@ -203,8 +277,13 @@ OPENMP_TASK_CLAUSE(mergeable) #undef OPENMP_SECTIONS_CLAUSE #undef OPENMP_PARALLEL_CLAUSE #undef OPENMP_PARALLEL_FOR_CLAUSE +#undef OPENMP_PARALLEL_FOR_SIMD_CLAUSE #undef OPENMP_PARALLEL_SECTIONS_CLAUSE #undef OPENMP_TASK_CLAUSE +#undef OPENMP_ATOMIC_CLAUSE +#undef OPENMP_TARGET_CLAUSE +#undef OPENMP_TEAMS_CLAUSE #undef OPENMP_SIMD_CLAUSE #undef OPENMP_FOR_CLAUSE +#undef OPENMP_FOR_SIMD_CLAUSE diff --git a/include/clang/Basic/OpenMPKinds.h b/include/clang/Basic/OpenMPKinds.h index 526cbb2..e2f1151 100644 --- a/include/clang/Basic/OpenMPKinds.h +++ b/include/clang/Basic/OpenMPKinds.h @@ -93,6 +93,12 @@ bool isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind); /// parallel', otherwise - false. bool isOpenMPParallelDirective(OpenMPDirectiveKind DKind); +/// \brief Checks if the specified directive is a teams-kind directive. +/// \param DKind Specified directive. +/// \return true - the directive is a teams-like directive like 'omp teams', +/// otherwise - false. +bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind); + /// \brief Checks if the specified directive is a simd directive. /// \param DKind Specified directive. /// \return true - the directive is a simd directive like 'omp simd', diff --git a/include/clang/Basic/OperatorKinds.h b/include/clang/Basic/OperatorKinds.h index d3b70c2..7120bae 100644 --- a/include/clang/Basic/OperatorKinds.h +++ b/include/clang/Basic/OperatorKinds.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_BASIC_OPERATOR_KINDS_H -#define LLVM_CLANG_BASIC_OPERATOR_KINDS_H +#ifndef LLVM_CLANG_BASIC_OPERATORKINDS_H +#define LLVM_CLANG_BASIC_OPERATORKINDS_H namespace clang { diff --git a/include/clang/Basic/OperatorPrecedence.h b/include/clang/Basic/OperatorPrecedence.h index b68d577..640749f 100644 --- a/include/clang/Basic/OperatorPrecedence.h +++ b/include/clang/Basic/OperatorPrecedence.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_OPERATOR_PRECEDENCE_H -#define LLVM_CLANG_OPERATOR_PRECEDENCE_H +#ifndef LLVM_CLANG_BASIC_OPERATORPRECEDENCE_H +#define LLVM_CLANG_BASIC_OPERATORPRECEDENCE_H #include "clang/Basic/TokenKinds.h" diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h index 8ae3b22..84c8dd1 100644 --- a/include/clang/Basic/PartialDiagnostic.h +++ b/include/clang/Basic/PartialDiagnostic.h @@ -13,8 +13,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_PARTIALDIAGNOSTIC_H -#define LLVM_CLANG_PARTIALDIAGNOSTIC_H +#ifndef LLVM_CLANG_BASIC_PARTIALDIAGNOSTIC_H +#define LLVM_CLANG_BASIC_PARTIALDIAGNOSTIC_H #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceLocation.h" diff --git a/include/clang/Basic/PlistSupport.h b/include/clang/Basic/PlistSupport.h index b7a9382..081f22d 100644 --- a/include/clang/Basic/PlistSupport.h +++ b/include/clang/Basic/PlistSupport.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_PLISTSUPPORT_H -#define LLVM_CLANG_PLISTSUPPORT_H +#ifndef LLVM_CLANG_BASIC_PLISTSUPPORT_H +#define LLVM_CLANG_BASIC_PLISTSUPPORT_H #include "clang/Basic/FileManager.h" #include "clang/Basic/SourceManager.h" diff --git a/include/clang/Basic/PrettyStackTrace.h b/include/clang/Basic/PrettyStackTrace.h index 0e49295..6badae5 100644 --- a/include/clang/Basic/PrettyStackTrace.h +++ b/include/clang/Basic/PrettyStackTrace.h @@ -14,8 +14,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef CLANG_BASIC_PRETTYSTACKTRACE_H -#define CLANG_BASIC_PRETTYSTACKTRACE_H +#ifndef LLVM_CLANG_BASIC_PRETTYSTACKTRACE_H +#define LLVM_CLANG_BASIC_PRETTYSTACKTRACE_H #include "clang/Basic/SourceLocation.h" #include "llvm/Support/PrettyStackTrace.h" diff --git a/include/clang/Basic/SanitizerBlacklist.h b/include/clang/Basic/SanitizerBlacklist.h new file mode 100644 index 0000000..2ce268a --- /dev/null +++ b/include/clang/Basic/SanitizerBlacklist.h @@ -0,0 +1,45 @@ +//===--- SanitizerBlacklist.h - Blacklist for sanitizers --------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// User-provided blacklist used to disable/alter instrumentation done in +// sanitizers. +// +//===----------------------------------------------------------------------===// +#ifndef LLVM_CLANG_BASIC_SANITIZERBLACKLIST_H +#define LLVM_CLANG_BASIC_SANITIZERBLACKLIST_H + +#include "clang/Basic/LLVM.h" +#include "clang/Basic/SourceLocation.h" +#include "clang/Basic/SourceManager.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/SpecialCaseList.h" +#include <memory> + +namespace clang { + +class SanitizerBlacklist { + std::unique_ptr<llvm::SpecialCaseList> SCL; + SourceManager &SM; + +public: + SanitizerBlacklist(StringRef BlacklistPath, SourceManager &SM); + bool isBlacklistedGlobal(StringRef GlobalName, + StringRef Category = StringRef()) const; + bool isBlacklistedType(StringRef MangledTypeName, + StringRef Category = StringRef()) const; + bool isBlacklistedFunction(StringRef FunctionName) const; + bool isBlacklistedFile(StringRef FileName, + StringRef Category = StringRef()) const; + bool isBlacklistedLocation(SourceLocation Loc, + StringRef Category = StringRef()) const; +}; + +} // end namespace clang + +#endif diff --git a/include/clang/Basic/Sanitizers.def b/include/clang/Basic/Sanitizers.def index 0ef39bc..91a1ef4 100644 --- a/include/clang/Basic/Sanitizers.def +++ b/include/clang/Basic/Sanitizers.def @@ -59,9 +59,11 @@ SANITIZER("float-cast-overflow", FloatCastOverflow) SANITIZER("float-divide-by-zero", FloatDivideByZero) SANITIZER("function", Function) SANITIZER("integer-divide-by-zero", IntegerDivideByZero) +SANITIZER("nonnull-attribute", NonnullAttribute) SANITIZER("null", Null) SANITIZER("object-size", ObjectSize) SANITIZER("return", Return) +SANITIZER("returns-nonnull-attribute", ReturnsNonnullAttribute) SANITIZER("shift", Shift) SANITIZER("signed-integer-overflow", SignedIntegerOverflow) SANITIZER("unreachable", Unreachable) @@ -78,9 +80,10 @@ SANITIZER("dataflow", DataFlow) // ABI or address space layout implications, and only catch undefined behavior. SANITIZER_GROUP("undefined", Undefined, Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow | - FloatDivideByZero | Function | IntegerDivideByZero | Null | - ObjectSize | Return | Shift | SignedIntegerOverflow | - Unreachable | VLABound | Vptr) + FloatDivideByZero | Function | IntegerDivideByZero | + NonnullAttribute | Null | ObjectSize | Return | + ReturnsNonnullAttribute | Shift | SignedIntegerOverflow | + Unreachable | VLABound | Vptr) // -fsanitize=undefined-trap includes // all sanitizers included by -fsanitize=undefined, except those that require @@ -88,9 +91,9 @@ SANITIZER_GROUP("undefined", Undefined, // -fsanitize-undefined-trap-on-error flag. SANITIZER_GROUP("undefined-trap", UndefinedTrap, Alignment | Bool | ArrayBounds | Enum | FloatCastOverflow | - FloatDivideByZero | IntegerDivideByZero | Null | ObjectSize | - Return | Shift | SignedIntegerOverflow | Unreachable | - VLABound) + FloatDivideByZero | IntegerDivideByZero | NonnullAttribute | + Null | ObjectSize | Return | ReturnsNonnullAttribute | + Shift | SignedIntegerOverflow | Unreachable | VLABound) SANITIZER_GROUP("integer", Integer, SignedIntegerOverflow | UnsignedIntegerOverflow | Shift | @@ -99,5 +102,9 @@ SANITIZER_GROUP("integer", Integer, SANITIZER("local-bounds", LocalBounds) SANITIZER_GROUP("bounds", Bounds, ArrayBounds | LocalBounds) +// Magic group, containing all sanitizers. For example, "-fno-sanitize=all" +// can be used to disable all the sanitizers. +SANITIZER_GROUP("all", All, ~0) + #undef SANITIZER #undef SANITIZER_GROUP diff --git a/include/clang/Basic/Sanitizers.h b/include/clang/Basic/Sanitizers.h new file mode 100644 index 0000000..868b331 --- /dev/null +++ b/include/clang/Basic/Sanitizers.h @@ -0,0 +1,47 @@ +//===--- Sanitizers.h - C Language Family Language Options ------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// \brief Defines the clang::SanitizerKind enum. +/// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_BASIC_SANITIZERS_H +#define LLVM_CLANG_BASIC_SANITIZERS_H + +namespace clang { + +enum class SanitizerKind { +#define SANITIZER(NAME, ID) ID, +#include "clang/Basic/Sanitizers.def" + Unknown +}; + +class SanitizerSet { + /// \brief Bitmask of enabled sanitizers. + unsigned Kinds; +public: + SanitizerSet(); + + /// \brief Check if a certain sanitizer is enabled. + bool has(SanitizerKind K) const; + + /// \brief Enable or disable a certain sanitizer. + void set(SanitizerKind K, bool Value); + + /// \brief Disable all sanitizers. + void clear(); + + /// \brief Returns true if at least one sanitizer is enabled. + bool empty() const; +}; + +} // end namespace clang + +#endif diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index 7b637d7..7aaee1d 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_SOURCELOCATION_H -#define LLVM_CLANG_SOURCELOCATION_H +#ifndef LLVM_CLANG_BASIC_SOURCELOCATION_H +#define LLVM_CLANG_BASIC_SOURCELOCATION_H #include "clang/Basic/LLVM.h" #include "llvm/Support/Compiler.h" @@ -292,7 +292,6 @@ public: const char *getCharacterData(bool *Invalid = nullptr) const; - const llvm::MemoryBuffer* getBuffer(bool *Invalid = nullptr) const; /// \brief Return a StringRef to the source buffer data for the /// specified FileID. diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index e567a7a..717258d 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -32,8 +32,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_SOURCEMANAGER_H -#define LLVM_CLANG_SOURCEMANAGER_H +#ifndef LLVM_CLANG_BASIC_SOURCEMANAGER_H +#define LLVM_CLANG_BASIC_SOURCEMANAGER_H #include "clang/Basic/FileManager.h" #include "clang/Basic/LLVM.h" @@ -205,10 +205,10 @@ namespace SrcMgr { /// this content cache. This is used for performance analysis. llvm::MemoryBuffer::BufferKind getMemoryBufferKind() const; - void setBuffer(llvm::MemoryBuffer *B) { + void setBuffer(std::unique_ptr<llvm::MemoryBuffer> B) { assert(!Buffer.getPointer() && "MemoryBuffer already set."); - Buffer.setPointer(B); - Buffer.setInt(false); + Buffer.setPointer(B.release()); + Buffer.setInt(0); } /// \brief Get the underlying buffer, returning NULL if the buffer is not @@ -685,9 +685,9 @@ class SourceManager : public RefCountedBase<SourceManager> { InBeforeInTUCacheEntry &getInBeforeInTUCache(FileID LFID, FileID RFID) const; // Cache for the "fake" buffer used for error-recovery purposes. - mutable llvm::MemoryBuffer *FakeBufferForRecovery; + mutable std::unique_ptr<llvm::MemoryBuffer> FakeBufferForRecovery; - mutable SrcMgr::ContentCache *FakeContentCacheForRecovery; + mutable std::unique_ptr<SrcMgr::ContentCache> FakeContentCacheForRecovery; /// \brief Lazily computed map of macro argument chunks to their expanded /// source location. @@ -754,7 +754,6 @@ public: /// \brief Set the file ID for the main source file. void setMainFileID(FileID FID) { - assert(MainFileID.isInvalid() && "MainFileID already set!"); MainFileID = FID; } @@ -789,12 +788,12 @@ public: /// /// This does no caching of the buffer and takes ownership of the /// MemoryBuffer, so only pass a MemoryBuffer to this once. - FileID createFileID(llvm::MemoryBuffer *Buffer, + FileID createFileID(std::unique_ptr<llvm::MemoryBuffer> Buffer, SrcMgr::CharacteristicKind FileCharacter = SrcMgr::C_User, int LoadedID = 0, unsigned LoadedOffset = 0, SourceLocation IncludeLoc = SourceLocation()) { - return createFileID(createMemBufferContentCache(Buffer), IncludeLoc, - FileCharacter, LoadedID, LoadedOffset); + return createFileID(createMemBufferContentCache(std::move(Buffer)), + IncludeLoc, FileCharacter, LoadedID, LoadedOffset); } /// \brief Return a new SourceLocation that encodes the @@ -833,7 +832,11 @@ public: /// \param DoNotFree If true, then the buffer will not be freed when the /// source manager is destroyed. void overrideFileContents(const FileEntry *SourceFile, - llvm::MemoryBuffer *Buffer, bool DoNotFree = false); + llvm::MemoryBuffer *Buffer, bool DoNotFree); + void overrideFileContents(const FileEntry *SourceFile, + std::unique_ptr<llvm::MemoryBuffer> Buffer) { + overrideFileContents(SourceFile, Buffer.release(), /*DoNotFree*/ false); + } /// \brief Override the given source file with another one. /// @@ -1624,7 +1627,7 @@ private: /// \brief Create a new ContentCache for the specified memory buffer. const SrcMgr::ContentCache * - createMemBufferContentCache(llvm::MemoryBuffer *Buf); + createMemBufferContentCache(std::unique_ptr<llvm::MemoryBuffer> Buf); FileID getFileIDSlow(unsigned SLocOffset) const; FileID getFileIDLocal(unsigned SLocOffset) const; @@ -1674,7 +1677,7 @@ class BeforeThanCompare<SourceRange> { public: explicit BeforeThanCompare(SourceManager &SM) : SM(SM) { } - bool operator()(SourceRange LHS, SourceRange RHS) { + bool operator()(SourceRange LHS, SourceRange RHS) const { return SM.isBeforeInTranslationUnit(LHS.getBegin(), RHS.getBegin()); } }; diff --git a/include/clang/Basic/SourceManagerInternals.h b/include/clang/Basic/SourceManagerInternals.h index af95b78..f31d604 100644 --- a/include/clang/Basic/SourceManagerInternals.h +++ b/include/clang/Basic/SourceManagerInternals.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_SOURCEMANAGER_INTERNALS_H -#define LLVM_CLANG_SOURCEMANAGER_INTERNALS_H +#ifndef LLVM_CLANG_BASIC_SOURCEMANAGERINTERNALS_H +#define LLVM_CLANG_BASIC_SOURCEMANAGERINTERNALS_H #include "clang/Basic/SourceLocation.h" #include "clang/Basic/SourceManager.h" diff --git a/include/clang/Basic/Specifiers.h b/include/clang/Basic/Specifiers.h index f895673..a968d00 100644 --- a/include/clang/Basic/Specifiers.h +++ b/include/clang/Basic/Specifiers.h @@ -203,6 +203,7 @@ namespace clang { CC_X86StdCall, // __attribute__((stdcall)) CC_X86FastCall, // __attribute__((fastcall)) CC_X86ThisCall, // __attribute__((thiscall)) + CC_X86VectorCall, // __attribute__((vectorcall)) CC_X86Pascal, // __attribute__((pascal)) CC_X86_64Win64, // __attribute__((ms_abi)) CC_X86_64SysV, // __attribute__((sysv_abi)) @@ -212,16 +213,18 @@ namespace clang { CC_IntelOclBicc // __attribute__((intel_ocl_bicc)) }; - /// \brief Checks whether the given calling convention is callee-cleanup. - inline bool isCalleeCleanup(CallingConv CC) { + /// \brief Checks whether the given calling convention supports variadic + /// calls. Unprototyped calls also use the variadic call rules. + inline bool supportsVariadicCall(CallingConv CC) { switch (CC) { case CC_X86StdCall: case CC_X86FastCall: case CC_X86ThisCall: case CC_X86Pascal: - return true; - default: + case CC_X86VectorCall: return false; + default: + return true; } } diff --git a/include/clang/Basic/StmtNodes.td b/include/clang/Basic/StmtNodes.td index d980648..750108f 100644 --- a/include/clang/Basic/StmtNodes.td +++ b/include/clang/Basic/StmtNodes.td @@ -135,6 +135,7 @@ def SubstNonTypeTemplateParmPackExpr : DStmt<Expr>; def FunctionParmPackExpr : DStmt<Expr>; def MaterializeTemporaryExpr : DStmt<Expr>; def LambdaExpr : DStmt<Expr>; +def CXXFoldExpr : DStmt<Expr>; // Obj-C Expressions. def ObjCStringLiteral : DStmt<Expr>; @@ -163,6 +164,7 @@ def ShuffleVectorExpr : DStmt<Expr>; def ConvertVectorExpr : DStmt<Expr>; def BlockExpr : DStmt<Expr>; def OpaqueValueExpr : DStmt<Expr>; +def TypoExpr : DStmt<Expr>; // Microsoft Extensions. def MSPropertyRefExpr : DStmt<Expr>; @@ -178,18 +180,25 @@ def AsTypeExpr : DStmt<Expr>; // OpenMP Directives. def OMPExecutableDirective : Stmt<1>; +def OMPLoopDirective : DStmt<OMPExecutableDirective, 1>; def OMPParallelDirective : DStmt<OMPExecutableDirective>; -def OMPSimdDirective : DStmt<OMPExecutableDirective>; -def OMPForDirective : DStmt<OMPExecutableDirective>; +def OMPSimdDirective : DStmt<OMPLoopDirective>; +def OMPForDirective : DStmt<OMPLoopDirective>; +def OMPForSimdDirective : DStmt<OMPLoopDirective>; def OMPSectionsDirective : DStmt<OMPExecutableDirective>; def OMPSectionDirective : DStmt<OMPExecutableDirective>; def OMPSingleDirective : DStmt<OMPExecutableDirective>; def OMPMasterDirective : DStmt<OMPExecutableDirective>; def OMPCriticalDirective : DStmt<OMPExecutableDirective>; -def OMPParallelForDirective : DStmt<OMPExecutableDirective>; +def OMPParallelForDirective : DStmt<OMPLoopDirective>; +def OMPParallelForSimdDirective : DStmt<OMPLoopDirective>; def OMPParallelSectionsDirective : DStmt<OMPExecutableDirective>; def OMPTaskDirective : DStmt<OMPExecutableDirective>; def OMPTaskyieldDirective : DStmt<OMPExecutableDirective>; def OMPBarrierDirective : DStmt<OMPExecutableDirective>; def OMPTaskwaitDirective : DStmt<OMPExecutableDirective>; def OMPFlushDirective : DStmt<OMPExecutableDirective>; +def OMPOrderedDirective : DStmt<OMPExecutableDirective>; +def OMPAtomicDirective : DStmt<OMPExecutableDirective>; +def OMPTargetDirective : DStmt<OMPExecutableDirective>; +def OMPTeamsDirective : DStmt<OMPExecutableDirective>; diff --git a/include/clang/Basic/TargetBuiltins.h b/include/clang/Basic/TargetBuiltins.h index b1652be..e112c65 100644 --- a/include/clang/Basic/TargetBuiltins.h +++ b/include/clang/Basic/TargetBuiltins.h @@ -13,8 +13,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_BASIC_TARGET_BUILTINS_H -#define LLVM_CLANG_BASIC_TARGET_BUILTINS_H +#ifndef LLVM_CLANG_BASIC_TARGETBUILTINS_H +#define LLVM_CLANG_BASIC_TARGETBUILTINS_H #include "clang/Basic/Builtins.h" #undef PPC @@ -164,6 +164,17 @@ namespace clang { LastTSBuiltin }; } + + /// \brief Le64 builtins + namespace Le64 { + enum { + LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1, + #define BUILTIN(ID, TYPE, ATTRS) BI##ID, + #include "clang/Basic/BuiltinsLe64.def" + LastTSBuiltin + }; + } + } // end namespace clang. #endif diff --git a/include/clang/Basic/TargetCXXABI.h b/include/clang/Basic/TargetCXXABI.h index f9e37c3..5669d2a 100644 --- a/include/clang/Basic/TargetCXXABI.h +++ b/include/clang/Basic/TargetCXXABI.h @@ -13,8 +13,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_TARGETCXXABI_H -#define LLVM_CLANG_TARGETCXXABI_H +#ifndef LLVM_CLANG_BASIC_TARGETCXXABI_H +#define LLVM_CLANG_BASIC_TARGETCXXABI_H #include "llvm/ADT/Triple.h" #include "llvm/Support/ErrorHandling.h" diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index edef7c0..69a5404 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -370,6 +370,15 @@ public: /// \brief Return the maximum width lock-free atomic operation which can be /// inlined given the supported features of the given target. unsigned getMaxAtomicInlineWidth() const { return MaxAtomicInlineWidth; } + /// \brief Returns true if the given target supports lock-free atomic + /// operations at the specified width and alignment. + virtual bool hasBuiltinAtomic(uint64_t AtomicSizeInBits, + uint64_t AlignmentInBits) const { + return AtomicSizeInBits <= AlignmentInBits && + AtomicSizeInBits <= getMaxAtomicInlineWidth() && + (AtomicSizeInBits <= getCharWidth() || + llvm::isPowerOf2_64(AtomicSizeInBits / getCharWidth())); + } /// \brief Return the maximum vector alignment supported for the given target. unsigned getMaxVectorAlign() const { return MaxVectorAlign; } @@ -519,22 +528,31 @@ public: CI_None = 0x00, CI_AllowsMemory = 0x01, CI_AllowsRegister = 0x02, - CI_ReadWrite = 0x04, // "+r" output constraint (read and write). - CI_HasMatchingInput = 0x08 // This output operand has a matching input. + CI_ReadWrite = 0x04, // "+r" output constraint (read and write). + CI_HasMatchingInput = 0x08, // This output operand has a matching input. + CI_ImmediateConstant = 0x10, // This operand must be an immediate constant + CI_EarlyClobber = 0x20, // "&" output constraint (early clobber). }; unsigned Flags; int TiedOperand; + struct { + int Min; + int Max; + } ImmRange; std::string ConstraintStr; // constraint: "=rm" std::string Name; // Operand name: [foo] with no []'s. public: ConstraintInfo(StringRef ConstraintStr, StringRef Name) - : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()), - Name(Name.str()) {} + : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()), + Name(Name.str()) { + ImmRange.Min = ImmRange.Max = 0; + } const std::string &getConstraintStr() const { return ConstraintStr; } const std::string &getName() const { return Name; } bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; } + bool earlyClobber() { return (Flags & CI_EarlyClobber) != 0; } bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; } bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; } @@ -553,10 +571,22 @@ public: return (unsigned)TiedOperand; } + bool requiresImmediateConstant() const { + return (Flags & CI_ImmediateConstant) != 0; + } + int getImmConstantMin() const { return ImmRange.Min; } + int getImmConstantMax() const { return ImmRange.Max; } + void setIsReadWrite() { Flags |= CI_ReadWrite; } + void setEarlyClobber() { Flags |= CI_EarlyClobber; } void setAllowsMemory() { Flags |= CI_AllowsMemory; } void setAllowsRegister() { Flags |= CI_AllowsRegister; } void setHasMatchingInput() { Flags |= CI_HasMatchingInput; } + void setRequiresImmediate(int Min, int Max) { + Flags |= CI_ImmediateConstant; + ImmRange.Min = Min; + ImmRange.Max = Max; + } /// \brief Indicate that this is an input operand that is tied to /// the specified output operand. @@ -577,13 +607,21 @@ public: bool validateInputConstraint(ConstraintInfo *OutputConstraints, unsigned NumOutputs, ConstraintInfo &info) const; + + virtual bool validateOutputSize(StringRef /*Constraint*/, + unsigned /*Size*/) const { + return true; + } + virtual bool validateInputSize(StringRef /*Constraint*/, unsigned /*Size*/) const { return true; } - virtual bool validateConstraintModifier(StringRef /*Constraint*/, - const char /*Modifier*/, - unsigned /*Size*/) const { + virtual bool + validateConstraintModifier(StringRef /*Constraint*/, + char /*Modifier*/, + unsigned /*Size*/, + std::string &/*SuggestedModifier*/) const { return true; } bool resolveSymbolicName(const char *&Name, diff --git a/include/clang/Basic/TargetOptions.h b/include/clang/Basic/TargetOptions.h index 2c86c31..9782539 100644 --- a/include/clang/Basic/TargetOptions.h +++ b/include/clang/Basic/TargetOptions.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_FRONTEND_TARGETOPTIONS_H -#define LLVM_CLANG_FRONTEND_TARGETOPTIONS_H +#ifndef LLVM_CLANG_BASIC_TARGETOPTIONS_H +#define LLVM_CLANG_BASIC_TARGETOPTIONS_H #include <string> #include <vector> diff --git a/include/clang/Basic/TemplateKinds.h b/include/clang/Basic/TemplateKinds.h index b730143..aed287b 100644 --- a/include/clang/Basic/TemplateKinds.h +++ b/include/clang/Basic/TemplateKinds.h @@ -11,8 +11,8 @@ /// \brief Defines the clang::TemplateNameKind enum. /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_TEMPLATEKINDS_H -#define LLVM_CLANG_TEMPLATEKINDS_H +#ifndef LLVM_CLANG_BASIC_TEMPLATEKINDS_H +#define LLVM_CLANG_BASIC_TEMPLATEKINDS_H namespace clang { diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def index 5d08833..3319d4e 100644 --- a/include/clang/Basic/TokenKinds.def +++ b/include/clang/Basic/TokenKinds.def @@ -116,7 +116,6 @@ TOK(eof) // End of file. TOK(eod) // End of preprocessing directive (end of line inside a // directive). TOK(code_completion) // Code completion marker -TOK(cxx_defaultarg_end) // C++ default argument end marker // C99 6.4.9: Comments. TOK(comment) // Comment (only in -E -C[C] mode) @@ -133,6 +132,9 @@ TOK(numeric_constant) // 0x123 TOK(char_constant) // 'a' TOK(wide_char_constant) // L'b' +// C++1z Character Constants +TOK(utf8_char_constant) // u8'a' + // C++11 Character Constants TOK(utf16_char_constant) // u'a' TOK(utf32_char_constant) // U'a' @@ -457,18 +459,22 @@ KEYWORD(__cdecl , KEYALL) KEYWORD(__stdcall , KEYALL) KEYWORD(__fastcall , KEYALL) KEYWORD(__thiscall , KEYALL) +KEYWORD(__vectorcall , KEYALL) KEYWORD(__forceinline , KEYMS) KEYWORD(__unaligned , KEYMS) +KEYWORD(__super , KEYMS) // OpenCL address space qualifiers KEYWORD(__global , KEYOPENCL) KEYWORD(__local , KEYOPENCL) KEYWORD(__constant , KEYOPENCL) KEYWORD(__private , KEYOPENCL) +KEYWORD(__generic , KEYOPENCL) ALIAS("global", __global , KEYOPENCL) ALIAS("local", __local , KEYOPENCL) ALIAS("constant", __constant , KEYOPENCL) ALIAS("private", __private , KEYOPENCL) +ALIAS("generic", __generic , KEYOPENCL) // OpenCL function qualifiers KEYWORD(__kernel , KEYOPENCL) ALIAS("kernel", __kernel , KEYOPENCL) @@ -489,6 +495,7 @@ KEYWORD(__pascal , KEYALL) // Altivec Extension. KEYWORD(__vector , KEYALTIVEC) KEYWORD(__pixel , KEYALTIVEC) +KEYWORD(__bool , KEYALTIVEC) // ARM NEON extensions. ALIAS("__fp16", half , KEYALL) @@ -545,8 +552,12 @@ KEYWORD(__multiple_inheritance , KEYMS) KEYWORD(__virtual_inheritance , KEYMS) KEYWORD(__interface , KEYMS) ALIAS("__int8" , char , KEYMS) +ALIAS("_int8" , char , KEYMS) ALIAS("__int16" , short , KEYMS) +ALIAS("_int16" , short , KEYMS) ALIAS("__int32" , int , KEYMS) +ALIAS("_int32" , int , KEYMS) +ALIAS("_int64" , __int64 , KEYMS) ALIAS("__wchar_t" , wchar_t , KEYMS) ALIAS("_asm" , asm , KEYMS) ALIAS("_alignof" , __alignof , KEYMS) @@ -555,6 +566,7 @@ ALIAS("_cdecl" , __cdecl , KEYMS | KEYBORLAND) ALIAS("_fastcall" , __fastcall , KEYMS | KEYBORLAND) ALIAS("_stdcall" , __stdcall , KEYMS | KEYBORLAND) ALIAS("_thiscall" , __thiscall , KEYMS) +ALIAS("_vectorcall" , __vectorcall, KEYMS) ALIAS("_uuidof" , __uuidof , KEYMS | KEYBORLAND) ALIAS("_inline" , inline , KEYMS) ALIAS("_declspec" , __declspec , KEYMS) diff --git a/include/clang/Basic/TokenKinds.h b/include/clang/Basic/TokenKinds.h index 794625c..f4ecb3e 100644 --- a/include/clang/Basic/TokenKinds.h +++ b/include/clang/Basic/TokenKinds.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_TOKENKINDS_H -#define LLVM_CLANG_TOKENKINDS_H +#ifndef LLVM_CLANG_BASIC_TOKENKINDS_H +#define LLVM_CLANG_BASIC_TOKENKINDS_H #include "llvm/Support/Compiler.h" @@ -86,9 +86,9 @@ inline bool isStringLiteral(TokenKind K) { /// constant, string, etc. inline bool isLiteral(TokenKind K) { return K == tok::numeric_constant || K == tok::char_constant || - K == tok::wide_char_constant || K == tok::utf16_char_constant || - K == tok::utf32_char_constant || isStringLiteral(K) || - K == tok::angle_string_literal; + K == tok::wide_char_constant || K == tok::utf8_char_constant || + K == tok::utf16_char_constant || K == tok::utf32_char_constant || + isStringLiteral(K) || K == tok::angle_string_literal; } /// \brief Return true if this is any of tok::annot_* kinds. diff --git a/include/clang/Basic/TypeTraits.h b/include/clang/Basic/TypeTraits.h index d7d2b18..ef84d2b 100644 --- a/include/clang/Basic/TypeTraits.h +++ b/include/clang/Basic/TypeTraits.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_TYPETRAITS_H -#define LLVM_CLANG_TYPETRAITS_H +#ifndef LLVM_CLANG_BASIC_TYPETRAITS_H +#define LLVM_CLANG_BASIC_TYPETRAITS_H namespace clang { diff --git a/include/clang/Basic/VersionTuple.h b/include/clang/Basic/VersionTuple.h index 54d06e0..77fd947 100644 --- a/include/clang/Basic/VersionTuple.h +++ b/include/clang/Basic/VersionTuple.h @@ -24,30 +24,35 @@ namespace clang { /// \brief Represents a version number in the form major[.minor[.subminor]]. class VersionTuple { - unsigned Major; + unsigned Major : 31; unsigned Minor : 31; unsigned Subminor : 31; unsigned HasMinor : 1; unsigned HasSubminor : 1; + unsigned UsesUnderscores : 1; public: VersionTuple() - : Major(0), Minor(0), Subminor(0), HasMinor(false), HasSubminor(false) { } + : Major(0), Minor(0), Subminor(0), HasMinor(false), HasSubminor(false), + UsesUnderscores(false) { } explicit VersionTuple(unsigned Major) - : Major(Major), Minor(0), Subminor(0), HasMinor(false), HasSubminor(false) + : Major(Major), Minor(0), Subminor(0), HasMinor(false), HasSubminor(false), + UsesUnderscores(false) { } - explicit VersionTuple(unsigned Major, unsigned Minor) + explicit VersionTuple(unsigned Major, unsigned Minor, + bool UsesUnderscores = false) : Major(Major), Minor(Minor), Subminor(0), HasMinor(true), - HasSubminor(false) + HasSubminor(false), UsesUnderscores(UsesUnderscores) { } - explicit VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor) + explicit VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor, + bool UsesUnderscores = false) : Major(Major), Minor(Minor), Subminor(Subminor), HasMinor(true), - HasSubminor(true) + HasSubminor(true), UsesUnderscores(UsesUnderscores) { } - + /// \brief Determine whether this version information is empty /// (e.g., all version components are zero). bool empty() const { return Major == 0 && Minor == 0 && Subminor == 0; } @@ -69,6 +74,14 @@ public: return Subminor; } + bool usesUnderscores() const { + return UsesUnderscores; + } + + void UseDotAsSeparator() { + UsesUnderscores = false; + } + /// \brief Determine if two version numbers are equivalent. If not /// provided, minor and subminor version numbers are considered to be zero. friend bool operator==(const VersionTuple& X, const VersionTuple &Y) { diff --git a/include/clang/Basic/VirtualFileSystem.h b/include/clang/Basic/VirtualFileSystem.h index 36f78fd..1c65fb5 100644 --- a/include/clang/Basic/VirtualFileSystem.h +++ b/include/clang/Basic/VirtualFileSystem.h @@ -10,16 +10,16 @@ /// \brief Defines the virtual file system interface vfs::FileSystem. //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_BASIC_VIRTUAL_FILE_SYSTEM_H -#define LLVM_CLANG_BASIC_VIRTUAL_FILE_SYSTEM_H +#ifndef LLVM_CLANG_BASIC_VIRTUALFILESYSTEM_H +#define LLVM_CLANG_BASIC_VIRTUALFILESYSTEM_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/Optional.h" #include "llvm/Support/ErrorOr.h" #include "llvm/Support/FileSystem.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/Support/SourceMgr.h" +#include "llvm/Support/raw_ostream.h" namespace llvm { class MemoryBuffer; @@ -89,11 +89,9 @@ public: /// \brief Get the status of the file. virtual llvm::ErrorOr<Status> status() = 0; /// \brief Get the contents of the file as a \p MemoryBuffer. - virtual std::error_code getBuffer(const Twine &Name, - std::unique_ptr<llvm::MemoryBuffer> &Result, - int64_t FileSize = -1, - bool RequiresNullTerminator = true, - bool IsVolatile = false) = 0; + virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> + getBuffer(const Twine &Name, int64_t FileSize = -1, + bool RequiresNullTerminator = true, bool IsVolatile = false) = 0; /// \brief Closes the file. virtual std::error_code close() = 0; /// \brief Sets the name to use for this file. @@ -188,16 +186,14 @@ public: /// \brief Get the status of the entry at \p Path, if one exists. virtual llvm::ErrorOr<Status> status(const Twine &Path) = 0; /// \brief Get a \p File object for the file at \p Path, if one exists. - virtual std::error_code openFileForRead(const Twine &Path, - std::unique_ptr<File> &Result) = 0; + virtual llvm::ErrorOr<std::unique_ptr<File>> + openFileForRead(const Twine &Path) = 0; /// This is a convenience method that opens a file, gets its content and then /// closes the file. - std::error_code getBufferForFile(const Twine &Name, - std::unique_ptr<llvm::MemoryBuffer> &Result, - int64_t FileSize = -1, - bool RequiresNullTerminator = true, - bool IsVolatile = false); + llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> + getBufferForFile(const Twine &Name, int64_t FileSize = -1, + bool RequiresNullTerminator = true, bool IsVolatile = false); /// \brief Get a directory_iterator for \p Dir. /// \note The 'end' iterator is directory_iterator(). @@ -231,8 +227,8 @@ public: void pushOverlay(IntrusiveRefCntPtr<FileSystem> FS); llvm::ErrorOr<Status> status(const Twine &Path) override; - std::error_code openFileForRead(const Twine &Path, - std::unique_ptr<File> &Result) override; + llvm::ErrorOr<std::unique_ptr<File>> + openFileForRead(const Twine &Path) override; directory_iterator dir_begin(const Twine &Dir, std::error_code &EC) override; typedef FileSystemList::reverse_iterator iterator; @@ -250,10 +246,8 @@ llvm::sys::fs::UniqueID getNextVirtualUniqueID(); /// \brief Gets a \p FileSystem for a virtual file system described in YAML /// format. -/// -/// Takes ownership of \p Buffer. IntrusiveRefCntPtr<FileSystem> -getVFSFromYAML(llvm::MemoryBuffer *Buffer, +getVFSFromYAML(std::unique_ptr<llvm::MemoryBuffer> Buffer, llvm::SourceMgr::DiagHandlerTy DiagHandler, void *DiagContext = nullptr, IntrusiveRefCntPtr<FileSystem> ExternalFS = getRealFileSystem()); @@ -280,4 +274,4 @@ public: } // end namespace vfs } // end namespace clang -#endif // LLVM_CLANG_BASIC_VIRTUAL_FILE_SYSTEM_H +#endif diff --git a/include/clang/Basic/arm_neon.td b/include/clang/Basic/arm_neon.td index 0247bb5..933f204 100644 --- a/include/clang/Basic/arm_neon.td +++ b/include/clang/Basic/arm_neon.td @@ -944,13 +944,6 @@ def VCVT_F64 : SInst<"vcvt_f64", "Fd", "lUlQlQUl">; def VCVT_HIGH_F64_F32 : SOpInst<"vcvt_high_f64", "wj", "f", OP_VCVT_EX_HI_F64>; def VCVTX_F32_F64 : SInst<"vcvtx_f32", "fj", "d">; def VCVTX_HIGH_F32_F64 : SOpInst<"vcvtx_high_f32", "qfj", "d", OP_VCVTX_HI>; -def FRINTN : SInst<"vrndn", "dd", "fdQfQd">; -def FRINTA : SInst<"vrnda", "dd", "fdQfQd">; -def FRINTP : SInst<"vrndp", "dd", "fdQfQd">; -def FRINTM : SInst<"vrndm", "dd", "fdQfQd">; -def FRINTX : SInst<"vrndx", "dd", "fdQfQd">; -def FRINTZ : SInst<"vrnd", "dd", "fdQfQd">; -def FRINTI : SInst<"vrndi", "dd", "fdQfQd">; def VCVT_S64 : SInst<"vcvt_s64", "xd", "dQd">; def VCVT_U64 : SInst<"vcvt_u64", "ud", "dQd">; def FRECPE : SInst<"vrecpe", "dd", "dQd">; @@ -983,11 +976,6 @@ def MAX : SInst<"vmax", "ddd", "dQd">; def MIN : SInst<"vmin", "ddd", "dQd">; //////////////////////////////////////////////////////////////////////////////// -// MaxNum/MinNum Floating Point -def FMAXNM : SInst<"vmaxnm", "ddd", "fdQfQd">; -def FMINNM : SInst<"vminnm", "ddd", "fdQfQd">; - -//////////////////////////////////////////////////////////////////////////////// // Pairwise Max/Min def MAXP : SInst<"vpmax", "ddd", "QcQsQiQUcQUsQUiQfQd">; def MINP : SInst<"vpmin", "ddd", "QcQsQiQUcQUsQUiQfQd">; @@ -1089,7 +1077,7 @@ def VDUP_LANE2: WOpInst<"vdup_laneq", "dji", "csilUcUsUiUlPcPshfdQcQsQiQlQPcQPsQUcQUsQUiQUlQhQfQdPlQPl", OP_DUP_LN>; def DUP_N : WOpInst<"vdup_n", "ds", "dQdPlQPl", OP_DUP>; -def MOV_N : WOpInst<"vmov_n", "ds", "dQd", OP_DUP>; +def MOV_N : WOpInst<"vmov_n", "ds", "dQdPlQPl", OP_DUP>; //////////////////////////////////////////////////////////////////////////////// def COMBINE : NoTestOpInst<"vcombine", "kdd", "dPl", OP_CONC>; @@ -1223,6 +1211,41 @@ def FCVTAU_S64 : SInst<"vcvta_u64", "ud", "dQd">; } //////////////////////////////////////////////////////////////////////////////// +// Round to Integral + +let ArchGuard = "__ARM_ARCH >= 8 && defined(__ARM_FEATURE_DIRECTED_ROUNDING)" in { +def FRINTN_S32 : SInst<"vrndn", "dd", "fQf">; +def FRINTA_S32 : SInst<"vrnda", "dd", "fQf">; +def FRINTP_S32 : SInst<"vrndp", "dd", "fQf">; +def FRINTM_S32 : SInst<"vrndm", "dd", "fQf">; +def FRINTX_S32 : SInst<"vrndx", "dd", "fQf">; +def FRINTZ_S32 : SInst<"vrnd", "dd", "fQf">; +} + +let ArchGuard = "__ARM_ARCH >= 8 && defined(__aarch64__) && defined(__ARM_FEATURE_DIRECTED_ROUNDING)" in { +def FRINTN_S64 : SInst<"vrndn", "dd", "dQd">; +def FRINTA_S64 : SInst<"vrnda", "dd", "dQd">; +def FRINTP_S64 : SInst<"vrndp", "dd", "dQd">; +def FRINTM_S64 : SInst<"vrndm", "dd", "dQd">; +def FRINTX_S64 : SInst<"vrndx", "dd", "dQd">; +def FRINTZ_S64 : SInst<"vrnd", "dd", "dQd">; +def FRINTI_S64 : SInst<"vrndi", "dd", "fdQfQd">; +} + +//////////////////////////////////////////////////////////////////////////////// +// MaxNum/MinNum Floating Point + +let ArchGuard = "__ARM_ARCH >= 8 && defined(__ARM_FEATURE_NUMERIC_MAXMIN)" in { +def FMAXNM_S32 : SInst<"vmaxnm", "ddd", "fQf">; +def FMINNM_S32 : SInst<"vminnm", "ddd", "fQf">; +} + +let ArchGuard = "__ARM_ARCH >= 8 && defined(__aarch64__) && defined(__ARM_FEATURE_NUMERIC_MAXMIN)" in { +def FMAXNM_S64 : SInst<"vmaxnm", "ddd", "dQd">; +def FMINNM_S64 : SInst<"vminnm", "ddd", "dQd">; +} + +//////////////////////////////////////////////////////////////////////////////// // Permutation def VTRN1 : SOpInst<"vtrn1", "ddd", "csiUcUsUifPcPsQcQsQiQlQUcQUsQUiQUlQfQdQPcQPsQPl", OP_TRN1>; |