diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2012-04-14 14:01:31 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2012-04-14 14:01:31 +0000 |
commit | dbe13110f59f48b4dbb7552b3ac2935acdeece7f (patch) | |
tree | be1815eb79b42ff482a8562b13c2dcbf0c5dcbee /include/clang/Basic | |
parent | 9da628931ebf2609493570f87824ca22402cc65f (diff) |
Notes
Diffstat (limited to 'include/clang/Basic')
43 files changed, 3823 insertions, 1083 deletions
diff --git a/include/clang/Basic/AllDiagnostics.h b/include/clang/Basic/AllDiagnostics.h new file mode 100644 index 0000000000000..7e774355488c6 --- /dev/null +++ b/include/clang/Basic/AllDiagnostics.h @@ -0,0 +1,39 @@ +//===--- AllDiagnostics.h - Aggregate Diagnostic headers --------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file includes all the separate Diagnostic headers & some related +// helpers. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_ALL_DIAGNOSTICS_H +#define LLVM_CLANG_ALL_DIAGNOSTICS_H + +#include "clang/AST/ASTDiagnostic.h" +#include "clang/Analysis/AnalysisDiagnostic.h" +#include "clang/Driver/DriverDiagnostic.h" +#include "clang/Frontend/FrontendDiagnostic.h" +#include "clang/Lex/LexDiagnostic.h" +#include "clang/Parse/ParseDiagnostic.h" +#include "clang/Sema/SemaDiagnostic.h" +#include "clang/Serialization/SerializationDiagnostic.h" + +namespace clang { +template <size_t SizeOfStr, typename FieldType> +class StringSizerHelper { + char FIELD_TOO_SMALL[SizeOfStr <= FieldType(~0U) ? 1 : -1]; +public: + enum { Size = SizeOfStr }; +}; +} // end namespace clang + +#define STR_SIZE(str, fieldTy) clang::StringSizerHelper<sizeof(str)-1, \ + fieldTy>::Size + +#endif diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 2a4ba5c6c73ce..e8e0f35096f3f 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -93,6 +93,10 @@ class Attr { list<string> Namespaces = []; // Set to true for attributes with arguments which require delayed parsing. bit LateParsed = 0; + // Set to true for attributes which must be instantiated within templates + bit TemplateDependent = 0; + // Set to true for attributes which have handler in Sema. + bit SemaHandler = 1; // Any additional text that should be included verbatim in the class. code AdditionalMembers = [{}]; } @@ -122,6 +126,7 @@ def Aligned : InheritableAttr { def AlignMac68k : InheritableAttr { let Spellings = []; + let SemaHandler = 0; } def AlwaysInline : InheritableAttr { @@ -140,13 +145,14 @@ def Annotate : InheritableParamAttr { def AsmLabel : InheritableAttr { let Spellings = []; let Args = [StringArgument<"Label">]; + let SemaHandler = 0; } def Availability : InheritableAttr { let Spellings = ["availability"]; let Args = [IdentifierArgument<"platform">, VersionArgument<"introduced">, VersionArgument<"deprecated">, VersionArgument<"obsoleted">, - BoolArgument<"unavailable">]; + BoolArgument<"unavailable">, StringArgument<"message">]; let AdditionalMembers = [{static llvm::StringRef getPrettyPlatformName(llvm::StringRef Platform) { return llvm::StringSwitch<llvm::StringRef>(Platform) @@ -274,6 +280,7 @@ def FastCall : InheritableAttr { def Final : InheritableAttr { let Spellings = []; + let SemaHandler = 0; } def MsStruct : InheritableAttr { @@ -315,6 +322,7 @@ def Malloc : InheritableAttr { def MaxFieldAlignment : InheritableAttr { let Spellings = []; let Args = [UnsignedArgument<"Alignment">]; + let SemaHandler = 0; } def MayAlias : InheritableAttr { @@ -324,14 +332,17 @@ def MayAlias : InheritableAttr { def MSP430Interrupt : InheritableAttr { let Spellings = []; let Args = [UnsignedArgument<"Number">]; + let SemaHandler = 0; } def MBlazeInterruptHandler : InheritableAttr { let Spellings = []; + let SemaHandler = 0; } def MBlazeSaveVolatiles : InheritableAttr { let Spellings = []; + let SemaHandler = 0; } def Naked : InheritableAttr { @@ -441,12 +452,18 @@ def ObjCReturnsInnerPointer : Attr { let Subjects = [ObjCMethod]; } +def ObjCRootClass : Attr { + let Spellings = ["objc_root_class"]; + let Subjects = [ObjCInterface]; +} + def Overloadable : Attr { let Spellings = ["overloadable"]; } def Override : InheritableAttr { let Spellings = []; + let SemaHandler = 0; } def Ownership : InheritableAttr { @@ -522,6 +539,12 @@ def Unavailable : InheritableAttr { def ArcWeakrefUnavailable : InheritableAttr { let Spellings = ["objc_arc_weak_reference_unavailable"]; + let Subjects = [ObjCInterface]; +} + +def ObjCRequiresPropertyDefs : InheritableAttr { + let Spellings = ["objc_requires_property_definitions"]; + let Subjects = [ObjCInterface]; } def Unused : InheritableAttr { @@ -570,6 +593,10 @@ def X86ForceAlignArgPointer : InheritableAttr { let Spellings = []; } +// AddressSafety attribute (e.g. for AddressSanitizer) +def NoAddressSafetyAnalysis : InheritableAttr { + let Spellings = ["no_address_safety_analysis"]; +} // C/C++ Thread safety attributes (e.g. for deadlock, data race checking) @@ -597,36 +624,42 @@ def GuardedBy : InheritableAttr { let Spellings = ["guarded_by"]; let Args = [ExprArgument<"Arg">]; let LateParsed = 1; + let TemplateDependent = 1; } def PtGuardedBy : InheritableAttr { let Spellings = ["pt_guarded_by"]; let Args = [ExprArgument<"Arg">]; let LateParsed = 1; + let TemplateDependent = 1; } def AcquiredAfter : InheritableAttr { let Spellings = ["acquired_after"]; let Args = [VariadicExprArgument<"Args">]; let LateParsed = 1; + let TemplateDependent = 1; } def AcquiredBefore : InheritableAttr { let Spellings = ["acquired_before"]; let Args = [VariadicExprArgument<"Args">]; let LateParsed = 1; + let TemplateDependent = 1; } def ExclusiveLockFunction : InheritableAttr { let Spellings = ["exclusive_lock_function"]; let Args = [VariadicExprArgument<"Args">]; let LateParsed = 1; + let TemplateDependent = 1; } def SharedLockFunction : InheritableAttr { let Spellings = ["shared_lock_function"]; let Args = [VariadicExprArgument<"Args">]; let LateParsed = 1; + let TemplateDependent = 1; } // The first argument is an integer or boolean value specifying the return value @@ -635,6 +668,7 @@ def ExclusiveTrylockFunction : InheritableAttr { let Spellings = ["exclusive_trylock_function"]; let Args = [ExprArgument<"SuccessValue">, VariadicExprArgument<"Args">]; let LateParsed = 1; + let TemplateDependent = 1; } // The first argument is an integer or boolean value specifying the return value @@ -643,34 +677,40 @@ def SharedTrylockFunction : InheritableAttr { let Spellings = ["shared_trylock_function"]; let Args = [ExprArgument<"SuccessValue">, VariadicExprArgument<"Args">]; let LateParsed = 1; + let TemplateDependent = 1; } def UnlockFunction : InheritableAttr { let Spellings = ["unlock_function"]; let Args = [VariadicExprArgument<"Args">]; let LateParsed = 1; + let TemplateDependent = 1; } def LockReturned : InheritableAttr { let Spellings = ["lock_returned"]; let Args = [ExprArgument<"Arg">]; let LateParsed = 1; + let TemplateDependent = 1; } def LocksExcluded : InheritableAttr { let Spellings = ["locks_excluded"]; let Args = [VariadicExprArgument<"Args">]; let LateParsed = 1; + let TemplateDependent = 1; } def ExclusiveLocksRequired : InheritableAttr { let Spellings = ["exclusive_locks_required"]; let Args = [VariadicExprArgument<"Args">]; let LateParsed = 1; + let TemplateDependent = 1; } def SharedLocksRequired : InheritableAttr { let Spellings = ["shared_locks_required"]; let Args = [VariadicExprArgument<"Args">]; let LateParsed = 1; + let TemplateDependent = 1; } diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index e06e05b1aa17d..d1af218c27be6 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -39,6 +39,7 @@ // P -> FILE // J -> jmp_buf // SJ -> sigjmp_buf +// K -> ucontext_t // . -> "...". This may only occur at the end of the function list. // // Types may be prefixed with the following modifiers: @@ -107,6 +108,8 @@ BUILTIN(__builtin_huge_vall, "Ld", "nc") BUILTIN(__builtin_inf , "d" , "nc") BUILTIN(__builtin_inff , "f" , "nc") BUILTIN(__builtin_infl , "Ld" , "nc") +BUILTIN(__builtin_labs , "LiLi" , "Fnc") +BUILTIN(__builtin_llabs, "LLiLLi", "Fnc") BUILTIN(__builtin_ldexp , "ddi" , "Fnc") BUILTIN(__builtin_ldexpf, "ffi" , "Fnc") BUILTIN(__builtin_ldexpl, "LdLdi", "Fnc") @@ -362,10 +365,12 @@ BUILTIN(__builtin_signbitf, "if", "nc") BUILTIN(__builtin_signbitl, "iLd", "nc") // Builtins for arithmetic. +BUILTIN(__builtin_clzs , "iUs" , "nc") BUILTIN(__builtin_clz , "iUi" , "nc") BUILTIN(__builtin_clzl , "iULi" , "nc") BUILTIN(__builtin_clzll, "iULLi", "nc") // TODO: int clzimax(uintmax_t) +BUILTIN(__builtin_ctzs , "iUs" , "nc") BUILTIN(__builtin_ctz , "iUi" , "nc") BUILTIN(__builtin_ctzl , "iULi" , "nc") BUILTIN(__builtin_ctzll, "iULLi", "nc") @@ -447,12 +452,15 @@ BUILTIN(__builtin_extend_pointer, "ULLiv*", "n") // _Unwind_Word == uint64_t // GCC Object size checking builtins BUILTIN(__builtin_object_size, "zvC*i", "n") BUILTIN(__builtin___memcpy_chk, "v*v*vC*zz", "nF") +BUILTIN(__builtin___memccpy_chk, "v*v*vC*iz", "nF") BUILTIN(__builtin___memmove_chk, "v*v*vC*zz", "nF") BUILTIN(__builtin___mempcpy_chk, "v*v*vC*zz", "nF") BUILTIN(__builtin___memset_chk, "v*v*izz", "nF") BUILTIN(__builtin___stpcpy_chk, "c*c*cC*z", "nF") BUILTIN(__builtin___strcat_chk, "c*c*cC*z", "nF") BUILTIN(__builtin___strcpy_chk, "c*c*cC*z", "nF") +BUILTIN(__builtin___strlcat_chk, "c*c*cC*zz", "nF") +BUILTIN(__builtin___strlcpy_chk, "c*c*cC*zz", "nF") BUILTIN(__builtin___strncat_chk, "c*c*cC*zz", "nF") BUILTIN(__builtin___strncpy_chk, "c*c*cC*zz", "nF") BUILTIN(__builtin___stpncpy_chk, "c*c*cC*zz", "nF") @@ -480,124 +488,163 @@ BUILTIN(__builtin_alloca, "v*z" , "n") // FIXME: These assume that char -> i8, short -> i16, int -> i32, // long long -> i64. -BUILTIN(__sync_fetch_and_add, "v.", "") -BUILTIN(__sync_fetch_and_add_1, "ccD*c.", "n") -BUILTIN(__sync_fetch_and_add_2, "ssD*s.", "n") -BUILTIN(__sync_fetch_and_add_4, "iiD*i.", "n") -BUILTIN(__sync_fetch_and_add_8, "LLiLLiD*LLi.", "n") -BUILTIN(__sync_fetch_and_add_16, "LLLiLLLiD*LLLi.", "n") - -BUILTIN(__sync_fetch_and_sub, "v.", "") -BUILTIN(__sync_fetch_and_sub_1, "ccD*c.", "n") -BUILTIN(__sync_fetch_and_sub_2, "ssD*s.", "n") -BUILTIN(__sync_fetch_and_sub_4, "iiD*i.", "n") -BUILTIN(__sync_fetch_and_sub_8, "LLiLLiD*LLi.", "n") -BUILTIN(__sync_fetch_and_sub_16, "LLLiLLLiD*LLLi.", "n") - -BUILTIN(__sync_fetch_and_or, "v.", "") -BUILTIN(__sync_fetch_and_or_1, "ccD*c.", "n") -BUILTIN(__sync_fetch_and_or_2, "ssD*s.", "n") -BUILTIN(__sync_fetch_and_or_4, "iiD*i.", "n") -BUILTIN(__sync_fetch_and_or_8, "LLiLLiD*LLi.", "n") -BUILTIN(__sync_fetch_and_or_16, "LLLiLLLiD*LLLi.", "n") - -BUILTIN(__sync_fetch_and_and, "v.", "") -BUILTIN(__sync_fetch_and_and_1, "ccD*c.", "n") -BUILTIN(__sync_fetch_and_and_2, "ssD*s.", "n") -BUILTIN(__sync_fetch_and_and_4, "iiD*i.", "n") -BUILTIN(__sync_fetch_and_and_8, "LLiLLiD*LLi.", "n") -BUILTIN(__sync_fetch_and_and_16, "LLLiLLLiD*LLLi.", "n") - -BUILTIN(__sync_fetch_and_xor, "v.", "") -BUILTIN(__sync_fetch_and_xor_1, "ccD*c.", "n") -BUILTIN(__sync_fetch_and_xor_2, "ssD*s.", "n") -BUILTIN(__sync_fetch_and_xor_4, "iiD*i.", "n") -BUILTIN(__sync_fetch_and_xor_8, "LLiLLiD*LLi.", "n") -BUILTIN(__sync_fetch_and_xor_16, "LLLiLLLiD*LLLi.", "n") - - -BUILTIN(__sync_add_and_fetch, "v.", "") -BUILTIN(__sync_add_and_fetch_1, "ccD*c.", "n") -BUILTIN(__sync_add_and_fetch_2, "ssD*s.", "n") -BUILTIN(__sync_add_and_fetch_4, "iiD*i.", "n") -BUILTIN(__sync_add_and_fetch_8, "LLiLLiD*LLi.", "n") -BUILTIN(__sync_add_and_fetch_16, "LLLiLLLiD*LLLi.", "n") - -BUILTIN(__sync_sub_and_fetch, "v.", "") -BUILTIN(__sync_sub_and_fetch_1, "ccD*c.", "n") -BUILTIN(__sync_sub_and_fetch_2, "ssD*s.", "n") -BUILTIN(__sync_sub_and_fetch_4, "iiD*i.", "n") -BUILTIN(__sync_sub_and_fetch_8, "LLiLLiD*LLi.", "n") -BUILTIN(__sync_sub_and_fetch_16, "LLLiLLLiD*LLLi.", "n") - -BUILTIN(__sync_or_and_fetch, "v.", "") -BUILTIN(__sync_or_and_fetch_1, "ccD*c.", "n") -BUILTIN(__sync_or_and_fetch_2, "ssD*s.", "n") -BUILTIN(__sync_or_and_fetch_4, "iiD*i.", "n") -BUILTIN(__sync_or_and_fetch_8, "LLiLLiD*LLi.", "n") -BUILTIN(__sync_or_and_fetch_16, "LLLiLLLiD*LLLi.", "n") - -BUILTIN(__sync_and_and_fetch, "v.", "") -BUILTIN(__sync_and_and_fetch_1, "ccD*c.", "n") -BUILTIN(__sync_and_and_fetch_2, "ssD*s.", "n") -BUILTIN(__sync_and_and_fetch_4, "iiD*i.", "n") -BUILTIN(__sync_and_and_fetch_8, "LLiLLiD*LLi.", "n") -BUILTIN(__sync_and_and_fetch_16, "LLLiLLLiD*LLLi.", "n") - -BUILTIN(__sync_xor_and_fetch, "v.", "") -BUILTIN(__sync_xor_and_fetch_1, "ccD*c.", "n") -BUILTIN(__sync_xor_and_fetch_2, "ssD*s.", "n") -BUILTIN(__sync_xor_and_fetch_4, "iiD*i.", "n") -BUILTIN(__sync_xor_and_fetch_8, "LLiLLiD*LLi.", "n") -BUILTIN(__sync_xor_and_fetch_16, "LLLiLLLiD*LLLi.", "n") - -BUILTIN(__sync_bool_compare_and_swap, "v.", "") -BUILTIN(__sync_bool_compare_and_swap_1, "bcD*cc.", "n") -BUILTIN(__sync_bool_compare_and_swap_2, "bsD*ss.", "n") -BUILTIN(__sync_bool_compare_and_swap_4, "biD*ii.", "n") -BUILTIN(__sync_bool_compare_and_swap_8, "bLLiD*LLiLLi.", "n") -BUILTIN(__sync_bool_compare_and_swap_16, "bLLLiD*LLLiLLLi.", "n") - -BUILTIN(__sync_val_compare_and_swap, "v.", "") -BUILTIN(__sync_val_compare_and_swap_1, "ccD*cc.", "n") -BUILTIN(__sync_val_compare_and_swap_2, "ssD*ss.", "n") -BUILTIN(__sync_val_compare_and_swap_4, "iiD*ii.", "n") -BUILTIN(__sync_val_compare_and_swap_8, "LLiLLiD*LLiLLi.", "n") -BUILTIN(__sync_val_compare_and_swap_16, "LLLiLLLiD*LLLiLLLi.", "n") - -BUILTIN(__sync_lock_test_and_set, "v.", "") -BUILTIN(__sync_lock_test_and_set_1, "ccD*c.", "n") -BUILTIN(__sync_lock_test_and_set_2, "ssD*s.", "n") -BUILTIN(__sync_lock_test_and_set_4, "iiD*i.", "n") -BUILTIN(__sync_lock_test_and_set_8, "LLiLLiD*LLi.", "n") -BUILTIN(__sync_lock_test_and_set_16, "LLLiLLLiD*LLLi.", "n") - -BUILTIN(__sync_lock_release, "v.", "") -BUILTIN(__sync_lock_release_1, "vcD*.", "n") -BUILTIN(__sync_lock_release_2, "vsD*.", "n") -BUILTIN(__sync_lock_release_4, "viD*.", "n") -BUILTIN(__sync_lock_release_8, "vLLiD*.", "n") -BUILTIN(__sync_lock_release_16, "vLLLiD*.", "n") - -BUILTIN(__sync_swap, "v.", "") -BUILTIN(__sync_swap_1, "ccD*c.", "n") -BUILTIN(__sync_swap_2, "ssD*s.", "n") -BUILTIN(__sync_swap_4, "iiD*i.", "n") -BUILTIN(__sync_swap_8, "LLiLLiD*LLi.", "n") -BUILTIN(__sync_swap_16, "LLLiLLLiD*LLLi.", "n") - -BUILTIN(__atomic_load, "v.", "t") -BUILTIN(__atomic_store, "v.", "t") -BUILTIN(__atomic_exchange, "v.", "t") -BUILTIN(__atomic_compare_exchange_strong, "v.", "t") -BUILTIN(__atomic_compare_exchange_weak, "v.", "t") -BUILTIN(__atomic_fetch_add, "v.", "t") -BUILTIN(__atomic_fetch_sub, "v.", "t") -BUILTIN(__atomic_fetch_and, "v.", "t") -BUILTIN(__atomic_fetch_or, "v.", "t") -BUILTIN(__atomic_fetch_xor, "v.", "t") +BUILTIN(__sync_fetch_and_add, "v.", "t") +BUILTIN(__sync_fetch_and_add_1, "ccD*c.", "nt") +BUILTIN(__sync_fetch_and_add_2, "ssD*s.", "nt") +BUILTIN(__sync_fetch_and_add_4, "iiD*i.", "nt") +BUILTIN(__sync_fetch_and_add_8, "LLiLLiD*LLi.", "nt") +BUILTIN(__sync_fetch_and_add_16, "LLLiLLLiD*LLLi.", "nt") + +BUILTIN(__sync_fetch_and_sub, "v.", "t") +BUILTIN(__sync_fetch_and_sub_1, "ccD*c.", "nt") +BUILTIN(__sync_fetch_and_sub_2, "ssD*s.", "nt") +BUILTIN(__sync_fetch_and_sub_4, "iiD*i.", "nt") +BUILTIN(__sync_fetch_and_sub_8, "LLiLLiD*LLi.", "nt") +BUILTIN(__sync_fetch_and_sub_16, "LLLiLLLiD*LLLi.", "nt") + +BUILTIN(__sync_fetch_and_or, "v.", "t") +BUILTIN(__sync_fetch_and_or_1, "ccD*c.", "nt") +BUILTIN(__sync_fetch_and_or_2, "ssD*s.", "nt") +BUILTIN(__sync_fetch_and_or_4, "iiD*i.", "nt") +BUILTIN(__sync_fetch_and_or_8, "LLiLLiD*LLi.", "nt") +BUILTIN(__sync_fetch_and_or_16, "LLLiLLLiD*LLLi.", "nt") + +BUILTIN(__sync_fetch_and_and, "v.", "t") +BUILTIN(__sync_fetch_and_and_1, "ccD*c.", "tn") +BUILTIN(__sync_fetch_and_and_2, "ssD*s.", "tn") +BUILTIN(__sync_fetch_and_and_4, "iiD*i.", "tn") +BUILTIN(__sync_fetch_and_and_8, "LLiLLiD*LLi.", "tn") +BUILTIN(__sync_fetch_and_and_16, "LLLiLLLiD*LLLi.", "tn") + +BUILTIN(__sync_fetch_and_xor, "v.", "t") +BUILTIN(__sync_fetch_and_xor_1, "ccD*c.", "tn") +BUILTIN(__sync_fetch_and_xor_2, "ssD*s.", "tn") +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_add_and_fetch, "v.", "t") +BUILTIN(__sync_add_and_fetch_1, "ccD*c.", "tn") +BUILTIN(__sync_add_and_fetch_2, "ssD*s.", "tn") +BUILTIN(__sync_add_and_fetch_4, "iiD*i.", "tn") +BUILTIN(__sync_add_and_fetch_8, "LLiLLiD*LLi.", "tn") +BUILTIN(__sync_add_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") + +BUILTIN(__sync_sub_and_fetch, "v.", "t") +BUILTIN(__sync_sub_and_fetch_1, "ccD*c.", "tn") +BUILTIN(__sync_sub_and_fetch_2, "ssD*s.", "tn") +BUILTIN(__sync_sub_and_fetch_4, "iiD*i.", "tn") +BUILTIN(__sync_sub_and_fetch_8, "LLiLLiD*LLi.", "tn") +BUILTIN(__sync_sub_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") + +BUILTIN(__sync_or_and_fetch, "v.", "t") +BUILTIN(__sync_or_and_fetch_1, "ccD*c.", "tn") +BUILTIN(__sync_or_and_fetch_2, "ssD*s.", "tn") +BUILTIN(__sync_or_and_fetch_4, "iiD*i.", "tn") +BUILTIN(__sync_or_and_fetch_8, "LLiLLiD*LLi.", "tn") +BUILTIN(__sync_or_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") + +BUILTIN(__sync_and_and_fetch, "v.", "t") +BUILTIN(__sync_and_and_fetch_1, "ccD*c.", "tn") +BUILTIN(__sync_and_and_fetch_2, "ssD*s.", "tn") +BUILTIN(__sync_and_and_fetch_4, "iiD*i.", "tn") +BUILTIN(__sync_and_and_fetch_8, "LLiLLiD*LLi.", "tn") +BUILTIN(__sync_and_and_fetch_16, "LLLiLLLiD*LLLi.", "tn") + +BUILTIN(__sync_xor_and_fetch, "v.", "t") +BUILTIN(__sync_xor_and_fetch_1, "ccD*c.", "tn") +BUILTIN(__sync_xor_and_fetch_2, "ssD*s.", "tn") +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_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") +BUILTIN(__sync_bool_compare_and_swap_4, "biD*ii.", "tn") +BUILTIN(__sync_bool_compare_and_swap_8, "bLLiD*LLiLLi.", "tn") +BUILTIN(__sync_bool_compare_and_swap_16, "bLLLiD*LLLiLLLi.", "tn") + +BUILTIN(__sync_val_compare_and_swap, "v.", "t") +BUILTIN(__sync_val_compare_and_swap_1, "ccD*cc.", "tn") +BUILTIN(__sync_val_compare_and_swap_2, "ssD*ss.", "tn") +BUILTIN(__sync_val_compare_and_swap_4, "iiD*ii.", "tn") +BUILTIN(__sync_val_compare_and_swap_8, "LLiLLiD*LLiLLi.", "tn") +BUILTIN(__sync_val_compare_and_swap_16, "LLLiLLLiD*LLLiLLLi.", "tn") + +BUILTIN(__sync_lock_test_and_set, "v.", "t") +BUILTIN(__sync_lock_test_and_set_1, "ccD*c.", "tn") +BUILTIN(__sync_lock_test_and_set_2, "ssD*s.", "tn") +BUILTIN(__sync_lock_test_and_set_4, "iiD*i.", "tn") +BUILTIN(__sync_lock_test_and_set_8, "LLiLLiD*LLi.", "tn") +BUILTIN(__sync_lock_test_and_set_16, "LLLiLLLiD*LLLi.", "tn") + +BUILTIN(__sync_lock_release, "v.", "t") +BUILTIN(__sync_lock_release_1, "vcD*.", "tn") +BUILTIN(__sync_lock_release_2, "vsD*.", "tn") +BUILTIN(__sync_lock_release_4, "viD*.", "tn") +BUILTIN(__sync_lock_release_8, "vLLiD*.", "tn") +BUILTIN(__sync_lock_release_16, "vLLLiD*.", "tn") + +BUILTIN(__sync_swap, "v.", "t") +BUILTIN(__sync_swap_1, "ccD*c.", "tn") +BUILTIN(__sync_swap_2, "ssD*s.", "tn") +BUILTIN(__sync_swap_4, "iiD*i.", "tn") +BUILTIN(__sync_swap_8, "LLiLLiD*LLi.", "tn") +BUILTIN(__sync_swap_16, "LLLiLLLiD*LLLi.", "tn") + +// Some of our atomics builtins are handled by AtomicExpr rather than +// as normal builtin CallExprs. This macro is used for such builtins. +#ifndef ATOMIC_BUILTIN +#define ATOMIC_BUILTIN(ID, TYPE, ATTRS) BUILTIN(ID, TYPE, ATTRS) +#endif + +// C11 _Atomic operations for <stdatomic.h>. +ATOMIC_BUILTIN(__c11_atomic_init, "v.", "t") +ATOMIC_BUILTIN(__c11_atomic_load, "v.", "t") +ATOMIC_BUILTIN(__c11_atomic_store, "v.", "t") +ATOMIC_BUILTIN(__c11_atomic_exchange, "v.", "t") +ATOMIC_BUILTIN(__c11_atomic_compare_exchange_strong, "v.", "t") +ATOMIC_BUILTIN(__c11_atomic_compare_exchange_weak, "v.", "t") +ATOMIC_BUILTIN(__c11_atomic_fetch_add, "v.", "t") +ATOMIC_BUILTIN(__c11_atomic_fetch_sub, "v.", "t") +ATOMIC_BUILTIN(__c11_atomic_fetch_and, "v.", "t") +ATOMIC_BUILTIN(__c11_atomic_fetch_or, "v.", "t") +ATOMIC_BUILTIN(__c11_atomic_fetch_xor, "v.", "t") +BUILTIN(__c11_atomic_thread_fence, "vi", "n") +BUILTIN(__c11_atomic_signal_fence, "vi", "n") +BUILTIN(__c11_atomic_is_lock_free, "iz", "n") + +// GNU atomic builtins. +ATOMIC_BUILTIN(__atomic_load, "v.", "t") +ATOMIC_BUILTIN(__atomic_load_n, "v.", "t") +ATOMIC_BUILTIN(__atomic_store, "v.", "t") +ATOMIC_BUILTIN(__atomic_store_n, "v.", "t") +ATOMIC_BUILTIN(__atomic_exchange, "v.", "t") +ATOMIC_BUILTIN(__atomic_exchange_n, "v.", "t") +ATOMIC_BUILTIN(__atomic_compare_exchange, "v.", "t") +ATOMIC_BUILTIN(__atomic_compare_exchange_n, "v.", "t") +ATOMIC_BUILTIN(__atomic_fetch_add, "v.", "t") +ATOMIC_BUILTIN(__atomic_fetch_sub, "v.", "t") +ATOMIC_BUILTIN(__atomic_fetch_and, "v.", "t") +ATOMIC_BUILTIN(__atomic_fetch_or, "v.", "t") +ATOMIC_BUILTIN(__atomic_fetch_xor, "v.", "t") +ATOMIC_BUILTIN(__atomic_fetch_nand, "v.", "t") +ATOMIC_BUILTIN(__atomic_add_fetch, "v.", "t") +ATOMIC_BUILTIN(__atomic_sub_fetch, "v.", "t") +ATOMIC_BUILTIN(__atomic_and_fetch, "v.", "t") +ATOMIC_BUILTIN(__atomic_or_fetch, "v.", "t") +ATOMIC_BUILTIN(__atomic_xor_fetch, "v.", "t") +ATOMIC_BUILTIN(__atomic_nand_fetch, "v.", "t") +BUILTIN(__atomic_test_and_set, "bvD*i", "n") +BUILTIN(__atomic_clear, "vvD*i", "n") BUILTIN(__atomic_thread_fence, "vi", "n") BUILTIN(__atomic_signal_fence, "vi", "n") +BUILTIN(__atomic_always_lock_free, "izvCD*", "n") +BUILTIN(__atomic_is_lock_free, "izvCD*", "n") + +#undef ATOMIC_BUILTIN // Non-overloaded atomic builtins. BUILTIN(__sync_synchronize, "v.", "n") @@ -628,9 +675,12 @@ LIBBUILTIN(malloc, "v*z", "f", "stdlib.h", ALL_LANGUAGES) LIBBUILTIN(realloc, "v*v*z", "f", "stdlib.h", ALL_LANGUAGES) // C99 string.h LIBBUILTIN(memcpy, "v*v*vC*z", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(memcmp, "ivC*vC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(memmove, "v*v*vC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strcpy, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strncpy, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strcmp, "icC*cC*", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strncmp, "icC*cC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strcat, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strncat, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(strxfrm, "zc*cC*z", "f", "string.h", ALL_LANGUAGES) @@ -654,7 +704,12 @@ LIBBUILTIN(vprintf, "icC*a", "fP:0:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vfprintf, "i.", "fP:1:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h", ALL_LANGUAGES) LIBBUILTIN(vsprintf, "ic*cC*a", "fP:1:", "stdio.h", ALL_LANGUAGES) -LIBBUILTIN(scanf, "icC*.", "fs:0:", "stdio.h", ALL_LANGUAGES) +LIBBUILTIN(scanf, "icC*R.", "fs:0:", "stdio.h", ALL_LANGUAGES) +LIBBUILTIN(fscanf, "iP*RcC*R.", "fs:1:", "stdio.h", ALL_LANGUAGES) +LIBBUILTIN(sscanf, "icC*RcC*R.", "fs:1:", "stdio.h", ALL_LANGUAGES) +LIBBUILTIN(vscanf, "icC*Ra", "fS:0:", "stdio.h", ALL_LANGUAGES) +LIBBUILTIN(vfscanf, "iP*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES) +LIBBUILTIN(vsscanf, "icC*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES) // C99 LIBBUILTIN(longjmp, "vJi", "fr", "setjmp.h", ALL_LANGUAGES) @@ -670,6 +725,8 @@ LIBBUILTIN(strndup, "c*cC*z", "f", "string.h", ALL_LANGUAGES) LIBBUILTIN(index, "c*cC*i", "f", "strings.h", ALL_LANGUAGES) LIBBUILTIN(rindex, "c*cC*i", "f", "strings.h", ALL_LANGUAGES) LIBBUILTIN(bzero, "vv*z", "f", "strings.h", ALL_LANGUAGES) +LIBBUILTIN(strcasecmp, "icC*cC*", "f", "strings.h", ALL_LANGUAGES) +LIBBUILTIN(strncasecmp, "icC*cC*z", "f", "strings.h", ALL_LANGUAGES) // POSIX unistd.h LIBBUILTIN(_exit, "vi", "fr", "unistd.h", ALL_LANGUAGES) LIBBUILTIN(vfork, "i", "fj", "unistd.h", ALL_LANGUAGES) @@ -679,13 +736,13 @@ LIBBUILTIN(vfork, "i", "fj", "unistd.h", ALL_LANGUAGES) // it here to avoid having two identical LIBBUILTIN entries. #undef setjmp LIBBUILTIN(_setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) -LIBBUILTIN(__sigsetjmp, "iJi", "fj", "setjmp.h", ALL_LANGUAGES) +LIBBUILTIN(__sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) -LIBBUILTIN(sigsetjmp, "iJi", "fj", "setjmp.h", ALL_LANGUAGES) +LIBBUILTIN(sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(setjmp_syscall, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(savectx, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(qsetjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) -LIBBUILTIN(getcontext, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) +LIBBUILTIN(getcontext, "iK*", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h", ALL_LANGUAGES) @@ -697,6 +754,8 @@ LIBBUILTIN(objc_msgSend, "GGH.", "f", "objc/message.h", OBJC_LANG) // long double objc_msgSend_fpret(id self, SEL op, ...) LIBBUILTIN(objc_msgSend_fpret, "LdGH.", "f", "objc/message.h", OBJC_LANG) +// _Complex long double objc_msgSend_fp2ret(id self, SEL op, ...) +LIBBUILTIN(objc_msgSend_fp2ret, "XLdGH.", "f", "objc/message.h", OBJC_LANG) // id objc_msgSend_stret (id, SEL, ...) LIBBUILTIN(objc_msgSend_stret, "GGH.", "f", "objc/message.h", OBJC_LANG) // id objc_msgSendSuper(struct objc_super *super, SEL op, ...) @@ -711,34 +770,39 @@ LIBBUILTIN(objc_getMetaClass, "GcC*", "f", "objc/runtime.h", OBJC_LANG) LIBBUILTIN(objc_enumerationMutation, "vG", "f", "objc/runtime.h", OBJC_LANG) // id objc_read_weak(id *location) -LIBBUILTIN(objc_read_weak, "GG*", "f", "/objc/objc-auto.h", OBJC_LANG) +LIBBUILTIN(objc_read_weak, "GG*", "f", "objc/objc-auto.h", OBJC_LANG) // id objc_assign_weak(id value, id *location) -LIBBUILTIN(objc_assign_weak, "GGG*", "f", "/objc/objc-auto.h", OBJC_LANG) +LIBBUILTIN(objc_assign_weak, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG) // id objc_assign_ivar(id value, id dest, ptrdiff_t offset) -LIBBUILTIN(objc_assign_ivar, "GGGY", "f", "/objc/objc-auto.h", OBJC_LANG) +LIBBUILTIN(objc_assign_ivar, "GGGY", "f", "objc/objc-auto.h", OBJC_LANG) // id objc_assign_global(id val, id *dest) -LIBBUILTIN(objc_assign_global, "GGG*", "f", "/objc/objc-auto.h", OBJC_LANG) +LIBBUILTIN(objc_assign_global, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG) // id objc_assign_strongCast(id val, id *dest -LIBBUILTIN(objc_assign_strongCast, "GGG*", "f", "/objc/objc-auto.h", OBJC_LANG) +LIBBUILTIN(objc_assign_strongCast, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG) // id objc_exception_extract(void *localExceptionData) -LIBBUILTIN(objc_exception_extract, "Gv*", "f", "/objc/objc-exception.h", OBJC_LANG) +LIBBUILTIN(objc_exception_extract, "Gv*", "f", "objc/objc-exception.h", OBJC_LANG) // void objc_exception_try_enter(void *localExceptionData) -LIBBUILTIN(objc_exception_try_enter, "vv*", "f", "/objc/objc-exception.h", OBJC_LANG) +LIBBUILTIN(objc_exception_try_enter, "vv*", "f", "objc/objc-exception.h", OBJC_LANG) // void objc_exception_try_exit(void *localExceptionData) -LIBBUILTIN(objc_exception_try_exit, "vv*", "f", "/objc/objc-exception.h", OBJC_LANG) +LIBBUILTIN(objc_exception_try_exit, "vv*", "f", "objc/objc-exception.h", OBJC_LANG) // int objc_exception_match(Class exceptionClass, id exception) -LIBBUILTIN(objc_exception_match, "iGG", "f", "/objc/objc-exception.h", OBJC_LANG) +LIBBUILTIN(objc_exception_match, "iGG", "f", "objc/objc-exception.h", OBJC_LANG) // void objc_exception_throw(id exception) -LIBBUILTIN(objc_exception_throw, "vG", "f", "/objc/objc-exception.h", OBJC_LANG) +LIBBUILTIN(objc_exception_throw, "vG", "f", "objc/objc-exception.h", OBJC_LANG) // int objc_sync_enter(id obj) -LIBBUILTIN(objc_sync_enter, "iG", "f", "/objc/objc-sync.h", OBJC_LANG) +LIBBUILTIN(objc_sync_enter, "iG", "f", "objc/objc-sync.h", OBJC_LANG) // int objc_sync_exit(id obj) -LIBBUILTIN(objc_sync_exit, "iG", "f", "/objc/objc-sync.h", OBJC_LANG) +LIBBUILTIN(objc_sync_exit, "iG", "f", "objc/objc-sync.h", OBJC_LANG) BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF") +// void NSLog(NSString *fmt, ...) +LIBBUILTIN(NSLog, "vG.", "fp:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG) +// void NSLogv(NSString *fmt, va_list args) +LIBBUILTIN(NSLogv, "vGa", "fP:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG) + // Builtin math library functions LIBBUILTIN(pow, "ddd", "fe", "math.h", ALL_LANGUAGES) LIBBUILTIN(powl, "LdLdLd", "fe", "math.h", ALL_LANGUAGES) diff --git a/include/clang/Basic/BuiltinsHexagon.def b/include/clang/Basic/BuiltinsHexagon.def new file mode 100644 index 0000000000000..334224f7ca578 --- /dev/null +++ b/include/clang/Basic/BuiltinsHexagon.def @@ -0,0 +1,689 @@ +//==--- BuiltinsHexagon.def - Hexagon 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 X86-specific builtin function database. Users of +// this file must define the BUILTIN macro to make use of this information. +// +//===----------------------------------------------------------------------===// + +BUILTIN(__builtin_HEXAGON_C2_cmpeq, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_cmpgt, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_cmpgtu, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_cmpeqp, "bLLiLLi", "") +BUILTIN(__builtin_HEXAGON_C2_cmpgtp, "bLLiLLi", "") +BUILTIN(__builtin_HEXAGON_C2_cmpgtup, "bLLiLLi", "") +BUILTIN(__builtin_HEXAGON_C2_bitsset, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_bitsclr, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_cmpeqi, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_cmpgti, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_cmpgtui, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_cmpgei, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_cmpgeui, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_cmplt, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_cmpltu, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_bitsclri, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_and, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_or, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_xor, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_andn, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_not, "bi", "") +BUILTIN(__builtin_HEXAGON_C2_orn, "bii", "") +BUILTIN(__builtin_HEXAGON_C2_pxfer_map, "bi", "") +BUILTIN(__builtin_HEXAGON_C2_any8, "bi", "") +BUILTIN(__builtin_HEXAGON_C2_all8, "bi", "") +BUILTIN(__builtin_HEXAGON_C2_vitpack, "iii", "") +BUILTIN(__builtin_HEXAGON_C2_mux, "iiii", "") +BUILTIN(__builtin_HEXAGON_C2_muxii, "iiii", "") +BUILTIN(__builtin_HEXAGON_C2_muxir, "iiii", "") +BUILTIN(__builtin_HEXAGON_C2_muxri, "iiii", "") +BUILTIN(__builtin_HEXAGON_C2_vmux, "LLiiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_C2_mask, "LLii", "") +BUILTIN(__builtin_HEXAGON_A2_vcmpbeq, "bLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vcmpbgtu, "bLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vcmpheq, "bLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vcmphgt, "bLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vcmphgtu, "bLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vcmpweq, "bLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vcmpwgt, "bLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vcmpwgtu, "bLLiLLi", "") +BUILTIN(__builtin_HEXAGON_C2_tfrpr, "ii", "") +BUILTIN(__builtin_HEXAGON_C2_tfrrp, "bi", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_hh_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_hh_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_hl_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_hl_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_lh_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_lh_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_ll_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_ll_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_hh_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_hh_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_hl_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_hl_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_lh_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_lh_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_ll_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_ll_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_hh_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_hh_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_hl_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_hl_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_lh_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_lh_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_ll_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_acc_sat_ll_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_hh_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_hh_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_hl_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_hl_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_lh_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_lh_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_ll_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_nac_sat_ll_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_hh_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_hh_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_hl_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_hl_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_lh_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_lh_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_ll_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_ll_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_hh_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_hh_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_hl_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_hl_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_lh_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_lh_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_ll_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_ll_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_hh_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_hh_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_hl_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_hl_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_lh_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_lh_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_ll_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_rnd_ll_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_hh_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_hh_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_hl_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_hl_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_lh_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_lh_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_ll_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_sat_rnd_ll_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_hh_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_hh_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_hl_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_hl_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_lh_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_lh_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_ll_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_acc_ll_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_hh_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_hh_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_hl_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_hl_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_lh_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_lh_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_ll_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_nac_ll_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_hh_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_hh_s1, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_hl_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_hl_s1, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_lh_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_lh_s1, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_ll_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_ll_s1, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_hh_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_hh_s1, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_hl_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_hl_s1, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_lh_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_lh_s1, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_ll_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyd_rnd_ll_s1, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_hh_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_hh_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_hl_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_hl_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_lh_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_lh_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_ll_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_acc_ll_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_hh_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_hh_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_hl_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_hl_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_lh_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_lh_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_ll_s0, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_nac_ll_s1, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_hh_s0, "Uiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_hh_s1, "Uiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_hl_s0, "Uiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_hl_s1, "Uiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_lh_s0, "Uiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_lh_s1, "Uiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_ll_s0, "Uiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_ll_s1, "Uiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_hh_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_hh_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_hl_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_hl_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_lh_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_lh_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_ll_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_acc_ll_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_hh_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_hh_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_hl_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_hl_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_lh_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_lh_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_ll_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_nac_ll_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_hh_s0, "ULLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_hh_s1, "ULLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_hl_s0, "ULLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_hl_s1, "ULLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_lh_s0, "ULLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_lh_s1, "ULLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_ll_s0, "ULLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyud_ll_s1, "ULLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpysmi, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_macsip, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_macsin, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_dpmpyss_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_dpmpyss_acc_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_dpmpyss_nac_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_dpmpyuu_s0, "ULLiii", "") +BUILTIN(__builtin_HEXAGON_M2_dpmpyuu_acc_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_dpmpyuu_nac_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_mpy_up, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyu_up, "Uiii", "") +BUILTIN(__builtin_HEXAGON_M2_dpmpyss_rnd_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyi, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mpyui, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_maci, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_acci, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_accii, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_nacci, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_naccii, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_subacc, "iiii", "") +BUILTIN(__builtin_HEXAGON_M2_vmpy2s_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_vmpy2s_s1, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_vmac2s_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_vmac2s_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_vmpy2s_s0pack, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_vmpy2s_s1pack, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_vmac2, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_vmpy2es_s0, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vmpy2es_s1, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vmac2es_s0, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vmac2es_s1, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vmac2es, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vrmac_s0, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vrmpy_s0, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vdmpyrs_s0, "iLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vdmpyrs_s1, "iLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vdmacs_s0, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vdmacs_s1, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vdmpys_s0, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vdmpys_s1, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_cmpyrs_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_cmpyrs_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_cmpyrsc_s0, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_cmpyrsc_s1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_cmacs_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_cmacs_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_cmacsc_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_cmacsc_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_cmpys_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_cmpys_s1, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_cmpysc_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_cmpysc_s1, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_cnacs_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_cnacs_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_cnacsc_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_cnacsc_s1, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_vrcmpys_s1, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_M2_vrcmpys_acc_s1, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_M2_vrcmpys_s1rp, "iLLii", "") +BUILTIN(__builtin_HEXAGON_M2_mmacls_s0, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmacls_s1, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmachs_s0, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmachs_s1, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyl_s0, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyl_s1, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyh_s0, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyh_s1, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmacls_rs0, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmacls_rs1, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmachs_rs0, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmachs_rs1, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyl_rs0, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyl_rs1, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyh_rs0, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyh_rs1, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_hmmpyl_rs1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_hmmpyh_rs1, "iii", "") +BUILTIN(__builtin_HEXAGON_M2_mmaculs_s0, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmaculs_s1, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmacuhs_s0, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmacuhs_s1, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyul_s0, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyul_s1, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyuh_s0, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyuh_s1, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmaculs_rs0, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmaculs_rs1, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmacuhs_rs0, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmacuhs_rs1, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyul_rs0, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyul_rs1, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyuh_rs0, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_mmpyuh_rs1, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vrcmaci_s0, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vrcmacr_s0, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vrcmaci_s0c, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vrcmacr_s0c, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_cmaci_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_cmacr_s0, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_M2_vrcmpyi_s0, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vrcmpyr_s0, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vrcmpyi_s0c, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vrcmpyr_s0c, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_cmpyi_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_cmpyr_s0, "LLiii", "") +BUILTIN(__builtin_HEXAGON_M2_vcmpy_s0_sat_i, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vcmpy_s0_sat_r, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vcmpy_s1_sat_i, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vcmpy_s1_sat_r, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vcmac_s0_sat_i, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vcmac_s0_sat_r, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_vcrotate, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_A2_add, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_sub, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addsat, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_subsat, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addi, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addh_l16_ll, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addh_l16_hl, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addh_l16_sat_ll, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addh_l16_sat_hl, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_subh_l16_ll, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_subh_l16_hl, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_subh_l16_sat_ll, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_subh_l16_sat_hl, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addh_h16_ll, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addh_h16_lh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addh_h16_hl, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addh_h16_hh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addh_h16_sat_ll, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addh_h16_sat_lh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addh_h16_sat_hl, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_addh_h16_sat_hh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_subh_h16_ll, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_subh_h16_lh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_subh_h16_hl, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_subh_h16_hh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_subh_h16_sat_ll, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_subh_h16_sat_lh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_subh_h16_sat_hl, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_subh_h16_sat_hh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_aslh, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_asrh, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_addp, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_addpsat, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_addsp, "LLiiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_subp, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_neg, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_negsat, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_abs, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_abssat, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_vconj, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_negp, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_absp, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_max, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_maxu, "Uiii", "") +BUILTIN(__builtin_HEXAGON_A2_min, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_minu, "Uiii", "") +BUILTIN(__builtin_HEXAGON_A2_maxp, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_maxup, "ULLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_minp, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_minup, "ULLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_tfr, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_tfrsi, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_tfrp, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_tfrpi, "LLii", "") +BUILTIN(__builtin_HEXAGON_A2_zxtb, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_sxtb, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_zxth, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_sxth, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_combinew, "LLiii", "") +BUILTIN(__builtin_HEXAGON_A2_combineii, "LLiii", "") +BUILTIN(__builtin_HEXAGON_A2_combine_hh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_combine_hl, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_combine_lh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_combine_ll, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_tfril, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_tfrih, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_and, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_or, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_xor, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_not, "ii", "") +BUILTIN(__builtin_HEXAGON_M2_xor_xacc, "iiii", "") +BUILTIN(__builtin_HEXAGON_A2_subri, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_andir, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_orir, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_andp, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_orp, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_xorp, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_notp, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_sxtw, "LLii", "") +BUILTIN(__builtin_HEXAGON_A2_sat, "iLLi", "") +BUILTIN(__builtin_HEXAGON_A2_sath, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_satuh, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_satub, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_satb, "ii", "") +BUILTIN(__builtin_HEXAGON_A2_vaddub, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vaddubs, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vaddh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vaddhs, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vadduhs, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vaddw, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vaddws, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_svavgh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_svavghs, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_svnavgh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_svaddh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_svaddhs, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_svadduhs, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_svsubh, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_svsubhs, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_svsubuhs, "iii", "") +BUILTIN(__builtin_HEXAGON_A2_vraddub, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vraddub_acc, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vradduh, "iLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vsubub, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vsububs, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vsubh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vsubhs, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vsubuhs, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vsubw, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vsubws, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vabsh, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vabshsat, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vabsw, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vabswsat, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vabsdiffw, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_M2_vabsdiffh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vrsadub, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vrsadub_acc, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vavgub, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vavguh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vavgh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vnavgh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vavgw, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vnavgw, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vavgwr, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vnavgwr, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vavgwcr, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vnavgwcr, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vavghcr, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vnavghcr, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vavguw, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vavguwr, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vavgubr, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vavguhr, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vavghr, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vnavghr, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vminh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vmaxh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vminub, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vmaxub, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vminuh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vmaxuh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vminw, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vmaxw, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vminuw, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A2_vmaxuw, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_r, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_r_r, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_r_r, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_lsl_r_r, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_p, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_r_p, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_r_p, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsl_r_p, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_r_acc, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_r_r_acc, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_r_r_acc, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_lsl_r_r_acc, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_p_acc, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_r_p_acc, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_r_p_acc, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsl_r_p_acc, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_r_nac, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_r_r_nac, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_r_r_nac, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_lsl_r_r_nac, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_p_nac, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_r_p_nac, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_r_p_nac, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsl_r_p_nac, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_r_and, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_r_r_and, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_r_r_and, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_lsl_r_r_and, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_r_or, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_r_r_or, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_r_r_or, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_lsl_r_r_or, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_p_and, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_r_p_and, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_r_p_and, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsl_r_p_and, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_p_or, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_r_p_or, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_r_p_or, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsl_r_p_or, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_r_sat, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_r_r_sat, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_r, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_r, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_r, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_p, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_p, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_p, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_r_acc, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_r_acc, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_r_acc, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_p_acc, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_p_acc, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_p_acc, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_r_nac, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_r_nac, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_r_nac, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_p_nac, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_p_nac, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_p_nac, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_r_xacc, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_r_xacc, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_p_xacc, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_p_xacc, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_r_and, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_r_and, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_r_and, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_r_or, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_r_or, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_r_or, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_p_and, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_p_and, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_p_and, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_p_or, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_p_or, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_p_or, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_r_sat, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_r_rnd, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_r_rnd_goodsyntax, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_addasl_rrri, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_valignib, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_valignrb, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_vspliceib, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_vsplicerb, "LLiLLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_vsplatrh, "LLii", "") +BUILTIN(__builtin_HEXAGON_S2_vsplatrb, "ii", "") +BUILTIN(__builtin_HEXAGON_S2_insert, "iiiii", "") +BUILTIN(__builtin_HEXAGON_S2_tableidxb_goodsyntax, "iiiii", "") +BUILTIN(__builtin_HEXAGON_S2_tableidxh_goodsyntax, "iiiii", "") +BUILTIN(__builtin_HEXAGON_S2_tableidxw_goodsyntax, "iiiii", "") +BUILTIN(__builtin_HEXAGON_S2_tableidxd_goodsyntax, "iiiii", "") +BUILTIN(__builtin_HEXAGON_S2_extractu, "iiii", "") +BUILTIN(__builtin_HEXAGON_S2_insertp, "LLiLLiLLiii", "") +BUILTIN(__builtin_HEXAGON_S2_extractup, "LLiLLiii", "") +BUILTIN(__builtin_HEXAGON_S2_insert_rp, "iiiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_extractu_rp, "iiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_insertp_rp, "LLiLLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_extractup_rp, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_tstbit_i, "bii", "") +BUILTIN(__builtin_HEXAGON_S2_setbit_i, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_togglebit_i, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_clrbit_i, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_tstbit_r, "bii", "") +BUILTIN(__builtin_HEXAGON_S2_setbit_r, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_togglebit_r, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_clrbit_r, "iii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_vh, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_vh, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_vh, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_vh, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_r_vh, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_r_vh, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsl_r_vh, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_vw, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_i_svw_trun, "iLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_svw_trun, "iLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_i_vw, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_i_vw, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asr_r_vw, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_asl_r_vw, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsr_r_vw, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_lsl_r_vw, "LLiLLii", "") +BUILTIN(__builtin_HEXAGON_S2_vrndpackwh, "iLLi", "") +BUILTIN(__builtin_HEXAGON_S2_vrndpackwhs, "iLLi", "") +BUILTIN(__builtin_HEXAGON_S2_vsxtbh, "LLii", "") +BUILTIN(__builtin_HEXAGON_S2_vzxtbh, "LLii", "") +BUILTIN(__builtin_HEXAGON_S2_vsathub, "iLLi", "") +BUILTIN(__builtin_HEXAGON_S2_svsathub, "ii", "") +BUILTIN(__builtin_HEXAGON_S2_svsathb, "ii", "") +BUILTIN(__builtin_HEXAGON_S2_vsathb, "iLLi", "") +BUILTIN(__builtin_HEXAGON_S2_vtrunohb, "iLLi", "") +BUILTIN(__builtin_HEXAGON_S2_vtrunewh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_vtrunowh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_vtrunehb, "iLLi", "") +BUILTIN(__builtin_HEXAGON_S2_vsxthw, "LLii", "") +BUILTIN(__builtin_HEXAGON_S2_vzxthw, "LLii", "") +BUILTIN(__builtin_HEXAGON_S2_vsatwh, "iLLi", "") +BUILTIN(__builtin_HEXAGON_S2_vsatwuh, "iLLi", "") +BUILTIN(__builtin_HEXAGON_S2_packhl, "LLiii", "") +BUILTIN(__builtin_HEXAGON_A2_swiz, "ii", "") +BUILTIN(__builtin_HEXAGON_S2_vsathub_nopack, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_vsathb_nopack, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_vsatwh_nopack, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_vsatwuh_nopack, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_shuffob, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_shuffeb, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_shuffoh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_shuffeh, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_parityp, "iLLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_lfsp, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_clbnorm, "ii", "") +BUILTIN(__builtin_HEXAGON_S2_clb, "ii", "") +BUILTIN(__builtin_HEXAGON_S2_cl0, "ii", "") +BUILTIN(__builtin_HEXAGON_S2_cl1, "ii", "") +BUILTIN(__builtin_HEXAGON_S2_clbp, "iLLi", "") +BUILTIN(__builtin_HEXAGON_S2_cl0p, "iLLi", "") +BUILTIN(__builtin_HEXAGON_S2_cl1p, "iLLi", "") +BUILTIN(__builtin_HEXAGON_S2_brev, "ii", "") +BUILTIN(__builtin_HEXAGON_S2_ct0, "ii", "") +BUILTIN(__builtin_HEXAGON_S2_ct1, "ii", "") +BUILTIN(__builtin_HEXAGON_S2_interleave, "LLiLLi", "") +BUILTIN(__builtin_HEXAGON_S2_deinterleave, "LLiLLi", "") + +BUILTIN(__builtin_SI_to_SXTHI_asrh, "ii", "") + +BUILTIN(__builtin_M2_vrcmpys_s1, "LLiLLii", "") +BUILTIN(__builtin_M2_vrcmpys_acc_s1, "LLiLLiLLii", "") +BUILTIN(__builtin_M2_vrcmpys_s1rp, "iLLii", "") + +BUILTIN(__builtin_M2_vradduh, "iLLiLLi", "") +BUILTIN(__builtin_A2_addsp, "LLiiLLi", "") +BUILTIN(__builtin_A2_addpsat, "LLiLLiLLi", "") + +BUILTIN(__builtin_A2_maxp, "LLiLLiLLi", "") +BUILTIN(__builtin_A2_maxup, "LLiLLiLLi", "") + +BUILTIN(__builtin_HEXAGON_A4_orn, "iii", "") +BUILTIN(__builtin_HEXAGON_A4_andn, "iii", "") +BUILTIN(__builtin_HEXAGON_A4_ornp, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A4_andnp, "LLiLLiLLi", "") +BUILTIN(__builtin_HEXAGON_A4_combineir, "LLiii", "") +BUILTIN(__builtin_HEXAGON_A4_combineri, "LLiii", "") +BUILTIN(__builtin_HEXAGON_C4_cmpneqi, "bii", "") +BUILTIN(__builtin_HEXAGON_C4_cmpneq, "bii", "") +BUILTIN(__builtin_HEXAGON_C4_cmpltei, "bii", "") +BUILTIN(__builtin_HEXAGON_C4_cmplte, "bii", "") +BUILTIN(__builtin_HEXAGON_C4_cmplteui, "bii", "") +BUILTIN(__builtin_HEXAGON_C4_cmplteu, "bii", "") +BUILTIN(__builtin_HEXAGON_A4_rcmpneq, "iii", "") +BUILTIN(__builtin_HEXAGON_A4_rcmpneqi, "iii", "") +BUILTIN(__builtin_HEXAGON_A4_rcmpeq, "iii", "") +BUILTIN(__builtin_HEXAGON_A4_rcmpeqi, "iii", "") +BUILTIN(__builtin_HEXAGON_C4_fastcorner9, "bii", "") +BUILTIN(__builtin_HEXAGON_C4_fastcorner9_not, "bii", "") +BUILTIN(__builtin_HEXAGON_C4_and_andn, "biii", "") +BUILTIN(__builtin_HEXAGON_C4_and_and, "biii", "") +BUILTIN(__builtin_HEXAGON_C4_and_orn, "biii", "") +BUILTIN(__builtin_HEXAGON_C4_and_or, "biii", "") +BUILTIN(__builtin_HEXAGON_C4_or_andn, "biii", "") +BUILTIN(__builtin_HEXAGON_C4_or_and, "biii", "") +BUILTIN(__builtin_HEXAGON_C4_or_orn, "biii", "") +BUILTIN(__builtin_HEXAGON_C4_or_or, "biii", "") +BUILTIN(__builtin_HEXAGON_S4_addaddi, "iiii", "") +BUILTIN(__builtin_HEXAGON_S4_subaddi, "iiii", "") +BUILTIN(__builtin_HEXAGON_M4_xor_xacc, "LLiLLiLLiLLi", "") + +BUILTIN(__builtin_HEXAGON_M4_and_and, "iiii", "") +BUILTIN(__builtin_HEXAGON_M4_and_or, "iiii", "") +BUILTIN(__builtin_HEXAGON_M4_and_xor, "iiii", "") +BUILTIN(__builtin_HEXAGON_M4_and_andn, "iiii", "") +BUILTIN(__builtin_HEXAGON_M4_xor_and, "iiii", "") +BUILTIN(__builtin_HEXAGON_M4_xor_or, "iiii", "") +BUILTIN(__builtin_HEXAGON_M4_xor_andn, "iiii", "") +BUILTIN(__builtin_HEXAGON_M4_or_and, "iiii", "") +BUILTIN(__builtin_HEXAGON_M4_or_or, "iiii", "") +BUILTIN(__builtin_HEXAGON_M4_or_xor, "iiii", "") +BUILTIN(__builtin_HEXAGON_M4_or_andn, "iiii", "") +BUILTIN(__builtin_HEXAGON_S4_or_andix, "iiii", "") +BUILTIN(__builtin_HEXAGON_S4_or_andi, "iiii", "") +BUILTIN(__builtin_HEXAGON_S4_or_ori, "iiii", "") + +BUILTIN(__builtin_HEXAGON_A4_modwrapu, "iii", "") + +BUILTIN(__builtin_HEXAGON_A4_cround_ri, "iii", "") +BUILTIN(__builtin_HEXAGON_A4_cround_rr, "iii", "") +BUILTIN(__builtin_HEXAGON_A4_round_ri, "iii", "") +BUILTIN(__builtin_HEXAGON_A4_round_rr, "iii", "") +BUILTIN(__builtin_HEXAGON_A4_round_ri_sat, "iii", "") +BUILTIN(__builtin_HEXAGON_A4_round_rr_sat, "iii", "") + +#undef BUILTIN diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index 6bd901469cee0..f44aed6f9548e 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -42,8 +42,6 @@ BUILTIN(__builtin_ia32_pfrcpit1, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfrcpit2, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfrsqrt, "V2fV2f", "nc") BUILTIN(__builtin_ia32_pfrsqit1, "V2fV2fV2f", "nc") -// GCC has pfrsqrtit1, even though this is not the name of the instruction. -BUILTIN(__builtin_ia32_pfrsqrtit1, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfsub, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pfsubr, "V2fV2fV2f", "nc") BUILTIN(__builtin_ia32_pi2fd, "V2fV2i", "nc") @@ -187,14 +185,14 @@ BUILTIN(__builtin_ia32_ucomisdle, "iV2dV2d", "") BUILTIN(__builtin_ia32_ucomisdgt, "iV2dV2d", "") BUILTIN(__builtin_ia32_ucomisdge, "iV2dV2d", "") BUILTIN(__builtin_ia32_ucomisdneq, "iV2dV2d", "") -BUILTIN(__builtin_ia32_cmpps, "V4fV4fV4fc", "") -BUILTIN(__builtin_ia32_cmpss, "V4fV4fV4fc", "") +BUILTIN(__builtin_ia32_cmpps, "V4fV4fV4fIc", "") +BUILTIN(__builtin_ia32_cmpss, "V4fV4fV4fIc", "") BUILTIN(__builtin_ia32_minps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_maxps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_minss, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_maxss, "V4fV4fV4f", "") -BUILTIN(__builtin_ia32_cmppd, "V2dV2dV2dc", "") -BUILTIN(__builtin_ia32_cmpsd, "V2dV2dV2dc", "") +BUILTIN(__builtin_ia32_cmppd, "V2dV2dV2dIc", "") +BUILTIN(__builtin_ia32_cmpsd, "V2dV2dV2dIc", "") BUILTIN(__builtin_ia32_minpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_maxpd, "V2dV2dV2d", "") BUILTIN(__builtin_ia32_minsd, "V2dV2dV2d", "") @@ -210,19 +208,13 @@ BUILTIN(__builtin_ia32_psubusw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pmulhw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pavgb128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_pavgw128, "V8sV8sV8s", "") -BUILTIN(__builtin_ia32_pcmpeqb128, "V16cV16cV16c", "") -BUILTIN(__builtin_ia32_pcmpeqw128, "V8sV8sV8s", "") -BUILTIN(__builtin_ia32_pcmpeqd128, "V4iV4iV4i", "") -BUILTIN(__builtin_ia32_pcmpgtb128, "V16cV16cV16c", "") -BUILTIN(__builtin_ia32_pcmpgtw128, "V8sV8sV8s", "") -BUILTIN(__builtin_ia32_pcmpgtd128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_pmaxub128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_pmaxsw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pminub128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_pminsw128, "V8sV8sV8s", "") -BUILTIN(__builtin_ia32_packsswb128, "V8sV8sV8s", "") -BUILTIN(__builtin_ia32_packssdw128, "V4iV4iV4i", "") -BUILTIN(__builtin_ia32_packuswb128, "V8sV8sV8s", "") +BUILTIN(__builtin_ia32_packsswb128, "V16cV8sV8s", "") +BUILTIN(__builtin_ia32_packssdw128, "V8sV4iV4i", "") +BUILTIN(__builtin_ia32_packuswb128, "V16cV8sV8s", "") BUILTIN(__builtin_ia32_pmulhuw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_addsubps, "V4fV4fV4f", "") BUILTIN(__builtin_ia32_addsubpd, "V2dV2dV2d", "") @@ -236,7 +228,7 @@ BUILTIN(__builtin_ia32_phaddsw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_phsubw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_phsubd128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_phsubsw128, "V8sV8sV8s", "") -BUILTIN(__builtin_ia32_pmaddubsw128, "V16cV16cV16c", "") +BUILTIN(__builtin_ia32_pmaddubsw128, "V8sV16cV16c", "") BUILTIN(__builtin_ia32_pmulhrsw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pshufb128, "V16cV16cV16c", "") BUILTIN(__builtin_ia32_psignb128, "V16cV16cV16c", "") @@ -304,19 +296,19 @@ BUILTIN(__builtin_ia32_psrldi128, "V4iV4ii", "") BUILTIN(__builtin_ia32_psrlqi128, "V2LLiV2LLii", "") BUILTIN(__builtin_ia32_psrawi128, "V8sV8si", "") BUILTIN(__builtin_ia32_psradi128, "V4iV4ii", "") -BUILTIN(__builtin_ia32_pmaddwd128, "V8sV8sV8s", "") +BUILTIN(__builtin_ia32_pmaddwd128, "V4iV8sV8s", "") BUILTIN(__builtin_ia32_monitor, "vv*UiUi", "") BUILTIN(__builtin_ia32_mwait, "vUiUi", "") BUILTIN(__builtin_ia32_lddqu, "V16ccC*", "") -BUILTIN(__builtin_ia32_palignr128, "V16cV16cV16cIc", "") // FIXME: Correct type? +BUILTIN(__builtin_ia32_palignr128, "V16cV16cV16cIc", "") BUILTIN(__builtin_ia32_insertps128, "V4fV4fV4fi", "") BUILTIN(__builtin_ia32_storelv4si, "vV2i*V2LLi", "") BUILTIN(__builtin_ia32_pblendvb128, "V16cV16cV16cV16c", "") -BUILTIN(__builtin_ia32_pblendw128, "V8sV8sV8si", "") -BUILTIN(__builtin_ia32_blendpd, "V2dV2dV2di", "") -BUILTIN(__builtin_ia32_blendps, "V4fV4fV4fi", "") +BUILTIN(__builtin_ia32_pblendw128, "V8sV8sV8sIi", "") +BUILTIN(__builtin_ia32_blendpd, "V2dV2dV2dIi", "") +BUILTIN(__builtin_ia32_blendps, "V4fV4fV4fIi", "") BUILTIN(__builtin_ia32_blendvpd, "V2dV2dV2dV2d", "") BUILTIN(__builtin_ia32_blendvps, "V4fV4fV4fV4f", "") @@ -353,28 +345,26 @@ BUILTIN(__builtin_ia32_movntdqa, "V2LLiV2LLi*", "") BUILTIN(__builtin_ia32_ptestz128, "iV2LLiV2LLi", "") BUILTIN(__builtin_ia32_ptestc128, "iV2LLiV2LLi", "") BUILTIN(__builtin_ia32_ptestnzc128, "iV2LLiV2LLi", "") -BUILTIN(__builtin_ia32_pcmpeqq, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_mpsadbw128, "V16cV16cV16ci", "") +BUILTIN(__builtin_ia32_phminposuw128, "V8sV8s", "") // SSE 4.2 -BUILTIN(__builtin_ia32_pcmpistrm128, "V16cV16cV16cc", "") -BUILTIN(__builtin_ia32_pcmpistri128, "iV16cV16cc", "") -BUILTIN(__builtin_ia32_pcmpestrm128, "V16cV16ciV16cic", "") -BUILTIN(__builtin_ia32_pcmpestri128, "iV16ciV16cic","") +BUILTIN(__builtin_ia32_pcmpistrm128, "V16cV16cV16cIc", "") +BUILTIN(__builtin_ia32_pcmpistri128, "iV16cV16cIc", "") +BUILTIN(__builtin_ia32_pcmpestrm128, "V16cV16ciV16ciIc", "") +BUILTIN(__builtin_ia32_pcmpestri128, "iV16ciV16ciIc","") -BUILTIN(__builtin_ia32_pcmpistria128, "iV16ciV16cic","") -BUILTIN(__builtin_ia32_pcmpistric128, "iV16ciV16cic","") -BUILTIN(__builtin_ia32_pcmpistrio128, "iV16ciV16cic","") -BUILTIN(__builtin_ia32_pcmpistris128, "iV16ciV16cic","") -BUILTIN(__builtin_ia32_pcmpistriz128, "iV16ciV16cic","") - -BUILTIN(__builtin_ia32_pcmpestria128, "iV16ciV16cic","") -BUILTIN(__builtin_ia32_pcmpestric128, "iV16ciV16cic","") -BUILTIN(__builtin_ia32_pcmpestrio128, "iV16ciV16cic","") -BUILTIN(__builtin_ia32_pcmpestris128, "iV16ciV16cic","") -BUILTIN(__builtin_ia32_pcmpestriz128, "iV16ciV16cic","") - -BUILTIN(__builtin_ia32_pcmpgtq, "V2LLiV2LLiV2LLi", "") +// FIXME: These builtins are horribly broken; reenable when PR11305 is fixed. +//BUILTIN(__builtin_ia32_pcmpistria128, "iV16cV16cIc","") +//BUILTIN(__builtin_ia32_pcmpistric128, "iV16cV16cIc","") +//BUILTIN(__builtin_ia32_pcmpistrio128, "iV16cV16cIc","") +//BUILTIN(__builtin_ia32_pcmpistris128, "iV16cV16cIc","") +//BUILTIN(__builtin_ia32_pcmpistriz128, "iV16cV16cIc","") +//BUILTIN(__builtin_ia32_pcmpestria128, "iV16ciV16ciIc","") +//BUILTIN(__builtin_ia32_pcmpestric128, "iV16ciV16ciIc","") +//BUILTIN(__builtin_ia32_pcmpestrio128, "iV16ciV16ciic","") +//BUILTIN(__builtin_ia32_pcmpestris128, "iV16ciV16ciIc","") +//BUILTIN(__builtin_ia32_pcmpestriz128, "iV16ciV16ciIc","") BUILTIN(__builtin_ia32_crc32qi, "UiUiUc", "") BUILTIN(__builtin_ia32_crc32hi, "UiUiUs", "") @@ -387,7 +377,7 @@ BUILTIN(__builtin_ia32_aesenclast128, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_aesdec128, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_aesdeclast128, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_aesimc128, "V2LLiV2LLi", "") -BUILTIN(__builtin_ia32_aeskeygenassist128, "V2LLiV2LLic", "") +BUILTIN(__builtin_ia32_aeskeygenassist128, "V2LLiV2LLiIc", "") // AVX BUILTIN(__builtin_ia32_addsubpd256, "V4dV4dV4d", "") @@ -404,16 +394,16 @@ BUILTIN(__builtin_ia32_vpermilvarpd, "V2dV2dV2LLi", "") BUILTIN(__builtin_ia32_vpermilvarps, "V4fV4fV4i", "") BUILTIN(__builtin_ia32_vpermilvarpd256, "V4dV4dV4LLi", "") BUILTIN(__builtin_ia32_vpermilvarps256, "V8fV8fV8i", "") -BUILTIN(__builtin_ia32_blendpd256, "V4dV4dV4di", "") -BUILTIN(__builtin_ia32_blendps256, "V8fV8fV8fi", "") +BUILTIN(__builtin_ia32_blendpd256, "V4dV4dV4dIi", "") +BUILTIN(__builtin_ia32_blendps256, "V8fV8fV8fIi", "") BUILTIN(__builtin_ia32_blendvpd256, "V4dV4dV4dV4d", "") BUILTIN(__builtin_ia32_blendvps256, "V8fV8fV8fV8f", "") -BUILTIN(__builtin_ia32_dpps256, "V8fV8fV8fi", "") +BUILTIN(__builtin_ia32_dpps256, "V8fV8fV8fIi", "") BUILTIN(__builtin_ia32_cmppd256, "V4dV4dV4dc", "") BUILTIN(__builtin_ia32_cmpps256, "V8fV8fV8fc", "") -BUILTIN(__builtin_ia32_vextractf128_pd256, "V2dV4dc", "") -BUILTIN(__builtin_ia32_vextractf128_ps256, "V4fV8fc", "") -BUILTIN(__builtin_ia32_vextractf128_si256, "V4iV8ic", "") +BUILTIN(__builtin_ia32_vextractf128_pd256, "V2dV4dIc", "") +BUILTIN(__builtin_ia32_vextractf128_ps256, "V4fV8fIc", "") +BUILTIN(__builtin_ia32_vextractf128_si256, "V4iV8iIc", "") BUILTIN(__builtin_ia32_cvtdq2pd256, "V4dV4i", "") BUILTIN(__builtin_ia32_cvtdq2ps256, "V8fV8i", "") BUILTIN(__builtin_ia32_cvtpd2ps256, "V4fV4d", "") @@ -422,22 +412,15 @@ BUILTIN(__builtin_ia32_cvtps2pd256, "V4dV4f", "") BUILTIN(__builtin_ia32_cvttpd2dq256, "V4iV4d", "") BUILTIN(__builtin_ia32_cvtpd2dq256, "V4iV4d", "") BUILTIN(__builtin_ia32_cvttps2dq256, "V8iV8f", "") -BUILTIN(__builtin_ia32_vperm2f128_pd256, "V4dV4dV4dc", "") -BUILTIN(__builtin_ia32_vperm2f128_ps256, "V8fV8fV8fc", "") -BUILTIN(__builtin_ia32_vperm2f128_si256, "V8iV8iV8ic", "") -BUILTIN(__builtin_ia32_vpermilpd, "V2dV2dc", "") -BUILTIN(__builtin_ia32_vpermilps, "V4fV4fc", "") -BUILTIN(__builtin_ia32_vpermilpd256, "V4dV4dc", "") -BUILTIN(__builtin_ia32_vpermilps256, "V8fV8fc", "") -BUILTIN(__builtin_ia32_vinsertf128_pd256, "V4dV4dV2dc", "") -BUILTIN(__builtin_ia32_vinsertf128_ps256, "V8fV8fV4fc", "") -BUILTIN(__builtin_ia32_vinsertf128_si256, "V8iV8iV4ic", "") +BUILTIN(__builtin_ia32_vinsertf128_pd256, "V4dV4dV2dIc", "") +BUILTIN(__builtin_ia32_vinsertf128_ps256, "V8fV8fV4fIc", "") +BUILTIN(__builtin_ia32_vinsertf128_si256, "V8iV8iV4iIc", "") BUILTIN(__builtin_ia32_sqrtpd256, "V4dV4d", "") BUILTIN(__builtin_ia32_sqrtps256, "V8fV8f", "") BUILTIN(__builtin_ia32_rsqrtps256, "V8fV8f", "") BUILTIN(__builtin_ia32_rcpps256, "V8fV8f", "") -BUILTIN(__builtin_ia32_roundpd256, "V4dV4di", "") -BUILTIN(__builtin_ia32_roundps256, "V8fV8fi", "") +BUILTIN(__builtin_ia32_roundpd256, "V4dV4dIi", "") +BUILTIN(__builtin_ia32_roundps256, "V8fV8fIi", "") BUILTIN(__builtin_ia32_vtestzpd, "iV2dV2d", "") BUILTIN(__builtin_ia32_vtestcpd, "iV2dV2d", "") BUILTIN(__builtin_ia32_vtestnzcpd, "iV2dV2d", "") @@ -462,11 +445,8 @@ BUILTIN(__builtin_ia32_vbroadcastsd256, "V4ddC*", "") BUILTIN(__builtin_ia32_vbroadcastss256, "V8ffC*", "") BUILTIN(__builtin_ia32_vbroadcastf128_pd256, "V4dV2dC*", "") BUILTIN(__builtin_ia32_vbroadcastf128_ps256, "V8fV4fC*", "") -BUILTIN(__builtin_ia32_loadupd256, "V4ddC*", "") -BUILTIN(__builtin_ia32_loadups256, "V8ffC*", "") BUILTIN(__builtin_ia32_storeupd256, "vd*V4d", "") BUILTIN(__builtin_ia32_storeups256, "vf*V8f", "") -BUILTIN(__builtin_ia32_loaddqu256, "V32ccC*", "") BUILTIN(__builtin_ia32_storedqu256, "vc*V32c", "") BUILTIN(__builtin_ia32_lddqu256, "V32ccC*", "") BUILTIN(__builtin_ia32_movntdq256, "vV4LLi*V4LLi", "") @@ -481,4 +461,173 @@ BUILTIN(__builtin_ia32_maskstoreps, "vV4f*V4fV4f", "") BUILTIN(__builtin_ia32_maskstorepd256, "vV4d*V4dV4d", "") BUILTIN(__builtin_ia32_maskstoreps256, "vV8f*V8fV8f", "") +// AVX2 +BUILTIN(__builtin_ia32_mpsadbw256, "V32cV32cV32ci", "") +BUILTIN(__builtin_ia32_pabsb256, "V32cV32c", "") +BUILTIN(__builtin_ia32_pabsw256, "V16sV16s", "") +BUILTIN(__builtin_ia32_pabsd256, "V8iV8i", "") +BUILTIN(__builtin_ia32_packsswb256, "V32cV16sV16s", "") +BUILTIN(__builtin_ia32_packssdw256, "V16sV8iV8i", "") +BUILTIN(__builtin_ia32_packuswb256, "V32cV16sV16s", "") +BUILTIN(__builtin_ia32_packusdw256, "V16sV8iV8i", "") +BUILTIN(__builtin_ia32_paddsb256, "V32cV32cV32c", "") +BUILTIN(__builtin_ia32_paddsw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_psubsb256, "V32cV32cV32c", "") +BUILTIN(__builtin_ia32_psubsw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_paddusb256, "V32cV32cV32c", "") +BUILTIN(__builtin_ia32_paddusw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_psubusb256, "V32cV32cV32c", "") +BUILTIN(__builtin_ia32_psubusw256, "V16sV16sV16s", "") +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_phaddw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_phaddd256, "V8iV8iV8i", "") +BUILTIN(__builtin_ia32_phaddsw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_phsubw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_phsubd256, "V8iV8iV8i", "") +BUILTIN(__builtin_ia32_phsubsw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_pmaddubsw256, "V16sV32cV32c", "") +BUILTIN(__builtin_ia32_pmaddwd256, "V8iV16sV16s", "") +BUILTIN(__builtin_ia32_pmaxub256, "V32cV32cV32c", "") +BUILTIN(__builtin_ia32_pmaxuw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_pmaxud256, "V8iV8iV8i", "") +BUILTIN(__builtin_ia32_pmaxsb256, "V32cV32cV32c", "") +BUILTIN(__builtin_ia32_pmaxsw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_pmaxsd256, "V8iV8iV8i", "") +BUILTIN(__builtin_ia32_pminub256, "V32cV32cV32c", "") +BUILTIN(__builtin_ia32_pminuw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_pminud256, "V8iV8iV8i", "") +BUILTIN(__builtin_ia32_pminsb256, "V32cV32cV32c", "") +BUILTIN(__builtin_ia32_pminsw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_pminsd256, "V8iV8iV8i", "") +BUILTIN(__builtin_ia32_pmovmskb256, "iV32c", "") +BUILTIN(__builtin_ia32_pmovsxbw256, "V16sV16c", "") +BUILTIN(__builtin_ia32_pmovsxbd256, "V8iV16c", "") +BUILTIN(__builtin_ia32_pmovsxbq256, "V4LLiV16c", "") +BUILTIN(__builtin_ia32_pmovsxwd256, "V8iV8s", "") +BUILTIN(__builtin_ia32_pmovsxwq256, "V4LLiV8s", "") +BUILTIN(__builtin_ia32_pmovsxdq256, "V4LLiV4i", "") +BUILTIN(__builtin_ia32_pmovzxbw256, "V16sV16c", "") +BUILTIN(__builtin_ia32_pmovzxbd256, "V8iV16c", "") +BUILTIN(__builtin_ia32_pmovzxbq256, "V4LLiV16c", "") +BUILTIN(__builtin_ia32_pmovzxwd256, "V8iV8s", "") +BUILTIN(__builtin_ia32_pmovzxwq256, "V4LLiV8s", "") +BUILTIN(__builtin_ia32_pmovzxdq256, "V4LLiV4i", "") +BUILTIN(__builtin_ia32_pmuldq256, "V4LLiV8iV8i", "") +BUILTIN(__builtin_ia32_pmulhrsw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_pmulhuw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_pmulhw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_pmuludq256, "V4LLiV8iV8i", "") +BUILTIN(__builtin_ia32_psadbw256, "V4LLiV32cV32c", "") +BUILTIN(__builtin_ia32_pshufb256, "V32cV32cV32c", "") +BUILTIN(__builtin_ia32_psignb256, "V32cV32cV32c", "") +BUILTIN(__builtin_ia32_psignw256, "V16sV16sV16s", "") +BUILTIN(__builtin_ia32_psignd256, "V8iV8iV8i", "") +BUILTIN(__builtin_ia32_pslldqi256, "V4LLiV4LLiIi", "") +BUILTIN(__builtin_ia32_psllwi256, "V16sV16si", "") +BUILTIN(__builtin_ia32_psllw256, "V16sV16sV8s", "") +BUILTIN(__builtin_ia32_pslldi256, "V8iV8ii", "") +BUILTIN(__builtin_ia32_pslld256, "V8iV8iV4i", "") +BUILTIN(__builtin_ia32_psllqi256, "V4LLiV4LLii", "") +BUILTIN(__builtin_ia32_psllq256, "V4LLiV4LLiV2LLi", "") +BUILTIN(__builtin_ia32_psrawi256, "V16sV16si", "") +BUILTIN(__builtin_ia32_psraw256, "V16sV16sV8s", "") +BUILTIN(__builtin_ia32_psradi256, "V8iV8ii", "") +BUILTIN(__builtin_ia32_psrad256, "V8iV8iV4i", "") +BUILTIN(__builtin_ia32_psrldqi256, "V4LLiV4LLiIi", "") +BUILTIN(__builtin_ia32_psrlwi256, "V16sV16si", "") +BUILTIN(__builtin_ia32_psrlw256, "V16sV16sV8s", "") +BUILTIN(__builtin_ia32_psrldi256, "V8iV8ii", "") +BUILTIN(__builtin_ia32_psrld256, "V8iV8iV4i", "") +BUILTIN(__builtin_ia32_psrlqi256, "V4LLiV4LLii", "") +BUILTIN(__builtin_ia32_psrlq256, "V4LLiV4LLiV2LLi", "") +BUILTIN(__builtin_ia32_movntdqa256, "V4LLiV4LLi*", "") +BUILTIN(__builtin_ia32_vbroadcastss_ps, "V4fV4f", "") +BUILTIN(__builtin_ia32_vbroadcastss_ps256, "V8fV4f", "") +BUILTIN(__builtin_ia32_vbroadcastsd_pd256, "V4dV2d", "") +BUILTIN(__builtin_ia32_vbroadcastsi256, "V4LLiV2LLiC*", "") +BUILTIN(__builtin_ia32_pblendd128, "V4iV4iV4iIi", "") +BUILTIN(__builtin_ia32_pblendd256, "V8iV8iV8iIi", "") +BUILTIN(__builtin_ia32_pbroadcastb256, "V32cV16c", "") +BUILTIN(__builtin_ia32_pbroadcastw256, "V16sV8s", "") +BUILTIN(__builtin_ia32_pbroadcastd256, "V8iV4i", "") +BUILTIN(__builtin_ia32_pbroadcastq256, "V4LLiV2LLi", "") +BUILTIN(__builtin_ia32_pbroadcastb128, "V16cV16c", "") +BUILTIN(__builtin_ia32_pbroadcastw128, "V8sV8s", "") +BUILTIN(__builtin_ia32_pbroadcastd128, "V4iV4i", "") +BUILTIN(__builtin_ia32_pbroadcastq128, "V2LLiV2LLi", "") +BUILTIN(__builtin_ia32_permvarsi256, "V8iV8iV8i", "") +BUILTIN(__builtin_ia32_permdf256, "V4dV4dIc", "") +BUILTIN(__builtin_ia32_permvarsf256, "V8fV8fV8f", "") +BUILTIN(__builtin_ia32_permdi256, "V4LLiV4LLiIc", "") +BUILTIN(__builtin_ia32_extract128i256, "V2LLiV4LLiIc", "") +BUILTIN(__builtin_ia32_insert128i256, "V4LLiV4LLiV2LLiIc", "") +BUILTIN(__builtin_ia32_maskloadd256, "V8iV8iC*V8i", "") +BUILTIN(__builtin_ia32_maskloadq256, "V4LLiV4LLiC*V4LLi", "") +BUILTIN(__builtin_ia32_maskloadd, "V4iV4iC*V4i", "") +BUILTIN(__builtin_ia32_maskloadq, "V2LLiV2LLiC*V2LLi", "") +BUILTIN(__builtin_ia32_maskstored256, "vV8i*V8iV8i", "") +BUILTIN(__builtin_ia32_maskstoreq256, "vV4LLi*V4LLiV4LLi", "") +BUILTIN(__builtin_ia32_maskstored, "vV4i*V4iV4i", "") +BUILTIN(__builtin_ia32_maskstoreq, "vV2LLi*V2LLiV2LLi", "") +BUILTIN(__builtin_ia32_psllv8si, "V8iV8iV8i", "") +BUILTIN(__builtin_ia32_psllv4si, "V4iV4iV4i", "") +BUILTIN(__builtin_ia32_psllv4di, "V4LLiV4LLiV4LLi", "") +BUILTIN(__builtin_ia32_psllv2di, "V2LLiV2LLiV2LLi", "") +BUILTIN(__builtin_ia32_psrav8si, "V8iV8iV8i", "") +BUILTIN(__builtin_ia32_psrav4si, "V4iV4iV4i", "") +BUILTIN(__builtin_ia32_psrlv8si, "V8iV8iV8i", "") +BUILTIN(__builtin_ia32_psrlv4si, "V4iV4iV4i", "") +BUILTIN(__builtin_ia32_psrlv4di, "V4LLiV4LLiV4LLi", "") +BUILTIN(__builtin_ia32_psrlv2di, "V2LLiV2LLiV2LLi", "") + +// BMI +BUILTIN(__builtin_ia32_bextr_u32, "UiUiUi", "") +BUILTIN(__builtin_ia32_bextr_u64, "ULLiULLiULLi", "") + +// BMI2 +BUILTIN(__builtin_ia32_bzhi_si, "UiUiUi", "") +BUILTIN(__builtin_ia32_bzhi_di, "ULLiULLiULLi", "") +BUILTIN(__builtin_ia32_pdep_si, "UiUiUi", "") +BUILTIN(__builtin_ia32_pdep_di, "ULLiULLiULLi", "") +BUILTIN(__builtin_ia32_pext_si, "UiUiUi", "") +BUILTIN(__builtin_ia32_pext_di, "ULLiULLiULLi", "") + +// FMA4 +BUILTIN(__builtin_ia32_vfmaddps, "V4fV4fV4fV4f", "") +BUILTIN(__builtin_ia32_vfmaddpd, "V2dV2dV2dV2d", "") +BUILTIN(__builtin_ia32_vfmaddss, "V4fV4fV4fV4f", "") +BUILTIN(__builtin_ia32_vfmaddsd, "V2dV2dV2dV2d", "") +BUILTIN(__builtin_ia32_vfmsubps, "V4fV4fV4fV4f", "") +BUILTIN(__builtin_ia32_vfmsubpd, "V2dV2dV2dV2d", "") +BUILTIN(__builtin_ia32_vfmsubss, "V4fV4fV4fV4f", "") +BUILTIN(__builtin_ia32_vfmsubsd, "V2dV2dV2dV2d", "") +BUILTIN(__builtin_ia32_vfnmaddps, "V4fV4fV4fV4f", "") +BUILTIN(__builtin_ia32_vfnmaddpd, "V2dV2dV2dV2d", "") +BUILTIN(__builtin_ia32_vfnmaddss, "V4fV4fV4fV4f", "") +BUILTIN(__builtin_ia32_vfnmaddsd, "V2dV2dV2dV2d", "") +BUILTIN(__builtin_ia32_vfnmsubps, "V4fV4fV4fV4f", "") +BUILTIN(__builtin_ia32_vfnmsubpd, "V2dV2dV2dV2d", "") +BUILTIN(__builtin_ia32_vfnmsubss, "V4fV4fV4fV4f", "") +BUILTIN(__builtin_ia32_vfnmsubsd, "V2dV2dV2dV2d", "") +BUILTIN(__builtin_ia32_vfmaddsubps, "V4fV4fV4fV4f", "") +BUILTIN(__builtin_ia32_vfmaddsubpd, "V2dV2dV2dV2d", "") +BUILTIN(__builtin_ia32_vfmsubaddps, "V4fV4fV4fV4f", "") +BUILTIN(__builtin_ia32_vfmsubaddpd, "V2dV2dV2dV2d", "") +BUILTIN(__builtin_ia32_vfmaddps256, "V8fV8fV8fV8f", "") +BUILTIN(__builtin_ia32_vfmaddpd256, "V4dV4dV4dV4d", "") +BUILTIN(__builtin_ia32_vfmsubps256, "V8fV8fV8fV8f", "") +BUILTIN(__builtin_ia32_vfmsubpd256, "V4dV4dV4dV4d", "") +BUILTIN(__builtin_ia32_vfnmaddps256, "V8fV8fV8fV8f", "") +BUILTIN(__builtin_ia32_vfnmaddpd256, "V4dV4dV4dV4d", "") +BUILTIN(__builtin_ia32_vfnmsubps256, "V8fV8fV8fV8f", "") +BUILTIN(__builtin_ia32_vfnmsubpd256, "V4dV4dV4dV4d", "") +BUILTIN(__builtin_ia32_vfmaddsubps256, "V8fV8fV8fV8f", "") +BUILTIN(__builtin_ia32_vfmaddsubpd256, "V4dV4dV4dV4d", "") +BUILTIN(__builtin_ia32_vfmsubaddps256, "V8fV8fV8fV8f", "") +BUILTIN(__builtin_ia32_vfmsubaddpd256, "V4dV4dV4dV4d", "") + #undef BUILTIN diff --git a/include/clang/Basic/CMakeLists.txt b/include/clang/Basic/CMakeLists.txt index df49dc6a1c9fe..3df88c7c4a5e9 100644 --- a/include/clang/Basic/CMakeLists.txt +++ b/include/clang/Basic/CMakeLists.txt @@ -13,6 +13,7 @@ clang_diag_gen(Frontend) clang_diag_gen(Lex) clang_diag_gen(Parse) clang_diag_gen(Sema) +clang_diag_gen(Serialization) clang_tablegen(DiagnosticGroups.inc -gen-clang-diag-groups SOURCE Diagnostic.td TARGET ClangDiagnosticGroups) diff --git a/include/clang/Basic/ConvertUTF.h b/include/clang/Basic/ConvertUTF.h index d928f9d0f66b5..ec6b973e6a7f3 100644 --- a/include/clang/Basic/ConvertUTF.h +++ b/include/clang/Basic/ConvertUTF.h @@ -98,7 +98,7 @@ bit mask & shift operations. ------------------------------------------------------------------------ */ -typedef unsigned long UTF32; /* at least 32 bits */ +typedef unsigned int UTF32; /* at least 32 bits */ typedef unsigned short UTF16; /* at least 16 bits */ typedef unsigned char UTF8; /* typically 8 bits */ typedef unsigned char Boolean; /* 0 or 1 */ @@ -131,15 +131,15 @@ ConversionResult ConvertUTF8toUTF16 ( const UTF8** sourceStart, const UTF8* sourceEnd, UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags); +ConversionResult ConvertUTF8toUTF32 ( + const UTF8** sourceStart, const UTF8* sourceEnd, + UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags); + #ifdef CLANG_NEEDS_THESE_ONE_DAY ConversionResult ConvertUTF16toUTF8 ( const UTF16** sourceStart, const UTF16* sourceEnd, UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags); -ConversionResult ConvertUTF8toUTF32 ( - const UTF8** sourceStart, const UTF8* sourceEnd, - UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags); - ConversionResult ConvertUTF32toUTF8 ( const UTF32** sourceStart, const UTF32* sourceEnd, UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags); @@ -151,9 +151,11 @@ ConversionResult ConvertUTF16toUTF32 ( ConversionResult ConvertUTF32toUTF16 ( const UTF32** sourceStart, const UTF32* sourceEnd, UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags); -#endif Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd); +#endif + +Boolean isLegalUTF8String(const UTF8 *source, const UTF8 *sourceEnd); #ifdef __cplusplus } diff --git a/include/clang/Basic/DeclNodes.td b/include/clang/Basic/DeclNodes.td index a37dc10398913..6f2bb35725191 100644 --- a/include/clang/Basic/DeclNodes.td +++ b/include/clang/Basic/DeclNodes.td @@ -66,8 +66,6 @@ def Named : Decl<1>; def ObjCCompatibleAlias : DDecl<Named>; def LinkageSpec : Decl, DeclContext; def ObjCPropertyImpl : Decl; -def ObjCForwardProtocol : Decl; -def ObjCClass : Decl; def FileScopeAsm : Decl; def AccessSpec : Decl; def Friend : Decl; @@ -75,3 +73,5 @@ def FriendTemplate : Decl; def StaticAssert : Decl; def Block : Decl, DeclContext; def ClassScopeFunctionSpecialization : Decl; +def Import : Decl; + diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index fefc44ce7bc6e..e1571786dd5ce 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -50,13 +50,19 @@ public: /// insertion hint. CharSourceRange RemoveRange; + /// \brief Code in the specific range that should be inserted in the insertion + /// location. + CharSourceRange InsertFromRange; + /// \brief The actual code to insert at the insertion location, as a /// string. std::string CodeToInsert; + bool BeforePreviousInsertions; + /// \brief Empty code modification hint, indicating that no code /// modification is known. - FixItHint() : RemoveRange() { } + FixItHint() : BeforePreviousInsertions(false) { } bool isNull() const { return !RemoveRange.isValid(); @@ -65,11 +71,26 @@ public: /// \brief Create a code modification hint that inserts the given /// code string at a specific location. static FixItHint CreateInsertion(SourceLocation InsertionLoc, - StringRef Code) { + StringRef Code, + bool BeforePreviousInsertions = false) { FixItHint Hint; Hint.RemoveRange = CharSourceRange(SourceRange(InsertionLoc, InsertionLoc), false); Hint.CodeToInsert = Code; + Hint.BeforePreviousInsertions = BeforePreviousInsertions; + return Hint; + } + + /// \brief Create a code modification hint that inserts the given + /// code from \arg FromRange at a specific location. + static FixItHint CreateInsertionFromRange(SourceLocation InsertionLoc, + CharSourceRange FromRange, + bool BeforePreviousInsertions = false) { + FixItHint Hint; + Hint.RemoveRange = + CharSourceRange(SourceRange(InsertionLoc, InsertionLoc), false); + Hint.InsertFromRange = FromRange; + Hint.BeforePreviousInsertions = BeforePreviousInsertions; return Hint; } @@ -105,7 +126,7 @@ public: /// "report warnings as errors" and passes them off to the DiagnosticConsumer /// for reporting to the user. DiagnosticsEngine is tied to one translation unit /// and one SourceManager. -class DiagnosticsEngine : public llvm::RefCountedBase<DiagnosticsEngine> { +class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> { public: /// Level - The level of the diagnostic, after it has been through mapping. enum Level { @@ -158,8 +179,10 @@ private: unsigned ErrorLimit; // Cap of # errors emitted, 0 -> no limit. unsigned TemplateBacktraceLimit; // Cap on depth of template backtrace stack, // 0 -> no limit. + unsigned ConstexprBacktraceLimit; // Cap on depth of constexpr evaluation + // backtrace stack, 0 -> no limit. ExtensionHandling ExtBehavior; // Map extensions onto warnings or errors? - llvm::IntrusiveRefCntPtr<DiagnosticIDs> Diags; + IntrusiveRefCntPtr<DiagnosticIDs> Diags; DiagnosticConsumer *Client; bool OwnsDiagClient; SourceManager *SourceMgr; @@ -287,7 +310,7 @@ private: unsigned NumPrevArgs, SmallVectorImpl<char> &Output, void *Cookie, - SmallVectorImpl<intptr_t> &QualTypeVals); + ArrayRef<intptr_t> QualTypeVals); void *ArgToStringCookie; ArgToStringFnTy ArgToStringFn; @@ -304,12 +327,12 @@ private: public: explicit DiagnosticsEngine( - const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &Diags, + const IntrusiveRefCntPtr<DiagnosticIDs> &Diags, DiagnosticConsumer *client = 0, bool ShouldOwnClient = true); ~DiagnosticsEngine(); - const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &getDiagnosticIDs() const { + const IntrusiveRefCntPtr<DiagnosticIDs> &getDiagnosticIDs() const { return Diags; } @@ -363,13 +386,25 @@ public: void setTemplateBacktraceLimit(unsigned Limit) { TemplateBacktraceLimit = Limit; } - + /// \brief Retrieve the maximum number of template instantiation - /// nodes to emit along with a given diagnostic. + /// notes to emit along with a given diagnostic. unsigned getTemplateBacktraceLimit() const { return TemplateBacktraceLimit; } - + + /// \brief Specify the maximum number of constexpr evaluation + /// notes to emit along with a given diagnostic. + void setConstexprBacktraceLimit(unsigned Limit) { + ConstexprBacktraceLimit = Limit; + } + + /// \brief Retrieve the maximum number of constexpr evaluation + /// notes to emit along with a given diagnostic. + unsigned getConstexprBacktraceLimit() const { + return ConstexprBacktraceLimit; + } + /// setIgnoreAllWarnings - When set to true, any unmapped warnings are /// ignored. If this and WarningsAsErrors are both set, then this one wins. void setIgnoreAllWarnings(bool Val) { IgnoreAllWarnings = Val; } @@ -450,18 +485,32 @@ public: bool setDiagnosticGroupMapping(StringRef Group, diag::Mapping Map, SourceLocation Loc = SourceLocation()); + /// \brief Set the warning-as-error flag for the given diagnostic. This + /// function always only operates on the current diagnostic state. + void setDiagnosticWarningAsError(diag::kind Diag, bool Enabled); + /// \brief Set the warning-as-error flag for the given diagnostic group. This /// function always only operates on the current diagnostic state. /// /// \returns True if the given group is unknown, false otherwise. bool setDiagnosticGroupWarningAsError(StringRef Group, bool Enabled); + /// \brief Set the error-as-fatal flag for the given diagnostic. This function + /// always only operates on the current diagnostic state. + void setDiagnosticErrorAsFatal(diag::kind Diag, bool Enabled); + /// \brief Set the error-as-fatal flag for the given diagnostic group. This /// function always only operates on the current diagnostic state. /// /// \returns True if the given group is unknown, false otherwise. bool setDiagnosticGroupErrorAsFatal(StringRef Group, bool Enabled); + /// \brief Add the specified mapping to all diagnostics. Mainly to be used + /// by -Wno-everything to disable all warnings but allow subsequent -W options + /// to enable specific warnings. + void setMappingToAllDiagnostics(diag::Mapping Map, + SourceLocation Loc = SourceLocation()); + bool hasErrorOccurred() const { return ErrorOccurred; } bool hasFatalErrorOccurred() const { return FatalErrorOccurred; } @@ -587,16 +636,22 @@ private: /// MaxArguments - The maximum number of arguments we can hold. We currently /// only support up to 10 arguments (%0-%9). A single diagnostic with more /// than that almost certainly has to be simplified anyway. - MaxArguments = 10 + MaxArguments = 10, + + /// MaxRanges - The maximum number of ranges we can hold. + MaxRanges = 10, + + /// MaxFixItHints - The maximum number of ranges we can hold. + MaxFixItHints = 10 }; /// NumDiagArgs - This contains the number of entries in Arguments. signed char NumDiagArgs; - /// NumRanges - This is the number of ranges in the DiagRanges array. + /// NumDiagRanges - This is the number of ranges in the DiagRanges array. unsigned char NumDiagRanges; - /// \brief The number of code modifications hints in the - /// FixItHints array. - unsigned char NumFixItHints; + /// NumDiagFixItHints - This is the number of hints in the DiagFixItHints + /// array. + unsigned char NumDiagFixItHints; /// DiagArgumentsKind - This is an array of ArgumentKind::ArgumentKind enum /// values, with one for each argument. This specifies whether the argument @@ -614,15 +669,27 @@ private: /// sort of argument kind it is. intptr_t DiagArgumentsVal[MaxArguments]; - /// DiagRanges - The list of ranges added to this diagnostic. It currently - /// only support 10 ranges, could easily be extended if needed. - CharSourceRange DiagRanges[10]; + /// DiagRanges - The list of ranges added to this diagnostic. + CharSourceRange DiagRanges[MaxRanges]; - enum { MaxFixItHints = 6 }; + /// FixItHints - If valid, provides a hint with some code to insert, remove, + /// or modify at a particular position. + FixItHint DiagFixItHints[MaxFixItHints]; - /// FixItHints - If valid, provides a hint with some code - /// to insert, remove, or modify at a particular position. - FixItHint FixItHints[MaxFixItHints]; + DiagnosticMappingInfo makeMappingInfo(diag::Mapping Map, SourceLocation L) { + bool isPragma = L.isValid(); + DiagnosticMappingInfo MappingInfo = DiagnosticMappingInfo::Make( + Map, /*IsUser=*/true, isPragma); + + // If this is a pragma mapping, then set the diagnostic mapping flags so + // that we override command line options. + if (isPragma) { + MappingInfo.setNoWarningAsError(true); + MappingInfo.setNoErrorAsFatal(true); + } + + return MappingInfo; + } /// ProcessDiag - This is the method used to report a diagnostic that is /// finally fully formed. @@ -633,6 +700,24 @@ private: return Diags->ProcessDiag(*this); } + /// @name Diagnostic Emission + /// @{ +protected: + // Sema requires access to the following functions because the current design + // of SFINAE requires it to use its own SemaDiagnosticBuilder, which needs to + // access us directly to ensure we minimize the emitted code for the common + // Sema::Diag() patterns. + friend class Sema; + + /// \brief Emit the current diagnostic and clear the diagnostic state. + bool EmitCurrentDiagnostic(); + + unsigned getCurrentDiagID() const { return CurDiagID; } + + SourceLocation getCurrentDiagLoc() const { return CurDiagLoc; } + + /// @} + friend class ASTReader; friend class ASTWriter; }; @@ -685,37 +770,39 @@ public: /// for example. class DiagnosticBuilder { mutable DiagnosticsEngine *DiagObj; - mutable unsigned NumArgs, NumRanges, NumFixItHints; + mutable unsigned NumArgs, NumRanges, NumFixits; + + /// \brief Status variable indicating if this diagnostic is still active. + /// + // NOTE: This field is redundant with DiagObj (IsActive iff (DiagObj == 0)), + // but LLVM is not currently smart enough to eliminate the null check that + // Emit() would end up with if we used that as our status variable. + mutable bool IsActive; void operator=(const DiagnosticBuilder&); // DO NOT IMPLEMENT friend class DiagnosticsEngine; explicit DiagnosticBuilder(DiagnosticsEngine *diagObj) - : DiagObj(diagObj), NumArgs(0), NumRanges(0), NumFixItHints(0) {} + : DiagObj(diagObj), NumArgs(0), NumRanges(0), NumFixits(0), IsActive(true) { + assert(diagObj && "DiagnosticBuilder requires a valid DiagnosticsEngine!"); + } friend class PartialDiagnostic; protected: - void FlushCounts(); - -public: - /// Copy constructor. When copied, this "takes" the diagnostic info from the - /// input and neuters it. - DiagnosticBuilder(const DiagnosticBuilder &D) { - DiagObj = D.DiagObj; - D.DiagObj = 0; - NumArgs = D.NumArgs; - NumRanges = D.NumRanges; - NumFixItHints = D.NumFixItHints; + void FlushCounts() { + DiagObj->NumDiagArgs = NumArgs; + DiagObj->NumDiagRanges = NumRanges; + DiagObj->NumDiagFixItHints = NumFixits; } - /// \brief Simple enumeration value used to give a name to the - /// suppress-diagnostic constructor. - enum SuppressKind { Suppress }; + /// \brief Clear out the current diagnostic. + void Clear() const { + DiagObj = 0; + IsActive = false; + } - /// \brief Create an empty DiagnosticBuilder object that represents - /// no actual diagnostic. - explicit DiagnosticBuilder(SuppressKind) - : DiagObj(0), NumArgs(0), NumRanges(0), NumFixItHints(0) { } + /// isActive - Determine whether this diagnostic is still active. + bool isActive() const { return IsActive; } /// \brief Force the diagnostic builder to emit the diagnostic now. /// @@ -724,25 +811,40 @@ public: /// /// \returns true if a diagnostic was emitted, false if the /// diagnostic was suppressed. - bool Emit(); + bool Emit() { + // If this diagnostic is inactive, then its soul was stolen by the copy ctor + // (or by a subclass, as in SemaDiagnosticBuilder). + if (!isActive()) return false; - /// Destructor - The dtor emits the diagnostic if it hasn't already - /// been emitted. - ~DiagnosticBuilder() { Emit(); } + // When emitting diagnostics, we set the final argument count into + // the DiagnosticsEngine object. + FlushCounts(); - /// isActive - Determine whether this diagnostic is still active. - bool isActive() const { return DiagObj != 0; } + // Process the diagnostic. + bool Result = DiagObj->EmitCurrentDiagnostic(); - /// \brief Retrieve the active diagnostic ID. - /// - /// \pre \c isActive() - unsigned getDiagID() const { - assert(isActive() && "DiagnosticsEngine is inactive"); - return DiagObj->CurDiagID; + // This diagnostic is dead. + Clear(); + + return Result; } - /// \brief Clear out the current diagnostic. - void Clear() { DiagObj = 0; } +public: + /// Copy constructor. When copied, this "takes" the diagnostic info from the + /// input and neuters it. + DiagnosticBuilder(const DiagnosticBuilder &D) { + DiagObj = D.DiagObj; + IsActive = D.IsActive; + D.Clear(); + NumArgs = D.NumArgs; + NumRanges = D.NumRanges; + NumFixits = D.NumFixits; + } + + /// Destructor - The dtor emits the diagnostic. + ~DiagnosticBuilder() { + Emit(); + } /// Operator bool: conversion of DiagnosticBuilder to bool always returns /// true. This allows is to be used in boolean error contexts like: @@ -750,38 +852,33 @@ public: operator bool() const { return true; } void AddString(StringRef S) const { + assert(isActive() && "Clients must not add to cleared diagnostic!"); assert(NumArgs < DiagnosticsEngine::MaxArguments && "Too many arguments to diagnostic!"); - if (DiagObj) { - DiagObj->DiagArgumentsKind[NumArgs] = DiagnosticsEngine::ak_std_string; - DiagObj->DiagArgumentsStr[NumArgs++] = S; - } + DiagObj->DiagArgumentsKind[NumArgs] = DiagnosticsEngine::ak_std_string; + DiagObj->DiagArgumentsStr[NumArgs++] = S; } void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const { + assert(isActive() && "Clients must not add to cleared diagnostic!"); assert(NumArgs < DiagnosticsEngine::MaxArguments && "Too many arguments to diagnostic!"); - if (DiagObj) { - DiagObj->DiagArgumentsKind[NumArgs] = Kind; - DiagObj->DiagArgumentsVal[NumArgs++] = V; - } + DiagObj->DiagArgumentsKind[NumArgs] = Kind; + DiagObj->DiagArgumentsVal[NumArgs++] = V; } void AddSourceRange(const CharSourceRange &R) const { - assert(NumRanges < - sizeof(DiagObj->DiagRanges)/sizeof(DiagObj->DiagRanges[0]) && + assert(isActive() && "Clients must not add to cleared diagnostic!"); + assert(NumRanges < DiagnosticsEngine::MaxRanges && "Too many arguments to diagnostic!"); - if (DiagObj) - DiagObj->DiagRanges[NumRanges++] = R; + DiagObj->DiagRanges[NumRanges++] = R; } void AddFixItHint(const FixItHint &Hint) const { - assert(NumFixItHints < DiagnosticsEngine::MaxFixItHints && - "Too many fix-it hints!"); - if (NumFixItHints >= DiagnosticsEngine::MaxFixItHints) - return; // Don't crash in release builds - if (DiagObj) - DiagObj->FixItHints[NumFixItHints++] = Hint; + assert(isActive() && "Clients must not add to cleared diagnostic!"); + assert(NumFixits < DiagnosticsEngine::MaxFixItHints && + "Too many arguments to diagnostic!"); + DiagObj->DiagFixItHints[NumFixits++] = Hint; } }; @@ -849,7 +946,8 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, const FixItHint &Hint) { - DB.AddFixItHint(Hint); + if (!Hint.isNull()) + DB.AddFixItHint(Hint); return DB; } @@ -951,17 +1049,22 @@ public: return DiagObj->DiagRanges[Idx]; } + /// \brief Return an array reference for this diagnostic's ranges. + ArrayRef<CharSourceRange> getRanges() const { + return llvm::makeArrayRef(DiagObj->DiagRanges, DiagObj->NumDiagRanges); + } + unsigned getNumFixItHints() const { - return DiagObj->NumFixItHints; + return DiagObj->NumDiagFixItHints; } const FixItHint &getFixItHint(unsigned Idx) const { - return DiagObj->FixItHints[Idx]; + assert(Idx < getNumFixItHints() && "Invalid index!"); + return DiagObj->DiagFixItHints[Idx]; } const FixItHint *getFixItHints() const { - return DiagObj->NumFixItHints? - &DiagObj->FixItHints[0] : 0; + return getNumFixItHints()? DiagObj->DiagFixItHints : 0; } /// FormatDiagnostic - Format this diagnostic into a string, substituting the @@ -1012,11 +1115,20 @@ public: range_iterator range_begin() const { return Ranges.begin(); } range_iterator range_end() const { return Ranges.end(); } unsigned range_size() const { return Ranges.size(); } + + ArrayRef<CharSourceRange> getRanges() const { + return llvm::makeArrayRef(Ranges); + } + typedef std::vector<FixItHint>::const_iterator fixit_iterator; fixit_iterator fixit_begin() const { return FixIts.begin(); } fixit_iterator fixit_end() const { return FixIts.end(); } unsigned fixit_size() const { return FixIts.size(); } + + ArrayRef<FixItHint> getFixIts() const { + return llvm::makeArrayRef(FixIts); + } }; /// DiagnosticConsumer - This is an abstract interface implemented by clients of @@ -1031,6 +1143,7 @@ public: unsigned getNumErrors() const { return NumErrors; } unsigned getNumWarnings() const { return NumWarnings; } + virtual void clear() { NumWarnings = NumErrors = 0; } virtual ~DiagnosticConsumer(); @@ -1053,6 +1166,10 @@ public: /// objects made available via \see BeginSourceFile() are inaccessible. virtual void EndSourceFile() {} + /// \brief Callback to inform the diagnostic client that processing of all + /// source files has ended. + virtual void finish() {} + /// IncludeInDiagnosticCounts - This method (whose default implementation /// returns true) indicates whether the diagnostics handled by this /// DiagnosticConsumer should be included in the number of diagnostics @@ -1075,6 +1192,7 @@ public: /// IgnoringDiagConsumer - This is a diagnostic client that just ignores all /// diags. class IgnoringDiagConsumer : public DiagnosticConsumer { + virtual void anchor(); void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) { // Just ignore it. diff --git a/include/clang/Basic/Diagnostic.td b/include/clang/Basic/Diagnostic.td index 8ae69fef27833..109cd0812c686 100644 --- a/include/clang/Basic/Diagnostic.td +++ b/include/clang/Basic/Diagnostic.td @@ -62,8 +62,6 @@ class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> { DiagMapping DefaultMapping = defaultmapping; DiagGroup Group; string CategoryName = ""; - string Brief = ""; - string Explanation = ""; } class Error<string str> : Diagnostic<str, CLASS_ERROR, MAP_ERROR>; @@ -87,12 +85,6 @@ class DefaultWarnShowInSystemHeader { class NoSFINAE { bit SFINAE = 0; } class AccessControl { bit AccessControl = 1; } -class Brief<string str> { string Brief = str; } -class FullExplanation<string brief, string full> { - string Brief = brief; - string Explanation = full; -} - // Definitions for Diagnostics. include "DiagnosticASTKinds.td" include "DiagnosticAnalysisKinds.td" @@ -102,4 +94,5 @@ include "DiagnosticFrontendKinds.td" include "DiagnosticLexKinds.td" include "DiagnosticParseKinds.td" include "DiagnosticSemaKinds.td" +include "DiagnosticSerializationKinds.td" diff --git a/include/clang/Basic/DiagnosticASTKinds.td b/include/clang/Basic/DiagnosticASTKinds.td index 705c95b7fc276..9cfe5efae259a 100644 --- a/include/clang/Basic/DiagnosticASTKinds.td +++ b/include/clang/Basic/DiagnosticASTKinds.td @@ -9,9 +9,103 @@ let Component = "AST" in { -//def note_comma_in_ice : Note< -// "C does not permit evaluated commas in an integer constant expression">; +// Constant expression diagnostics. These (and their users) belong in Sema. def note_expr_divide_by_zero : Note<"division by zero">; +def note_constexpr_invalid_cast : Note< + "%select{reinterpret_cast|dynamic_cast|cast which performs the conversions of" + " a reinterpret_cast|cast from %1}0 is not allowed in a constant expression">; +def note_constexpr_invalid_downcast : Note< + "cannot cast object of dynamic type %0 to type %1">; +def note_constexpr_overflow : Note< + "value %0 is outside the range of representable values of type %1">; +def note_constexpr_negative_shift : Note<"negative shift count %0">; +def note_constexpr_large_shift : Note< + "shift count %0 >= width of type %1 (%2 bit%s2)">; +def note_constexpr_lshift_of_negative : Note<"left shift of negative value %0">; +def note_constexpr_lshift_discards : Note<"signed left shift discards bits">; +def note_constexpr_invalid_function : Note< + "%select{non-constexpr|undefined}0 %select{function|constructor}1 %2 cannot " + "be used in a constant expression">; +def note_constexpr_virtual_call : Note< + "cannot evaluate virtual function call in a constant expression">; +def note_constexpr_virtual_base : Note< + "cannot construct object of type %0 with virtual base class " + "in a constant expression">; +def note_constexpr_nonliteral : Note< + "non-literal type %0 cannot be used in a constant expression">; +def note_constexpr_non_global : Note< + "%select{pointer|reference}0 to %select{|subobject of }1" + "%select{temporary|%3}2 is not a constant expression">; +def note_constexpr_array_index : Note<"cannot refer to element %0 of " + "%select{array of %2 elements|non-array object}1 in a constant expression">; +def note_constexpr_float_arithmetic : Note< + "floating point arithmetic produces %select{an infinity|a NaN}0">; +def note_constexpr_pointer_subtraction_not_same_array : Note< + "subtracted pointers are not elements of the same array">; +def note_constexpr_pointer_comparison_base_classes : Note< + "comparison of addresses of subobjects of different base classes " + "has unspecified value">; +def note_constexpr_pointer_comparison_base_field : Note< + "comparison of address of base class subobject %0 of class %1 to field %2 " + "has unspecified value">; +def note_constexpr_pointer_comparison_differing_access : Note< + "comparison of address of fields %0 and %2 of %4 with differing access " + "specifiers (%1 vs %3) has unspecified value">; +def note_constexpr_compare_virtual_mem_ptr : Note< + "comparison of pointer to virtual member function %0 has unspecified value">; +def note_constexpr_past_end : Note< + "dereferenced pointer past the end of %select{|subobject of }0" + "%select{temporary|%2}1 is not a constant expression">; +def note_constexpr_past_end_subobject : Note< + "cannot %select{access base class of|access derived class of|access field of|" + "access array element of|ERROR|call member function on|" + "access real component of|access imaginary component of}0 " + "pointer past the end of object">; +def note_constexpr_null_subobject : Note< + "cannot %select{access base class of|access derived class of|access field of|" + "access array element of|perform pointer arithmetic on|" + "call member function on|access real component of|" + "access imaginary component of}0 null pointer">; +def note_constexpr_var_init_non_constant : Note< + "initializer of %0 is not a constant expression">; +def note_constexpr_typeid_polymorphic : Note< + "typeid applied to expression of polymorphic type %0 is " + "not allowed in a constant expression">; +def note_constexpr_void_comparison : Note< + "comparison between unequal pointers to void has unspecified result">; +def note_constexpr_temporary_here : Note<"temporary created here">; +def note_constexpr_conditional_never_const : Note< + "both arms of conditional operator are unable to produce a " + "constant expression">; +def note_constexpr_depth_limit_exceeded : Note< + "constexpr evaluation exceeded maximum depth of %0 calls">; +def note_constexpr_call_limit_exceeded : Note< + "constexpr evaluation hit maximum call limit">; +def note_constexpr_lifetime_ended : Note< + "read of %select{temporary|variable}0 whose lifetime has ended">; +def note_constexpr_ltor_volatile_type : Note< + "read of volatile-qualified type %0 is not allowed in a constant expression">; +def note_constexpr_ltor_volatile_obj : Note< + "read of volatile %select{temporary|object %1|member %1}0 is not allowed in " + "a constant expression">; +def note_constexpr_ltor_mutable : Note< + "read of mutable member %0 is not allowed in a constant expression">; +def note_constexpr_ltor_non_const_int : Note< + "read of non-const variable %0 is not allowed in a constant expression">; +def note_constexpr_ltor_non_constexpr : Note< + "read of non-constexpr variable %0 is not allowed in a constant expression">; +def note_constexpr_read_past_end : Note< + "read of dereferenced one-past-the-end pointer is not allowed in a " + "constant expression">; +def note_constexpr_read_inactive_union_member : Note< + "read of member %0 of union with %select{active member %2|no active member}1 " + "is not allowed in a constant expression">; +def note_constexpr_read_uninit : Note< + "read of uninitialized object is not allowed in a constant expression">; +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'">; // inline asm related. let CategoryName = "Inline Assembly Issue" in { diff --git a/include/clang/Basic/DiagnosticAnalysisKinds.td b/include/clang/Basic/DiagnosticAnalysisKinds.td index 46dc0e60a7eb5..5461212cd2382 100644 --- a/include/clang/Basic/DiagnosticAnalysisKinds.td +++ b/include/clang/Basic/DiagnosticAnalysisKinds.td @@ -9,7 +9,4 @@ let Component = "Analysis" in { -// CHECK: use of uninitialized values -def warn_uninit_val : Warning<"use of uninitialized variable">; - } diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td index f9a910a1c21e5..103fc00b40f0d 100644 --- a/include/clang/Basic/DiagnosticCommonKinds.td +++ b/include/clang/Basic/DiagnosticCommonKinds.td @@ -18,6 +18,7 @@ let Component = "Common" in { def fatal_too_many_errors : Error<"too many errors emitted, stopping now">, DefaultFatal; +def note_declared_at : Note<"declared here">; def note_previous_definition : Note<"previous definition is here">; def note_previous_declaration : Note<"previous declaration is here">; def note_previous_implicit_declaration : Note< @@ -40,6 +41,12 @@ def err_expected_colon : Error<"expected ':'">; def err_expected_colon_after_setter_name : Error< "method name referenced in property setter attribute " "must end with ':'">; +def err_invalid_string_udl : Error< + "string literal with user-defined suffix cannot be used here">; +def err_invalid_character_udl : Error< + "character literal with user-defined suffix cannot be used here">; +def err_invalid_numeric_udl : Error< + "numeric literal with user-defined suffix cannot be used here">; // Parse && Sema def ext_no_declarators : ExtWarn<"declaration does not declare anything">, @@ -58,8 +65,6 @@ def warn_cxx98_compat_variadic_templates : InGroup<CXX98Compat>, DefaultIgnore; def err_default_special_members : Error< "only special member functions may be defaulted">; -def err_friends_define_only_namespace_scope : Error< - "cannot define a function with non-namespace scope in a friend declaration">; def err_deleted_non_function : Error< "only functions can have deleted definitions">; def err_module_not_found : Error<"module '%0' not found">, DefaultFatal; @@ -83,8 +88,8 @@ def warn_integer_too_large_for_signed : Warning< "integer constant is so large that it is unsigned">; // Sema && AST -def note_invalid_subexpr_in_ice : Note< - "subexpression not valid in an integer constant expression">; +def note_invalid_subexpr_in_const_expr : Note< + "subexpression not valid in a constant expression">; // Targets diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index 3c0e4f53d3c11..b44315932c6bd 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -18,6 +18,10 @@ def err_drv_unknown_stdin_type : 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_rtlib_name : Error< + "invalid runtime library name in argument '%0'">; +def err_drv_unsupported_rtlib_for_platform : Error< + "unsupported runtime library '%0' for platform '%1'">; def err_drv_invalid_stdlib_name : Error< "invalid library name in argument '%0'">; def err_drv_invalid_opt_with_multiple_archs : Error< @@ -38,7 +42,7 @@ def err_drv_command_failure : Error< def err_drv_invalid_darwin_version : Error< "invalid Darwin version number: %0">; def err_drv_missing_argument : Error< - "argument to '%0' is missing (expected %1 %plural{1:value|:values}1)">; + "argument to '%0' is missing (expected %1 value%s1)">; def err_drv_invalid_Xarch_argument_with_args : Error< "invalid Xarch argument: '%0', options requiring arguments are unsupported">; def err_drv_invalid_Xarch_argument_isdriver : Error< @@ -62,11 +66,13 @@ def err_drv_clang_unsupported_opt_cxx_darwin_i386 : Error< def err_drv_command_failed : Error< "%0 command failed with exit code %1 (use -v to see invocation)">; def err_drv_command_signalled : Error< - "%0 command failed due to signal %1 (use -v to see invocation)">; + "%0 command failed due to signal (use -v to see invocation)">; def err_drv_invalid_mfloat_abi : Error< "invalid float ABI '%0'">; def err_drv_invalid_libcxx_deployment : Error< "invalid deployment target for -stdlib=libc++ (requires %0 or later)">; +def err_drv_invalid_feature : Error< + "invalid feature '%0' for CPU '%1'">; def err_drv_I_dash_not_supported : Error< "'%0' not supported, please use -iquote instead">; @@ -89,21 +95,23 @@ def err_drv_objc_gc_arr : Error< "cannot specify both '-fobjc-arc' and '%0'">; def err_arc_nonfragile_abi : Error< "-fobjc-arc is not supported with fragile abi">; +def err_arc_unsupported : Error< + "-fobjc-arc is not supported on current deployment target">; def err_drv_mg_requires_m_or_mm : Error< "option '-MG' requires '-M' or '-MM'">; def warn_c_kext : Warning< "ignoring -fapple-kext which is valid for c++ and objective-c++ only">; -def warn_drv_unsupported_option_argument : Warning< - "ignoring unsupported argument '%1' to option '%0'">; def warn_drv_input_file_unused : Warning< "%0: '%1' input unused when '%2' is present">; def warn_drv_preprocessed_input_file_unused : Warning< "%0: previously preprocessed input unused when '%1' is present">; def warn_drv_unused_argument : Warning< - "argument unused during compilation: '%0'">; -def warn_drv_pipe_ignored_with_save_temps : Warning< - "-pipe ignored because -save-temps specified">; + "argument unused during compilation: '%0'">, + InGroup<DiagGroup<"unused-command-line-argument">>; +def warn_drv_empty_joined_argument : Warning< + "joined argument expects addition arg: '%0'">, + InGroup<DiagGroup<"unused-command-line-argument">>; def warn_drv_not_using_clang_cpp : Warning< "not using the clang preprocessor due to user override">; def warn_drv_not_using_clang_cxx : Warning< @@ -116,8 +124,6 @@ def warn_drv_assuming_mfloat_abi_is : Warning< "unknown platform, assuming -mfloat-abi=%0">; def warn_ignoring_ftabstop_value : Warning< "ignoring invalid -ftabstop value '%0', using default value %1">; -def warn_drv_conflicting_deployment_targets : Warning< - "conflicting deployment targets, both MACOSX_DEPLOYMENT_TARGET '%0' and IPHONEOS_DEPLOYMENT_TARGET '%1' are present in environment">; def warn_drv_treating_input_as_cxx : Warning< "treating '%0' input as '%1' when in C++ mode, this behavior is deprecated">, InGroup<Deprecated>; diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index fffa42feb2fba..5d6b887feb4bd 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -13,12 +13,12 @@ def err_fe_error_opening : Error<"error opening '%0': %1">; def err_fe_error_reading : Error<"error reading '%0'">; def err_fe_error_reading_stdin : Error<"error reading stdin">; def err_fe_error_backend : Error<"error in backend: %0">, DefaultFatal; -def err_fe_invalid_ast_file : Error<"invalid AST file: '%0'">, DefaultFatal; -def err_fe_invalid_ast_action : Error<"invalid action for AST input">, - DefaultFatal; + // Error generated by the backend. def err_fe_inline_asm : Error<"%0">, CatInlineAsm; def note_fe_inline_asm_here : Note<"instantiated into assembly here">; +def err_fe_cannot_link_module : Error<"cannot link module '%0': %1">, + DefaultFatal; @@ -26,16 +26,8 @@ def err_fe_invalid_code_complete_file : Error< "cannot locate code-completion file %0">, DefaultFatal; def err_fe_stdout_binary : Error<"unable to change standard output to binary">, DefaultFatal; -def err_fe_stderr_binary : Error<"unable to change standard error to binary">, - DefaultFatal; def err_fe_dependency_file_requires_MT : Error< "-dependency-file requires at least one -MT or -MQ option">; -def err_fe_incompatible_options : Error< - "'%0' cannot be used with '%1'">, DefaultFatal; -def err_fe_no_fixit_and_codegen : Error< - "FIX-ITs cannot be applied when generating code">; -def err_fe_unable_to_find_fixit_file : Error< - "FIX-IT could not find file '%0'">; def err_fe_invalid_plugin_name : Error< "unable to find plugin '%0'">; def err_fe_expected_compiler_job : Error< @@ -54,19 +46,6 @@ def err_fe_unable_to_create_target : Error< "unable to create target: '%0'">; def err_fe_unable_to_interface_with_target : Error< "unable to interface with target machine">; -def err_fe_unable_to_read_pch_file : Error< - "unable to read PCH file: '%0'">; -def err_fe_not_a_pch_file : Error< - "input is not a PCH file: '%0'">; -def err_fe_pch_malformed : Error< - "malformed or corrupted PCH file: '%0'">, DefaultFatal; -def err_fe_pch_malformed_block : Error< - "malformed block record in PCH file: '%0'">, DefaultFatal; -def err_fe_pch_error_at_end_block : Error< - "error at end of module block in PCH file: '%0'">, DefaultFatal; -def err_fe_pch_file_modified : Error< - "file '%0' has been modified since the precompiled header was built">, - DefaultFatal; def err_fe_unable_to_open_output : Error< "unable to open output file '%0': '%1'">; def err_fe_unable_to_rename_temp : Error< @@ -82,6 +61,10 @@ def warn_fe_cc_print_header_failure : Warning< def warn_fe_cc_log_diagnostics_failure : Warning< "unable to open CC_LOG_DIAGNOSTICS file: %0 (using stderr)">; +def warn_fe_serialized_diag_failure : Warning< + "unable to open file %0 for serializing diagnostics (%1)">, + InGroup<DiagGroup<"serialized-diagnostics">>; + def err_verify_missing_start : Error< "cannot find start ('{{') of expected %0">; def err_verify_missing_end : Error< @@ -98,54 +81,25 @@ def note_fixit_in_macro : Note< def note_fixit_failed : Note< "FIX-IT unable to apply suggested code changes">; def note_fixit_unfixed_error : Note<"FIX-IT detected an error it cannot fix">; -def note_fixit_main_file_unchanged : Note< - "main file unchanged">; def warn_fixit_no_changes : Note< "FIX-IT detected errors it could not fix; no output will be generated">; -def err_fe_invoking : Error<"error invoking%0: %1">, DefaultFatal; - // PCH reader def err_relocatable_without_isysroot : Error< "must specify system root with -isysroot when building a relocatable " "PCH file">; -def warn_pch_target_triple : Error< - "PCH file was compiled for the target '%0' but the current translation " - "unit is being compiled for target '%1'">; -def err_pch_langopt_mismatch : Error<"%0 was %select{disabled|enabled}1 in " - "PCH file but is currently %select{disabled|enabled}2">; -def err_pch_langopt_value_mismatch : Error< - "%0 differs in PCH file vs. current file">; - -def warn_pch_version_too_old : Error< - "PCH file uses an older PCH format that is no longer supported">; -def warn_pch_version_too_new : Error< - "PCH file uses a newer PCH format that cannot be read">; -def warn_pch_different_branch : Error< - "PCH file built from a different branch (%0) than the compiler (%1)">; -def warn_cmdline_conflicting_macro_def : Error< - "definition of the macro '%0' conflicts with the definition used to " - "build the precompiled header">; -def note_pch_macro_defined_as : Note< - "definition of macro '%0' in the precompiled header">; -def warn_cmdline_missing_macro_defs : Warning< - "macro definitions used to build the precompiled header are missing">; -def note_using_macro_def_from_pch : Note< - "using this macro definition from precompiled header">; -def warn_macro_name_used_in_pch : Error< - "definition of macro %0 conflicts with an identifier used in the " - "precompiled header">; -def warn_pch_compiler_options_mismatch : Error< - "compiler options used when building the precompiled header differ from " - "the options used when using the precompiled header">; -def err_not_a_pch_file : Error< - "'%0' does not appear to be a precompiled header file">, DefaultFatal; def warn_unknown_warning_option : Warning< "unknown warning option '%0'">, InGroup<DiagGroup<"unknown-warning-option"> >; def warn_unknown_negative_warning_option : Warning< - "unknown warning option '%0'">, + "unknown warning option '%0'?">, + InGroup<DiagGroup<"unknown-warning-option"> >, DefaultIgnore; +def warn_unknown_warning_option_suggest : Warning< + "unknown warning option '%0'; did you mean '%1'?">, + InGroup<DiagGroup<"unknown-warning-option"> >; +def warn_unknown_negative_warning_option_suggest : Warning< + "unknown warning option '%0'; did you mean '%1'?">, InGroup<DiagGroup<"unknown-warning-option"> >, DefaultIgnore; def warn_unknown_warning_specifier : Warning< "unknown %0 warning specifier: '%1'">, @@ -158,4 +112,23 @@ def warn_incompatible_analyzer_plugin_api : Warning< 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< + "no module name provided; specify one with -fmodule-name=">, + DefaultFatal; +def err_missing_module : Error< + "no module named '%0' declared in module map file '%1'">, DefaultFatal; +def err_missing_umbrella_header : Error< + "cannot open umbrella header '%0': %1">, DefaultFatal; +def err_no_submodule : Error<"no submodule named %0 in module '%1'">; +def err_no_submodule_suggest : Error< + "no submodule named %0 in module '%1'; did you mean '%2'?">; +def warn_missing_submodule : Warning<"missing submodule '%0'">, + InGroup<IncompleteUmbrella>; +def err_module_map_temp_file : Error< + "unable to write temporary module map file '%0'">, DefaultFatal; +def err_module_unavailable : Error<"module '%0' requires feature '%1'">; + } diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 49603eb69e44a..c83985345bce6 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -25,7 +25,15 @@ def AmbigMemberTemplate : DiagGroup<"ambiguous-member-template">; def : DiagGroup<"attributes">; def : DiagGroup<"bad-function-cast">; def Availability : DiagGroup<"availability">; -def BoolConversions : DiagGroup<"bool-conversions">; +def AutoImport : DiagGroup<"auto-import">; +def ConstantConversion : DiagGroup<"constant-conversion">; +def LiteralConversion : DiagGroup<"literal-conversion">; +def StringConversion : DiagGroup<"string-conversion">; +def SignConversion : DiagGroup<"sign-conversion">; +def BoolConversion : DiagGroup<"bool-conversion">; +def IntConversion : DiagGroup<"int-conversion">; +def NullConversion : DiagGroup<"null-conversion">; +def BuiltinRequiresHeader : DiagGroup<"builtin-requires-header">; def CXXCompat: DiagGroup<"c++-compat">; def CastAlign : DiagGroup<"cast-align">; def : DiagGroup<"cast-qual">; @@ -54,34 +62,63 @@ def ExtraTokens : DiagGroup<"extra-tokens">; def FormatExtraArgs : DiagGroup<"format-extra-args">; def FormatZeroLength : DiagGroup<"format-zero-length">; -def CXX98Compat : DiagGroup<"c++98-compat">; +def CXX98CompatBindToTemporaryCopy : + DiagGroup<"c++98-compat-bind-to-temporary-copy">; +def CXX98CompatLocalTypeTemplateArgs : + DiagGroup<"c++98-compat-local-type-template-args">; +def CXX98CompatUnnamedTypeTemplateArgs : + DiagGroup<"c++98-compat-unnamed-type-template-args">; + +def CXX98Compat : DiagGroup<"c++98-compat", + [CXX98CompatBindToTemporaryCopy, + CXX98CompatLocalTypeTemplateArgs, + CXX98CompatUnnamedTypeTemplateArgs]>; // Warnings for C++11 features which are Extensions in C++98 mode. def CXX98CompatPedantic : DiagGroup<"c++98-compat-pedantic", [CXX98Compat]>; def CXX11Narrowing : DiagGroup<"c++11-narrowing">; + +// Original name of this warning in Clang def : DiagGroup<"c++0x-narrowing", [CXX11Narrowing]>; -def CXX11Compat : DiagGroup<"c++11-compat", [CXX11Narrowing]>; +// Name of this warning in GCC +def : DiagGroup<"narrowing", [CXX11Narrowing]>; + +def CXX11CompatReservedUserDefinedLiteral : + DiagGroup<"c++11-compat-reserved-user-defined-literal">; +def ReservedUserDefinedLiteral : + DiagGroup<"reserved-user-defined-literal", + [CXX11CompatReservedUserDefinedLiteral]>; + +def CXX11Compat : DiagGroup<"c++11-compat", + [CXX11Narrowing, + CXX11CompatReservedUserDefinedLiteral]>; def : DiagGroup<"c++0x-compat", [CXX11Compat]>; def : DiagGroup<"effc++">; def ExitTimeDestructors : DiagGroup<"exit-time-destructors">; +def FlexibleArrayExtensions : DiagGroup<"flexible-array-extensions">; def FourByteMultiChar : DiagGroup<"four-char-constants">; def GlobalConstructors : DiagGroup<"global-constructors">; def : DiagGroup<"idiomatic-parentheses">; def BitwiseOpParentheses: DiagGroup<"bitwise-op-parentheses">; def LogicalOpParentheses: DiagGroup<"logical-op-parentheses">; +def DanglingElse: DiagGroup<"dangling-else">; def IgnoredQualifiers : DiagGroup<"ignored-qualifiers">; def : DiagGroup<"import">; def IncompatiblePointerTypes : DiagGroup<"incompatible-pointer-types">; +def IncompleteUmbrella : DiagGroup<"incomplete-umbrella">; +def KNRPromotedParameter : DiagGroup<"knr-promoted-parameter">; def : DiagGroup<"init-self">; def : DiagGroup<"inline">; def : DiagGroup<"int-to-pointer-cast">; def : DiagGroup<"invalid-pch">; def LiteralRange : DiagGroup<"literal-range">; -def LocalTypeTemplateArgs : DiagGroup<"local-type-template-args">; +def LocalTypeTemplateArgs : DiagGroup<"local-type-template-args", + [CXX98CompatLocalTypeTemplateArgs]>; def MalformedWarningCheck : DiagGroup<"malformed-warning-check">; def Main : DiagGroup<"main">; +def MainReturnType : DiagGroup<"main-return-type">; def MissingBraces : DiagGroup<"missing-braces">; def MissingDeclarations: DiagGroup<"missing-declarations">; def : DiagGroup<"missing-format-attribute">; @@ -94,31 +131,37 @@ def LongLong : DiagGroup<"long-long">; def MismatchedTags : DiagGroup<"mismatched-tags">; def MissingFieldInitializers : DiagGroup<"missing-field-initializers">; def ModuleBuild : DiagGroup<"module-build">; +def NullCharacter : DiagGroup<"null-character">; def NullDereference : DiagGroup<"null-dereference">; def InitializerOverrides : DiagGroup<"initializer-overrides">; def NonNull : DiagGroup<"nonnull">; def : DiagGroup<"nonportable-cfstrings">; def NonVirtualDtor : DiagGroup<"non-virtual-dtor">; +def OveralignedType : DiagGroup<"over-aligned">; def : DiagGroup<"old-style-cast">; def : DiagGroup<"old-style-definition">; def OutOfLineDeclaration : DiagGroup<"out-of-line-declaration">; def : DiagGroup<"overflow">; def OverlengthStrings : DiagGroup<"overlength-strings">; def OverloadedVirtual : DiagGroup<"overloaded-virtual">; +def ObjCPropertyImpl : DiagGroup<"objc-property-implementation">; def ObjCMissingSuperCalls : DiagGroup<"objc-missing-super-calls">; def ObjCRetainBlockProperty : DiagGroup<"objc-noncopy-retain-block-property">; -def ObjCContinuationPropertyType :DiagGroup<"objc-continuation-property-type">; +def ObjCReadonlyPropertyHasSetter : DiagGroup<"objc-readonly-with-setter-property">; +def ObjCRootClass : DiagGroup<"objc-root-class">; def Packed : DiagGroup<"packed">; def Padded : DiagGroup<"padded">; def PointerArith : DiagGroup<"pointer-arith">; def PoundWarning : DiagGroup<"#warnings">, DiagCategory<"#warning Directive">; -def PoundPragmaMessage : DiagGroup<"#pragma messages">, +def PoundPragmaMessage : DiagGroup<"#pragma-messages">, DiagCategory<"#pragma message Directive">; def : DiagGroup<"pointer-to-int-cast">; def : DiagGroup<"redundant-decls">; -def ReturnType : DiagGroup<"return-type">; -def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy">; +def ReturnTypeCLinkage : DiagGroup<"return-type-c-linkage">; +def ReturnType : DiagGroup<"return-type", [ReturnTypeCLinkage]>; +def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy", + [CXX98CompatBindToTemporaryCopy]>; def SelfAssignment : DiagGroup<"self-assign">; def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">; def Sentinel : DiagGroup<"sentinel">; @@ -132,6 +175,8 @@ def : DiagGroup<"stack-protector">; def : DiagGroup<"switch-default">; def : DiagGroup<"synth">; def SizeofArrayArgument : DiagGroup<"sizeof-array-argument">; +def StringPlusInt : DiagGroup<"string-plus-int">; +def StrncatSize : DiagGroup<"strncat-size">; def TautologicalCompare : DiagGroup<"tautological-compare">; def HeaderHygiene : DiagGroup<"header-hygiene">; @@ -154,18 +199,25 @@ def : DiagGroup<"strict-overflow=5">; def : DiagGroup<"strict-overflow">; def InvalidOffsetof : DiagGroup<"invalid-offsetof">; +def LambdaExtensions : DiagGroup<"lambda-extensions">; def : DiagGroup<"strict-prototypes">; def StrictSelector : DiagGroup<"strict-selector-match">; +def MethodDuplicate : DiagGroup<"duplicate-method-match">; +def CoveredSwitchDefault : DiagGroup<"covered-switch-default">; def SwitchEnum : DiagGroup<"switch-enum">; -def Switch : DiagGroup<"switch", [SwitchEnum]>; +def Switch : DiagGroup<"switch">; def Trigraphs : DiagGroup<"trigraphs">; def : DiagGroup<"type-limits">; +def Unicode : DiagGroup<"unicode">; def Uninitialized : DiagGroup<"uninitialized">; def UninitializedMaybe : DiagGroup<"conditional-uninitialized">; def UnknownPragmas : DiagGroup<"unknown-pragmas">; +def NSobjectAttribute : DiagGroup<"NSObject-attribute">; def UnknownAttributes : DiagGroup<"attributes">; -def UnnamedTypeTemplateArgs : DiagGroup<"unnamed-type-template-args">; +def IgnoredAttributes : DiagGroup<"ignored-attributes">; +def UnnamedTypeTemplateArgs : DiagGroup<"unnamed-type-template-args", + [CXX98CompatUnnamedTypeTemplateArgs]>; def UnusedArgument : DiagGroup<"unused-argument">; def UnusedComparison : DiagGroup<"unused-comparison">; def UnusedExceptionParameter : DiagGroup<"unused-exception-parameter">; @@ -204,9 +256,11 @@ def SuperSubClassMismatch : DiagGroup<"super-class-method-mismatch">; def OverridingMethodMismatch : DiagGroup<"overriding-method-mismatch">; def : DiagGroup<"variadic-macros">; def VariadicMacros : DiagGroup<"variadic-macros">; -def VectorConversions : DiagGroup<"vector-conversions">; // clang specific +def VectorConversion : DiagGroup<"vector-conversion">; // clang specific +def VexingParse : DiagGroup<"vexing-parse">; def VLA : DiagGroup<"vla">; def VolatileRegisterVar : DiagGroup<"volatile-register-var">; +def Visibility : DiagGroup<"visibility">; // GCC calls -Wdeprecated-writable-strings -Wwrite-strings. def GCCWriteStrings : DiagGroup<"write-strings" , [DeprecatedWritableStr]>; @@ -225,7 +279,8 @@ def ParenthesesOnEquality : DiagGroup<"parentheses-equality">; def Parentheses : DiagGroup<"parentheses", [LogicalOpParentheses, BitwiseOpParentheses, - ParenthesesOnEquality]>; + ParenthesesOnEquality, + DanglingElse]>; // -Wconversion has its own warnings, but we split a few out for // legacy reasons: @@ -233,13 +288,16 @@ def Parentheses : DiagGroup<"parentheses", // - conversion warnings with constant sources are on by default // - conversion warnings for literals are on by default // - bool-to-pointer conversion warnings are on by default +// - __null-to-integer conversion warnings are on by default def Conversion : DiagGroup<"conversion", [DiagGroup<"shorten-64-to-32">, - DiagGroup<"constant-conversion">, - DiagGroup<"literal-conversion">, - DiagGroup<"string-conversion">, - DiagGroup<"sign-conversion">, - BoolConversions]>, + ConstantConversion, + LiteralConversion, + StringConversion, + SignConversion, + BoolConversion, + NullConversion, + IntConversion]>, DiagCategory<"Value Conversion Issue">; def Unused : DiagGroup<"unused", @@ -252,6 +310,7 @@ def Unused : DiagGroup<"unused", // Format settings. def FormatInvalidSpecifier : DiagGroup<"format-invalid-specifier">; def FormatSecurity : DiagGroup<"format-security">; +def FormatNonStandard : DiagGroup<"format-non-iso">; def FormatY2K : DiagGroup<"format-y2k">; def Format : DiagGroup<"format", [FormatExtraArgs, FormatZeroLength, NonNull, @@ -283,8 +342,8 @@ def Most : DiagGroup<"most", [ Reorder, ReturnType, SelfAssignment, - Switch, SizeofArrayArgument, + StringPlusInt, Trigraphs, Uninitialized, UnknownPragmas, @@ -297,13 +356,23 @@ def Most : DiagGroup<"most", [ // Thread Safety warnings def ThreadSafety : DiagGroup<"thread-safety">; -// -Wall is -Wmost -Wparentheses -Wtop-level-comparison -def : DiagGroup<"all", [Most, Parentheses]>; +// Note that putting warnings in -Wall will not disable them by default. If a +// warning should be active _only_ when -Wall is passed in, mark it as +// DefaultIgnore in addition to putting it here. +def : DiagGroup<"all", [Most, Parentheses, Switch]>; // Aliases. def : DiagGroup<"", [Extra]>; // -W = -Wextra def : DiagGroup<"endif-labels", [ExtraTokens]>; // -Wendif-labels=-Wendif-tokens def : DiagGroup<"comments", [Comment]>; // -Wcomments = -Wcomment +def : DiagGroup<"conversion-null", + [NullConversion]>; // -Wconversion-null = -Wnull-conversion +def : DiagGroup<"bool-conversions", + [BoolConversion]>; // -Wbool-conversions = -Wbool-conversion +def : DiagGroup<"int-conversions", + [IntConversion]>; // -Wint-conversions = -Wint-conversion +def : DiagGroup<"vector-conversions", + [VectorConversion]>; // -Wvector-conversions = -Wvector-conversion // A warning group for warnings that we want to have on by default in clang, // but which aren't on by default in GCC. @@ -317,11 +386,16 @@ def : DiagGroup<"c++0x-extensions", [CXX11]>; def DelegatingCtorCycles : DiagGroup<"delegating-ctor-cycles">; -// A warning group for warnings about using C1X features as extensions. -def C1X : DiagGroup<"c1x-extensions">; +// A warning group for warnings about using C11 features as extensions. +def C11 : DiagGroup<"c11-extensions">; + +// A warning group for warnings about using C99 features as extensions. +def C99 : DiagGroup<"c99-extensions">; // A warning group for warnings about GCC extensions. def GNU : DiagGroup<"gnu", [GNUDesignator, VLA]>; +// A warning group for warnings about code that clang accepts but gcc doesn't. +def GccCompat : DiagGroup<"gcc-compat">; // A warning group for warnings about Microsoft extensions. def Microsoft : DiagGroup<"microsoft">; @@ -329,3 +403,13 @@ def Microsoft : DiagGroup<"microsoft">; def ObjCNonUnifiedException : DiagGroup<"objc-nonunified-exceptions">; def ObjCProtocolMethodImpl : DiagGroup<"objc-protocol-method-implementation">; + +// ObjC API warning groups. +def ObjCRedundantLiteralUse : DiagGroup<"objc-redundant-literal-use">; +def ObjCRedundantAPIUse : DiagGroup<"objc-redundant-api-use", [ + ObjCRedundantLiteralUse + ]>; + +def ObjCCocoaAPI : DiagGroup<"objc-cocoa-api", [ + ObjCRedundantAPIUse + ]>; diff --git a/include/clang/Basic/DiagnosticIDs.h b/include/clang/Basic/DiagnosticIDs.h index 16d9b39985ed2..a6c22db3e8d01 100644 --- a/include/clang/Basic/DiagnosticIDs.h +++ b/include/clang/Basic/DiagnosticIDs.h @@ -31,14 +31,15 @@ namespace clang { namespace diag { // Start position for diagnostics. enum { - DIAG_START_DRIVER = 300, - DIAG_START_FRONTEND = DIAG_START_DRIVER + 100, - DIAG_START_LEX = DIAG_START_FRONTEND + 120, - DIAG_START_PARSE = DIAG_START_LEX + 300, - DIAG_START_AST = DIAG_START_PARSE + 300, - DIAG_START_SEMA = DIAG_START_AST + 100, - DIAG_START_ANALYSIS = DIAG_START_SEMA + 3000, - DIAG_UPPER_LIMIT = DIAG_START_ANALYSIS + 100 + DIAG_START_DRIVER = 300, + DIAG_START_FRONTEND = DIAG_START_DRIVER + 100, + 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_SEMA = DIAG_START_AST + 100, + DIAG_START_ANALYSIS = DIAG_START_SEMA + 3000, + DIAG_UPPER_LIMIT = DIAG_START_ANALYSIS + 100 }; class CustomDiagInfo; @@ -49,7 +50,7 @@ namespace clang { // Get typedefs for common diagnostics. enum { #define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ - SFINAE,ACCESS,CATEGORY,NOWERROR,SHOWINSYSHEADER,BRIEF,FULL) ENUM, + SFINAE,ACCESS,CATEGORY,NOWERROR,SHOWINSYSHEADER) ENUM, #include "clang/Basic/DiagnosticCommonKinds.inc" NUM_BUILTIN_COMMON_DIAGNOSTICS #undef DIAG @@ -108,7 +109,7 @@ public: /// \brief Used for handling and querying diagnostic IDs. Can be used and shared /// by multiple Diagnostics for multiple translation units. -class DiagnosticIDs : public llvm::RefCountedBase<DiagnosticIDs> { +class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> { public: /// Level - The level of the diagnostic, after it has been through mapping. enum Level { @@ -182,6 +183,10 @@ public: /// category. static StringRef getCategoryNameFromID(unsigned CategoryID); + /// isARCDiagnostic - Return true if a given diagnostic falls into an + /// ARC diagnostic category; + static bool isARCDiagnostic(unsigned DiagID); + /// \brief Enumeration describing how the the emission of a diagnostic should /// be treated when it occurs during C++ template argument deduction. enum SFINAEResponse { @@ -218,39 +223,6 @@ public: /// are not SFINAE errors. static SFINAEResponse getDiagnosticSFINAEResponse(unsigned DiagID); - /// getName - Given a diagnostic ID, return its name - static StringRef getName(unsigned DiagID); - - /// getIdFromName - Given a diagnostic name, return its ID, or 0 - static unsigned getIdFromName(StringRef Name); - - /// getBriefExplanation - Given a diagnostic ID, return a brief explanation - /// of the issue - static StringRef getBriefExplanation(unsigned DiagID); - - /// getFullExplanation - Given a diagnostic ID, return a full explanation - /// of the issue - static StringRef getFullExplanation(unsigned DiagID); - - /// Iterator class used for traversing all statically declared - /// diagnostics. - class diag_iterator { - const void *impl; - - friend class DiagnosticIDs; - diag_iterator(const void *im) : impl(im) {} - public: - diag_iterator &operator++(); - bool operator==(const diag_iterator &x) const { return impl == x.impl; } - bool operator!=(const diag_iterator &x) const { return impl != x.impl; } - - llvm::StringRef getDiagName() const; - unsigned getDiagID() const; - }; - - static diag_iterator diags_begin(); - static diag_iterator diags_end(); - /// \brief Get the set of all diagnostic IDs in the group with the given name. /// /// \param Diags [out] - On return, the diagnostics in the group. @@ -258,6 +230,13 @@ public: bool getDiagnosticsInGroup(StringRef Group, llvm::SmallVectorImpl<diag::kind> &Diags) const; + /// \brief Get the set of all diagnostic IDs. + void getAllDiagnostics(llvm::SmallVectorImpl<diag::kind> &Diags) const; + + /// \brief Get the warning option with the closest edit distance to the given + /// group name. + static StringRef getNearestWarningOption(StringRef Group); + private: /// \brief Get the set of all diagnostic IDs in the given group. /// diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index 9b3a178cac783..670283ef1a5c9 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -13,16 +13,19 @@ let Component = "Lex", CategoryName = "Lexical or Preprocessor Issue" in { -def null_in_string : Warning<"null character(s) preserved in string literal">; -def null_in_char : Warning<"null character(s) preserved in character literal">; -def null_in_file : Warning<"null character ignored">; +def null_in_string : Warning<"null character(s) preserved in string literal">, + InGroup<NullCharacter>; +def null_in_char : Warning<"null character(s) preserved in character literal">, + InGroup<NullCharacter>; +def null_in_file : Warning<"null character ignored">, InGroup<NullCharacter>; def warn_nested_block_comment : Warning<"'/*' within block comment">, InGroup<Comment>; def escaped_newline_block_comment_end : Warning< "escaped newline between */ characters at block comment end">, InGroup<Comment>; def backslash_newline_space : Warning< - "backslash and newline separated by space">; + "backslash and newline separated by space">, + InGroup<DiagGroup<"backslash-newline-escape">>; // Digraphs. def warn_cxx98_compat_less_colon_colon : Warning< @@ -45,14 +48,21 @@ def ext_bcpl_comment : Extension< InGroup<Comment>; def ext_no_newline_eof : Extension<"no newline at end of file">, InGroup<DiagGroup<"newline-eof">>; -def ext_dollar_in_identifier : Extension<"'$' in identifier">; -def charize_microsoft_ext : Extension<"@# is a microsoft extension">; + +def warn_cxx98_compat_no_newline_eof : Warning< + "C++98 requires newline at end of file">, + InGroup<CXX98CompatPedantic>, DefaultIgnore; + +def ext_dollar_in_identifier : Extension<"'$' in identifier">, + InGroup<DiagGroup<"dollar-in-identifier-extension">>; +def ext_charize_microsoft : Extension<"@# is a microsoft extension">, + InGroup<Microsoft>; def ext_token_used : Extension<"extension used">, InGroup<DiagGroup<"language-extension-token">>; def warn_cxx11_keyword : Warning<"'%0' is a keyword in C++11">, - InGroup<CXX11Compat>; + InGroup<CXX11Compat>, DefaultIgnore; def warn_unterminated_string : ExtWarn<"missing terminating '\"' character">; def warn_unterminated_char : ExtWarn<"missing terminating ' character">; @@ -90,7 +100,16 @@ def err_hex_escape_no_digits : Error<"\\x used with no following hex digits">; def err_ucn_escape_no_digits : Error<"\\u used with no following hex digits">; def err_ucn_escape_invalid : Error<"invalid universal character">; def err_ucn_escape_incomplete : Error<"incomplete universal character name">; -def err_ucn_escape_too_big : Error<"universal character name is too long">; +def err_ucn_escape_basic_scs : Error< + "character '%0' cannot be specified by a universal character name">; +def err_ucn_control_character : Error< + "universal character name refers to a control character">; +def warn_cxx98_compat_literal_ucn_escape_basic_scs : Warning< + "specifying character '%0' with a universal character name " + "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; +def warn_cxx98_compat_literal_ucn_control_character : Warning< + "universal character name referring to a control character " + "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; def err_invalid_decimal_digit : Error<"invalid digit '%0' in decimal constant">; def err_invalid_binary_digit : Error<"invalid digit '%0' in binary constant">; def err_invalid_octal_digit : Error<"invalid digit '%0' in octal constant">; @@ -102,10 +121,14 @@ def warn_extraneous_char_constant : Warning< "extraneous characters in character constant ignored">; def warn_char_constant_too_large : Warning< "character constant too long for its type">; +def err_multichar_utf_character_literal : Error< + "Unicode character literals may not contain multiple characters">; def err_exponent_has_no_digits : Error<"exponent has no digits">; def ext_imaginary_constant : Extension<"imaginary constants are an extension">; def err_hexconstant_requires_exponent : Error< "hexadecimal floating constants require an exponent">; +def err_hexconstant_requires_digits : Error< + "hexadecimal floating constants require a significand">; def ext_hexconstant_invalid : Extension< "hexadecimal floating constants are a C99 feature">; def ext_binary_literal : Extension< @@ -116,36 +139,69 @@ def warn_hex_escape_too_large : ExtWarn<"hex escape sequence out of range">; def ext_string_too_long : Extension<"string literal of length %0 exceeds " "maximum length %1 that %select{C90|ISO C99|C++}2 compilers are required to " "support">, InGroup<OverlengthStrings>; -def warn_ucn_escape_too_large : ExtWarn< - "character unicode escape sequence too long for its type">; +def err_character_too_large : Error< + "character too large for enclosing character literal type">; def warn_ucn_not_valid_in_c89 : ExtWarn< - "unicode escape sequences are only valid in C99 or C++">; + "unicode escape sequences are only valid in C99 or C++">, InGroup<Unicode>; def warn_cxx98_compat_unicode_literal : Warning< "unicode literals are incompatible with C++98">, InGroup<CXX98Compat>, 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; +def warn_cxx11_compat_reserved_user_defined_literal : Warning< + "identifier after literal will be treated as a reserved user-defined literal " + "suffix in C++11">, + InGroup<CXX11CompatReservedUserDefinedLiteral>, DefaultIgnore; +def ext_reserved_user_defined_literal : ExtWarn< + "invalid suffix on literal; C++11 requires a space between literal and " + "identifier">, InGroup<ReservedUserDefinedLiteral>, DefaultError; +def ext_ms_reserved_user_defined_literal : ExtWarn< + "invalid suffix on literal; C++11 requires a space between literal and " + "identifier">, InGroup<ReservedUserDefinedLiteral>; def err_unsupported_string_concat : Error< "unsupported non-standard concatenation of string literals">; - +def err_string_concat_mixed_suffix : Error< + "differing user-defined suffixes ('%0' and '%1') in string literal " + "concatenation">; +def err_pp_invalid_udl : Error< + "%select{character|integer}0 literal with user-defined suffix " + "cannot be used in preprocessor constant expression">; +def err_bad_string_encoding : Error< + "illegal character encoding in string literal">; +def warn_bad_string_encoding : ExtWarn< + "illegal character encoding in string literal">, + InGroup<DiagGroup<"invalid-source-encoding">>; +def err_bad_character_encoding : Error< + "illegal character encoding in character literal">; +def warn_bad_character_encoding : ExtWarn< + "illegal character encoding in character literal">, + InGroup<DiagGroup<"invalid-source-encoding">>; + + //===----------------------------------------------------------------------===// // PTH Diagnostics //===----------------------------------------------------------------------===// -def err_pth_cannot_read : Error< - "PTH file '%0' could not be read">; def err_invalid_pth_file : Error< "invalid or corrupt PTH file '%0'">; //===----------------------------------------------------------------------===// // Preprocessor Diagnostics //===----------------------------------------------------------------------===// -def pp_hash_warning : Warning<"#warning%0">, + +let CategoryName = "User Defined Issues" in { +def pp_hash_warning : Warning<"%0">, InGroup<PoundWarning>, DefaultWarnShowInSystemHeader; +def err_pp_hash_error : Error<"%0">; +} + def pp_include_next_in_primary : Warning< "#include_next in primary source file">; def pp_include_macros_out_of_predefines : Error< "the #__include_macros directive is only for internal use by -imacros">; def pp_include_next_absolute_path : Warning<"#include_next with absolute path">; def ext_c99_whitespace_required_after_macro_name : ExtWarn< - "ISO C99 requires whitespace after the macro name">; + "ISO C99 requires whitespace after the macro name">, InGroup<C99>; def ext_missing_whitespace_after_macro_name : ExtWarn< "whitespace required after macro name">; def warn_missing_whitespace_after_macro_name : Warning< @@ -160,6 +216,9 @@ def pp_out_of_date_dependency : Warning< def pp_undef_builtin_macro : Warning<"undefining builtin macro">; def pp_redef_builtin_macro : Warning<"redefining builtin macro">, InGroup<DiagGroup<"builtin-macro-redefined">>; +def pp_disabled_macro_expansion : Warning< + "disabled expansion of recursive macro">, DefaultIgnore, + InGroup<DiagGroup<"disabled-macro-expansion">>; def pp_macro_not_used : Warning<"macro is not used">, DefaultIgnore, InGroup<DiagGroup<"unused-macros">>; def warn_pp_undef_identifier : Warning< @@ -175,7 +234,11 @@ def warn_pp_convert_lhs_to_positive : Warning< def warn_pp_convert_rhs_to_positive : Warning< "right side of operator converted from negative value to unsigned: %0">; -def ext_pp_import_directive : Extension<"#import is a language extension">; +def ext_pp_import_directive : Extension<"#import is a language extension">, + InGroup<DiagGroup<"import-preprocessor-directive-pedantic">>; +def err_pp_import_directive_ms : Error< + "#import of type library is an unsupported Microsoft feature">; + def ext_pp_ident_directive : Extension<"#ident is a language extension">; def ext_pp_include_next_directive : Extension< "#include_next is a language extension">; @@ -195,8 +258,11 @@ 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< + "embedding a #%0 directive within macro arguments is not supported">; def ext_embedded_directive : Extension< - "embedding a directive within macro arguments is not portable">; + "embedding a directive within macro arguments has undefined behavior">, + InGroup<DiagGroup<"embedded-directive">>; def ext_missing_varargs_arg : Extension< "varargs argument missing, but tolerated as an extension">; def ext_empty_fnmacro_arg : Extension< @@ -206,7 +272,6 @@ def warn_cxx98_compat_empty_fnmacro_arg : Warning< InGroup<CXX98CompatPedantic>, DefaultIgnore; def err_pp_invalid_directive : Error<"invalid preprocessing directive">; -def err_pp_hash_error : Error<"#error%0">; def err_pp_file_not_found : Error<"'%0' file not found">, DefaultFatal; def err_pp_error_opening_file : Error< "error opening file '%0': %1">, DefaultFatal; @@ -236,7 +301,6 @@ def pp_err_else_without_if : Error<"#else without #if">; def pp_err_elif_without_if : Error<"#elif without #if">; def err_pp_endif_without_if : Error<"#endif without #if">; def err_pp_expected_value_in_expr : Error<"expected value in expression">; -def err_pp_missing_val_before_operator : Error<"missing value before operator">; def err_pp_expected_rparen : Error<"expected ')' in preprocessor expression">; def err_pp_expected_eol : Error< "expected end of line in preprocessor expression">; @@ -266,6 +330,19 @@ def warn_has_warning_invalid_option : ExtWarn<"__has_warning expected option name (e.g. \"-Wundef\")">, InGroup<MalformedWarningCheck>; +def warn_pragma_include_alias_mismatch_angle : + ExtWarn<"angle-bracketed include <%0> cannot be aliased to double-quoted " + "include \"%1\"">, InGroup<UnknownPragmas>; +def warn_pragma_include_alias_mismatch_quote : + ExtWarn<"double-quoted include \"%0\" cannot be aliased to angle-bracketed " + "include <%1>">, InGroup<UnknownPragmas>; +def warn_pragma_include_alias_expected : + ExtWarn<"pragma include_alias expected '%0'">, + InGroup<UnknownPragmas>; +def warn_pragma_include_alias_expected_filename : + ExtWarn<"pragma include_alias expected include filename">, + InGroup<UnknownPragmas>; + def err__Pragma_malformed : Error< "_Pragma takes a parenthesized string literal">; def err_pragma_comment_malformed : Error< @@ -355,7 +432,7 @@ def warn_cxx98_compat_pp_line_too_big : Warning< "#line number greater than 32767 is incompatible with C++98">, InGroup<CXX98CompatPedantic>, DefaultIgnore; -def err_pp_export_non_macro : Error<"no macro named %0 to export">; +def err_pp_visibility_non_macro : Error<"no macro named %0">; def err_pp_arc_cf_code_audited_syntax : Error<"expected 'begin' or 'end'">; def err_pp_double_begin_of_arc_cf_code_audited : Error< @@ -367,4 +444,60 @@ def err_pp_include_in_arc_cf_code_audited : Error< def err_pp_eof_in_arc_cf_code_audited : Error< "'#pragma clang arc_cf_code_audited' was not ended within this file">; +// Module map parsing +def err_mmap_unknown_token : Error<"skipping stray token">; +def err_mmap_expected_module : Error<"expected module declaration">; +def err_mmap_expected_module_name : Error<"expected module name">; +def err_mmap_expected_lbrace : Error<"expected '{' to start module '%0'">; +def err_mmap_expected_rbrace : Error<"expected '}'">; +def note_mmap_lbrace_match : Note<"to match this '{'">; +def err_mmap_expected_rsquare : Error<"expected ']' to close attribute">; +def note_mmap_lsquare_match : Note<"to match this ']'">; +def err_mmap_expected_member : Error< + "expected umbrella, header, submodule, or module export">; +def err_mmap_expected_header : Error<"expected a header name after '%0'">; +def err_mmap_module_redefinition : Error< + "redefinition of module '%0'">; +def note_mmap_prev_definition : Note<"previously defined here">; +def err_mmap_header_conflict : Error< + "header '%0' is already part of module '%1'">; +def err_mmap_header_not_found : Error< + "%select{|umbrella }0header '%1' not found">; +def err_mmap_umbrella_dir_not_found : Error< + "umbrella directory '%0' not found">; +def err_mmap_umbrella_clash : Error< + "umbrella for module '%0' already covers this directory">; +def err_mmap_export_module_id : Error< + "expected an exported module name or '*'">; +def err_mmap_missing_module_unqualified : Error< + "no module named '%0' visible from '%1'">; +def err_mmap_missing_module_qualified : Error< + "no module named '%0' in '%1'">; +def err_mmap_top_level_inferred_submodule : Error< + "only submodules may be inferred with wildcard syntax">; +def err_mmap_inferred_no_umbrella : Error< + "inferred submodules require a module with an umbrella">; +def err_mmap_inferred_redef : Error< + "redefinition of inferred submodule">; +def err_mmap_expected_lbrace_wildcard : Error< + "expected '{' to start inferred submodule">; +def err_mmap_expected_wildcard_member : Error< + "expected module export wildcard">; +def err_mmap_expected_export_wildcard : Error< + "only '*' can be exported from an inferred submodule">; +def err_mmap_explicit_top_level : Error< + "'explicit' is not permitted on top-level modules">; +def err_mmap_nested_submodule_id : Error< + "qualified module name can only be used to define modules at the top level">; +def err_mmap_expected_feature : Error<"expected a feature name">; +def err_mmap_expected_attribute : Error<"expected an attribute name">; +def warn_mmap_unknown_attribute : Warning<"unknown attribute '%0'">, + InGroup<IgnoredAttributes>; + +def warn_auto_module_import : Warning< + "treating #%select{include|import|include_next|__include_macros}0 as an " + "import of module '%1'">, InGroup<AutoImport>, DefaultIgnore; +def warn_uncovered_module_header : Warning< + "umbrella header does not include header '%0'">, InGroup<IncompleteUmbrella>; + } diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 73437b217b186..c183da7a6ac90 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -23,6 +23,9 @@ let CategoryName = "Parse Issue" in { def ext_empty_source_file : Extension<"ISO C forbids an empty source file">; def ext_top_level_semi : Extension< "extra ';' outside of a function">; +def warn_cxx98_compat_top_level_semi : Warning< + "extra ';' outside of a function is incompatible with C++98">, + InGroup<CXX98CompatPedantic>, DefaultIgnore; def ext_extra_struct_semi : Extension< "extra ';' inside a %0">; def ext_extra_ivar_semi : Extension< @@ -35,9 +38,10 @@ def ext_integer_complex : Extension< "complex integer types are an extension">; def ext_thread_before : Extension<"'__thread' before 'static'">; -def ext_empty_struct_union : Extension<"empty %select{struct|union}0 " - "(accepted as an extension) has size 0 in C, size 1 in C++">, - InGroup<CXXCompat>; +def ext_empty_struct_union : Extension< + "empty %select{struct|union}0 is a GNU extension">, InGroup<GNU>; +def warn_empty_struct_union_compat : Warning<"empty %select{struct|union}0 " + "has size 0 in C, size 1 in C++">, InGroup<CXXCompat>, DefaultIgnore; def error_empty_enum : Error<"use of empty enum">; def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">; def err_invalid_short_spec : Error<"'short %0' is invalid">; @@ -49,12 +53,17 @@ def err_friend_storage_spec : Error<"'%0' is invalid in friend declarations">; def ext_ident_list_in_param : Extension< "type-less parameter names in function declaration">; def ext_c99_variable_decl_in_for_loop : Extension< - "variable declaration in for loop is a C99-specific feature">; + "variable declaration in for loop is a C99-specific feature">, InGroup<C99>; def ext_c99_compound_literal : Extension< - "compound literals are a C99-specific feature">; + "compound literals are a C99-specific feature">, InGroup<C99>; +def ext_c99_flexible_array_member : Extension< + "Flexible array members are a C99-specific feature">, InGroup<C99>; def ext_enumerator_list_comma : Extension< "commas at the end of enumerator lists are a %select{C99|C++11}0-specific " "feature">; +def warn_cxx98_compat_enumerator_list_comma : Warning< + "commas at the end of enumerator lists are incompatible with C++98">, + InGroup<CXX98CompatPedantic>, DefaultIgnore; def err_enumerator_list_missing_comma : Error< "missing ',' between enumerators">; def err_enumerator_unnamed_no_def : Error< @@ -62,16 +71,26 @@ def err_enumerator_unnamed_no_def : Error< def ext_ms_enum_fixed_underlying_type : Extension< "enumeration types with a fixed underlying type are a Microsoft extension">, InGroup<Microsoft>; +def warn_cxx98_compat_enum_fixed_underlying_type : Warning< + "enumeration types with a fixed underlying type are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; +def warn_cxx98_compat_alignof : Warning< + "alignof expressions are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; -def ext_c1x_generic_selection : Extension< - "generic selections are a C1X-specific feature">, InGroup<C1X>; +def warn_microsoft_dependent_exists : Warning< + "dependent %select{__if_not_exists|__if_exists}0 declarations are ignored">, + InGroup<DiagGroup<"microsoft-exists">>; + +def ext_c11_generic_selection : Extension< + "generic selections are a C11-specific feature">, InGroup<C11>; def err_duplicate_default_assoc : Error< "duplicate default generic association">; def note_previous_default_assoc : Note< "previous default generic association is here">; -def ext_c1x_alignas : Extension< - "_Alignas is a C1X-specific feature">, InGroup<C1X>; +def ext_c11_alignas : Extension< + "_Alignas is a C11-specific feature">, InGroup<C11>; def ext_gnu_indirect_goto : Extension< "use of GNU indirect-goto extension">, InGroup<GNU>; @@ -98,10 +117,10 @@ def ext_gnu_case_range : Extension<"use of GNU case range extension">, InGroup<GNU>; // Generic errors. -def err_parse_error : Error<"parse error">; def err_expected_expression : Error<"expected expression">; def err_expected_type : Error<"expected a type">; def err_expected_external_declaration : Error<"expected external declaration">; +def err_extraneous_closing_brace : Error<"extraneous closing brace ('}')">; def err_expected_ident : Error<"expected identifier">; def err_expected_ident_lparen : Error<"expected identifier or '('">; def err_expected_ident_lbrace : Error<"expected identifier or '{'">; @@ -126,17 +145,24 @@ def err_function_declared_typedef : Error< "function definition declared 'typedef'">; def err_iboutletcollection_builtintype : Error< "type argument of iboutletcollection attribute cannot be a builtin type">; - +def err_iboutletcollection_with_protocol : Error< + "invalid argument of iboutletcollection attribute">; def err_at_defs_cxx : Error<"@defs is not supported in Objective-C++">; def err_at_in_class : Error<"unexpected '@' in member specification">; def err_expected_fn_body : Error< "expected function body after function declarator">; +def warn_attribute_on_function_definition : Warning< + "GCC does not allow %0 attribute in this position on a function definition">, + InGroup<GccCompat>; +def warn_attribute_no_decl : Warning< + "attribute %0 ignored, because it is not attached to a declaration">, + InGroup<IgnoredAttributes>; def err_expected_method_body : Error<"expected method body">; def err_invalid_token_after_toplevel_declarator : Error< "expected ';' after top level declarator">; -def err_invalid_equalequal_after_declarator : Error< - "invalid '==' at end of declaration; did you mean '='?">; +def err_invalid_token_after_declarator_suggest_equal : Error< + "invalid '%0' at end of declaration; did you mean '='?">; def err_expected_statement : Error<"expected statement">; def err_expected_lparen_after : Error<"expected '(' after '%0'">; def err_expected_lparen_after_id : Error<"expected '(' after %0">; @@ -174,8 +200,8 @@ def err_label_end_of_compound_statement : Error< def err_address_of_label_outside_fn : Error< "use of address-of-label extension outside of a function body">; def err_expected_string_literal : Error<"expected string literal">; -def err_expected_asm_operand : Error< - "expected string literal or '[' for asm operand">, CatInlineAsm; +def err_asm_operand_wide_string_literal : Error< + "cannot use %select{unicode|wide}0 string literal in 'asm'">; def err_expected_selector_for_method : Error< "expected selector for Objective-C method">; def err_expected_property_name : Error<"expected property name">; @@ -188,25 +214,45 @@ def err_illegal_decl_reference_to_reference : Error< "%0 declared as a reference to a reference">; def ext_rvalue_reference : ExtWarn< "rvalue references are a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_rvalue_reference : Warning< + "rvalue references are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def ext_ref_qualifier : ExtWarn< "reference qualifiers on functions are a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_ref_qualifier : Warning< + "reference qualifiers on functions are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def ext_inline_namespace : ExtWarn< "inline namespaces are a C++11 feature">, InGroup<CXX11>; -def err_generalized_initializer_lists : Error< - "generalized initializer lists are a C++11 extension unsupported in Clang">; +def warn_cxx98_compat_inline_namespace : Warning< + "inline namespaces are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def ext_generalized_initializer_lists : ExtWarn< - "generalized initializer lists are a C++11 extension unsupported in Clang">, + "generalized initializer lists are a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_generalized_initializer_lists : Warning< + "generalized initializer lists are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; +def err_init_list_bin_op : Error<"initializer list cannot be used on the " + "%select{left|right}0 hand side of operator '%1'">; +def warn_cxx98_compat_trailing_return_type : Warning< + "trailing return types are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def ext_auto_type_specifier : ExtWarn< "'auto' type specifier is a C++11 extension">, InGroup<CXX11>; def warn_auto_storage_class : Warning< "'auto' storage class specifier is redundant and incompatible with C++11">, - InGroup<CXX11Compat>; + InGroup<CXX11Compat>, DefaultIgnore; def ext_auto_storage_class : ExtWarn< "'auto' storage class specifier is not permitted in C++11, and will not " - "be supported in future releases">; + "be supported in future releases">, InGroup<DiagGroup<"auto-storage-class">>; 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 err_for_range_expected_decl : Error< + "for range declaration must declare a variable">; def err_argument_required_after_attribute : Error< "argument required after attribute">; def err_missing_param : Error<"expected parameter declarator">; @@ -214,7 +260,14 @@ def err_missing_comma_before_ellipsis : Error< "C requires a comma prior to the ellipsis in a variadic function type">; def err_unexpected_typedef_ident : Error< "unexpected type name %0: expected identifier">; +def warn_cxx98_compat_decltype : Warning< + "'decltype' type specifier is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; +def err_unexpected_scope_on_base_decltype : Error< + "unexpected namespace scope prior to decltype">; def err_expected_class_name : Error<"expected class name">; +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">; @@ -228,9 +281,11 @@ def err_typename_invalid_storageclass : Error< "type name does not allow storage class to be specified">; def err_typename_invalid_functionspec : Error< "type name does not allow function specifier to be specified">; +def err_typename_invalid_constexpr : Error< + "type name does not allow constexpr specifier to be specified">; def err_typename_identifiers_only : Error< "typename is allowed for identifiers only">; - + def err_invalid_decl_spec_combination : Error< "cannot combine with previous '%0' declaration specifier">; def err_invalid_vector_decl_spec_combination : Error< @@ -255,30 +310,40 @@ def err_templated_using_directive : Error< "cannot template a using directive">; def err_templated_using_declaration : Error< "cannot template a using declaration">; -def err_expected_ident_in_using : Error< - "expected an identifier in using directive">; def err_unexected_colon_in_nested_name_spec : Error< "unexpected ':' in nested name specifier">; def err_bool_redeclaration : Error< "redeclaration of C++ built-in type 'bool'">; -def ext_c1x_static_assert : Extension< - "_Static_assert is a C1X-specific feature">, InGroup<C1X>; +def ext_c11_static_assert : Extension< + "_Static_assert is a C11-specific feature">, InGroup<C11>; +def warn_cxx98_compat_static_assert : Warning< + "static_assert declarations are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; /// Objective-C parser diagnostics def err_expected_minus_or_plus : Error< "method type specifier must start with '-' or '+'">; def err_objc_no_attributes_on_category : Error< "attributes may not be specified on a category">; -def err_objc_missing_end : Error<"missing @end">; +def err_objc_missing_end : Error<"missing '@end'">; +def note_objc_container_start : Note< + "%select{class|protocol|category|class extension|implementation" + "|category implementation}0 started here">; def warn_objc_protocol_qualifier_missing_id : Warning< "protocol qualifiers without 'id' is archaic">; def err_objc_unknown_at : Error<"expected an Objective-C directive after '@'">; def err_illegal_super_cast : Error< "cannot cast 'super' (it isn't an expression)">; +def err_nsnumber_nonliteral_unary : Error< + "@%0 must be followed by a number to form an NSNumber object">; -let CategoryName = "Automatic Reference Counting Issue" in { +let CategoryName = "ARC Parse Issue" in { def err_arc_bridge_retain : Error< "unknown cast annotation __bridge_retain; did you mean __bridge_retained?">; +// To be default mapped to an error later. +def warn_arc_bridge_cast_nonarc : Warning< + "'%0' casts have no effect when not using ARC">, + InGroup<DiagGroup<"arc-bridge-casts-disallowed-in-nonarc">>; } def err_objc_illegal_visibility_spec : Error< @@ -303,13 +368,8 @@ def err_objc_directive_only_in_protocol : Error< def err_missing_catch_finally : Error< "@try statement without a @catch and @finally clause">; def err_objc_concat_string : Error<"unexpected token after Objective-C string">; -def err_missing_sel_definition : Error<"cannot find definition of 'SEL'">; -def err_missing_id_definition : Error<"cannot find definition of 'id'">; -def err_missing_proto_definition : Error< - "cannot find definition of 'Protocol'">; -def err_missing_class_definition : Error<"cannot find definition of 'Class'">; -def err_expected_implementation : Error< - "@end must appear in an @implementation context">; +def err_expected_objc_container : Error< + "'@end' must appear in an Objective-C context">; def error_property_ivar_decl : Error< "property synthesize requires specification of an ivar">; def err_synthesized_property_name : Error< @@ -332,10 +392,16 @@ def err_func_def_no_params : Error< "function definition does not declare parameters">; def err_expected_lparen_after_type : Error< "expected '(' for function-style cast or type construction">; -def err_expected_equal_after_declarator : Error< - "expected '=' after declarator">; +def err_expected_init_in_condition : Error< + "variable declaration in condition must have an initializer">; +def err_expected_init_in_condition_lparen : Error< + "variable declaration in condition cannot have a parenthesized initializer">; def warn_parens_disambiguated_as_function_decl : Warning< - "parentheses were disambiguated as a function declarator">; + "parentheses were disambiguated as a function declarator">, + InGroup<VexingParse>; +def warn_dangling_else : Warning< + "add explicit braces to avoid dangling else">, + InGroup<DanglingElse>; def err_expected_member_or_base_name : Error< "expected class member or base class name">; def err_expected_lbrace_after_base_specifiers : Error< @@ -344,8 +410,13 @@ def ext_ellipsis_exception_spec : Extension< "exception specification of '...' is a Microsoft extension">; def err_dynamic_and_noexcept_specification : Error< "cannot have both throw() and noexcept() clause on the same function">; +def warn_cxx98_compat_noexcept_decl : Warning< + "noexcept specifications are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_expected_catch : Error<"expected catch">; def err_expected_lbrace_or_comma : Error<"expected '{' or ','">; +def err_expected_rbrace_or_comma : Error<"expected '}' or ','">; +def err_expected_rsquare_or_comma : Error<"expected ']' or ','">; def err_using_namespace_in_class : Error< "'using namespace' is not allowed in classes">; def err_destructor_tilde_identifier : Error< @@ -356,13 +427,24 @@ def err_default_arg_unparsed : Error< "unexpected end of default argument expression">; def err_parser_impl_limit_overflow : Error< "parser recursion limit reached, program too complex">, DefaultFatal; +def err_misplaced_ellipsis_in_declaration : Error< + "'...' must %select{immediately precede declared identifier|" + "be innermost component of anonymous pack declaration}0">; // C++ derived classes def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">; // C++ operator overloading -def err_operator_string_not_empty : Error< +def err_literal_operator_string_prefix : Error< + "string literal after 'operator' cannot have an encoding prefix">; +def err_literal_operator_string_not_empty : Error< "string literal after 'operator' must be '\"\"'">; +def err_literal_operator_missing_space : Error< + "C++11 requires a space between the \"\" and the user-defined suffix in a " + "literal operator">; +def warn_cxx98_compat_literal_operator : Warning< + "literal operators are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; // Classes. def err_anon_type_definition : Error< @@ -371,16 +453,27 @@ def err_default_delete_in_multiple_declaration : Error< "'= %select{default|delete}0' is a function definition and must occur in a " "standalone declaration">; +def warn_cxx98_compat_noexcept_expr : Warning< + "noexcept expressions are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; +def warn_cxx98_compat_nullptr : Warning< + "'nullptr' is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; + def warn_cxx98_compat_alignas : Warning<"'alignas' is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; def warn_cxx98_compat_attribute : Warning< "attributes are incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; -def err_cxx0x_attribute_forbids_arguments : Error< - "C++11 attribute '%0' cannot have an argument list">; -def err_cxx0x_attribute_requires_arguments : Error< - "C++1 attribute '%0' must have an argument list">; +def err_cxx11_attribute_forbids_arguments : Error< + "attribute '%0' cannot have an argument list">; +def err_cxx11_attribute_forbids_ellipsis : Error< + "attribute '%0' cannot be used as an attribute pack">; def err_attributes_not_allowed : Error<"an attribute list cannot appear here">; +def err_l_square_l_square_not_attribute : Error< + "C++11 only allows consecutive left square brackets when " + "introducing an attribute">; +def err_alignas_pack_exp_unsupported : Error< + "pack expansions in alignment specifiers are not supported yet">; /// C++ Templates def err_expected_template : Error<"expected template">; @@ -388,23 +481,22 @@ def err_unknown_template_name : Error< "unknown template name %0">; def err_expected_comma_greater : Error< "expected ',' or '>' in template-parameter-list">; -def err_expected_type_id_after : Error<"expected type-id after '%0'">; -def err_expected_class_before : Error<"expected 'class' before '%0'">; +def err_class_on_template_template_param : Error< + "template template parameter requires 'class' after the parameter list">; def err_template_spec_syntax_non_template : Error< "identifier followed by '<' indicates a class template specialization but " "%0 %select{does not refer to a template|refers to a function " "template|<unused>|refers to a template template parameter}1">; def err_id_after_template_in_nested_name_spec : Error< "expected template name after 'template' keyword in nested name specifier">; -def err_id_after_template_in_typename_spec : Error< - "expected template name after 'template' keyword in typename specifier">; -def err_less_after_template_name_in_nested_name_spec : Error< - "expected '<' after 'template %0' in nested name specifier">; def err_two_right_angle_brackets_need_space : Error< "a space is required between consecutive right angle brackets (use '> >')">; def warn_cxx0x_right_shift_in_template_arg : Warning< "use of right-shift operator ('>>') in template argument will require " "parentheses in C++11">; +def warn_cxx98_compat_two_right_angle_brackets : Warning< + "consecutive right angle brackets are incompatible with C++98 (use '> >')">, + InGroup<CXX98Compat>, DefaultIgnore; def err_multiple_template_declarators : Error< "%select{|a template declaration|an explicit template specialization|" "an explicit template instantiation}0 can " @@ -414,12 +506,20 @@ def err_explicit_instantiation_with_definition : Error< "definition is meant to be an explicit specialization, add '<>' after the " "'template' keyword">; def err_enum_template : Error<"enumeration cannot be a template">; +def err_explicit_instantiation_enum : Error< + "enumerations cannot be explicitly instantiated">; +def err_expected_template_parameter : Error<"expected template parameter">; def err_missing_dependent_template_keyword : Error< "use 'template' keyword to treat '%0' as a dependent template name">; def warn_missing_dependent_template_keyword : ExtWarn< "use 'template' keyword to treat '%0' as a dependent template name">; +def ext_extern_template : Extension< + "extern templates are a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_extern_template : Warning< + "extern templates are incompatible with C++98">, + InGroup<CXX98CompatPedantic>, DefaultIgnore; def warn_static_inline_explicit_inst_ignored : Warning< "ignoring '%select{static|inline}0' keyword on explicit template " "instantiation">; @@ -457,23 +557,31 @@ def err_ctor_init_missing_comma : Error< "missing ',' between base or member initializers">; // C++ declarations -def err_friend_decl_defines_class : Error< +def err_friend_decl_defines_type : Error< "cannot define a type in a friend declaration">; def err_missing_whitespace_digraph : Error< "found '<::' after a " "%select{template name|const_cast|dynamic_cast|reinterpret_cast|static_cast}0" " which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?">; -def warn_deleted_function_accepted_as_extension: ExtWarn< - "deleted function definition accepted as a C++11 extension">, InGroup<CXX11>; -def warn_defaulted_function_accepted_as_extension: ExtWarn< - "defaulted function definition accepted as a C++11 extension">, - InGroup<CXX11>; +def ext_deleted_function : ExtWarn< + "deleted function definitions are a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_deleted_function : Warning< + "deleted function definitions are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; +def ext_defaulted_function : ExtWarn< + "defaulted function definitions are a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_defaulted_function : Warning< + "defaulted function definitions are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; // C++11 in-class member initialization -def warn_nonstatic_member_init_accepted_as_extension: ExtWarn< - "in-class initialization of non-static data member accepted as a C++11 extension">, +def ext_nonstatic_member_init : ExtWarn< + "in-class initialization of non-static data member is a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_nonstatic_member_init : Warning< + "in-class initialization of non-static data members is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_bitfield_member_init: Error< "bitfield member cannot have an in-class initializer">; def err_incomplete_array_member_init: Error< @@ -481,23 +589,30 @@ def err_incomplete_array_member_init: Error< // C++11 alias-declaration def ext_alias_declaration : ExtWarn< - "alias declarations accepted as a C++11 extension">, InGroup<CXX11>; + "alias declarations are a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_alias_declaration : Warning< + "alias declarations are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; 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 : Extension< - "'%0' keyword accepted as a C++11 extension">, InGroup<CXX11>; +def ext_override_control_keyword : ExtWarn< + "'%0' keyword is a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_override_control_keyword : Warning< + "'%0' keyword is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_duplicate_virt_specifier : Error< "class member already marked '%0'">; -def err_duplicate_class_virt_specifier : Error< - "class already marked '%0'">; def err_scoped_enum_missing_identifier : Error< "scoped enumeration requires a name">; +def warn_cxx98_compat_scoped_enum : Warning< + "scoped enumerations are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_expected_parameter_pack : Error< "expected the name of a parameter pack">; @@ -514,6 +629,11 @@ def err_this_captured_by_reference : Error< def err_expected_capture : Error< "expected variable name or 'this' in lambda capture list">; def err_expected_lambda_body : Error<"expected body of lambda expression">; +def warn_cxx98_compat_lambda : Warning< + "lambda expressions are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; +def err_lambda_missing_parens : Error< + "lambda requires '()' before %select{'mutable'|return type}0">; // Availability attribute def err_expected_version : Error< @@ -554,8 +674,6 @@ def warn_pragma_align_invalid_option : Warning< // - #pragma pack def warn_pragma_pack_invalid_action : Warning< "unknown action for '#pragma pack' - ignored">; -def warn_pragma_pack_invalid_constant : Warning< - "invalid constant for '#pragma pack', expected %0 - ignored">; def warn_pragma_pack_malformed : Warning< "expected integer or identifier in '#pragma pack' - ignored">; // - #pragma unused @@ -592,7 +710,7 @@ def err_seh___finally_block : Error< let CategoryName = "Modules Issue" in { def err_module_expected_ident : Error< - "expected a module name after '__import_module__'">; + "expected a module name after module import">; def err_module_expected_semi : Error< "expected a semicolon name after module name">; } diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 0fbf0cee0a5d7..e553740ab1dfe 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -16,10 +16,38 @@ let CategoryName = "Semantic Issue" in { // Constant expressions def err_expr_not_ice : Error< - "expression is not an integer constant expression">; + "expression is not an %select{integer|integral}0 constant expression">; def ext_expr_not_ice : Extension< - "expression is not integer constant expression " - "(but is allowed as an extension)">; + "expression is not an %select{integer|integral}0 constant expression; " + "folding it to a constant is a GNU extension">, InGroup<GNU>; +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_expr_not_cce : Error< + "%select{case value|enumerator value|non-type template argument}0 " + "is not a constant expression">; +def err_cce_narrowing : ExtWarn< + "%select{case value|enumerator value|non-type template argument}0 " + "%select{cannot be narrowed from type %2 to %3|" + "evaluates to %2, which cannot be narrowed to type %3}1">, + InGroup<CXX11Narrowing>, DefaultError; +def err_cce_narrowing_sfinae : Error< + "%select{case value|enumerator value|non-type template argument}0 " + "%select{cannot be narrowed from type %2 to %3|" + "evaluates to %2, which cannot be narrowed to type %3}1">; +def err_ice_not_integral : Error< + "integral constant expression must have integral or unscoped enumeration " + "type, not %0">; +def err_ice_incomplete_type : Error< + "integral constant expression has incomplete class type %0">; +def err_ice_explicit_conversion : Error< + "integral constant expression requires explicit conversion from %0 to %1">; +def note_ice_conversion_here : Note< + "conversion to %select{integral|enumeration}0 type %1 declared here">; +def err_ice_ambiguous_conversion : Error< + "ambiguous conversion from type %0 to an integral or unscoped " + "enumeration type">; // Semantic analysis of constant literals. def ext_predef_outside_function : Warning< @@ -35,8 +63,7 @@ def warn_double_const_requires_fp64 : Warning< "double precision constant requires cl_khr_fp64, casting to single precision">; // C99 variable-length arrays -def ext_vla : Extension< - "variable length arrays are a C99 feature, accepted as an extension">, +def ext_vla : Extension<"variable length arrays are a C99 feature">, InGroup<VLA>; def err_vla_non_pod : Error<"variable length array of non-POD element type %0">; def err_vla_in_sfinae : Error< @@ -63,8 +90,6 @@ def err_variably_modified_new_type : Error< // C99 Designated Initializers def ext_designated_init : Extension< "designated initializers are a C99 feature">; -def ext_designated_init_cxx : Extension< - "designated initializers are a C99 feature, accepted in C++ as an extension">; def err_array_designator_negative : Error< "array designator value '%0' is negative">; def err_array_designator_empty_range : Error< @@ -100,8 +125,6 @@ def ext_flexible_array_init : Extension< "flexible array initialization is a GNU extension">, InGroup<GNU>; // Declarations. -def ext_anon_param_requires_type_specifier : Extension< - "type specifier required for unnamed parameter, defaults to int">; def err_bad_variable_name : Error< "%0 cannot be the name of a variable or data member">; def err_bad_parameter_name : Error< @@ -114,7 +137,20 @@ def warn_unused_variable : Warning<"unused variable %0">, def warn_unused_exception_param : Warning<"unused exception parameter %0">, InGroup<UnusedExceptionParameter>, DefaultIgnore; def warn_decl_in_param_list : Warning< - "declaration of %0 will not be visible outside of this function">; + "declaration of %0 will not be visible outside of this function">, + InGroup<Visibility>; +def warn_redefinition_in_param_list : Warning< + "redefinition of %0 will not be visible outside of this function">, + InGroup<Visibility>; +def warn_empty_parens_are_function_decl : Warning< + "empty parentheses interpreted as a function declaration">, + InGroup<VexingParse>; +def note_empty_parens_function_call : Note< + "change this ',' to a ';' to call %0">; +def note_empty_parens_default_ctor : Note< + "remove parentheses to declare a variable">; +def note_empty_parens_zero_initialize : Note< + "replace parentheses with an initializer to declare a variable">; def warn_unused_function : Warning<"unused function %0">, InGroup<UnusedFunction>, DefaultIgnore; def warn_unused_member_function : Warning<"unused member function %0">, @@ -134,13 +170,16 @@ def warn_parameter_size: Warning< def warn_return_value_size: Warning< "return value of %0 is a large (%1 bytes) pass-by-value object; " "pass it by reference instead ?">, InGroup<LargeByValueCopy>; - +def warn_return_value_udt: Warning< + "%0 has C-linkage specified, but returns user-defined type %1 which is " + "incompatible with C">, InGroup<ReturnTypeCLinkage>; def warn_implicit_function_decl : Warning< "implicit declaration of function %0">, InGroup<ImplicitFunctionDeclare>, DefaultIgnore; def ext_implicit_function_decl : ExtWarn< "implicit declaration of function %0 is invalid in C99">, InGroup<ImplicitFunctionDeclare>; +def note_function_suggestion : Note<"did you mean %0?">; def err_ellipsis_first_arg : Error< "ISO C requires a named argument before '...'">; @@ -192,6 +231,9 @@ def err_using_decl_can_not_refer_to_namespace : Error< "using declaration can not refer to namespace">; def err_using_decl_constructor : Error< "using declaration can not refer to a constructor">; +def warn_cxx98_compat_using_decl_constructor : Warning< + "inherited constructors are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_using_decl_destructor : Error< "using declaration can not refer to a destructor">; def err_using_decl_template_id : Error< @@ -247,23 +289,30 @@ def warn_unreachable : Warning<"will never be executed">, /// Built-in functions. def ext_implicit_lib_function_decl : ExtWarn< - "implicitly declaring C library function '%0' with type %1">; + "implicitly declaring library function '%0' with type %1">; def note_please_include_header : Note< "please include the header <%0> or explicitly provide a " "declaration for '%1'">; def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">; def warn_implicit_decl_requires_stdio : Warning< "declaration of built-in function '%0' requires inclusion of the header " - "<stdio.h>">; + "<stdio.h>">, + InGroup<BuiltinRequiresHeader>; def warn_implicit_decl_requires_setjmp : Warning< "declaration of built-in function '%0' requires inclusion of the header " - "<setjmp.h>">; + "<setjmp.h>">, + InGroup<BuiltinRequiresHeader>; +def warn_implicit_decl_requires_ucontext : Warning< + "declaration of built-in function '%0' requires inclusion of the header " + "<ucontext.h>">, + InGroup<BuiltinRequiresHeader>; def warn_redecl_library_builtin : Warning< "incompatible redeclaration of library function %0">; def err_builtin_definition : Error<"definition of builtin function %0">; def err_types_compatible_p_in_cplusplus : Error< "__builtin_types_compatible_p is not valid in C++">; -def warn_builtin_unknown : Warning<"use of unknown builtin %0">, DefaultError; +def warn_builtin_unknown : Warning<"use of unknown builtin %0">, + InGroup<ImplicitFunctionDeclare>, DefaultError; def warn_dyn_class_memaccess : Warning< "%select{destination for|source of|first operand of|second operand of}0 this " "%1 call is a pointer to dynamic class %2; vtable pointer will be " @@ -286,6 +335,15 @@ def warn_strlcpycat_wrong_size : Warning< InGroup<DiagGroup<"strlcpy-strlcat-size">>; def note_strlcpycat_wrong_size : Note< "change size argument to be the size of the destination">; + +def warn_strncat_large_size : Warning< + "the value of the size argument in 'strncat' is too large, might lead to a " + "buffer overflow">, InGroup<StrncatSize>, DefaultIgnore; +def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears " + "to be size of the source">, InGroup<StrncatSize>, DefaultIgnore; +def note_strncat_wrong_size : Note< + "change the argument to be the free space in the destination buffer minus " + "the terminating null byte">; /// main() // static/inline main() are not errors in C, just in C++. @@ -293,8 +351,12 @@ def warn_static_main : Warning<"'main' should not be declared static">, InGroup<Main>; def err_static_main : Error<"'main' is not allowed to be declared static">; def err_inline_main : Error<"'main' is not allowed to be declared inline">; +def err_constexpr_main : Error< + "'main' is not allowed to be declared constexpr">; def err_main_template_decl : Error<"'main' cannot be a template">; def err_main_returns_nonint : Error<"'main' must return 'int'">; +def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">, + InGroup<MainReturnType>; def err_main_surplus_args : Error<"too many parameters (%0) for 'main': " "must be 0, 2, or 3">; def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">, @@ -333,8 +395,14 @@ def warn_pragma_unused_undeclared_var : Warning< "undeclared variable %0 used as an argument for '#pragma unused'">; def warn_pragma_unused_expected_var_arg : Warning< "only variables can be arguments to '#pragma unused'">; -def err_unsupported_pragma_weak : Error< - "using '#pragma weak' to refer to an undeclared identifier is not yet supported">; +def err_pragma_push_visibility_mismatch : Error< + "#pragma visibility push with no matching #pragma visibility pop">; +def note_surrounding_namespace_ends_here : Note< + "surrounding namespace with visibility attribute ends here">; +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">; /// Objective-C parser diagnostics def err_duplicate_class_def : Error< @@ -364,12 +432,25 @@ def warn_property_attribute : Warning< def warn_property_types_are_incompatible : Warning< "property type %0 is incompatible with type %1 inherited from %2">; def err_undef_interface : Error<"cannot find interface declaration for %0">; +def err_category_forward_interface : Error< + "cannot define %select{category|class extension}0 for undefined class %1">; def err_class_extension_after_impl : Error< "cannot declare class extension for %0 after class implementation">; def note_implementation_declared : Note< "class implementation is declared here">; def note_class_declared : Note< "class is declared here">; +def note_receiver_is_id : Note< + "receiver is treated with 'id' type for purpose of method lookup">; +def note_suppressed_class_declare : Note< + "class with specified objc_requires_property_definitions attribute is declared here">; +def err_objc_root_class_subclass : Error< + "objc_root_class attribute may only be specified on a root class declaration">; +def warn_objc_root_class_missing : Warning< + "class %0 defined without specifying a base class">, + InGroup<ObjCRootClass>, DefaultIgnore; +def note_objc_needs_superclass : Note< + "add a super class to fix this problem">; def warn_dup_category_def : Warning< "duplicate definition of category %1 on interface %0">; def err_conflicting_super_class : Error<"conflicting super class name %0">; @@ -473,11 +554,13 @@ def warn_strict_multiple_method_decl : Warning< "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore; def warn_accessor_property_type_mismatch : Warning< "type of property %0 does not match type of accessor %1">; -def note_declared_at : Note<"declared here">; -def note_method_declared_at : Note<"method declared here">; +def not_conv_function_declared_at : Note<"type conversion function declared here">; +def note_method_declared_at : Note<"method %0 declared here">; def err_setter_type_void : Error<"type of setter must be void">; def err_duplicate_method_decl : Error<"duplicate declaration of method %0">; -def err_missing_atend : Error<"'@end' is missing in implementation context">; +def warn_duplicate_method_decl : + Warning<"multiple declarations of method %0 found and ignored">, + InGroup<MethodDuplicate>, DefaultIgnore; def err_objc_var_decl_inclass : Error<"cannot declare variable inside @interface or @protocol">; def error_missing_method_context : Error< @@ -489,6 +572,10 @@ def err_objc_property_requires_object : Error< def warn_objc_property_no_assignment_attribute : Warning< "no 'assign', 'retain', or 'copy' attribute is specified - " "'assign' is assumed">; +def warn_objc_isa_use : Warning< + "direct access to objective-c's isa is deprecated " + "in favor of object_setClass() and object_getClass()">, + InGroup<DiagGroup<"deprecated-objc-isa-usage">>; def warn_objc_property_default_assign_on_object : Warning< "default property attribute 'assign' not appropriate for non-gc object">; def warn_property_attr_mismatch : Warning< @@ -499,19 +586,26 @@ def warn_objc_property_copy_missing_on_block : Warning< def warn_objc_property_retain_of_block : Warning< "retain'ed block property does not copy the block " "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>; +def warn_objc_readonly_property_has_setter : Warning< + "setter cannot be specified for a readonly property">, + InGroup<ObjCReadonlyPropertyHasSetter>; def warn_atomic_property_rule : Warning< "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 " "with a user defined %select{getter|setter}2">, InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>; def note_atomic_property_fixup_suggest : Note<"setter and getter must both be " "synthesized, or both be user defined,or the property must be nonatomic">; -def warn_atomic_property_nontrivial_assign_op : Warning< - "atomic property of type %0 synthesizing setter using non-trivial assignment" - " operator">, InGroup<DiagGroup<"objc-property-atomic-setter-synthesis">>; +def err_atomic_property_nontrivial_assign_op : Error< + "atomic property of reference type %0 cannot have non-trivial assignment" + " operator">; def warn_owning_getter_rule : Warning< "property's synthesized getter follows Cocoa naming" " convention for returning 'owned' objects">, InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>; +def warn_auto_synthesizing_protocol_property :Warning< + "auto property synthesis will not synthesize property" + " declared in a protocol">, + InGroup<DiagGroup<"objc-protocol-property-synthesis">>; def warn_property_getter_owning_mismatch : Warning< "property declared as returning non-retained objects" "; getter returning retained objects">; @@ -525,9 +619,9 @@ def warn_default_atomic_custom_getter_setter : Warning< def err_use_continuation_class : Error< "illegal redeclaration of property in continuation class %0" " (attribute must be 'readwrite', while its primary must be 'readonly')">; -def warn_type_mismatch_continuation_class : Warning< +def err_type_mismatch_continuation_class : Error< "type of property %0 in continuation class does not match " - "property type in primary class">, InGroup<ObjCContinuationPropertyType>; + "property type in primary class">; def err_use_continuation_class_redeclaration_readwrite : Error< "illegal redeclaration of 'readwrite' property in continuation class %0" " (perhaps you intended this to be a 'readwrite' redeclaration of a " @@ -565,6 +659,9 @@ def warn_arc_perform_selector_leaks : Warning< InGroup<DiagGroup<"arc-performSelector-leaks">>; def err_gc_weak_property_strong_type : Error< "weak attribute declared on a __strong type property in GC mode">; +def warn_receiver_is_weak : Warning < + "weak receiver may be unpredictably null in ARC mode">, + InGroup<DiagGroup<"receiver-is-weak">>, DefaultIgnore; def error_synthesized_ivar_yet_not_supported : Error< "instance variable synthesis not yet supported" @@ -602,12 +699,12 @@ def warn_auto_implicit_atomic_property : Warning< def warn_unimplemented_selector: Warning< "unimplemented selector %0">, InGroup<Selector>, DefaultIgnore; def warn_unimplemented_protocol_method : Warning< - "method in protocol not implemented">, InGroup<Protocol>; + "method %0 in protocol not implemented">, InGroup<Protocol>; // C++ declarations def err_static_assert_expression_is_not_constant : Error< "static_assert expression is not an integral constant expression">; -def err_static_assert_failed : Error<"static_assert failed \"%0\"">; +def err_static_assert_failed : Error<"static_assert failed %0">; def warn_inline_namespace_reopened_noninline : Warning< "inline namespace cannot be re-opened as a non-inline namespace">; @@ -619,13 +716,25 @@ def err_unexpected_friend : Error< "friends can only be classes or functions">; def ext_enum_friend : ExtWarn< "enumeration type %0 cannot be a friend">; +def warn_cxx98_compat_enum_friend : Warning< + "befriending enumeration type %0 is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def ext_nonclass_type_friend : ExtWarn< "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_nonclass_type_friend : Warning< + "non-class friend type %0 is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_friend_is_member : Error< "friends cannot be members of the declaring class">; +def warn_cxx98_compat_friend_is_member : Warning< + "friend declaration naming a member of the declaring class is incompatible " + "with C++98">, InGroup<CXX98Compat>, DefaultIgnore; def ext_unelaborated_friend_type : ExtWarn< - "specify '%select{struct|union|class|enum}0' to befriend %1; accepted " - "as a C++11 extension">, InGroup<CXX11>; + "unelaborated friend declaration is a C++11 extension; specify " + "'%select{struct|union|class|enum}0' to befriend %1">, InGroup<CXX11>; +def warn_cxx98_compat_unelaborated_friend_type : Warning< + "befriending %1 without '%select{struct|union|class|enum}0' keyword is " + "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; def err_qualified_friend_not_found : Error< "no function named %0 with type %1 was found in the specified scope">; def err_introducing_special_friend : Error< @@ -675,6 +784,10 @@ def warn_weak_vtable : Warning< "%0 has no out-of-line virtual method definitions; its vtable will be " "emitted in every translation unit">, InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore; +def warn_weak_template_vtable : Warning< + "explicit template instantiation %0 will emit a vtable in every " + "translation unit">, + InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore; def ext_using_undefined_std : ExtWarn< "using directive refers to implicitly-defined namespace 'std'">; @@ -714,9 +827,9 @@ def err_class_redeclared_with_different_access : Error< "%0 redeclared with '%1' access">; def err_access : Error< "%1 is a %select{private|protected}0 member of %3">, AccessControl; -def war_ms_using_declaration_inaccessible : ExtWarn< - "using declaration refers to inaccessible member '%0', which refers " - "to accessible member '%1', accepted for Microsoft compatibility">, +def ext_ms_using_declaration_inaccessible : ExtWarn< + "using declaration referring to inaccessible member '%0' (which refers " + "to accessible member '%1') is a Microsoft compatibility extension">, AccessControl, InGroup<Microsoft>; def err_access_ctor : Error< "calling a %select{private|protected}0 constructor of class %2">, @@ -738,9 +851,6 @@ def err_access_field_ctor : Error< "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">, AccessControl; -def err_access_ctor_field : - Error<"field of type %1 has %select{private|protected}2 constructor">, - AccessControl; def err_access_dtor : Error< "calling a %select{private|protected}1 destructor of class %0">, AccessControl; @@ -763,36 +873,27 @@ def err_access_dtor_field : def err_access_dtor_var : Error<"variable of type %1 has %select{private|protected}2 destructor">, AccessControl; -def err_access_assign_field : - Error<"field of type %1 has %select{private|protected}2 copy assignment" - " operator">, - AccessControl; -def err_access_assign_base : - Error<"base class %0 has %select{private|protected}1 copy assignment" - " operator">, - AccessControl; -def err_access_copy_field : - Error<"field of type %1 has %select{private|protected}2 copy constructor">, - AccessControl; -def err_access_copy_base : - Error<"base class %0 has %select{private|protected}1 copy constructor">, - AccessControl; def err_access_dtor_ivar : Error<"instance variable of type %0 has %select{private|protected}1 " "destructor">, AccessControl; def note_previous_access_declaration : Note< "previously declared '%1' here">; -def err_access_outside_class : Error< - "access to %select{private|protected}0 member outside any class context">, - AccessControl; def note_access_natural : Note< "%select{|implicitly }1declared %select{private|protected}0 here">; def note_access_constrained_by_path : Note< "constrained by %select{|implicitly }1%select{private|protected}0" " inheritance here">; -def note_access_protected_restricted : Note< - "object type %select{|%1 }0must derive from context type %2">; +def note_access_protected_restricted_noobject : Note< + "must name member using the type of the current context %0">; +def note_access_protected_restricted_ctordtor : Note< + "protected %select{constructor|destructor}0 can only be used to " + "%select{construct|destroy}0 a base class subobject">; +def note_access_protected_restricted_object : Note< + "can only access this member on an object of type %0">; +def warn_cxx98_compat_sfinae_access_control : Warning< + "substitution failure due to access control is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE; // C++ name lookup def err_incomplete_nested_name_spec : Error< @@ -815,6 +916,9 @@ def err_incomplete_member_access : Error< "member access into incomplete type %0">; def err_incomplete_type : Error< "incomplete type %0 where a complete type is required">; +def warn_cxx98_compat_enum_nested_name_spec : Warning< + "enumeration type in nested name specifier is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; // C++ class members def err_storageclass_invalid_for_member : Error< @@ -879,6 +983,11 @@ def err_illegal_union_or_anon_struct_member : Error< "%select{anonymous struct|union}0 member %1 has a non-trivial " "%select{constructor|copy constructor|move constructor|copy assignment " "operator|move assignment operator|destructor}2">; +def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning< + "%select{anonymous struct|union}0 member %1 with a non-trivial " + "%select{constructor|copy constructor|move constructor|copy assignment " + "operator|move assignment operator|destructor}2 is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def note_nontrivial_has_virtual : Note< "because type %0 has a virtual %select{member function|base class}1">; def note_nontrivial_has_nontrivial : Note< @@ -889,8 +998,13 @@ def note_nontrivial_user_defined : Note< "because type %0 has a user-declared %select{constructor|copy constructor|" "move constructor|copy assignment operator|move assignment operator|" "destructor}1">; -def err_static_data_member_not_allowed_in_union_or_anon_struct : Error< - "static data member %0 not allowed in %select{anonymous struct|union}1">; +def err_static_data_member_not_allowed_in_anon_struct : Error< + "static data member %0 not allowed in anonymous struct">; +def ext_static_data_member_in_union : ExtWarn< + "static data member %0 in union is a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_static_data_member_in_union : Warning< + "static data member %0 in union is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_union_member_of_reference_type : Error< "union member %0 has reference type %1">; def ext_anonymous_struct_union_qualified : Extension< @@ -977,17 +1091,22 @@ def err_init_conversion_failed : Error< "cannot initialize %select{a variable|a parameter|return object|an " "exception object|a member subobject|an array element|a new value|a value|a " "base class|a constructor delegation|a vector element}0 of type %1 with an " - "%select{rvalue|lvalue}2 of type %3">; + "%select{rvalue|lvalue}2 of type %3" + "%select{|: different classes (%5 vs %6)" + "|: different number of parameters (%5 vs %6)" + "|: type mismatch at %ordinal5 parameter (%6 vs %7)" + "|: different return type (%5 vs %6)" + "|: different qualifiers (" + "%select{none|const|restrict|const and restrict|volatile|const and volatile|" + "volatile and restrict|const, volatile, and restrict}5 vs " + "%select{none|const|restrict|const and restrict|volatile|const and volatile|" + "volatile and restrict|const, volatile, and restrict}6)}4">; def err_lvalue_to_rvalue_ref : Error<"rvalue reference to type %0 cannot bind " "to lvalue of type %1">; -def err_invalid_initialization : Error< -"invalid initialization of reference of type %0 from expression of type %1">; -def err_lvalue_to_rvalue_ambig_ref : Error<"rvalue reference cannot bind to lvalue " - "due to multiple conversion functions">; -def err_not_reference_to_const_init : Error< - "%select{non-const|volatile}0 lvalue reference to type %1 cannot be " - "initialized with a %select{value|temporary}2 of type %3">; +def err_lvalue_reference_bind_to_initlist : Error< + "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an " + "initializer list temporary">; def err_lvalue_reference_bind_to_temporary : Error< "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to a " "temporary of type %2">; @@ -1009,17 +1128,12 @@ def err_member_function_call_bad_cvr : Error<"member function %0 not viable: " "%select{const|restrict|const or restrict|volatile|const or volatile|" "volatile or restrict|const, volatile, or restrict}2">; -def err_reference_init_drops_quals : Error< - "initialization of reference to type %0 with a %select{value|temporary}1 of type %2 drops " - "qualifiers">; def err_reference_bind_to_bitfield : Error< "%select{non-const|volatile}0 reference cannot bind to bit-field %1">; def err_reference_bind_to_vector_element : Error< "%select{non-const|volatile}0 reference cannot bind to vector element">; def err_reference_var_requires_init : Error< "declaration of reference variable %0 requires an initializer">; -def err_const_var_requires_init : Error< - "declaration of const variable '%0' requires an initializer">; def err_reference_without_init : Error< "reference to type %0 requires an initializer">; def err_reference_has_multiple_inits : Error< @@ -1049,6 +1163,11 @@ def warn_uninit_var_captured_by_block : Warning< def warn_maybe_uninit_var_captured_by_block : Warning< "variable %0 may be uninitialized when captured by block">, InGroup<UninitializedMaybe>, DefaultIgnore; +def warn_uninit_byref_blockvar_captured_by_block : Warning< + "block pointer variable %0 is uninitialized when captured by block">, + InGroup<Uninitialized>, DefaultIgnore; +def note_block_var_fixit_add_initialization : Note< + "maybe you meant to use __block %0">; def note_var_fixit_add_initialization : Note< "initialize the variable %0 to silence this warning">; def err_init_incomplete_type : Error<"initialization of incomplete type %0">; @@ -1057,32 +1176,47 @@ def err_temp_copy_no_viable : Error< "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|" - "initializing vector element}0 of type %1">; + "initializing vector element|capturing value}0 of type %1">; def ext_rvalue_to_reference_temp_copy_no_viable : ExtWarn< "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|" - "initializing vector element}0 of type %1; C++98 requires a copy " + "initializing vector element|capturing value}0 of type %1; C++98 requires a copy " "constructor when binding a reference to a temporary">, InGroup<BindToTemporaryCopy>; def err_temp_copy_ambiguous : Error< "ambiguous constructor call when %select{copying variable|copying " "parameter|returning object|throwing object|copying member subobject|copying " "array element|allocating object|copying temporary|initializing base subobject|" - "initializing vector element}0 of type %1">; + "initializing vector element|capturing value}0 of type %1">; def err_temp_copy_deleted : Error< "%select{copying variable|copying parameter|returning object|throwing " "object|copying member subobject|copying array element|allocating object|" - "copying temporary|initializing base subobject|initializing vector element}0 " - "of type %1 invokes deleted constructor">; + "copying temporary|initializing base subobject|initializing vector element|" + "capturing value}0 of type %1 invokes deleted constructor">; def err_temp_copy_incomplete : Error< "copying a temporary object of incomplete type %0">; +def warn_cxx98_compat_temp_copy : Warning< + "%select{copying variable|copying parameter|returning object|throwing " + "object|copying member subobject|copying array element|allocating object|" + "copying temporary|initializing base subobject|initializing vector element}1 " + "of type %2 when binding a reference to a temporary would %select{invoke " + "an inaccessible constructor|find no viable constructor|find ambiguous " + "constructors|invoke a deleted constructor}0 in C++98">, + InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore; +def err_selected_explicit_constructor : Error< + "chosen constructor is explicit in copy-initialization">; +def note_constructor_declared_here : Note< + "constructor declared here">; // C++11 decltype -def err_cannot_determine_declared_type_of_overloaded_function : Error< - "cannot determine the type of an overloaded function">; +def err_decltype_in_declarator : Error< + "'decltype' cannot be used to name a declaration">; // C++11 auto +def warn_cxx98_compat_auto_type_specifier : Warning< + "'auto' type specifier is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_auto_variable_cannot_appear_in_own_initializer : Error< "variable %0 declared with 'auto' type cannot appear in its own initializer">; def err_illegal_decl_array_of_auto : Error< @@ -1098,6 +1232,10 @@ def err_auto_var_requires_init : Error< "declaration of variable %0 with type %1 requires an initializer">; def err_auto_new_requires_ctor_arg : Error< "new expression for type %0 requires a constructor argument">; +def err_auto_new_requires_parens : Error< + "new expression for type %0 cannot use list-initialization">; +def err_auto_var_init_no_expression : Error< + "initializer for variable %0 with type %1 is empty">; def err_auto_var_init_multiple_expressions : Error< "initializer for variable %0 with type %1 contains multiple expressions">; def err_auto_new_ctor_multiple_expressions : Error< @@ -1110,10 +1248,21 @@ def err_trailing_return_in_parens : Error< "trailing return type may not be nested within parentheses">; def err_auto_var_deduction_failure : Error< "variable %0 with type %1 has incompatible initializer of type %2">; +def err_auto_var_deduction_failure_from_init_list : Error< + "cannot deduce actual type for variable %0 with type %1 from initializer list">; def err_auto_new_deduction_failure : Error< "new expression for type %0 has incompatible constructor argument of type %1">; def err_auto_different_deductions : Error< "'auto' deduced as %0 in declaration of %1 and deduced as %2 in declaration of %3">; +def err_implied_std_initializer_list_not_found : Error< + "cannot deduce type of initializer list because std::initializer_list was " + "not found; include <initializer_list>">; +def err_malformed_std_initializer_list : Error< + "std::initializer_list must be a class template with a single type parameter">; +def warn_dangling_std_initializer_list : Warning< + "array backing the initializer list will be destroyed at the end of " + "%select{the full-expression|the constructor}0">, + InGroup<DiagGroup<"dangling-initializer-list">>; // C++11 override control def override_keyword_only_allowed_on_virtual_member_functions : Error< @@ -1126,11 +1275,9 @@ def err_class_marked_final_used_as_base : Error< // C++11 attributes def err_repeat_attribute : Error<"'%0' attribute cannot be repeated">; -// C++11 [[final]] +// C++11 final def err_final_function_overridden : Error< "declaration of %0 overrides a 'final' function">; -def err_final_base : Error< - "derivation from 'final' %0">; // C++11 scoped enumerations def err_enum_invalid_underlying : Error< @@ -1148,14 +1295,18 @@ def err_enum_redeclare_fixed_mismatch : Error< "enumeration previously declared with %select{non|}0fixed underlying type">; def err_enum_redeclare_scoped_mismatch : Error< "enumeration previously declared as %select{un|}0scoped">; +def err_enum_class_reference : Error< + "reference to %select{|scoped }0enumeration must use 'enum' " + "not 'enum class'">; def err_only_enums_have_underlying_types : Error< "only enumeration types have underlying types">; -def err_incomplete_type_no_underlying_type : Error< - "an incomplete enumeration type has no underlying type yet">; // C++11 delegating constructors -def err_delegation_0x_only : Error< +def err_delegating_ctor : Error< "delegating constructors are permitted only in C++11">; +def warn_cxx98_compat_delegating_ctor : Warning< + "delegating constructors are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_delegating_initializer_alone : Error< "an initializer for a delegating constructor must appear alone">; def warn_delegating_ctor_cycle : Warning< @@ -1165,8 +1316,6 @@ def note_it_delegates_to : Note< "it delegates to">, InGroup<DelegatingCtorCycles>; def note_which_delegates_to : Note< "which delegates to">, InGroup<DelegatingCtorCycles>; -def err_delegating_codegen_not_implemented : Error< - "code generation for delegating constructors not implemented">; // C++11 range-based for loop def err_for_range_decl_must_be_var : Error< @@ -1191,6 +1340,9 @@ def note_for_range_begin_end : Note< "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">; // C++11 constexpr +def warn_cxx98_compat_constexpr : Warning< + "'constexpr' specifier is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_invalid_constexpr : Error< "%select{function parameter|typedef|non-static data member}0 " "cannot be constexpr">; @@ -1201,37 +1353,27 @@ def err_constexpr_no_declarators : Error< "constexpr can only be used in variable and function declarations">; def err_invalid_constexpr_var_decl : Error< "constexpr variable declaration must be a definition">; -def err_constexpr_var_requires_init : Error< - "declaration of constexpr variable %0 requires an initializer">; +def err_constexpr_static_mem_var_requires_init : Error< + "declaration of constexpr static data member %0 requires an initializer">; +def err_constexpr_var_non_literal : Error< + "constexpr variable cannot have non-literal type %0">; def err_constexpr_var_requires_const_init : Error< "constexpr variable %0 must be initialized by a constant expression">; def err_constexpr_redecl_mismatch : Error< "%select{non-constexpr declaration of %0 follows constexpr declaration" "|constexpr declaration of %0 follows non-constexpr declaration}1">; -def note_constexpr_redecl_mismatch : Note< - "previous declaration was %select{not |}0marked constexpr">; def err_constexpr_virtual : Error<"virtual function cannot be constexpr">; -def note_constexpr_tmpl_virtual : Note<"function template instantiation is not " - "constexpr because it is virtual">; -def err_constexpr_virtual_base : Error<"constexpr constructor not allowed in " - "%select{class|struct}0 with virtual base %plural{1:class|:classes}1">; -def note_constexpr_tmpl_virtual_base : Note<"constructor template instantiation is " - "not constexpr because %select{class|struct}0 has virtual base " - "%plural{1:class|:classes}1">; +def err_constexpr_virtual_base : Error< + "constexpr %select{member function|constructor}0 not allowed in " + "%select{class|struct}1 with virtual base %plural{1:class|:classes}2">; def note_non_literal_virtual_base : Note<"%select{class|struct}0 with virtual " "base %plural{1:class|:classes}1 is not a literal type">; def note_constexpr_virtual_base_here : Note<"virtual base class declared here">; def err_constexpr_non_literal_return : Error< "constexpr function's return type %0 is not a literal type">; -def note_constexpr_tmpl_non_literal_return : Note< - "function template instantiation is not constexpr because return type %0 is " - "not a literal type">; def err_constexpr_non_literal_param : Error< "constexpr %select{function|constructor}1's %ordinal0 parameter type %2 is " "not a literal type">; -def note_constexpr_tmpl_non_literal_param : Note< - "%select{function|constructor}1 template instantiation is not constexpr " - "because %ordinal0 parameter type %2 is not a literal type">; def err_constexpr_body_invalid_stmt : Error< "statement not allowed in constexpr %select{function|constructor}0">; def err_constexpr_type_definition : Error< @@ -1241,6 +1383,9 @@ def err_constexpr_vla : Error< "%select{function|constructor}1">; def err_constexpr_var_declaration : Error< "variables cannot be declared in a constexpr %select{function|constructor}0">; +def err_constexpr_function_never_constant_expr : ExtWarn< + "constexpr %select{function|constructor}0 never produces a " + "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError; def err_constexpr_body_no_return : Error< "no return statement in constexpr function">; def err_constexpr_body_multiple_return : Error< @@ -1263,21 +1408,24 @@ def note_non_literal_no_constexpr_ctors : Note< def note_non_literal_base_class : Note< "%0 is not literal because it has base class %1 of non-literal type">; def note_non_literal_field : Note< - "%0 is not literal because it has data member %1 of non-literal type %2">; + "%0 is not literal because it has data member %1 of " + "%select{non-literal|volatile}3 type %2">; def note_non_literal_user_provided_dtor : Note< "%0 is not literal because it has a user-provided destructor">; def note_non_literal_nontrivial_dtor : Note< "%0 is not literal because it has a non-trivial destructor">; -def note_non_literal_mutable_field : Note< - "%0 is not literal because it has a mutable data member">; + +// C++11 char16_t/char32_t +def warn_cxx98_compat_unicode_type : Warning< + "'%0' type specifier is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; // Objective-C++ def err_objc_decls_may_only_appear_in_global_scope : Error< "Objective-C declarations may only appear in global scope">; +// Attributes def err_nsobject_attribute : Error< "__attribute ((NSObject)) is for pointer types only">; - -// Attributes def err_attribute_can_be_applied_only_to_symbol_declaration : Error< "%0 attribute can be applied only to symbol declaration">; def err_attributes_are_not_compatible : Error< @@ -1287,6 +1435,9 @@ def err_attribute_wrong_number_arguments : Error< ":requires exactly %0 arguments}0">; def err_attribute_too_many_arguments : Error< "attribute takes no more than %0 argument%s0">; +def err_suppress_autosynthesis : Error< + "objc_requires_property_definitions attribute may only be specified on a class" + "to a class declaration">; def err_attribute_too_few_arguments : Error< "attribute takes at least %0 argument%s0">; def err_attribute_missing_parameter_name : Error< @@ -1341,8 +1492,6 @@ def err_typecheck_vector_not_convertable : Error< "can't convert between vector values of different size (%0 and %1)">; def err_typecheck_ext_vector_not_typedef : Error< "ext_vector_type only applies to types, not variables">; -def err_unsupported_vector_size : Error< - "unsupported type %0 for vector_size attribute, please use on typedef">; def err_ext_vector_component_exceeds_length : Error< "vector component access exceeds type %0">; def err_ext_vector_component_name_illegal : Error< @@ -1361,12 +1510,46 @@ def err_as_qualified_auto_decl : Error< "automatic variable qualified with an address space">; def err_arg_with_address_space : Error< "parameter may not be qualified with an address space">; -def err_attr_objc_ownership_bad_type : Error< - "the type %0 cannot be retained">; def err_attr_objc_ownership_redundant : Error< - "the type %0 already has retainment attributes set on it">; + "the type %0 is already explicitly ownership-qualified">; def err_attribute_not_string : Error< "argument to %0 attribute was not a string literal">; +def err_undeclared_nsnumber : Error< + "NSNumber must be available to use Objective-C literals">; +def err_invalid_nsnumber_type : Error< + "%0 is not a valid literal type for NSNumber">; +def err_undeclared_nsarray : Error< + "NSArray must be available to use Objective-C array literals">; +def err_undeclared_nsdictionary : Error< + "NSDictionary must be available to use Objective-C dictionary " + "literals">; +def err_undeclared_arraywithobjects : Error< + "declaration of %0 is missing in NSArray class">; +def err_undeclared_dictwithobjects : Error< + "declaration of %0 is missing in NSDictionary class">; +def err_undeclared_nsnumber_method : Error< + "declaration of %0 is missing in NSNumber class">; +def err_objc_literal_method_sig : Error< + "literal construction method %0 has incompatible signature">; +def note_objc_literal_method_param : Note< + "%select{first|second|third}0 parameter has unexpected type %1 " + "(should be %2)">; +def note_objc_literal_method_return : Note< + "method returns unexpected type %0 (should be an object type)">; +def err_invalid_collection_element : Error< + "collection element of type %0 is not an Objective-C object">; +def err_box_literal_collection : Error< + "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' " + "in a collection">; + +let CategoryName = "Cocoa API Issue" in { +def warn_objc_redundant_literal_use : Warning< + "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>; +} + +def warn_bool_for_boolean_literal : Warning< + "BOOL of type %0 is non-intergal and unsuitable for a " + "boolean literal - ignored">, InGroup<DiagGroup<"numeric-literals">>; def err_only_annotate_after_access_spec : Error< "access specifier can only have annotation attributes">; def err_attribute_section_invalid_for_target : Error< @@ -1380,6 +1563,8 @@ def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning< def warn_attribute_ignored : Warning<"%0 attribute ignored">; def warn_unknown_attribute_ignored : Warning< "unknown attribute %0 ignored">, InGroup<UnknownAttributes>; +def warn_declspec_attribute_ignored : Warning< + "attribute %0 is ignored, place it after \"%select{class|struct|union|enum}1\" to apply attribute to type declaration">, InGroup<IgnoredAttributes>; def warn_attribute_precede_definition : Warning< "attribute declaration must precede definition">; def warn_attribute_void_function_method : Warning< @@ -1389,6 +1574,9 @@ def warn_attribute_weak_on_field : Warning< "__weak attribute cannot be specified on a field declaration">; def warn_gc_attribute_weak_on_local : Warning< "Objective-C GC does not allow weak variables on the stack">; +def warn_nsobject_attribute : Warning< + "__attribute ((NSObject)) may be put on a typedef only, " + "attribute is ignored">, InGroup<NSobjectAttribute>; def warn_attribute_weak_on_local : Warning< "__weak attribute cannot be specified on an automatic variable">; def warn_weak_identifier_undeclared : Warning< @@ -1408,16 +1596,15 @@ def err_alias_not_supported_on_darwin : Error < def warn_attribute_wrong_decl_type : Warning< "%0 attribute only applies to %select{functions|unions|" "variables and functions|functions and methods|parameters|" - "parameters and methods|functions, methods and blocks|" - "classes and virtual methods|functions, methods, and parameters|" - "classes|virtual methods|class members|variables|methods|" - "variables, functions and labels|fields and global variables}1">; + "functions, methods and blocks|functions, methods, and parameters|" + "classes|variables|methods|variables, functions and labels|" + "fields and global variables|structs}1">; def err_attribute_wrong_decl_type : Error< "%0 attribute only applies to %select{functions|unions|" "variables and functions|functions and methods|parameters|" - "parameters and methods|functions, methods and blocks|" - "classes and virtual methods|functions, methods, and parameters|" - "classes|virtual methods|class members|variables|methods|structs}1">; + "functions, methods and blocks|functions, methods, and parameters|" + "classes|variables|methods|variables, functions and labels|" + "fields and global variables|structs}1">; def warn_function_attribute_wrong_type : Warning< "'%0' only applies to function types; type here is %1">; def warn_pointer_attribute_wrong_type : Warning< @@ -1449,8 +1636,6 @@ def err_objc_precise_lifetime_bad_type : Error< def warn_objc_precise_lifetime_meaningless : Error< "objc_precise_lifetime is not meaningful for " "%select{__unsafe_unretained|__autoreleasing}0 objects">; -def warn_label_attribute_not_unused : Warning< - "The only valid attribute for labels is 'unused'">; def err_invalid_pcs : Error<"Invalid PCS type">; def err_attribute_can_be_applied_only_to_value_decl : Error< "%0 attribute can only be applied to value declarations">; @@ -1473,12 +1658,18 @@ def err_attribute_argument_out_of_range : Error< "%plural{0:no parameters to index into|" "1:can only be 1, since there is one parameter|" ":must be between 1 and %2}2">; -def err_attribute_argument_not_lockable : Error< +def warn_attribute_argument_not_lockable : Warning< "%0 attribute requires arguments whose type is annotated " - "with 'lockable' attribute">; -def err_attribute_decl_not_lockable : Error< + "with 'lockable' attribute; type here is '%1'">, + InGroup<ThreadSafety>, DefaultIgnore; +def warn_attribute_decl_not_lockable : Warning< "%0 attribute can only be applied in a context annotated " - "with 'lockable' attribute">; + "with 'lockable' attribute">, + InGroup<ThreadSafety>, DefaultIgnore; +def warn_attribute_argument_not_class : Warning< + "%0 attribute requires arguments that are class type or point to" + " class type; type here is '%1'">, + InGroup<ThreadSafety>, DefaultIgnore; def warn_unlock_but_no_lock : Warning< "unlocking '%0' that was not locked">, InGroup<ThreadSafety>, DefaultIgnore; @@ -1489,12 +1680,13 @@ def warn_no_unlock : Warning< "mutex '%0' is still locked at the end of function">, InGroup<ThreadSafety>, DefaultIgnore; // FIXME: improve the error message about locks not in scope -def warn_lock_at_end_of_scope : Warning< - "mutex '%0' is still locked at the end of its scope">, +def warn_lock_some_predecessors : Warning< + "mutex '%0' is not locked on every path through here">, InGroup<ThreadSafety>, DefaultIgnore; def warn_expecting_lock_held_on_loop : Warning< "expecting mutex '%0' to be locked at start of each loop">, InGroup<ThreadSafety>, DefaultIgnore; +def note_locked_here : Note<"mutex acquired here">; def warn_lock_exclusive_and_shared : Warning< "mutex '%0' is locked exclusively and shared in the same scope">, InGroup<ThreadSafety>, DefaultIgnore; @@ -1524,7 +1716,7 @@ def warn_fun_excludes_mutex : Warning< "cannot call function '%0' while mutex '%1' is locked">, InGroup<ThreadSafety>, DefaultIgnore; def warn_cannot_resolve_lock : Warning< - "cannot resolve lock expression to a specific lockable object">, + "cannot resolve lock expression">, InGroup<ThreadSafety>, DefaultIgnore; @@ -1542,10 +1734,10 @@ def warn_impcast_float_integer : Warning< InGroup<DiagGroup<"conversion">>, DefaultIgnore; def warn_impcast_integer_sign : Warning< "implicit conversion changes signedness: %0 to %1">, - InGroup<DiagGroup<"sign-conversion">>, DefaultIgnore; + InGroup<SignConversion>, DefaultIgnore; def warn_impcast_integer_sign_conditional : Warning< "operand of ? changes signedness: %0 to %1">, - InGroup<DiagGroup<"sign-conversion">>, DefaultIgnore; + InGroup<SignConversion>, DefaultIgnore; def warn_impcast_integer_precision : Warning< "implicit conversion loses integer precision: %0 to %1">, InGroup<DiagGroup<"conversion">>, DefaultIgnore; @@ -1554,26 +1746,33 @@ def warn_impcast_integer_64_32 : Warning< InGroup<DiagGroup<"shorten-64-to-32">>, DefaultIgnore; def warn_impcast_integer_precision_constant : Warning< "implicit conversion from %2 to %3 changes value from %0 to %1">, - InGroup<DiagGroup<"constant-conversion">>; + InGroup<ConstantConversion>; def warn_impcast_bitfield_precision_constant : Warning< "implicit truncation from %2 to bitfield changes value from %0 to %1">, - InGroup<DiagGroup<"constant-conversion">>; + InGroup<ConstantConversion>; def warn_impcast_literal_float_to_integer : Warning< "implicit conversion turns literal floating-point number into integer: " "%0 to %1">, - InGroup<DiagGroup<"literal-conversion">>, DefaultIgnore; + InGroup<LiteralConversion>; def warn_impcast_string_literal_to_bool : Warning< "implicit conversion turns string literal into bool: %0 to %1">, - InGroup<DiagGroup<"string-conversion">>, DefaultIgnore; + InGroup<StringConversion>, DefaultIgnore; def warn_impcast_different_enum_types : Warning< "implicit conversion from enumeration type %0 to different enumeration type " "%1">, InGroup<DiagGroup<"conversion">>; def warn_impcast_bool_to_null_pointer : Warning< "initialization of pointer of type %0 to null from a constant boolean " - "expression">, InGroup<BoolConversions>; + "expression">, InGroup<BoolConversion>; def warn_impcast_null_pointer_to_integer : Warning< - "implicit conversion of NULL constant to integer">, - InGroup<DiagGroup<"conversion">>, DefaultIgnore; + "implicit conversion of NULL constant to %0">, + InGroup<NullConversion>; +def warn_impcast_function_to_bool : Warning< + "address of function %q0 will always evaluate to 'true'">, + InGroup<BoolConversion>; +def note_function_to_bool_silence : Note< + "prefix with the address-of operator to silence this warning">; +def note_function_to_bool_call : Note< + "suffix with parentheses to turn this into a function call">; def warn_cast_align : Warning< "cast from %0 to %1 increases required alignment from %2 to %3">, @@ -1599,6 +1798,9 @@ def warn_transparent_union_attribute_zero_fields : Warning< def warn_attribute_type_not_supported : Warning< "'%0' attribute argument not supported: %1">; def warn_attribute_unknown_visibility : Warning<"unknown visibility '%0'">; +def warn_attribute_protected_visibility : + Warning<"target does not support 'protected' visibility; using 'default'">, + InGroup<DiagGroup<"unsupported-visibility">>; def err_unknown_machine_mode : Error<"unknown machine mode %0">; def err_unsupported_machine_mode : Error<"unsupported machine mode %0">; def err_mode_not_primitive : Error< @@ -1611,9 +1813,6 @@ def warn_attribute_nonnull_no_pointers : Warning< "'nonnull' attribute applied to function with no pointer arguments">; def warn_attribute_malloc_pointer_only : Warning< "'malloc' attribute only applies to functions returning a pointer type">; -def warn_transparent_union_nonpointer : Warning< - "'transparent_union' attribute support incomplete; only supported for " - "pointer unions">; def warn_attribute_sentinel_named_arguments : Warning< "'sentinel' attribute requires named arguments">; def warn_attribute_sentinel_not_variadic : Warning< @@ -1644,9 +1843,10 @@ def warn_attribute_ibaction: Warning< "ibaction attribute can only be applied to Objective-C instance methods">; def err_iboutletcollection_type : Error< "invalid type %0 as argument of iboutletcollection attribute">; -def err_iboutlet_object_type : Error< +def warn_iboutlet_object_type : Warning< "%select{ivar|property}2 with %0 attribute must " - "be an object type (invalid %1)">; + "be an object type (invalid %1)">, + InGroup<DiagGroup<"invalid-iboutlet">>; def err_attribute_overloadable_not_function : Error< "'overloadable' attribute can only be applied to a function">; def err_attribute_overloadable_missing : Error< @@ -1707,8 +1907,6 @@ def err_uninitialized_member_for_assign : Error< "cannot define the implicit default assignment operator for %0, because " "non-static %select{reference|const}1 member %2 can't use default " "assignment operator">; -def note_first_required_here : Note< - "synthesized method is first required here">; def err_uninitialized_member_in_ctor : Error< "%select{|implicit default }0constructor for %1 must explicitly initialize " "the %select{reference|const}2 member %3">; @@ -1727,7 +1925,8 @@ def note_default_argument_declared_here : Note< def ext_param_promoted_not_compatible_with_prototype : ExtWarn< "promoted type %0 of K&R function parameter is not compatible with the " - "parameter type %1 declared in a previous prototype">; + "parameter type %1 declared in a previous prototype">, + InGroup<KNRPromotedParameter>; // C++ Overloading Semantic Analysis. @@ -1760,7 +1959,16 @@ def note_ovl_candidate : Note<"candidate " "is the implicit move constructor|" "is the implicit copy assignment operator|" "is the implicit move assignment operator|" - "is an inherited constructor}0%1">; + "is an inherited constructor}0%1" + "%select{| has different class (expected %3 but has %4)" + "| has different number of parameters (expected %3 but has %4)" + "| has type mismatch at %ordinal3 parameter (expected %4 but has %5)" + "| has different return type (%3 expected but has %4)" + "| has different qualifiers (expected " + "%select{none|const|restrict|const and restrict|volatile|const and volatile" + "|volatile and restrict|const, volatile, and restrict}3 but found " + "%select{none|const|restrict|const and restrict|volatile|const and volatile" + "|volatile and restrict|const, volatile, and restrict}4)}2">; def note_ovl_candidate_inherited_constructor : Note<"inherited from here">; def note_ovl_candidate_bad_deduction : Note< @@ -1805,8 +2013,9 @@ def note_ovl_candidate_deleted : Note< "constructor (the implicit move constructor)|" "function (the implicit copy assignment operator)|" "function (the implicit move assignment operator)|" - "constructor (inherited)}0%1 " - "has been explicitly %select{made unavailable|deleted}2">; + "constructor (inherited)}0%1 has been " + "%select{explicitly made unavailable|explicitly deleted|" + "implicitly deleted}2">; // Giving the index of the bad argument really clutters this message, and // it's relatively unimportant because 1) it's generally obvious which @@ -1973,6 +2182,10 @@ def err_ref_init_ambiguous : Error< "reference initialization of type %0 with initializer of type %1 is ambiguous">; def err_ovl_deleted_init : Error< "call to %select{unavailable|deleted}0 constructor of %1">; +def err_ovl_deleted_special_init : Error< + "call to implicitly-deleted %select{default constructor|copy constructor|" + "move constructor|copy assignment operator|move assignment operator|" + "destructor|function}0 of %1">; def err_ovl_ambiguous_oper_unary : Error< "use of overloaded operator '%0' is ambiguous (operand type %1)">; def err_ovl_ambiguous_oper_binary : Error< @@ -1980,6 +2193,10 @@ def err_ovl_ambiguous_oper_binary : Error< def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">; def err_ovl_deleted_oper : Error< "overload resolution selected %select{unavailable|deleted}0 operator '%1'%2">; +def err_ovl_deleted_special_oper : Error< + "overload resolution selected implicitly-deleted %select{default constructor|" + "copy constructor|move constructor|copy assignment operator|move assignment " + "operator|destructor|'%1'}0%2">; def err_ovl_no_viable_subscript : Error<"no viable overloaded operator[] for type %0">; def err_ovl_no_oper : @@ -2011,7 +2228,13 @@ def err_addr_ovl_not_func_ptrref : Error< "address of overloaded function %0 cannot be converted to type %1">; def err_addr_ovl_no_qualifier : Error< "can't form member pointer of type %0 without '&' and class name">; - + +// C++11 Literal Operators +def err_ovl_no_viable_literal_operator : Error< + "no matching literal operator for call to %0" + "%select{| with argument of type %2| with arguments of types %2 and %3}1" + "%select{| or 'const char *', and no matching literal operator template}4">; + // C++ Template Declarations def err_template_param_shadow : Error< "declaration of %0 shadows template parameter">; @@ -2057,6 +2280,9 @@ def err_template_param_default_arg_missing : Error< def ext_template_parameter_default_in_function_template : ExtWarn< "default template arguments for a function template are a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_template_parameter_default_in_function_template : Warning< + "default template arguments for a function template are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_template_parameter_default_template_member : Error< "cannot add a default template argument to the definition of a member of a " "class template">; @@ -2097,6 +2323,12 @@ def ext_template_arg_local_type : ExtWarn< "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>; def ext_template_arg_unnamed_type : ExtWarn< "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>; +def warn_cxx98_compat_template_arg_local_type : Warning< + "local type %0 as template argument is incompatible with C++98">, + InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore; +def warn_cxx98_compat_template_arg_unnamed_type : Warning< + "unnamed type as template argument is incompatible with C++98">, + InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore; def note_template_unnamed_type_here : Note< "unnamed type used in template argument was declared here">; def err_template_arg_overload_type : Error< @@ -2115,6 +2347,13 @@ def err_template_arg_not_integral_or_enumeral : Error< def err_template_arg_not_ice : Error< "non-type template argument of type %0 is not an integral constant " "expression">; +def err_template_arg_not_address_constant : Error< + "non-type template argument of type %0 is not a constant expression">; +def err_template_arg_untyped_null_constant : Error< + "null non-type template argument must be cast to template parameter type %0">; +def err_template_arg_wrongtype_null_constant : Error< + "null non-type template argument of type %0 does not match template parameter " + "of type %1">; 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 (%0 vs %1)">; @@ -2150,20 +2389,31 @@ def err_template_arg_field : Error< "non-type template argument refers to non-static data member %0">; def err_template_arg_method : Error< "non-type template argument refers to non-static member function %0">; -def err_template_arg_function_not_extern : Error< - "non-template argument refers to function %0 with internal linkage">; -def err_template_arg_object_not_extern : Error< - "non-template argument refers to object %0 that does not have external " - "linkage">; +def err_template_arg_object_no_linkage : Error< + "non-type template argument refers to %select{function|object}0 %1 that " + "does not have linkage">; +def warn_cxx98_compat_template_arg_object_internal : Warning< + "non-type template argument referring to %select{function|object}0 %1 with " + "internal linkage is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; +def ext_template_arg_object_internal : ExtWarn< + "non-type template argument referring to %select{function|object}0 %1 with " + "internal linkage is a C++11 extension">, InGroup<CXX11>; +def err_template_arg_thread_local : Error< + "non-type template argument refers to thread-local object">; def note_template_arg_internal_object : Note< - "non-template argument refers to %select{function|object}0 here">; -def note_template_arg_refers_here : Note<"non-template argument refers here">; + "non-type template argument refers to %select{function|object}0 here">; +def note_template_arg_refers_here : Note< + "non-type template argument refers here">; 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 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< + "redundant parentheses surrounding address non-type template argument are " + "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; def err_pointer_to_member_type : Error< "invalid use of pointer to member type after %select{.*|->*}0">; def err_pointer_to_member_call_drops_quals : Error< @@ -2175,7 +2425,8 @@ def err_pointer_to_member_oper_value_classify: Error< // C++ template specialization def err_template_spec_unknown_kind : Error< "can only provide an explicit specialization for a class template, function " - "template, or a member function, static data member, or member class of a " + "template, or a member function, static data member, " + "%select{or member class|member class, or member enumeration}0 of a " "class template">; def note_specialized_entity : Note< "explicitly specialized declaration is here">; @@ -2187,30 +2438,30 @@ def err_template_spec_decl_friend : Error< "cannot declare an explicit specialization in a friend">; def err_template_spec_decl_out_of_scope_global : Error< "%select{class template|class template partial|function template|member " - "function|static data member|member class}0 specialization of %1 must " - "originally be declared in the global scope">; -def ext_template_spec_decl_out_of_scope_global : ExtWarn< - "%select{class template|class template partial|function template|member " - "function|static data member|member class}0 specialization of %1 must " - "originally be declared in the global scope; accepted as a C++11 extension">, - InGroup<CXX11>; + "function|static data member|member class|member enumeration}0 " + "specialization of %1 must originally be declared in the global scope">; def err_template_spec_decl_out_of_scope : Error< "%select{class template|class template partial|function template|member " - "function|static data member|member class}0 specialization of %1 must " - "originally be declared in namespace %2">; + "function|static data member|member class|member enumeration}0 " + "specialization of %1 must originally be declared in namespace %2">; def ext_template_spec_decl_out_of_scope : ExtWarn< + "first declaration of %select{class template|class template partial|" + "function template|member function|static data member|member class|" + "member enumeration}0 specialization of %1 outside namespace %2 is a " + "C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_template_spec_decl_out_of_scope : Warning< "%select{class template|class template partial|function template|member " - "function|static data member|member class}0 specialization of %1 must " - "originally be declared in namespace %2; accepted as a C++11 extension">, - InGroup<CXX11>; + "function|static data member|member class|member enumeration}0 " + "specialization of %1 outside namespace %2 is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_template_spec_redecl_out_of_scope : Error< "%select{class template|class template partial|function template|member " - "function|static data member|member class}0 specialization of %1 not in a " - "namespace enclosing %2">; + "function|static data member|member class|member enumeration}0 " + "specialization of %1 not in a namespace enclosing %2">; def err_template_spec_redecl_global_scope : Error< "%select{class template|class template partial|function template|member " - "function|static data member|member class}0 specialization of %1 must occur " - "at global scope">; + "function|static data member|member class|member enumeration}0 " + "specialization of %1 must occur at global scope">; def err_spec_member_not_instantiated : Error< "specialization of member %q0 does not specialize an instantiated member">; def note_specialized_decl : Note<"attempt to specialize declaration here">; @@ -2297,7 +2548,7 @@ def err_function_template_spec_no_match : Error< "no function template matches function template specialization %0">; def err_function_template_spec_ambiguous : Error< "function template specialization %0 ambiguously refers to more than one " - "function template; explicitly specify%select{|additional }1 template " + "function template; explicitly specify%select{| additional}1 template " "arguments to identify a particular function template">; def note_function_template_spec_matched : Note< "function template matches specialization %0">; @@ -2309,7 +2560,7 @@ def err_template_recursion_depth_exceeded : Error< "recursive template instantiation exceeded maximum depth of %0">, DefaultFatal, NoSFINAE; def note_template_recursion_depth : Note< - "use -ftemplate-depth-N to increase recursive template instantiation depth">; + "use -ftemplate-depth=N to increase recursive template instantiation depth">; def err_template_instantiate_within_definition : Error< "%select{implicit|explicit}0 instantiation of template %1 within its" @@ -2328,6 +2579,8 @@ def note_function_template_spec_here : Note< "in instantiation of function template specialization %q0 requested here">; def note_template_static_data_member_def_here : Note< "in instantiation of static data member %q0 requested here">; +def note_template_enum_def_here : Note< + "in instantiation of enumeration %q0 requested here">; def note_template_type_alias_instantiation_here : Note< "in instantiation of template type alias %0 requested here">; @@ -2370,10 +2623,12 @@ def ext_explicit_instantiation_after_specialization : Extension< "explicit instantiation of %0 that occurs after an explicit " "specialization will be ignored (C++11 extension)">, InGroup<CXX11>; +def warn_cxx98_compat_explicit_instantiation_after_specialization : Warning< + "explicit instantiation of %0 that occurs after an explicit " + "specialization is incompatible with C++98">, + InGroup<CXX98CompatPedantic>, DefaultIgnore; def note_previous_template_specialization : Note< "previous template specialization is here">; -def err_explicit_instantiation_enum : Error< - "explicit instantiation of enumeration type %0">; def err_explicit_instantiation_nontemplate_type : Error< "explicit instantiation of non-templated type %0">; def note_nontemplate_decl_here : Note< @@ -2386,10 +2641,10 @@ def err_explicit_instantiation_must_be_global : Error< "explicit instantiation of %0 must occur at global scope">; def warn_explicit_instantiation_out_of_scope_0x : Warning< "explicit instantiation of %0 not in a namespace enclosing %1">, - InGroup<CXX11Compat>; + InGroup<CXX11Compat>, DefaultIgnore; def warn_explicit_instantiation_must_be_global_0x : Warning< "explicit instantiation of %0 must occur at global scope">, - InGroup<CXX11Compat>; + InGroup<CXX11Compat>, DefaultIgnore; def err_explicit_instantiation_requires_name : Error< "explicit instantiation declaration requires a name">; @@ -2414,16 +2669,19 @@ def note_explicit_instantiation_candidate : Note< "explicit instantiation candidate function template here %0">; def err_explicit_instantiation_inline : Error< "explicit instantiation cannot be 'inline'">; +def warn_explicit_instantiation_inline_0x : Warning< + "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>, + DefaultIgnore; def err_explicit_instantiation_constexpr : Error< "explicit instantiation cannot be 'constexpr'">; def ext_explicit_instantiation_without_qualified_id : Extension< "qualifier in explicit instantiation of %q0 requires a template-id " "(a typedef is not permitted)">; def err_explicit_instantiation_unqualified_wrong_namespace : Error< - "explicit instantiation of %q0 must occur in %1">; + "explicit instantiation of %q0 must occur in namespace %1">; def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning< - "explicit instantiation of %q0 must occur in %1">, - InGroup<CXX11Compat>; + "explicit instantiation of %q0 must occur in namespace %1">, + InGroup<CXX11Compat>, DefaultIgnore; def err_explicit_instantiation_undefined_member : Error< "explicit instantiation of undefined %select{member class|member function|" "static data member}0 %1 of class template %2">; @@ -2448,6 +2706,9 @@ def warn_typename_missing : ExtWarn< InGroup<DiagGroup<"typename-missing">>; def ext_typename_outside_of_template : ExtWarn< "'typename' occurs outside of a template">, InGroup<CXX11>; +def warn_cxx98_compat_typename_outside_of_template : Warning< + "use of 'typename' outside of a template is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_typename_refers_to_using_value_decl : Error< "typename specifier refers to a dependent using declaration for a value " "%0 in %1">; @@ -2456,8 +2717,6 @@ def note_using_value_decl_missing_typename : Note< def err_template_kw_refers_to_non_template : Error< "%0 following the 'template' keyword does not refer to a template">; -def err_template_kw_refers_to_function_template : Error< - "%0 following the 'template' keyword refers to a function template">; def err_template_kw_refers_to_class_template : Error< "'%0%1' instantiated to a class template, not a function template">; def note_referenced_class_template : Error< @@ -2466,6 +2725,9 @@ def err_template_kw_missing : Error< "missing 'template' keyword prior to dependent template name '%0%1'">; def ext_template_outside_of_template : ExtWarn< "'template' keyword outside of a template">, InGroup<CXX11>; +def warn_cxx98_compat_template_outside_of_template : Warning< + "use of 'template' keyword outside of a template is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_non_type_template_in_nested_name_specifier : Error< "qualified name refers into a specialization of function template '%0'">; @@ -2474,6 +2736,8 @@ def err_template_id_not_a_type : Error< def note_template_declared_here : Note< "%select{function template|class template|type alias template|template template parameter}0 " "%1 declared here">; +def note_parameter_type : Note< + "parameter of type %0 is declared here">; // C++11 Variadic Templates def err_template_param_pack_default_arg : Error< @@ -2497,25 +2761,29 @@ def err_unexpanded_parameter_pack_0 : Error< "%select{expression|base type|declaration type|data member type|bit-field " "size|static assertion|fixed underlying type|enumerator value|" "using declaration|friend declaration|qualifier|initializer|default argument|" - "non-type template parameter type|exception type|partial specialization}0 " + "non-type template parameter type|exception type|partial specialization|" + "__if_exists name|__if_not_exists name}0 " "contains an unexpanded parameter pack">; def err_unexpanded_parameter_pack_1 : Error< "%select{expression|base type|declaration type|data member type|bit-field " "size|static assertion|fixed underlying type|enumerator value|" "using declaration|friend declaration|qualifier|initializer|default argument|" - "non-type template parameter type|exception type|partial specialization}0 " + "non-type template parameter type|exception type|partial specialization|" + "__if_exists name|__if_not_exists name}0 " "contains unexpanded parameter pack %1">; def err_unexpanded_parameter_pack_2 : Error< "%select{expression|base type|declaration type|data member type|bit-field " "size|static assertion|fixed underlying type|enumerator value|" "using declaration|friend declaration|qualifier|initializer|default argument|" - "non-type template parameter type|exception type|partial specialization}0 " + "non-type template parameter type|exception type|partial specialization|" + "__if_exists name|__if_not_exists name}0 " "contains unexpanded parameter packs %1 and %2">; def err_unexpanded_parameter_pack_3_or_more : Error< "%select{expression|base type|declaration type|data member type|bit-field " "size|static assertion|fixed underlying type|enumerator value|" "using declaration|friend declaration|qualifier|initializer|default argument|" - "non-type template parameter type|exception type|partial specialization}0 " + "non-type template parameter type|exception type|partial specialization|" + "__if_exists name|__if_not_exists name}0 " "contains unexpanded parameter packs %1, %2, ...">; def err_pack_expansion_without_parameter_packs : Error< @@ -2570,6 +2838,8 @@ def warn_unavailable_fwdclass_message : Warning< def note_unavailable_here : Note< "%select{declaration|function}0 has been explicitly marked " "%select{unavailable|deleted|deprecated}1 here">; +def note_implicitly_deleted : Note< + "explicitly defaulted function was implicitly deleted here">; def warn_not_enough_argument : Warning< "not enough variable arguments in %0 declaration to fit a sentinel">, InGroup<Sentinel>; @@ -2593,6 +2863,37 @@ def err_definition_of_explicitly_defaulted_member : Error< def err_redefinition_extern_inline : Error< "redefinition of a 'extern inline' function %0 is not supported in " "%select{C99 mode|C++}1">; +def warn_cxx98_compat_friend_redefinition : Warning< + "friend function %0 would be implicitly redefined in C++98">, + InGroup<CXX98Compat>, DefaultIgnore; + +def note_deleted_dtor_no_operator_delete : Note< + "virtual destructor requires an unambiguous, accessible 'operator delete'">; +def note_deleted_special_member_class_subobject : Note< + "%select{default constructor|copy constructor|move constructor|" + "copy assignment operator|move assignment operator|destructor}0 of " + "%select{||||union }4%1 is implicitly deleted because " + "%select{base class %3|field %3}2 has " + "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 " + "%select{%select{default constructor|copy constructor|move constructor|copy " + "assignment operator|move assignment operator|destructor}0|destructor}5" + "%select{||s||}4">; +def note_deleted_default_ctor_uninit_field : Note< + "default constructor of %0 is implicitly deleted because field %1 of " + "%select{reference|const-qualified}3 type %2 would not be initialized">; +def note_deleted_default_ctor_all_const : Note< + "default constructor of %0 is implicitly deleted because all " + "%select{data members|data members of an anonymous union member}1" + " are const-qualified">; +def note_deleted_copy_ctor_rvalue_reference : Note< + "copy constructor of %0 is implicitly deleted because field %1 is of " + "rvalue reference type %2">; +def note_deleted_copy_user_declared_move : Note< + "copy %select{constructor|assignment operator}0 is implicitly deleted because" + " %1 has a user-declared move %select{constructor|assignment operator}2">; +def note_deleted_assign_field : Note< + "%select{copy|move}0 assignment operator of %0 is implicitly deleted " + "because field %1 is of %select{reference|const-qualified}3 type %2">; // This should eventually be an error. def warn_undefined_internal : Warning< @@ -2600,9 +2901,11 @@ def warn_undefined_internal : Warning< DiagGroup<"undefined-internal">; def note_used_here : Note<"used here">; -def warn_redefinition_of_typedef : Warning< - "redefinition of typedef %0 is invalid in C">, - InGroup<DiagGroup<"typedef-redefinition"> >, DefaultError; +def warn_redefinition_of_typedef : ExtWarn< + "redefinition of typedef %0 is a C11 feature">, + InGroup<DiagGroup<"typedef-redefinition"> >; +def err_redefinition_variably_modified_typedef : Error< + "redefinition of %select{typedef|type alias}0 for variably-modified type %1">; def err_inline_declaration_block_scope : Error< "inline declaration of %0 not allowed in block scope">; @@ -2626,6 +2929,9 @@ def err_redefinition_different_type : Error< "redefinition of %0 with a different type">; def err_redefinition_different_kind : Error< "redefinition of %0 as different kind of symbol">; +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">>; def err_redefinition_different_typedef : Error< "%select{typedef|type alias|type alias template}0 redefinition with different types (%1 vs %2)">; def err_tag_reference_non_tag : Error< @@ -2686,6 +2992,9 @@ def err_vm_func_decl : Error< "function declaration cannot have variably modified type">; def err_array_too_large : Error< "array is too large (%0 elements)">; +def warn_array_new_too_large : Warning<"array is too large (%0 elements)">, + // FIXME PR11644: ", will throw std::bad_array_new_length at runtime" + InGroup<DiagGroup<"bad-array-new-length">>; // -Wpadded, -Wpacked def warn_padded_struct_field : Warning< @@ -2701,6 +3010,9 @@ def warn_unnecessary_packed : Warning< "packed attribute is unnecessary for %0">, InGroup<Packed>, DefaultIgnore; def err_typecheck_negative_array_size : Error<"array size is negative">; +def warn_typecheck_negative_array_new_size : Warning<"array size is negative">, + // FIXME PR11644: ", will throw std::bad_array_new_length at runtime" + InGroup<DiagGroup<"bad-array-new-length">>; def warn_typecheck_function_qualifiers : Warning< "qualifier on function type %0 has unspecified behavior">; def err_typecheck_invalid_restrict_not_pointer : Error< @@ -2713,8 +3025,9 @@ def ext_typecheck_zero_array_size : Extension< "zero size arrays are an extension">; def err_typecheck_zero_array_size : Error< "zero-length arrays are not permitted in C++">; -def err_at_least_one_initializer_needed_to_size_array : Error< - "at least one initializer value required to size array">; +def warn_typecheck_zero_static_array_size : Warning< + "'static' has no effect on zero-length arrays">, + InGroup<DiagGroup<"array-bounds">>; def err_array_size_non_int : Error<"size of array has non-integer type %0">; def err_init_element_not_constant : Error< "initializer element is not a compile-time constant">; @@ -2725,8 +3038,6 @@ def err_block_extern_cant_init : Error< def warn_extern_init : Warning<"'extern' variable has an initializer">; def err_variable_object_no_init : Error< "variable-sized object may not be initialized">; -def err_array_init_list_required : Error< - "initialization with '{...}' expected for array">; def err_excess_initializers : Error< "excess elements in %select{array|vector|scalar|union|struct}0 initializer">; def warn_excess_initializers : ExtWarn< @@ -2750,14 +3061,31 @@ def ext_complex_component_init : Extension< "complex initialization specifying real and imaginary components " "is an extension">, InGroup<DiagGroup<"complex-component-init">>; def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">; +def warn_cxx98_compat_empty_scalar_initializer : Warning< + "scalar initialized from empty initializer list is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_illegal_initializer : Error< "illegal initializer (only variables can be initialized)">; def err_illegal_initializer_type : Error<"illegal initializer type %0">; -def err_init_list_variable_narrowing : Error< +def err_init_list_type_narrowing_sfinae : Error< + "type %0 cannot be narrowed to %1 in initializer list">; +def err_init_list_type_narrowing : ExtWarn< + "type %0 cannot be narrowed to %1 in initializer list">, + InGroup<CXX11Narrowing>, DefaultError; +def err_init_list_variable_narrowing_sfinae : Error< "non-constant-expression cannot be narrowed from type %0 to %1 in " "initializer list">; -def err_init_list_constant_narrowing : Error< +def err_init_list_variable_narrowing : ExtWarn< + "non-constant-expression cannot be narrowed from type %0 to %1 in " + "initializer list">, InGroup<CXX11Narrowing>, DefaultError; +def err_init_list_constant_narrowing_sfinae : Error< "constant expression evaluates to %0 which cannot be narrowed to type %1">; +def err_init_list_constant_narrowing : ExtWarn< + "constant expression evaluates to %0 which cannot be narrowed to type %1">, + InGroup<CXX11Narrowing>, DefaultError; +def warn_init_list_type_narrowing : Warning< + "type %0 cannot be narrowed to %1 in initializer list in C++11">, + InGroup<CXX11Narrowing>, DefaultIgnore; def warn_init_list_variable_narrowing : Warning< "non-constant-expression cannot be narrowed from type %0 to %1 in " "initializer list in C++11">, @@ -2783,7 +3111,7 @@ def err_anon_bitfield_width_exceeds_type_size : Error< "size of anonymous bit-field (%0 bits) exceeds size of its type (%1 bits)">; def err_incorrect_number_of_vector_initializers : Error< "number of elements must be either one or match the size of the vector">; - + // Used by C++ which allows bit-fields that are wider than the type. def warn_bitfield_width_exceeds_type_size: Warning< "size of bit-field %0 (%1 bits) exceeds the size of its type; value will be " @@ -2795,6 +3123,9 @@ def warn_anon_bitfield_width_exceeds_type_size : Warning< def warn_missing_braces : Warning< "suggest braces around initialization of subobject">, InGroup<DiagGroup<"missing-braces">>, DefaultIgnore; +def err_missing_braces : Error< + "cannot omit braces around initialization of subobject when using direct " + "list-initialization">; def err_redefinition_of_label : Error<"redefinition of label %0">; def err_undeclared_label_use : Error<"use of undeclared label %0">; @@ -2804,17 +3135,28 @@ def warn_unused_label : Warning<"unused label %0">, def err_goto_into_protected_scope : Error<"goto into protected scope">; def warn_goto_into_protected_scope : ExtWarn<"goto into protected scope">, InGroup<Microsoft>; +def warn_cxx98_compat_goto_into_protected_scope : Warning< + "goto would jump into protected scope in C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_switch_into_protected_scope : Error< "switch case is in protected scope">; +def warn_cxx98_compat_switch_into_protected_scope : Warning< + "switch case would be in a protected scope in 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">; +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">; def note_protected_by_variable_init : Note< "jump bypasses variable initialization">; def note_protected_by_variable_nontriv_destructor : Note< "jump bypasses variable with a non-trivial destructor">; +def note_protected_by_variable_non_pod : Note< + "jump bypasses initialization of non-POD variable">; def note_protected_by_cleanup : Note< "jump bypasses initialization of variable with __attribute__((cleanup))">; def note_protected_by_vla_typedef : Note< @@ -2890,9 +3232,11 @@ def err_flexible_array_empty_struct : Error< def err_flexible_array_has_nonpod_type : Error< "flexible array member %0 of non-POD element type %1">; def ext_flexible_array_in_struct : Extension< - "%0 may not be nested in a struct due to flexible array member">; + "%0 may not be nested in a struct due to flexible array member">, + InGroup<FlexibleArrayExtensions>; def ext_flexible_array_in_array : Extension< - "%0 may not be used as an array element due to flexible array member">; + "%0 may not be used as an array element due to flexible array member">, + InGroup<FlexibleArrayExtensions>; def err_flexible_array_init : Error< "initialization of flexible array member is not allowed">; def ext_flexible_array_empty_aggregate_ms : Extension< @@ -2907,18 +3251,29 @@ def ext_flexible_array_empty_aggregate_gnu : Extension< def ext_flexible_array_union_gnu : Extension< "flexible array member %0 in a union is a GNU extension">, InGroup<GNU>; -let CategoryName = "Automatic Reference Counting Issue" in { +let CategoryName = "ARC Semantic Issue" in { // ARC-mode diagnostics. + +let CategoryName = "ARC Weak References" in { + def err_arc_weak_no_runtime : Error< "the current deployment target does not support automated __weak references">; def err_arc_unsupported_weak_class : Error< "class is incompatible with __weak references">; def err_arc_weak_unavailable_assign : Error< "assignment of a weak-unavailable object to a __weak object">; +def err_arc_weak_unavailable_property : Error< + "synthesis of a weak-unavailable property is disallowed " + "because it requires synthesis of an ivar of the __weak object">; def err_arc_convesion_of_weak_unavailable : Error< "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to" " a __weak object of type %2">; + +} // end "ARC Weak References" category + +let CategoryName = "ARC Restrictions" in { + def err_arc_illegal_explicit_message : Error< "ARC forbids explicit message send of %0">; def err_arc_unused_init_message : Error< @@ -2929,8 +3284,10 @@ def err_arc_mismatched_cast : Error< "%select{%2|a non-Objective-C pointer type %2|a block pointer|" "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1" " to %3 is disallowed with ARC">; +def err_arc_nolifetime_behavior : Error< + "explicit ownership qualifier on cast result has no effect">; def err_arc_objc_object_in_struct : Error< - "ARC forbids Objective-C objects in structs or unions">; + "ARC forbids %select{Objective-C objects|blocks}0 in structs or unions">; def err_arc_objc_property_default_assign_on_object : Error< "ARC forbids synthesizing a property of an Objective-C object " "with unspecified ownership or storage attribute">; @@ -2938,6 +3295,9 @@ def err_arc_illegal_selector : Error< "ARC forbids use of %0 in a @selector">; def err_arc_illegal_method_def : Error< "ARC forbids implementation of %0">; + +} // end "ARC Restrictions" category + def err_arc_lost_method_convention : Error< "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 " "method, but its implementation doesn't match because %select{" @@ -2950,8 +3310,10 @@ def note_arc_gained_method_convention : Note< "declaration in interface is not in the '%select{alloc|copy|init|new}0' " "family because %select{its result type is not an object pointer|" "its result type is unrelated to its receiver type}1">; -def err_typecheck_arr_assign_self : Error< +def err_typecheck_arc_assign_self : Error< "cannot assign to 'self' outside of a method in the init family">; +def err_typecheck_arc_assign_self_class_method : Error< + "cannot assign to 'self' in a class method">; def err_typecheck_arr_assign_enumeration : Error< "fast enumeration variables can't be modified in ARC by default; " "declare the variable __strong to allow this">; @@ -2982,6 +3344,9 @@ def warn_err_new_delete_object_array : Warning< def err_arc_autoreleasing_var : Error< "%select{__block variables|global variables|fields|ivars}0 cannot have " "__autoreleasing ownership">; +def err_arc_autoreleasing_capture : Error< + "cannot capture __autoreleasing variable in a " + "%select{block|lambda by copy}0">; def err_arc_thread_ownership : Error< "thread-local variable has non-trivial ownership: type is %0">; def err_arc_indirect_no_ownership : Error< @@ -3005,17 +3370,26 @@ def err_arc_may_not_respond : Error< "no visible @interface for %0 declares the selector %1">; def err_arc_receiver_forward_instance : Error< "receiver type %0 for instance message is a forward declaration">; +def warn_receiver_forward_instance : Warning< + "receiver type %0 for instance message is a forward declaration">, + InGroup<DiagGroup<"receiver-forward-class">>, DefaultIgnore; def err_arc_collection_forward : Error< "collection expression type %0 is a forward declaration">; def err_arc_multiple_method_decl : Error< "multiple methods named %0 found with mismatched result, " "parameter type or attributes">; + +let CategoryName = "ARC Retain Cycle" in { + def warn_arc_retain_cycle : Warning< "capturing %0 strongly in this block is likely to lead to a retain cycle">, InGroup<ARCRetainCycles>; def note_arc_retain_cycle_owner : Note< "block will be retained by %select{the captured object|an object strongly " "retained by the captured object}0">; + +} // end "ARC Retain Cycle" category + def note_nontrivial_objc_ownership : Note< "because type %0 has %select{no|no|__strong|__weak|__autoreleasing}1 " "ownership">; @@ -3023,6 +3397,8 @@ def warn_arc_object_memaccess : Warning< "%select{destination for|source of}0 this %1 call is a pointer to " "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>; +let CategoryName = "ARC and @properties" in { + def err_arc_strong_property_ownership : Error< "existing ivar %1 for strong property %0 may not be " "%select{|__unsafe_unretained||__weak}2">; @@ -3032,10 +3408,15 @@ def err_arc_assign_property_ownership : Error< def err_arc_inconsistent_property_ownership : Error< "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be " "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">; + +} // end "ARC and @properties" category + def err_arc_atomic_ownership : Error< "cannot perform atomic operation on a pointer to type %0: type has " "non-trivial ownership">; +let CategoryName = "ARC Casting Rules" in { + def err_arc_bridge_cast_incompatible : Error< "incompatible types casting %0 to %1 with a %select{__bridge|" "__bridge_transfer|__bridge_retained}2 cast">; @@ -3044,14 +3425,19 @@ def err_arc_bridge_cast_wrong_kind : Error< "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|" "__bridge_transfer|__bridge_retained}4">; def err_arc_cast_requires_bridge : Error< - "cast of %select{Objective-C|block|C}0 pointer type %1 to " - "%select{Objective-C|block|C}2 pointer type %3 requires a bridged cast">; + "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 " + "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 " + "requires a bridged cast">; def note_arc_bridge : Note< "use __bridge to convert directly (no change in ownership)">; def note_arc_bridge_transfer : Note< - "use __bridge_transfer to transfer ownership of a +1 %0 into ARC">; + "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer " + "ownership of a +1 %0 into ARC">; def note_arc_bridge_retained : Note< - "use __bridge_retained to make an ARC object available as a +1 %0">; + "use %select{__bridge_retained|CFBridgingRetain call}1 to make an " + "ARC object available as a +1 %0">; + +} // ARC Casting category } // ARC category name @@ -3080,15 +3466,11 @@ def err_illegal_decl_mempointer_in_nonclass : Error< def err_mempointer_in_nonclass_type : Error< "member pointer refers into non-class type %0">; def err_reference_to_void : Error<"cannot form a reference to 'void'">; -def err_qualified_block_pointer_type : Error< - "qualifier specification on block pointer type not allowed">; def err_nonfunction_block_type : Error< "block pointer to non-function type is invalid">; def err_return_block_has_expr : Error<"void block should not return a value">; def err_block_return_missing_expr : Error< "non-void block should return a value">; -def err_block_with_return_type_requires_args : Error< - "block with explicit return type requires argument list">; def err_func_def_incomplete_result : Error< "incomplete result type %0 in function definition">; def err_atomic_specifier_bad_type : Error< @@ -3099,9 +3481,6 @@ def err_atomic_specifier_bad_type : Error< // Expressions. def ext_sizeof_function_type : Extension< "invalid application of 'sizeof' to a function type">, InGroup<PointerArith>; -def err_sizeof_alignof_overloaded_function_type : Error< - "invalid application of '%select{sizeof|__alignof|vec_step}0' to an " - "overloaded function">; def ext_sizeof_void_type : Extension< "invalid application of '%select{sizeof|__alignof|vec_step}0' to a void " "type">, InGroup<PointerArith>; @@ -3118,7 +3497,8 @@ def err_offsetof_record_type : Error< "offsetof requires struct, union, or class type, %0 invalid">; def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">; def ext_offsetof_extended_field_designator : Extension< - "using extended field designator is an extension">; + "using extended field designator is an extension">, + InGroup<DiagGroup<"extended-offsetof">>; def warn_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">, InGroup<InvalidOffsetof>; def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">; @@ -3179,6 +3559,12 @@ def warn_self_assignment : Warning< "explicitly assigning a variable of type %0 to itself">, InGroup<SelfAssignment>, DefaultIgnore; +def warn_string_plus_int : Warning< + "adding %0 to a string does not append to the string">, + InGroup<StringPlusInt>; +def note_string_plus_int_silence : Note< + "use array indexing to silence this warning">; + def warn_sizeof_array_param : Warning< "sizeof on array function parameter will return size of %0 instead of %1">, InGroup<SizeofArrayArgument>; @@ -3226,7 +3612,7 @@ def err_typecheck_member_reference_unknown : Error< "cannot refer to member %0 in %1 with '%select{.|->}2'">; def err_member_reference_needs_call : Error< "base of member reference is a function; perhaps you meant to call " - "it%select{| with no arguments}?">; + "it%select{| with no arguments}0?">; def warn_subscript_is_char : Warning<"array subscript is of type 'char'">, InGroup<CharSubscript>, DefaultIgnore; @@ -3238,6 +3624,11 @@ def err_member_not_yet_instantiated : Error< def note_non_instantiated_member_here : Note< "not-yet-instantiated member is declared here">; +def err_enumerator_does_not_exist : Error< + "enumerator %0 does not exist in instantiation of %1">; +def note_enum_specialized_here : Note< + "enum %0 was explicitly specialized here">; + def err_member_redeclared : Error<"class member cannot be redeclared">; def err_member_name_of_class : Error<"member %0 has the same name as its class">; def err_member_def_undefined_record : Error< @@ -3246,13 +3637,11 @@ def err_member_def_does_not_match : Error< "out-of-line definition of %0 does not match any declaration in %1">; def err_member_def_does_not_match_suggest : Error< "out-of-line definition of %0 does not match any declaration in %1; " - "did you mean %2">; + "did you mean %2?">; def err_member_def_does_not_match_ret_type : Error< "out-of-line definition of %q0 differs from the declaration in the return type">; def err_nonstatic_member_out_of_line : Error< "non-static data member defined out-of-line">; -def err_nonstatic_flexible_variable : Error< - "non-static initialization of a variable with flexible array member">; def err_qualified_typedef_declarator : Error< "typedef declarator cannot be qualified">; def err_qualified_param_declarator : Error< @@ -3307,7 +3696,11 @@ def err_array_init_non_constant_array : Error< "cannot initialize array of type %0 with non-constant array of type %1">; def ext_array_init_copy : Extension< "initialization of an array of type %0 from a compound literal of type %1 is " - "a GNU extension">; + "a GNU extension">, InGroup<GNU>; +// This is intentionally not disabled by -Wno-gnu. +def ext_array_init_parens : ExtWarn< + "parenthesized initialization of a member array is a GNU extension">, + InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError; def warn_deprecated_string_literal_conversion : Warning< "conversion from string literal to %0 is deprecated">, InGroup<DeprecatedWritableStr>; def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">; @@ -3349,14 +3742,10 @@ def warn_pointer_indirection_from_incompatible_type : Warning< "behavior.">, InGroup<DiagGroup<"undefined-reinterpret-cast">>, DefaultIgnore; -def err_assignment_requires_nonfragile_object : Error< - "cannot assign to class object in non-fragile ABI (%0 invalid)">; -def err_direct_interface_unsupported : Error< - "indirection to an interface is not supported (%0 invalid)">; +def err_objc_object_assignment : Error< + "cannot assign to class object (%0 invalid)">; def err_typecheck_invalid_operands : Error< "invalid operands to binary expression (%0 and %1)">; -def err_typecheck_sub_ptr_object : Error< - "subtraction of pointer %0 requires pointee to be a complete object type">; def err_typecheck_sub_ptr_compatible : Error< "%0 and %1 are not pointers to compatible types">; def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn< @@ -3377,13 +3766,13 @@ def ext_typecheck_comparison_of_distinct_pointers : ExtWarn< "comparison of distinct pointer types (%0 and %1)">; def ext_typecheck_cond_incompatible_operands : ExtWarn< "incompatible operand types (%0 and %1)">; +def err_cond_voidptr_arc : Error < + "operands to conditional of types %0 and %1 are incompatible in ARC mode">; def err_typecheck_comparison_of_distinct_pointers : Error< "comparison of distinct pointer types (%0 and %1)">; def ext_typecheck_comparison_of_distinct_pointers_nonstandard : ExtWarn< "comparison of distinct pointer types (%0 and %1) uses non-standard " "composite pointer type %2">; -def err_typecheck_vector_comparison : Error< - "comparison of vector types (%0 and %1) not supported yet">; 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">; @@ -3408,26 +3797,15 @@ def warn_null_in_comparison_operation : Warning< InGroup<DiagGroup<"null-arithmetic">>; def err_invalid_this_use : Error< - "invalid use of 'this' outside of a nonstatic member function">; + "invalid use of 'this' outside of a non-static member function">; def err_invalid_member_use_in_static_method : Error< "invalid use of member %0 in static member function">; def err_invalid_qualified_function_type : Error< - "type qualifier is not allowed on this function">; -def err_invalid_ref_qualifier_function_type : Error< - "ref-qualifier '%select{&&|&}0' is only allowed on non-static member functions," - " member function pointers, and typedefs of function types">; -def ext_qualified_function_type_template_arg : ExtWarn< - "template argument of '%0' qualified function type is a GNU extension">, - InGroup<GNU>; - -def err_invalid_qualified_function_pointer : Error< - "type qualifier is not allowed on this function %select{pointer|reference}0">; -def err_invalid_qualified_typedef_function_type_use : Error< - "a qualified function type cannot be used to declare a " - "%select{static member|nonmember}0 function">; -def err_invalid_ref_qualifier_typedef_function_type_use : Error< - "%select{static member|nonmember}0 function cannot have a ref-qualifier " - "'%select{&&|&}1'">; + "%select{static |non-}0member function %select{of type %2 |}1" + "cannot have '%3' qualifier">; +def err_compound_qualified_function_type : Error< + "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1" + "cannot have '%3' qualifier">; def err_ref_qualifier_overload : Error< "cannot overload a member function %select{without a ref-qualifier|with " @@ -3435,13 +3813,17 @@ def err_ref_qualifier_overload : Error< "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">; def err_invalid_non_static_member_use : Error< - "invalid use of nonstatic data member %0">; + "invalid use of non-static data member %0">; +def err_nested_non_static_member_use : Error< + "%select{call to non-static member function|use of non-static data member}0 " + "%2 of %1 from nested type %3">; +def warn_cxx98_compat_non_static_member_use : Warning< + "use of non-static data member %0 in an unevaluated context is " + "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; def err_invalid_incomplete_type_use : Error< "invalid use of incomplete type %0">; def err_builtin_func_cast_more_than_one_arg : Error< "function-style cast to a builtin type can only take one argument">; -def err_builtin_direct_init_more_than_one_arg : Error< - "initializer of a builtin type can only take one argument">; def err_value_init_for_array_type : Error< "array types cannot be value-initialized">; def warn_format_nonliteral_noargs : Warning< @@ -3464,13 +3846,43 @@ def err_invalid_property_name : Error< "%0 is not a valid property name (accessing an object of type %1)">; def err_getter_not_found : Error< "expected getter method not found on object of type %0">; +def err_objc_subscript_method_not_found : Error< + "expected method to %select{read|write}1 %select{dictionary|array}2 element not " + "found on object of type %0">; +def err_objc_subscript_index_type : Error< + "method index parameter type %0 is not integral type">; +def err_objc_subscript_key_type : Error< + "method key parameter type %0 is not object type">; +def err_objc_subscript_dic_object_type : Error< + "method object parameter type %0 is not object type">; +def err_objc_subscript_object_type : Error< + "cannot assign to this %select{dictionary|array}1 because assigning method's 2nd parameter" + " of type %0 is not an objective-C pointer type">; +def err_objc_subscript_base_type : Error< + "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">; +def err_objc_multiple_subscript_type_conversion : Error< + "indexing expression is invalid because subscript type %0 has " + "multiple type conversion functions">; +def err_objc_subscript_type_conversion : Error< + "indexing expression is invalid because subscript type %0 is not an integral" + " or objective-C pointer type">; +def err_objc_subscript_pointer : Error< + "indexing expression is invalid because subscript type %0 is not an" + " objective-C pointer">; +def err_objc_indexing_method_result_type : Error< + "method for accessing %select{dictionary|array}1 element must have Objective-C" + " object return type instead of %0">; +def err_objc_index_incomplete_class_type : Error< + "objective-C index expression has incomplete class type %0">; +def err_illegal_container_subscripting_op : Error< + "illegal operation on objective-c container subscripting">; def err_property_not_found_forward_class : Error< "property %0 cannot be found in forward class object %1">; def err_property_not_as_forward_class : Error< "property %0 refers to an incomplete Objective-C class %1 " "(with no @interface available)">; def note_forward_class : Note< - "forward class is declared here">; + "forward declaration of class here">; def err_duplicate_property : Error< "property has a previous declaration">; def ext_gnu_void_ptr : Extension< @@ -3480,16 +3892,22 @@ def ext_gnu_ptr_func_arith : Extension< "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function " "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">, InGroup<PointerArith>; -def error_readonly_property_assignment : Error< - "assigning to property with 'readonly' attribute not allowed">; def error_readonly_message_assignment : Error< "assigning to 'readonly' return result of an objective-c message not allowed">; def ext_integer_increment_complex : Extension< "ISO C does not support '++'/'--' on complex integer type %0">; def ext_integer_complement_complex : Extension< "ISO C does not support '~' for complex conjugation of %0">; -def error_nosetter_property_assignment : Error< - "setter method is needed to assign to object using property" " assignment syntax">; +def err_nosetter_property_assignment : Error< + "%select{assignment to readonly property|" + "no setter method %1 for assignment to property}0">; +def err_nosetter_property_incdec : Error< + "%select{%select{increment|decrement}1 of readonly property|" + "no setter method %2 for %select{increment|decrement}1 of property}0">; +def err_nogetter_property_compound_assignment : Error< + "a getter method is needed to perform a compound assignment on a property">; +def err_nogetter_property_incdec : Error< + "no getter method %1 for %select{increment|decrement} of property">; def error_no_subobject_property_setting : Error< "expression is not assignable">; def err_qualified_objc_access : Error< @@ -3547,8 +3965,6 @@ def warn_register_objc_catch_parm : Warning< "'register' storage specifier on @catch parameter will be ignored">; def err_qualified_objc_catch_parm : Error< "@catch parameter declarator cannot be qualified">; -def err_objc_pointer_cxx_catch_gnu : Error< - "can't catch Objective C exceptions in C++ in the GNU runtime">; def warn_objc_pointer_cxx_catch_fragile : Warning< "can not catch an exception thrown with @throw in C++ in the non-unified " "exception model">, InGroup<ObjCNonUnifiedException>; @@ -3560,12 +3976,12 @@ def err_incomplete_type_objc_at_encode : Error< def warn_setter_getter_impl_required : Warning< "property %0 requires method %1 to be defined - " "use @synthesize, @dynamic or provide a method implementation " - "in this class implementation">; + "in this class implementation">, + InGroup<ObjCPropertyImpl>; def warn_setter_getter_impl_required_in_category : Warning< "property %0 requires method %1 to be defined - " - "use @dynamic or provide a method implementation in this category">; -def note_property_impl_required : Note< - "implementation is here">; + "use @dynamic or provide a method implementation in this category">, + InGroup<ObjCPropertyImpl>; def note_parameter_named_here : Note< "passing argument to parameter %0 here">; def note_parameter_here : Note< @@ -3598,6 +4014,9 @@ def err_bad_const_cast_dest : Error< "which is not a reference, pointer-to-object, or pointer-to-data-member">; def ext_cast_fn_obj : Extension< "cast between pointer-to-function and pointer-to-object is an extension">; +def warn_cxx98_compat_cast_fn_obj : Warning< + "cast between pointer-to-function and pointer-to-object is incompatible with C++98">, + InGroup<CXX98CompatPedantic>, DefaultIgnore; def err_bad_reinterpret_cast_small_int : Error< "cast from pointer to smaller type %2 loses information">; def err_bad_cxx_cast_vector_to_scalar_different_size : Error< @@ -3619,7 +4038,6 @@ def err_bad_static_cast_member_pointer_nonmp : Error< 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_static_cast_incomplete : Error<"%0 is an incomplete type">; def err_bad_reinterpret_cast_reference : Error< "reinterpret_cast of a %0 to %1 needs its address which is not allowed">; def warn_undefined_reinterpret_cast : Warning< @@ -3669,7 +4087,8 @@ def err_placement_new_non_placement_delete : Error< "'new' expression with placement arguments refers to non-placement " "'operator delete'">; def err_array_size_not_integral : Error< - "array size expression must have integral or enumerated type, not %0">; + "array size expression must have integral or %select{|unscoped }0" + "enumeration type, not %1">; def err_array_size_incomplete_type : Error< "array size expression has incomplete class type %0">; def err_array_size_explicit_conversion : Error< @@ -3683,6 +4102,10 @@ def ext_array_size_conversion : Extension< "implicit conversion from array size expression of type %0 to " "%select{integral|enumeration}1 type %2 is a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_array_size_conversion : Warning< + "implicit conversion from array size expression of type %0 to " + "%select{integral|enumeration}1 type %2 is incompatible with C++98">, + InGroup<CXX98CompatPedantic>, DefaultIgnore; def err_address_space_qualified_new : Error< "'new' cannot allocate objects of type %0 in address space '%1'">; def err_address_space_qualified_delete : Error< @@ -3697,7 +4120,8 @@ def ext_delete_void_ptr_operand : ExtWarn< 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 behaviour">; + "deleting pointer to incomplete type %0 may cause undefined behaviour">, + InGroup<DiagGroup<"delete-incomplete">>; def err_delete_incomplete_class_type : Error< "deleting incomplete class type %0; no conversions to pointer type">; def warn_delete_array_type : Warning< @@ -3711,10 +4135,10 @@ def note_member_declared_here : Note< def err_decrement_bool : Error<"cannot decrement expression of type bool">; def warn_increment_bool : Warning< "incrementing expression of type bool is deprecated">, InGroup<Deprecated>; -def ext_catch_incomplete_ptr : ExtWarn< - "ISO C++ forbids catching a pointer to incomplete type %0">; -def ext_catch_incomplete_ref : ExtWarn< - "ISO C++ forbids catching a reference to incomplete type %0">; +def err_catch_incomplete_ptr : Error< + "cannot catch pointer to incomplete type %0">; +def err_catch_incomplete_ref : Error< + "cannot catch reference to incomplete type %0">; def err_catch_incomplete : Error<"cannot catch incomplete type %0">; def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">; def err_qualified_catch_declarator : Error< @@ -3722,8 +4146,6 @@ def err_qualified_catch_declarator : Error< def err_early_catch_all : Error<"catch-all handler must come last">; def err_bad_memptr_rhs : Error< "right hand operand to %0 has non pointer-to-member type %1">; -def err_memptr_rhs_to_incomplete : Error< - "cannot dereference pointer into incomplete class type %0">; def err_bad_memptr_lhs : Error< "left hand operand to %0 must be a %select{|pointer to }1class " "compatible with the right hand operand, but is %2">; @@ -3751,6 +4173,10 @@ def note_hidden_overloaded_virtual_declared_here : Note< def warn_using_directive_in_header : Warning< "using namespace directive in global context in header">, InGroup<HeaderHygiene>, DefaultIgnore; +def warn_overaligned_type : Warning< + "type %0 requires %1 bytes of alignment and the default allocator only " + "guarantees %2 bytes">, + InGroup<OveralignedType>, DefaultIgnore; def err_conditional_void_nonvoid : Error< "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand " @@ -3769,11 +4195,79 @@ def err_throw_incomplete_ptr : Error< def err_return_in_constructor_handler : Error< "return in the catch of a function try block of a constructor is illegal">; +let CategoryName = "Lambda Issue" in { + def err_capture_more_than_once : Error< + "%0 can appear only once in a capture list">; + def err_reference_capture_with_reference_default : Error< + "'&' cannot precede a capture when the capture default is '&'">; + def err_this_capture_with_copy_default : Error< + "'this' cannot be explicitly captured when the capture default is '='">; + def err_copy_capture_with_copy_default : Error< + "'&' must precede a capture when the capture default is '='">; + def err_capture_does_not_name_variable : Error< + "%0 in capture list does not name a variable">; + def err_capture_non_automatic_variable : Error< + "%0 cannot be captured because it does not have automatic storage " + "duration">; + def err_this_capture : Error< + "'this' cannot be %select{implicitly |}0captured in this context">; + def err_lambda_capture_block : Error< + "__block variable %0 cannot be captured in a lambda expression">; + 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_impcap : Error< + "variable %0 cannot be implicitly captured in a lambda with no " + "capture-default specified">; + def note_lambda_decl : Note<"lambda expression begins here">; + def err_lambda_unevaluated_operand : Error< + "lambda expression in an unevaluated operand">; + def ext_lambda_implies_void_return : ExtWarn< + "C++11 requires lambda with omitted result type to consist of a single " + "return statement">, + InGroup<LambdaExtensions>; + def err_lambda_return_init_list : Error< + "cannot deduce lambda return type from initializer list">; + def err_lambda_capture_default_arg : Error< + "lambda expression in default argument cannot capture any entity">; + def err_lambda_unexpanded_pack : Error< + "unexpanded function parameter pack capture is unsupported">; + def err_lambda_incomplete_result : Error< + "incomplete result type %0 in lambda expression">; + def err_lambda_objc_object_result : Error< + "non-pointer Objective-C class type %0 in lambda expression result">; + def ext_lambda_default_arguments : ExtWarn< + "C++11 forbids default arguments for lambda expressions">, + InGroup<LambdaExtensions>; + def err_noreturn_lambda_has_return_expr : Error< + "lambda declared 'noreturn' should not return">; + def warn_maybe_falloff_nonvoid_lambda : Warning< + "control may reach end of non-void lambda">, + InGroup<ReturnType>; + def warn_falloff_nonvoid_lambda : Warning< + "control reaches end of non-void lambda">, + InGroup<ReturnType>; + def err_access_lambda_capture : Error< + // The ERRORs represent other special members that aren't constructors, in + // hopes that someone will bother noticing and reporting if they appear + "capture of variable '%0' as type %1 calls %select{private|protected}3 " + "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">, + AccessControl; + def note_lambda_to_block_conv : Note< + "implicit capture of lambda object due to conversion to block pointer " + "here">; +} + def err_operator_arrow_circular : Error< "circular pointer delegation detected">; def err_pseudo_dtor_base_not_scalar : Error< "object expression of non-scalar type %0 cannot be used in a " "pseudo-destructor expression">; +def ext_pseudo_dtor_on_void : ExtWarn< + "pseudo-destructors on type void are a Microsoft extension">, + InGroup<Microsoft>; def err_pseudo_dtor_type_mismatch : Error< "the type of object expression (%0) does not match the type being destroyed " "(%1) in pseudo-destructor expression">; @@ -3785,9 +4279,6 @@ def err_dtor_expr_without_call : Error< def err_pseudo_dtor_destructor_non_type : Error< "%0 does not refer to a type name in pseudo-destructor expression; expected " "the name of type %1">; -def err_pseudo_dtor_template : Error< - "specialization of template %0 does not refer to a scalar type in pseudo-" - "destructor expression">; def err_invalid_use_of_function_type : Error< "a function type is not allowed here">; def err_invalid_use_of_array_type : Error<"an array type is not allowed here">; @@ -3803,10 +4294,10 @@ def err_typecheck_deleted_function : Error< "conversion function from %0 to %1 invokes a deleted function">; def err_expected_class_or_namespace : Error<"expected a class or namespace">; -def err_missing_qualified_for_redecl : Error< - "must qualify the name %0 to declare %q1 in this scope">; -def err_invalid_declarator_scope : Error< - "definition or redeclaration of %0 not in a namespace enclosing %1">; +def err_expected_class : Error<"%0 is not a class%select{ or namespace|, " + "namespace, or scoped enumeration}1">; +def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here " + "because namespace %1 does not enclose namespace %2">; def err_invalid_declarator_global_scope : Error< "definition or redeclaration of %0 cannot name the global scope">; def err_invalid_declarator_in_function : Error< @@ -3818,8 +4309,6 @@ def err_cannot_form_pointer_to_member_of_reference_type : Error< "cannot form a pointer-to-member to member %0 of reference type %1">; def err_incomplete_object_call : Error< "incomplete type in call to object of type %0">; -def err_incomplete_pointer_to_member_return : Error< - "incomplete return type %0 of pointer-to-member constant">; def warn_condition_is_assignment : Warning<"using the result of an " "assignment as a condition without parentheses">, @@ -3842,12 +4331,6 @@ def note_equality_comparison_to_assign : Note< def note_equality_comparison_silence : Note< "remove extraneous parentheses around the comparison to silence this warning">; -def warn_synthesized_ivar_access : Warning< - "direct access of synthesized ivar by using property access %0">, - InGroup<NonfragileAbi2>, DefaultIgnore; - -def note_global_declared_at : Note<"global variable declared here">; - // assignment related diagnostics (also for argument passing, returning, etc). // In most of these diagnostics the %2 is a value from the // Sema::AssignmentAction enumeration @@ -3857,11 +4340,24 @@ def err_typecheck_convert_incompatible : Error< "%select{from incompatible type|to parameter of incompatible type|" "from a function with incompatible result type|to incompatible type|" "with an expression of incompatible type|to parameter of incompatible type|" - "to incompatible type}2 %1; " - "%select{|dereference with *|" - "take the address with &|" - "remove *|" - "remove &}3">; + "to incompatible type}2 %1" + "%select{|; dereference with *|" + "; take the address with &|" + "; remove *|" + "; remove &}3" + "%select{|: different classes (%5 vs %6)" + "|: different number of parameters (%5 vs %6)" + "|: type mismatch at %ordinal5 parameter (%6 vs %7)" + "|: different return type (%5 vs %6)" + "|: different qualifiers (" + "%select{none|const|restrict|const and restrict|volatile|const and volatile|" + "volatile and restrict|const, volatile, and restrict}5 vs " + "%select{none|const|restrict|const and restrict|volatile|const and volatile|" + "volatile and restrict|const, volatile, and restrict}6)}4">; +def err_typecheck_missing_return_type_incompatible : Error< + "return type %0 must match previous return type %1 when %select{block " + "literal|lambda expression}2 has unspecified explicit return type">; + def warn_incompatible_qualified_id : Warning< "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" " %0 " @@ -3874,21 +4370,23 @@ def ext_typecheck_convert_pointer_int : ExtWarn< "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" " %0 " "%select{from|to parameter of type|from a function with result type|to type|" - "with an expression of type|to parameter of type|to type}2 %1; " - "%select{|dereference with *|" - "take the address with &|" - "remove *|" - "remove &}3">; + "with an expression of type|to parameter of type|to type}2 %1" + "%select{|; dereference with *|" + "; take the address with &|" + "; remove *|" + "; remove &}3">, + InGroup<IntConversion>; def ext_typecheck_convert_int_pointer : ExtWarn< "incompatible integer to pointer conversion " "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" " %0 " "%select{from|to parameter of type|from a function with result type|to type|" - "with an expression of type|to parameter of type|to type}2 %1; " - "%select{|dereference with *|" - "take the address with &|" - "remove *|" - "remove &}3">; + "with an expression of type|to parameter of type|to type}2 %1" + "%select{|; dereference with *|" + "; take the address with &|" + "; remove *|" + "; remove &}3">, + InGroup<IntConversion>; def ext_typecheck_convert_pointer_void_func : Extension< "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" " %0 " @@ -3908,10 +4406,10 @@ def ext_typecheck_convert_incompatible_pointer : ExtWarn< " %0 " "%select{from|to parameter of type|from a function with result type|to type|" "with an expression of type|to parameter of type|to type}2 %1" - "%select{|dereference with *|" - "take the address with &|" - "remove *|" - "remove &}3">, + "%select{|; dereference with *|" + "; take the address with &|" + "; remove *|" + "; remove &}3">, InGroup<IncompatiblePointerTypes>; def ext_typecheck_convert_discards_qualifiers : ExtWarn< "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" @@ -3933,7 +4431,7 @@ def warn_incompatible_vectors : Warning< " %0 " "%select{from|to parameter of type|from a function with result type|to type|" "with an expression of type|to parameter of type|to type}2 %1">, - InGroup<VectorConversions>, DefaultIgnore; + InGroup<VectorConversion>, DefaultIgnore; def err_int_to_block_pointer : Error< "invalid block pointer conversion " "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" @@ -3964,8 +4462,6 @@ def err_typecheck_incompatible_ownership : Error< "|sending %0 to parameter of type %1" "|casting %0 to type %1}2" " changes retain/release properties of pointer">; -def err_typecheck_convert_ambiguous : Error< - "ambiguity in initializing value of type %0 with initializer of type %1">; def err_typecheck_comparison_of_distinct_blocks : Error< "comparison of distinct block types (%0 and %1)">; @@ -3984,6 +4480,8 @@ def err_typecheck_duplicate_vector_components_not_mlvalue : Error< "vector is not assignable (contains duplicate components)">; def err_block_decl_ref_not_modifiable_lvalue : Error< "variable is not assignable (missing __block type specifier)">; +def err_lambda_decl_ref_not_modifiable_lvalue : Error< + "cannot assign to a variable captured by copy in a non-mutable lambda">; def err_typecheck_call_not_function : Error< "called object type %0 is not a function or function pointer">; def err_call_incomplete_return : Error< @@ -4012,6 +4510,8 @@ def err_typecheck_call_too_many_args_at_most : Error< "expected at most %1, have %2">; def note_callee_decl : Note< "%0 declared here">; +def note_defined_here : Note<"%0 defined here">; + def warn_call_wrong_number_of_arguments : Warning< "too %select{few|many}0 arguments in call to %1">; def err_atomic_builtin_must_be_pointer : Error< @@ -4025,12 +4525,15 @@ def err_atomic_builtin_pointer_size : Error< def err_atomic_op_needs_atomic : Error< "first argument to atomic operation must be a pointer to _Atomic " "type (%0 invalid)">; +def err_atomic_op_needs_trivial_copy : Error< + "first argument to atomic operation must be a pointer to a trivially-copyable" + " type (%0 invalid)">; def err_atomic_op_needs_atomic_int_or_ptr : Error< - "first argument to atomic operation must be a pointer to atomic " - "integer or pointer (%0 invalid)">; -def err_atomic_op_logical_needs_atomic_int : Error< - "first argument to logical atomic operation must be a pointer to atomic " - "integer (%0 invalid)">; + "first argument to atomic operation must be a pointer to %select{|atomic }0" + "integer or pointer (%1 invalid)">; +def err_atomic_op_bitwise_needs_atomic_int : Error< + "first argument to bitwise atomic operation must be a pointer to " + "%select{|atomic }0integer (%1 invalid)">; def err_deleted_function_use : Error<"attempt to use a deleted function">; @@ -4055,6 +4558,10 @@ def warn_cannot_pass_non_pod_arg_to_vararg : Warning< "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic" " %select{function|block|method|constructor}2; call will abort at runtime">, InGroup<DiagGroup<"non-pod-varargs">>, DefaultError; +def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning< + "passing object of trivial but non-POD type %0 through variadic" + " %select{function|block|method|constructor}1 is incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; def err_typecheck_call_invalid_ordered_compare : Error< "ordered compare requires two args of floating point type (%0 and %1)">; @@ -4095,9 +4602,6 @@ def warn_typecheck_cond_pointer_integer_mismatch : ExtWarn< InGroup<DiagGroup<"conditional-type-mismatch">>; def err_typecheck_choose_expr_requires_constant : Error< "'__builtin_choose_expr' requires a constant expression">; -def ext_typecheck_expression_not_constant_but_accepted : Extension< - "expression is not a constant, but is accepted as one by GNU extensions">, - InGroup<GNU>; def warn_unused_expr : Warning<"expression result unused">, InGroup<UnusedValue>; def warn_unused_voidptr : Warning< @@ -4106,6 +4610,9 @@ def warn_unused_voidptr : Warning< def warn_unused_property_expr : Warning< "property access result unused - getters should not be used for side effects">, InGroup<UnusedValue>; +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>; @@ -4120,6 +4627,10 @@ def note_inequality_comparison_to_or_assign : Note< def err_incomplete_type_used_in_type_trait_expr : Error< "incomplete type %0 used in type trait expression">; +def err_type_trait_arity : Error< + "type trait requires %0%select{| or more}1 argument%select{|s}2; have " + "%3 argument%s3">; + def err_dimension_expr_not_constant_integer : Error< "dimension expression does not evaluate to a constant unsigned int">; def err_expected_ident_or_lparen : Error<"expected identifier or '('">; @@ -4165,10 +4676,6 @@ def err_invalid_conversion_between_vector_and_integer : Error< def err_invalid_conversion_between_vector_and_scalar : Error< "invalid conversion between vector type %0 and scalar type %1">; -def err_overload_expr_requires_non_zero_constant : Error< - "overload requires a non-zero constant expression as first argument">; -def err_overload_incorrect_fntype : Error< - "argument is not a function, or has wrong number of parameters">; // C++ member initializers. def err_only_constructors_take_base_inits : Error< @@ -4177,7 +4684,7 @@ def err_only_constructors_take_base_inits : Error< def err_multiple_mem_initialization : Error < "multiple initializations given for non-static member %0">; def err_multiple_mem_union_initialization : Error < - "initializing multiple members of anonymous union">; + "initializing multiple members of union">; def err_multiple_base_initialization : Error < "multiple initializations given for base %0">; @@ -4213,16 +4720,19 @@ def err_in_class_initializer_literal_type : Error< "in-class initializer for static data member of type %0 requires " "'constexpr' specifier">; def err_in_class_initializer_non_constant : Error< - "in-class initializer is not a constant expression">; + "in-class initializer for static data member is not a constant expression">; def ext_in_class_initializer_non_constant : Extension< - "in-class initializer is not a constant expression, accepted as an extension">; + "in-class initializer for static data member is not a constant expression; " + "folding it to a constant is a GNU extension">; // C++ anonymous unions and GNU anonymous structs/unions def ext_anonymous_union : Extension< - "anonymous unions are a GNU extension in C">, InGroup<GNU>; -def ext_anonymous_struct : Extension< + "anonymous unions are a C11 extension">, InGroup<C11>; +def ext_gnu_anonymous_struct : Extension< "anonymous structs are a GNU extension">, InGroup<GNU>; +def ext_c11_anonymous_struct : Extension< + "anonymous structs are a C11 extension">, InGroup<C11>; def err_anonymous_union_not_static : Error< "anonymous unions at namespace or global scope must be declared 'static'">; def err_anonymous_union_with_storage_spec : Error< @@ -4253,7 +4763,14 @@ def ext_ms_anonymous_struct : ExtWarn< // C++ local classes def err_reference_to_local_var_in_enclosing_function : Error< - "reference to local variable %0 declared in enclosed function %1">; + "reference to local variable %0 declared in enclosing function %1">; +def err_reference_to_local_var_in_enclosing_block : Error< + "reference to local variable %0 declared in enclosing block literal">; +def err_reference_to_local_var_in_enclosing_lambda : Error< + "reference to local variable %0 declared in enclosing lambda expression">; +def err_reference_to_local_var_in_enclosing_context : Error< + "reference to local variable %0 declared in enclosing context">; + def note_local_variable_declared_here : Note< "%0 declared here">; def err_static_data_member_not_allowed_in_local_class : Error< @@ -4277,14 +4794,6 @@ def err_memptr_conv_via_virtual : Error< "conversion from pointer to member of class %0 to pointer to member " "of class %1 via virtual base %2 is not allowed">; -// C++ access control -def err_conv_to_inaccessible_base : Error< - "conversion from %0 to inaccessible base class %1">, AccessControl; -def note_inheritance_specifier_here : Note< - "'%0' inheritance specifier here">; -def note_inheritance_implicitly_private_here : Note< - "inheritance is implicitly 'private'">; - // C++ member name lookup def err_ambiguous_member_multiple_subobjects : Error< "non-static member %0 found in multiple base-class subobjects of type %1:%2">; @@ -4347,16 +4856,18 @@ def err_operator_delete_param_type : Error< // C++ literal operators def err_literal_operator_outside_namespace : Error< "literal operator %0 must be in a namespace or global scope">; +def err_literal_operator_default_argument : Error< + "literal operator cannot have a default argument">; // FIXME: This diagnostic sucks def err_literal_operator_params : Error< "parameter declaration for literal operator %0 is not valid">; -def warn_user_literal_hexfloat : Warning< - "user-defined literal with suffix '%0' is preempted by C99 hexfloat " - "extension">, InGroup<UserDefinedLiterals>; +def err_literal_operator_extern_c : Error< + "literal operator must have C++ linkage">; def warn_user_literal_reserved : Warning< - "user-defined literals not starting with '_' are reserved by the " - "implementation">, InGroup<UserDefinedLiterals>; - + "user-defined literal suffixes not starting with '_' are reserved; " + "no literal will invoke this operator">, + InGroup<UserDefinedLiterals>; + // C++ conversion functions def err_conv_function_not_member : Error< "conversion function must be a non-static member function">; @@ -4385,8 +4896,11 @@ def warn_not_compound_assign : Warning< "use of unary operator that may be intended as compound assignment (%0=)">; // C++11 explicit conversion operators -def warn_explicit_conversion_functions : Warning< +def ext_explicit_conversion_functions : ExtWarn< "explicit conversion functions are a C++11 extension">, InGroup<CXX11>; +def warn_cxx98_compat_explicit_conversion_functions : Warning< + "explicit conversion functions are incompatible with C++98">, + InGroup<CXX98Compat>, DefaultIgnore; // C++11 defaulted functions def err_defaulted_default_ctor_params : Error< @@ -4448,6 +4962,9 @@ def err_incorrect_defaulted_exception_spec : Error< "copy constructor|move constructor|copy assignment operator|move assignment " "operator|destructor}0 does not match the " "calculated one">; +def err_incorrect_defaulted_constexpr : Error< + "defaulted definition of %select{default constructor|copy constructor|" + "move constructor}0 is not constexpr">; def err_out_of_line_default_deletes : Error< "defaulting this %select{default constructor|copy constructor|move " "constructor|copy assignment operator|move assignment operator|destructor}0 " @@ -4461,10 +4978,10 @@ def warn_ptr_arith_exceeds_bounds : Warning< "contains %1 element%s2)">, InGroup<DiagGroup<"array-bounds-pointer-arithmetic">>, DefaultIgnore; def warn_array_index_precedes_bounds : Warning< - "array index of '%0' indexes before the beginning of the array">, + "array index %0 is before the beginning of the array">, InGroup<DiagGroup<"array-bounds">>; def warn_array_index_exceeds_bounds : Warning< - "array index of '%0' indexes past the end of an array (that contains %1 " + "array index %0 is past the end of the array (which contains %1 " "element%s2)">, InGroup<DiagGroup<"array-bounds">>; def note_array_index_out_of_bounds : Note< "array %0 declared here">; @@ -4486,7 +5003,7 @@ def warn_scanf_nonzero_width : Warning< "zero field width in scanf format string is unused">, InGroup<Format>; def warn_printf_conversion_argument_type_mismatch : Warning< - "conversion specifies type %0 but the argument has type %1">, + "format specifies type %0 but the argument has type %1">, InGroup<Format>; def warn_printf_positional_arg_exceeds_data_args : Warning < "data argument position '%0' exceeds the number of data arguments (%1)">, @@ -4500,9 +5017,11 @@ def warn_format_invalid_positional_specifier : Warning< def warn_format_mix_positional_nonpositional_args : Warning< "cannot mix positional and non-positional arguments in format string">, InGroup<Format>; -def warn_null_arg : Warning< - "null passed to a callee which requires a non-null argument">, - InGroup<NonNull>; +def warn_static_array_too_small : Warning< + "array argument is too small; contains %0 elements, callee requires at least %1">, + InGroup<DiagGroup<"array-bounds">>; +def note_callee_static_array : Note< + "callee declares array parameter as static here">; def warn_empty_format_string : Warning< "format string is empty">, InGroup<FormatZeroLength>; def warn_format_string_is_wide_literal : Warning< @@ -4523,13 +5042,26 @@ def warn_printf_nonsensical_flag: Warning< def warn_format_nonsensical_length: Warning< "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">, InGroup<Format>; +def warn_format_non_standard_positional_arg: ExtWarn< + "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore; +def warn_format_non_standard: ExtWarn< + "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">, + InGroup<FormatNonStandard>, DefaultIgnore; +def warn_format_non_standard_conversion_spec: ExtWarn< + "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">, + InGroup<FormatNonStandard>, DefaultIgnore; def warn_printf_ignored_flag: Warning< "flag '%0' is ignored when flag '%1' is present">, InGroup<Format>; def warn_scanf_scanlist_incomplete : Warning< "no closing ']' for '%%[' in scanf format string">, InGroup<Format>; - +def note_format_string_defined : Note<"format string is defined here">; + +def warn_null_arg : Warning< + "null passed to a callee which requires a non-null argument">, + InGroup<NonNull>; + // CHECK: returning address/reference of stack memory def warn_ret_stack_addr : Warning< "address of stack memory associated with local variable %0 returned">, @@ -4597,9 +5129,6 @@ def err_generic_sel_multi_match : Error< // Blocks def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks" " or pick a deployment target that supports them">; -def err_expected_block_lbrace : Error<"expected '{' in block literal">; -def err_return_in_block_expression : Error< - "return not allowed in block expression literal">; def err_block_returning_array_function : Error< "block cannot return %select{array|function}0 type %1">; @@ -4633,20 +5162,37 @@ def err_duplicate_case : Error<"duplicate case value '%0'">; def warn_case_empty_range : Warning<"empty case range specified">; def warn_missing_case_for_condition : Warning<"no case matching constant switch condition '%0'">; + +def warn_def_missing_case1 : Warning< + "enumeration value %0 not explicitly handled in switch">, + InGroup<SwitchEnum>, DefaultIgnore; +def warn_def_missing_case2 : Warning< + "enumeration values %0 and %1 not explicitly handled in switch">, + InGroup<SwitchEnum>, DefaultIgnore; +def warn_def_missing_case3 : Warning< + "enumeration values %0, %1, and %2 not explicitly handled in switch">, + InGroup<SwitchEnum>, DefaultIgnore; +def warn_def_missing_cases : Warning< + "%0 enumeration values not explicitly handled in switch: %1, %2, %3...">, + InGroup<SwitchEnum>, DefaultIgnore; + def warn_missing_case1 : Warning<"enumeration value %0 not handled in switch">, - InGroup<DiagGroup<"switch-enum"> >; + InGroup<Switch>; def warn_missing_case2 : Warning< "enumeration values %0 and %1 not handled in switch">, - InGroup<DiagGroup<"switch-enum"> >; + InGroup<Switch>; def warn_missing_case3 : Warning< "enumeration values %0, %1, and %2 not handled in switch">, - InGroup<DiagGroup<"switch-enum"> >; + InGroup<Switch>; def warn_missing_cases : Warning< "%0 enumeration values not handled in switch: %1, %2, %3...">, - InGroup<DiagGroup<"switch-enum"> >; + InGroup<Switch>; +def warn_unreachable_default : Warning< + "default label in switch which covers all enumeration values">, + InGroup<CoveredSwitchDefault>, DefaultIgnore; def warn_not_in_enum : Warning<"case value not in enumerated type %0">, - InGroup<DiagGroup<"switch-enum"> >; + InGroup<Switch>; def err_typecheck_statement_requires_scalar : Error< "statement requires expression of scalar type (%0 invalid)">; def err_typecheck_statement_requires_integer : Error< @@ -4662,8 +5208,20 @@ def err_switch_explicit_conversion : Error< "switch condition type %0 requires explicit conversion to %1">; def err_switch_incomplete_class_type : Error< "switch condition has incomplete class type %0">; + def warn_empty_if_body : Warning< "if statement has empty body">, InGroup<EmptyBody>; +def warn_empty_for_body : Warning< + "for loop has empty body">, InGroup<EmptyBody>; +def warn_empty_range_based_for_body : Warning< + "range-based for loop has empty body">, InGroup<EmptyBody>; +def warn_empty_while_body : Warning< + "while loop has empty body">, InGroup<EmptyBody>; +def warn_empty_switch_body : Warning< + "switch statement has empty body">, InGroup<EmptyBody>; +def note_empty_body_on_separate_line : Note< + "put the semicolon on a separate line to silence this warning">, + InGroup<EmptyBody>; def err_va_start_used_in_non_variadic_function : Error< "'va_start' used in function with fixed args">; @@ -4696,7 +5254,10 @@ def ext_return_has_expr : ExtWarn< "should not return a value">, DefaultError, InGroup<ReturnType>; def ext_return_has_void_expr : Extension< - "void %select{function|method}1 %0 should not return void expression">; + "void %select{function|method|block}1 %0 should not return void expression">; +def err_return_init_list : Error< + "%select{void function|void method|constructor|destructor}1 %0 " + "must not return a value">; def warn_noreturn_function_has_return_expr : Warning< "function %0 declared 'noreturn' should not return">, InGroup<DiagGroup<"invalid-noreturn">>; @@ -4769,14 +5330,14 @@ def err_decimal_unsupported : Error< "GNU decimal type extension not supported">; def err_missing_type_specifier : Error< "C++ requires a type specifier for all declarations">; -def err_missing_param_declspec : Error< - "parameter requires a declaration specifier">; def err_objc_array_of_interfaces : Error< "array of interface %0 is invalid (probably should be an array of pointers)">; def ext_c99_array_usage : Extension< - "use of C99-specific array features, accepted as an extension">; + "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 " + "feature">, InGroup<C99>; def err_c99_array_usage_cxx : Error< - "C99-specific array features are not permitted in C++">; + "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 " + "feature, not permitted in C++">; def err_double_requires_fp64 : Error< "use of type 'double' requires cl_khr_fp64 extension to be enabled">; def err_nsconsumed_attribute_mismatch : Error< @@ -4803,7 +5364,8 @@ def error_protected_ivar_access : Error<"instance variable %0 is protected">, AccessControl; def warn_maynot_respond : Warning<"%0 may not respond to %1">; def warn_attribute_method_def : Warning< - "method attribute can only be specified on method declarations">; + "attributes on method implementation and its declaration must match">, + InGroup<DiagGroup<"mismatched-method-attributes">>; def ext_typecheck_base_super : Warning< "method parameter type %0 does not match " "super class method parameter type %1">, InGroup<SuperSubClassMismatch>, DefaultIgnore; @@ -4910,8 +5472,6 @@ def note_related_result_type_inferred : Note< } let CategoryName = "Modules Issue" in { -def err_module_private_follows_public : Error< - "__module_private__ declaration of %0 follows public declaration">; def err_module_private_specialization : Error< "%select{template|partial|member}0 specialization cannot be " "declared __module_private__">; @@ -4921,6 +5481,8 @@ def err_module_private_local : Error< def err_module_private_local_class : Error< "local %select{struct|union|class|enum}0 cannot be declared " "__module_private__">; +def err_module_private_definition : Error< + "definition of %0 must be imported before it is required">; } } // end of sema component. diff --git a/include/clang/Basic/DiagnosticSerializationKinds.td b/include/clang/Basic/DiagnosticSerializationKinds.td new file mode 100644 index 0000000000000..7f9fe262f7f64 --- /dev/null +++ b/include/clang/Basic/DiagnosticSerializationKinds.td @@ -0,0 +1,60 @@ +//==--- DiagnosticSerializationKinds.td - serialization diagnostics -------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +let Component = "Serialization" in { + +def err_fe_unable_to_read_pch_file : Error< + "unable to read PCH file: '%0'">; +def err_fe_not_a_pch_file : Error< + "input is not a PCH file: '%0'">; +def err_fe_pch_malformed : Error< + "malformed or corrupted PCH file: '%0'">, DefaultFatal; +def err_fe_pch_malformed_block : Error< + "malformed block record in PCH file: '%0'">, DefaultFatal; +def err_fe_pch_error_at_end_block : Error< + "error at end of module block in PCH file: '%0'">, DefaultFatal; +def err_fe_pch_file_modified : Error< + "file '%0' has been modified since the precompiled header was built">, + DefaultFatal; + +def warn_pch_target_triple : Error< + "PCH file was compiled for the target '%0' but the current translation " + "unit is being compiled for target '%1'">; +def err_pch_langopt_mismatch : Error<"%0 was %select{disabled|enabled}1 in " + "PCH file but is currently %select{disabled|enabled}2">; +def err_pch_langopt_value_mismatch : Error< + "%0 differs in PCH file vs. current file">; + +def warn_pch_version_too_old : Error< + "PCH file uses an older PCH format that is no longer supported">; +def warn_pch_version_too_new : Error< + "PCH file uses a newer PCH format that cannot be read">; +def warn_pch_different_branch : Error< + "PCH file built from a different branch (%0) than the compiler (%1)">; +def err_pch_with_compiler_errors : Error< + "PCH file contains compiler errors">; +def warn_cmdline_conflicting_macro_def : Error< + "definition of the macro '%0' conflicts with the definition used to " + "build the precompiled header">; +def note_pch_macro_defined_as : Note< + "definition of macro '%0' in the precompiled header">; +def warn_cmdline_missing_macro_defs : Warning< + "macro definitions used to build the precompiled header are missing">; +def note_using_macro_def_from_pch : Note< + "using this macro definition from precompiled header">; +def warn_macro_name_used_in_pch : Error< + "definition of macro %0 conflicts with an identifier used in the " + "precompiled header">; +def warn_pch_compiler_options_mismatch : Error< + "compiler options used when building the precompiled header differ from " + "the options used when using the precompiled header">; + +def err_not_a_pch_file : Error< + "'%0' does not appear to be a precompiled header file">, DefaultFatal; +} diff --git a/include/clang/Basic/ExpressionTraits.h b/include/clang/Basic/ExpressionTraits.h index 403a59a8d19c5..c4e6a1c96f1aa 100644 --- a/include/clang/Basic/ExpressionTraits.h +++ b/include/clang/Basic/ExpressionTraits.h @@ -1,4 +1,4 @@ -//===--- ExpressionTraits.h - C++ Expression Traits Support Enumerations ----*- C++ -*-===// +//===- ExpressionTraits.h - C++ Expression Traits Support Enums -*- C++ -*-===// // // The LLVM Compiler Infrastructure // diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h index ea8ed9f02fed7..5c7d9eba4af15 100644 --- a/include/clang/Basic/FileManager.h +++ b/include/clang/Basic/FileManager.h @@ -39,7 +39,7 @@ namespace sys { class Path; } namespace clang { class FileManager; class FileSystemStatCache; - + /// DirectoryEntry - Cached information about one directory (either on /// the disk or in the virtual file system). /// @@ -64,12 +64,12 @@ class FileEntry { dev_t Device; // ID for the device containing the file. ino_t Inode; // Inode number for the file. mode_t FileMode; // The file mode as returned by 'stat'. - + /// FD - The file descriptor for the file entry if it is opened and owned /// by the FileEntry. If not, this is set to -1. mutable int FD; friend class FileManager; - + public: FileEntry(dev_t device, ino_t inode, mode_t m) : Name(0), Device(device), Inode(inode), FileMode(m), FD(-1) {} @@ -80,7 +80,7 @@ public: memcpy(this, &FE, sizeof(FE)); assert(FD == -1 && "Cannot copy a file-owning FileEntry"); } - + void operator=(const FileEntry &FE) { memcpy(this, &FE, sizeof(FE)); assert(FD == -1 && "Cannot assign a file-owning FileEntry"); @@ -110,13 +110,14 @@ public: /// properties, such as uniquing files based on "inode", so that a file with two /// names (e.g. symlinked) will be treated as a single file. /// -class FileManager : public llvm::RefCountedBase<FileManager> { +class FileManager : public RefCountedBase<FileManager> { FileSystemOptions FileSystemOpts; class UniqueDirContainer; class UniqueFileContainer; - /// UniqueRealDirs/UniqueRealFiles - Cache for existing real directories/files. + /// UniqueRealDirs/UniqueRealFiles - Cache for existing real + /// directories/files. /// UniqueDirContainer &UniqueRealDirs; UniqueFileContainer &UniqueRealFiles; @@ -147,7 +148,7 @@ class FileManager : public llvm::RefCountedBase<FileManager> { unsigned NumDirCacheMisses, NumFileCacheMisses; // Caching. - llvm::OwningPtr<FileSystemStatCache> StatCache; + OwningPtr<FileSystemStatCache> StatCache; bool getStatValue(const char *Path, struct stat &StatBuf, int *FileDescriptor); @@ -224,7 +225,7 @@ public: /// file to the corresponding FileEntry pointer. void GetUniqueIDMapping( SmallVectorImpl<const FileEntry *> &UIDToFiles) const; - + void PrintStats() const; }; diff --git a/include/clang/Basic/FileSystemStatCache.h b/include/clang/Basic/FileSystemStatCache.h index 77828b3ecb8ad..96a2f90ed1941 100644 --- a/include/clang/Basic/FileSystemStatCache.h +++ b/include/clang/Basic/FileSystemStatCache.h @@ -14,6 +14,7 @@ #ifndef LLVM_CLANG_FILESYSTEMSTATCACHE_H #define LLVM_CLANG_FILESYSTEMSTATCACHE_H +#include "clang/Basic/LLVM.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/StringMap.h" #include <sys/types.h> @@ -25,8 +26,9 @@ namespace clang { /// system calls, which is used by precompiled and pretokenized headers to /// improve performance. class FileSystemStatCache { + virtual void anchor(); protected: - llvm::OwningPtr<FileSystemStatCache> NextStatCache; + OwningPtr<FileSystemStatCache> NextStatCache; public: virtual ~FileSystemStatCache() {} diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index 5e48a86619743..cc0080b8779d3 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -20,11 +20,9 @@ #include "clang/Basic/LLVM.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" -#include "llvm/ADT/SmallString.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/Support/PointerLikeTypeTraits.h" #include <cassert> -#include <cctype> #include <string> namespace llvm { @@ -49,8 +47,6 @@ namespace clang { /// variable or function name). The preprocessor keeps this information in a /// set, and all tok::identifier tokens have a pointer to one of these. class IdentifierInfo { - // Note: DON'T make TokenID a 'tok::TokenKind'; MSVC will treat it as a - // signed char and TokenKinds > 255 won't be handled correctly. unsigned TokenID : 9; // Front-end token ID or tok::identifier. // Objective-C keyword ('protocol' in '@protocol') or builtin (__builtin_inf). // First NUM_OBJC_KEYWORDS values are for Objective-C, the remaining values @@ -62,11 +58,19 @@ class IdentifierInfo { bool IsPoisoned : 1; // True if identifier is poisoned. bool IsCPPOperatorKeyword : 1; // True if ident is a C++ operator keyword. bool NeedsHandleIdentifier : 1; // See "RecomputeNeedsHandleIdentifier". - bool IsFromAST : 1; // True if identfier first appeared in an AST - // file and wasn't modified since. + bool IsFromAST : 1; // True if identifier was loaded (at least + // partially) from an AST file. + bool ChangedAfterLoad : 1; // True if identifier has changed from the + // definition loaded from an AST file. bool RevertedTokenID : 1; // True if RevertTokenIDToIdentifier was // called. - // 5 bits left in 32-bit word. + bool OutOfDate : 1; // True if there may be additional + // information about this identifier + // stored externally. + bool IsModulesImport : 1; // True if this is the 'import' contextual + // keyword. + // 1 bit left in 32-bit word. + void *FETokenInfo; // Managed by the language front-end. llvm::StringMapEntry<IdentifierInfo*> *Entry; @@ -132,7 +136,6 @@ public: NeedsHandleIdentifier = 1; else RecomputeNeedsHandleIdentifier(); - IsFromAST = false; } /// getTokenID - If this is a source-language token (e.g. 'for'), this API @@ -221,7 +224,6 @@ public: NeedsHandleIdentifier = 1; else RecomputeNeedsHandleIdentifier(); - IsFromAST = false; } /// isPoisoned - Return true if this token has been poisoned. @@ -253,8 +255,48 @@ public: /// from an AST file. bool isFromAST() const { return IsFromAST; } - void setIsFromAST(bool FromAST = true) { IsFromAST = FromAST; } + void setIsFromAST() { IsFromAST = true; } + /// \brief Determine whether this identifier has changed since it was loaded + /// from an AST file. + bool hasChangedSinceDeserialization() const { + return ChangedAfterLoad; + } + + /// \brief Note that this identifier has changed since it was loaded from + /// an AST file. + void setChangedSinceDeserialization() { + ChangedAfterLoad = true; + } + + /// \brief Determine whether the information for this identifier is out of + /// date with respect to the external source. + bool isOutOfDate() const { return OutOfDate; } + + /// \brief Set whether the information for this identifier is out of + /// date with respect to the external source. + void setOutOfDate(bool OOD) { + OutOfDate = OOD; + if (OOD) + NeedsHandleIdentifier = true; + else + RecomputeNeedsHandleIdentifier(); + } + + /// \brief Determine whether this is the contextual keyword + /// '__experimental_modules_import'. + bool isModulesImport() const { return IsModulesImport; } + + /// \brief Set whether this identifier is the contextual keyword + /// '__experimental_modules_import'. + void setModulesImport(bool I) { + IsModulesImport = I; + if (I) + NeedsHandleIdentifier = true; + else + RecomputeNeedsHandleIdentifier(); + } + private: /// RecomputeNeedsHandleIdentifier - The Preprocessor::HandleIdentifier does /// several special (but rare) things to identifiers of various sorts. For @@ -266,8 +308,8 @@ private: void RecomputeNeedsHandleIdentifier() { NeedsHandleIdentifier = (isPoisoned() | hasMacroDefinition() | isCPlusPlusOperatorKeyword() | - isExtensionToken() | isCXX11CompatKeyword() || - (getTokenID() == tok::kw___import_module__)); + isExtensionToken() | isCXX11CompatKeyword() || isOutOfDate() || + isModulesImport()); } }; @@ -449,6 +491,10 @@ public: // 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; @@ -662,14 +708,7 @@ public: /// has been capitalized. static Selector constructSetterName(IdentifierTable &Idents, SelectorTable &SelTable, - const IdentifierInfo *Name) { - llvm::SmallString<100> SelectorName; - SelectorName = "set"; - SelectorName += Name->getName(); - SelectorName[3] = toupper(SelectorName[3]); - IdentifierInfo *SetterName = &Idents.get(SelectorName); - return SelTable.getUnarySelector(SetterName); - } + const IdentifierInfo *Name); }; /// DeclarationNameExtra - Common base of the MultiKeywordSelector, diff --git a/include/clang/Basic/LLVM.h b/include/clang/Basic/LLVM.h index 27c459dee4e24..813b49ed23532 100644 --- a/include/clang/Basic/LLVM.h +++ b/include/clang/Basic/LLVM.h @@ -24,9 +24,20 @@ namespace llvm { class StringRef; class Twine; template<typename T> class ArrayRef; + template<class T> class OwningPtr; + template<unsigned InternalLen> class SmallString; template<typename T, unsigned N> class SmallVector; template<typename T> class SmallVectorImpl; + template<typename T> + struct SaveAndRestore; + + // Reference counting. + template <typename T> class IntrusiveRefCntPtr; + template <typename T> struct IntrusiveRefCntPtrInfo; + template <class Derived> class RefCountedBase; + class RefCountedBaseVPTR; + class raw_ostream; // TODO: DenseMap, ... } @@ -44,9 +55,18 @@ namespace clang { using llvm::StringRef; using llvm::Twine; using llvm::ArrayRef; + using llvm::OwningPtr; + using llvm::SmallString; using llvm::SmallVector; using llvm::SmallVectorImpl; - + using llvm::SaveAndRestore; + + // Reference counting. + using llvm::IntrusiveRefCntPtr; + using llvm::IntrusiveRefCntPtrInfo; + using llvm::RefCountedBase; + using llvm::RefCountedBaseVPTR; + using llvm::raw_ostream; } // end namespace clang. diff --git a/include/clang/Basic/Lambda.h b/include/clang/Basic/Lambda.h new file mode 100644 index 0000000000000..df50d94894ae6 --- /dev/null +++ b/include/clang/Basic/Lambda.h @@ -0,0 +1,38 @@ +//===--- Lambda.h - Types for C++ Lambdas -----------------------*- 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 several types used to describe C++ lambda +// expressions that are shared between the parser and AST. +//===----------------------------------------------------------------------===// + + +#ifndef LLVM_CLANG_BASIC_LAMBDA_H +#define LLVM_CLANG_BASIC_LAMBDA_H + +namespace clang { + +/// LambdaCaptureDefault - The default, if any, capture method for a +/// lambda expression. +enum LambdaCaptureDefault { + LCD_None, + LCD_ByCopy, + LCD_ByRef +}; + +/// LambdaCaptureKind - The different capture forms in a lambda +/// introducer: 'this' or a copied or referenced variable. +enum LambdaCaptureKind { + LCK_This, + LCK_ByCopy, + LCK_ByRef +}; + +} // end namespace clang + +#endif // LLVM_CLANG_BASIC_LAMBDA_H diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def index 03882f8cdb099..d2ce7c0df63e7 100644 --- a/include/clang/Basic/LangOptions.def +++ b/include/clang/Basic/LangOptions.def @@ -42,7 +42,7 @@ #endif LANGOPT(C99 , 1, 0, "C99") -LANGOPT(C1X , 1, 0, "C1X") +LANGOPT(C11 , 1, 0, "C11") LANGOPT(MicrosoftExt , 1, 0, "Microsoft extensions") LANGOPT(MicrosoftMode , 1, 0, "Microsoft compatibility mode") LANGOPT(Borland , 1, 0, "Borland extensions") @@ -90,16 +90,18 @@ LANGOPT(Blocks , 1, 0, "blocks extension to C") BENIGN_LANGOPT(EmitAllDecls , 1, 0, "support for emitting all declarations") LANGOPT(MathErrno , 1, 1, "errno support for math functions") BENIGN_LANGOPT(HeinousExtensions , 1, 0, "Extensions that we really don't like and may be ripped out at any time") - +LANGOPT(Modules , 1, 0, "modules extension to C") LANGOPT(Optimize , 1, 0, "__OPTIMIZE__ predefined macro") 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(PICLevel , 2, 0, "__PIC__ level") +VALUE_LANGOPT(PICLevel , 2, 0, "__PIC__ level") +VALUE_LANGOPT(PIELevel , 2, 0, "__PIE__ level") LANGOPT(GNUInline , 1, 0, "GNU inline semantics") -LANGOPT(NoInline , 1, 0, "__NO_INLINE__ predefined macro") +LANGOPT(NoInlineDefine , 1, 0, "__NO_INLINE__ predefined macro") LANGOPT(Deprecated , 1, 0, "__DEPRECATED predefined macro") +LANGOPT(FastMath , 1, 0, "__FAST_MATH__ predefined macro") BENIGN_LANGOPT(ObjCGCBitmapPrint , 1, 0, "printing of GC's bitmap layout for __weak/__strong ivars") @@ -116,17 +118,23 @@ LANGOPT(AssumeSaneOperatorNew , 1, 1, "implicit __attribute__((malloc)) for C++' BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision") BENIGN_LANGOPT(CatchUndefined , 1, 0, "catching undefined behavior at run time") BENIGN_LANGOPT(DumpRecordLayouts , 1, 0, "dumping the layout of IRgen'd records") +BENIGN_LANGOPT(DumpRecordLayoutsSimple , 1, 0, "dumping the layout of IRgen'd records in a simple form") BENIGN_LANGOPT(DumpVTableLayouts , 1, 0, "dumping the layouts of emitted vtables") LANGOPT(NoConstantCFStrings , 1, 0, "no constant CoreFoundation strings") BENIGN_LANGOPT(InlineVisibilityHidden , 1, 0, "hidden default visibility for inline C++ methods") BENIGN_LANGOPT(ParseUnknownAnytype, 1, 0, "__unknown_anytype") BENIGN_LANGOPT(DebuggerSupport , 1, 0, "debugger support") +BENIGN_LANGOPT(DebuggerCastResultToId, 1, 0, "for 'po' in the debugger, cast the result to id if it is of unknown type") +BENIGN_LANGOPT(DebuggerObjCLiteral , 1, 0, "debugger objective-C literals and subscripting support") +BENIGN_LANGOPT(AddressSanitizer , 1, 0, "AddressSanitizer enabled") +BENIGN_LANGOPT(ThreadSanitizer , 1, 0, "ThreadSanitizer enabled") BENIGN_LANGOPT(SpellChecking , 1, 1, "spell-checking") LANGOPT(SinglePrecisionConstants , 1, 0, "treating double-precision floating point constants as single precision constants") LANGOPT(FastRelaxedMath , 1, 0, "OpenCL fast relaxed math") LANGOPT(DefaultFPContract , 1, 0, "FP_CONTRACT") LANGOPT(NoBitFieldTypeAlign , 1, 0, "bit-field type alignment") +LANGOPT(HexagonQdsp6Compat , 1, 0, "hexagon-qdsp6 backward compatibility") LANGOPT(ObjCAutoRefCount , 1, 0, "Objective-C automated reference counting") LANGOPT(ObjCRuntimeHasWeak , 1, 0, "__weak support in the ARC runtime") LANGOPT(FakeAddressSpaceMap , 1, 0, "OpenCL fake address space map") @@ -145,11 +153,15 @@ ENUM_LANGOPT(SignedOverflowBehavior, SignedOverflowBehaviorTy, 2, SOB_Undefined, BENIGN_LANGOPT(InstantiationDepth, 32, 1024, "maximum template instantiation depth") +BENIGN_LANGOPT(ConstexprCallDepth, 32, 512, + "maximum constexpr call depth") BENIGN_LANGOPT(NumLargeByValueCopy, 32, 0, "if non-zero, warn about parameter or return Warn if parameter/return value is larger in bytes than this setting. 0 is no check.") VALUE_LANGOPT(MSCVersion, 32, 0, "version of Microsoft Visual C/C++") +LANGOPT(ApplePragmaPack, 1, 0, "Apple gcc-compatible #pragma pack handling") + #undef LANGOPT #undef VALUE_LANGOPT #undef BENIGN_LANGOPT diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h index 688047ff5bdf9..ce4ff063c6282 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -15,13 +15,33 @@ #define LLVM_CLANG_LANGOPTIONS_H #include <string> +#include "clang/Basic/LLVM.h" #include "clang/Basic/Visibility.h" +#include "llvm/ADT/IntrusiveRefCntPtr.h" namespace clang { +/// Bitfields of LangOptions, split out from LangOptions in order to ensure that +/// this large collection of bitfields is a trivial class type. +class LangOptionsBase { +public: + // Define simple language options (with no accessors). +#define LANGOPT(Name, Bits, Default, Description) unsigned Name : Bits; +#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) +#include "clang/Basic/LangOptions.def" + +protected: + // Define language options of enumeration type. These are private, and will + // have accessors (below). +#define LANGOPT(Name, Bits, Default, Description) +#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ + unsigned Name : Bits; +#include "clang/Basic/LangOptions.def" +}; + /// LangOptions - This class keeps track of the various options that can be /// enabled, which controls the dialect of C that is accepted. -class LangOptions { +class LangOptions : public RefCountedBase<LangOptions>, public LangOptionsBase { public: typedef clang::Visibility Visibility; @@ -34,19 +54,6 @@ public: SOB_Trapping // -ftrapv }; - // Define simple language options (with no accessors). -#define LANGOPT(Name, Bits, Default, Description) unsigned Name : Bits; -#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) -#include "clang/Basic/LangOptions.def" - -private: - // Define language options of enumeration type. These are private, and will - // have accessors (below). -#define LANGOPT(Name, Bits, Default, Description) -#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ - unsigned Name : Bits; -#include "clang/Basic/LangOptions.def" - public: std::string ObjCConstantStringClass; @@ -54,6 +61,9 @@ public: /// If none is specified, abort (GCC-compatible behaviour). std::string OverflowHandler; + /// \brief The name of the current module. + std::string CurrentModule; + LangOptions(); // Define accessors/mutators for language options of enumeration type. diff --git a/include/clang/Basic/Linkage.h b/include/clang/Basic/Linkage.h index 01b6c790428aa..09a5a0b6b1f36 100644 --- a/include/clang/Basic/Linkage.h +++ b/include/clang/Basic/Linkage.h @@ -29,7 +29,7 @@ enum Linkage { InternalLinkage, /// \brief External linkage within a unique namespace. From the - /// langauge perspective, these entities have external + /// language perspective, these entities have external /// linkage. However, since they reside in an anonymous namespace, /// their names are unique to this translation unit, which is /// equivalent to having internal linkage from the code-generation diff --git a/include/clang/Basic/Makefile b/include/clang/Basic/Makefile index eeffe2dfb6cd2..702afac1e6b91 100644 --- a/include/clang/Basic/Makefile +++ b/include/clang/Basic/Makefile @@ -4,6 +4,7 @@ BUILT_SOURCES = \ DiagnosticCommonKinds.inc DiagnosticDriverKinds.inc \ DiagnosticFrontendKinds.inc DiagnosticLexKinds.inc \ DiagnosticParseKinds.inc DiagnosticSemaKinds.inc \ + DiagnosticSerializationKinds.inc \ DiagnosticIndexName.inc DiagnosticGroups.inc AttrList.inc arm_neon.inc \ Version.inc @@ -29,7 +30,7 @@ else CLANG_HAS_VERSION_PATCHLEVEL := 1 endif -$(ObjDir)/Diagnostic%Kinds.inc.tmp : Diagnostic.td Diagnostic%Kinds.td $(CLANG_TBLGEN) $(ObjDir)/.dir +$(ObjDir)/Diagnostic%Kinds.inc.tmp : Diagnostic.td $(INPUT_TDS) $(CLANG_TBLGEN) $(ObjDir)/.dir $(Echo) "Building Clang $(patsubst Diagnostic%Kinds.inc.tmp,%,$(@F)) diagnostic tables with tblgen" $(Verb) $(ClangTableGen) -gen-clang-diags-defs -clang-component=$(patsubst Diagnostic%Kinds.inc.tmp,%,$(@F)) -o $(call SYSPATH, $@) $< diff --git a/include/clang/Basic/Module.h b/include/clang/Basic/Module.h new file mode 100644 index 0000000000000..82dbd5b0c02d6 --- /dev/null +++ b/include/clang/Basic/Module.h @@ -0,0 +1,284 @@ +//===--- Module.h - Describe a module ---------------------------*- 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 Module class, which describes a module in the source +// code. +// +//===----------------------------------------------------------------------===// +#ifndef LLVM_CLANG_BASIC_MODULE_H +#define LLVM_CLANG_BASIC_MODULE_H + +#include "clang/Basic/SourceLocation.h" +#include "llvm/ADT/PointerIntPair.h" +#include "llvm/ADT/PointerUnion.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include <string> +#include <utility> +#include <vector> + +namespace llvm { + class raw_ostream; +} + +namespace clang { + +class DirectoryEntry; +class FileEntry; +class LangOptions; +class TargetInfo; + +/// \brief Describes the name of a module. +typedef llvm::SmallVector<std::pair<std::string, SourceLocation>, 2> + ModuleId; + +/// \brief Describes a module or submodule. +class Module { +public: + /// \brief The name of this module. + std::string Name; + + /// \brief The location of the module definition. + SourceLocation DefinitionLoc; + + /// \brief The parent of this module. This will be NULL for the top-level + /// module. + Module *Parent; + + /// \brief The umbrella header or directory. + llvm::PointerUnion<const DirectoryEntry *, const FileEntry *> Umbrella; + +private: + /// \brief The submodules of this module, indexed by name. + std::vector<Module *> SubModules; + + /// \brief A mapping from the submodule name to the index into the + /// \c SubModules vector at which that submodule resides. + llvm::StringMap<unsigned> SubModuleIndex; + +public: + /// \brief The headers that are part of this module. + llvm::SmallVector<const FileEntry *, 2> Headers; + + /// \brief The set of language features required to use this module. + /// + /// If any of these features is not present, the \c IsAvailable bit + /// will be false to indicate that this (sub)module is not + /// available. + llvm::SmallVector<std::string, 2> Requires; + + /// \brief Whether this module is available in the current + /// translation unit. + unsigned IsAvailable : 1; + + /// \brief Whether this module was loaded from a module file. + unsigned IsFromModuleFile : 1; + + /// \brief Whether this is a framework module. + unsigned IsFramework : 1; + + /// \brief Whether this is an explicit submodule. + unsigned IsExplicit : 1; + + /// \brief Whether this is a "system" module (which assumes that all + /// headers in it are system headers). + unsigned IsSystem : 1; + + /// \brief Whether we should infer submodules for this module based on + /// the headers. + /// + /// Submodules can only be inferred for modules with an umbrella header. + unsigned InferSubmodules : 1; + + /// \brief Whether, when inferring submodules, the inferred submodules + /// should be explicit. + unsigned InferExplicitSubmodules : 1; + + /// \brief Whether, when inferring submodules, the inferr submodules should + /// export all modules they import (e.g., the equivalent of "export *"). + unsigned InferExportWildcard : 1; + + /// \brief Describes the visibility of the various names within a + /// particular module. + enum NameVisibilityKind { + /// \brief All of the names in this module are hidden. + /// + Hidden, + /// \brief Only the macro names in this module are visible. + MacrosVisible, + /// \brief All of the names in this module are visible. + AllVisible + }; + + ///\ brief The visibility of names within this particular module. + NameVisibilityKind NameVisibility; + + /// \brief The location of the inferred submodule. + SourceLocation InferredSubmoduleLoc; + + /// \brief The set of modules imported by this module, and on which this + /// module depends. + llvm::SmallVector<Module *, 2> Imports; + + /// \brief Describes an exported module. + /// + /// The pointer is the module being re-exported, while the bit will be true + /// to indicate that this is a wildcard export. + typedef llvm::PointerIntPair<Module *, 1, bool> ExportDecl; + + /// \brief The set of export declarations. + llvm::SmallVector<ExportDecl, 2> Exports; + + /// \brief Describes an exported module that has not yet been resolved + /// (perhaps because tASThe module it refers to has not yet been loaded). + struct UnresolvedExportDecl { + /// \brief The location of the 'export' keyword in the module map file. + SourceLocation ExportLoc; + + /// \brief The name of the module. + ModuleId Id; + + /// \brief Whether this export declaration ends in a wildcard, indicating + /// that all of its submodules should be exported (rather than the named + /// module itself). + bool Wildcard; + }; + + /// \brief The set of export declarations that have yet to be resolved. + llvm::SmallVector<UnresolvedExportDecl, 2> UnresolvedExports; + + /// \brief Construct a top-level module. + explicit Module(StringRef Name, SourceLocation DefinitionLoc, + bool IsFramework) + : Name(Name), DefinitionLoc(DefinitionLoc), Parent(0), Umbrella(), + IsAvailable(true), IsFromModuleFile(false), IsFramework(IsFramework), + IsExplicit(false), IsSystem(false), + InferSubmodules(false), InferExplicitSubmodules(false), + InferExportWildcard(false), NameVisibility(Hidden) { } + + /// \brief Construct a new module or submodule. + Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent, + bool IsFramework, bool IsExplicit); + + ~Module(); + + /// \brief Determine whether this module is available for use within the + /// current translation unit. + bool isAvailable() const { return IsAvailable; } + + /// \brief Determine whether this module is available for use within the + /// current translation unit. + /// + /// \param LangOpts The language options used for the current + /// translation unit. + /// + /// \param Target The target options used for the current translation unit. + /// + /// \param Feature If this module is unavailable, this parameter + /// will be set to one of the features that is required for use of + /// this module (but is not available). + bool isAvailable(const LangOptions &LangOpts, + const TargetInfo &Target, + StringRef &Feature) const; + + /// \brief Determine whether this module is a submodule. + bool isSubModule() const { return Parent != 0; } + + /// \brief Determine whether this module is a submodule of the given other + /// module. + bool isSubModuleOf(Module *Other) const; + + /// \brief Determine whether this module is a part of a framework, + /// either because it is a framework module or because it is a submodule + /// of a framework module. + bool isPartOfFramework() const { + for (const Module *Mod = this; Mod; Mod = Mod->Parent) + if (Mod->IsFramework) + return true; + + return false; + } + + /// \brief Retrieve the full name of this module, including the path from + /// its top-level module. + std::string getFullModuleName() const; + + /// \brief Retrieve the top-level module for this (sub)module, which may + /// be this module. + Module *getTopLevelModule() { + return const_cast<Module *>( + const_cast<const Module *>(this)->getTopLevelModule()); + } + + /// \brief Retrieve the top-level module for this (sub)module, which may + /// be this module. + const Module *getTopLevelModule() const; + + /// \brief Retrieve the name of the top-level module. + /// + StringRef getTopLevelModuleName() const { + return getTopLevelModule()->Name; + } + + /// \brief Retrieve the directory for which this module serves as the + /// umbrella. + const DirectoryEntry *getUmbrellaDir() const; + + /// \brief Retrieve the header that serves as the umbrella header for this + /// module. + const FileEntry *getUmbrellaHeader() const { + return Umbrella.dyn_cast<const FileEntry *>(); + } + + /// \brief Determine whether this module has an umbrella directory that is + /// not based on an umbrella header. + bool hasUmbrellaDir() const { + return Umbrella && Umbrella.is<const DirectoryEntry *>(); + } + + /// \briaf Add the given feature requirement to the list of features + /// required by this module. + /// + /// \param Feature The feature that is required by this module (and + /// its submodules). + /// + /// \param LangOpts The set of language options that will be used to + /// evaluate the availability of this feature. + /// + /// \param Target The target options that will be used to evaluate the + /// availability of this feature. + void addRequirement(StringRef Feature, const LangOptions &LangOpts, + const TargetInfo &Target); + + /// \brief Find the submodule with the given name. + /// + /// \returns The submodule if found, or NULL otherwise. + Module *findSubmodule(StringRef Name) const; + + typedef std::vector<Module *>::iterator submodule_iterator; + typedef std::vector<Module *>::const_iterator submodule_const_iterator; + + submodule_iterator submodule_begin() { return SubModules.begin(); } + submodule_const_iterator submodule_begin() const {return SubModules.begin();} + submodule_iterator submodule_end() { return SubModules.end(); } + submodule_const_iterator submodule_end() const { return SubModules.end(); } + + /// \brief Print the module map for this module to the given stream. + /// + void print(llvm::raw_ostream &OS, unsigned Indent = 0) const; + + /// \brief Dump the contents of this module to the given output stream. + void dump() const; +}; + +} // end namespace clang + + +#endif // LLVM_CLANG_BASIC_MODULE_H diff --git a/include/clang/Basic/OnDiskHashTable.h b/include/clang/Basic/OnDiskHashTable.h index 7328b1a6bbfab..8028a73326c37 100644 --- a/include/clang/Basic/OnDiskHashTable.h +++ b/include/clang/Basic/OnDiskHashTable.h @@ -356,7 +356,7 @@ public: friend bool operator!=(const key_iterator& X, const key_iterator &Y) { return X.NumEntriesLeft != Y.NumEntriesLeft; } - + key_iterator& operator++() { // Preincrement if (!NumItemsInBucketLeft) { // 'Items' starts with a 16-bit unsigned integer representing the @@ -421,7 +421,7 @@ public: bool operator!=(const item_iterator& X) const { return X.NumEntriesLeft != NumEntriesLeft; } - + item_iterator& operator++() { // Preincrement if (!NumItemsInBucketLeft) { // 'Items' starts with a 16-bit unsigned integer representing the @@ -449,7 +449,7 @@ public: LocalPtr += 4; // Skip the hash. // Determine the length of the key and the data. - const std::pair<unsigned, unsigned>& L = Info::ReadKeyDataLength(LocalPtr); + const std::pair<unsigned, unsigned>& L =Info::ReadKeyDataLength(LocalPtr); // Read the key. const internal_key_type& Key = @@ -458,14 +458,14 @@ public: InfoObj->ReadData(Key, LocalPtr + L.first, L.second)); } }; - + item_iterator item_begin() { return item_iterator(Base + 4, getNumEntries(), &InfoObj); } item_iterator item_end() { return item_iterator(); } Info &getInfoObj() { return InfoObj; } - + static OnDiskChainedHashTable* Create(const unsigned char* buckets, const unsigned char* const base, const Info &InfoObj = Info()) { diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h index c6ca98976555b..007e6a47603ac 100644 --- a/include/clang/Basic/PartialDiagnostic.h +++ b/include/clang/Basic/PartialDiagnostic.h @@ -25,88 +25,90 @@ namespace clang { class PartialDiagnostic { public: + enum { + // The MaxArguments and MaxFixItHints member enum values from + // DiagnosticsEngine are private but DiagnosticsEngine declares + // PartialDiagnostic a friend. These enum values are redeclared + // here so that the nested Storage class below can access them. + MaxArguments = DiagnosticsEngine::MaxArguments + }; + struct Storage { - Storage() : NumDiagArgs(0), NumDiagRanges(0), NumFixItHints(0) { } + Storage() : NumDiagArgs(0), NumDiagRanges(0) { } enum { - /// MaxArguments - The maximum number of arguments we can hold. We + /// MaxArguments - The maximum number of arguments we can hold. We /// currently only support up to 10 arguments (%0-%9). /// A single diagnostic with more than that almost certainly has to /// be simplified anyway. - MaxArguments = DiagnosticsEngine::MaxArguments + MaxArguments = PartialDiagnostic::MaxArguments }; - + /// NumDiagArgs - This contains the number of entries in Arguments. unsigned char NumDiagArgs; - + /// NumDiagRanges - This is the number of ranges in the DiagRanges array. unsigned char NumDiagRanges; - /// \brief The number of code modifications hints in the - /// FixItHints array. - unsigned char NumFixItHints; - /// DiagArgumentsKind - This is an array of ArgumentKind::ArgumentKind enum /// values, with one for each argument. This specifies whether the argument /// is in DiagArgumentsStr or in DiagArguments. unsigned char DiagArgumentsKind[MaxArguments]; - - /// DiagArgumentsVal - The values for the various substitution positions. - /// This is used when the argument is not an std::string. The specific value + + /// DiagArgumentsVal - The values for the various substitution positions. + /// This is used when the argument is not an std::string. The specific value /// is mangled into an intptr_t and the interpretation depends on exactly /// what sort of argument kind it is. intptr_t DiagArgumentsVal[MaxArguments]; - + /// \brief The values for the various substitution positions that have /// string arguments. std::string DiagArgumentsStr[MaxArguments]; - + /// DiagRanges - The list of ranges added to this diagnostic. It currently /// only support 10 ranges, could easily be extended if needed. CharSourceRange DiagRanges[10]; - - enum { MaxFixItHints = DiagnosticsEngine::MaxFixItHints }; - + /// FixItHints - If valid, provides a hint with some code /// to insert, remove, or modify at a particular position. - FixItHint FixItHints[MaxFixItHints]; + SmallVector<FixItHint, 6> FixItHints; }; - /// \brief An allocator for Storage objects, which uses a small cache to + /// \brief An allocator for Storage objects, which uses a small cache to /// objects, used to reduce malloc()/free() traffic for partial diagnostics. class StorageAllocator { static const unsigned NumCached = 16; Storage Cached[NumCached]; Storage *FreeList[NumCached]; unsigned NumFreeListEntries; - + public: StorageAllocator(); ~StorageAllocator(); - + /// \brief Allocate new storage. Storage *Allocate() { if (NumFreeListEntries == 0) return new Storage; - + Storage *Result = FreeList[--NumFreeListEntries]; Result->NumDiagArgs = 0; Result->NumDiagRanges = 0; - Result->NumFixItHints = 0; + Result->FixItHints.clear(); return Result; } - + /// \brief Free the given storage object. void Deallocate(Storage *S) { if (S >= Cached && S <= Cached + NumCached) { FreeList[NumFreeListEntries++] = S; return; } - + delete S; } }; - + private: // NOTE: Sema assumes that PartialDiagnostic is location-invariant // in the sense that its bits can be safely memcpy'ed and destructed @@ -114,18 +116,18 @@ private: /// DiagID - The diagnostic ID. mutable unsigned DiagID; - + /// DiagStorage - Storage for args and ranges. mutable Storage *DiagStorage; /// \brief Allocator used to allocate storage for this diagnostic. StorageAllocator *Allocator; - + /// \brief Retrieve storage for this particular diagnostic. Storage *getStorage() const { if (DiagStorage) return DiagStorage; - + if (Allocator) DiagStorage = Allocator->Allocate(); else { @@ -134,48 +136,53 @@ private: } return DiagStorage; } - - void freeStorage() { + + void freeStorage() { if (!DiagStorage) return; - + + // The hot path for PartialDiagnostic is when we just used it to wrap an ID + // (typically so we have the flexibility of passing a more complex + // diagnostic into the callee, but that does not commonly occur). + // + // Split this out into a slow function for silly compilers (*cough*) which + // can't do decent partial inlining. + freeStorageSlow(); + } + + void freeStorageSlow() { if (Allocator) Allocator->Deallocate(DiagStorage); else if (Allocator != reinterpret_cast<StorageAllocator *>(~uintptr_t(0))) delete DiagStorage; DiagStorage = 0; } - + void AddSourceRange(const CharSourceRange &R) const { if (!DiagStorage) DiagStorage = getStorage(); - assert(DiagStorage->NumDiagRanges < + assert(DiagStorage->NumDiagRanges < llvm::array_lengthof(DiagStorage->DiagRanges) && "Too many arguments to diagnostic!"); DiagStorage->DiagRanges[DiagStorage->NumDiagRanges++] = R; - } + } void AddFixItHint(const FixItHint &Hint) const { if (Hint.isNull()) return; - + if (!DiagStorage) DiagStorage = getStorage(); - assert(DiagStorage->NumFixItHints < Storage::MaxFixItHints && - "Too many code modification hints!"); - if (DiagStorage->NumFixItHints >= Storage::MaxFixItHints) - return; // Don't crash in release builds - DiagStorage->FixItHints[DiagStorage->NumFixItHints++] - = Hint; + DiagStorage->FixItHints.push_back(Hint); } - + public: PartialDiagnostic(unsigned DiagID, StorageAllocator &Allocator) : DiagID(DiagID), DiagStorage(0), Allocator(&Allocator) { } - - PartialDiagnostic(const PartialDiagnostic &Other) + + PartialDiagnostic(const PartialDiagnostic &Other) : DiagID(Other.DiagID), DiagStorage(0), Allocator(Other.Allocator) { if (Other.DiagStorage) { @@ -184,14 +191,14 @@ public: } } - PartialDiagnostic(const PartialDiagnostic &Other, Storage *DiagStorage) - : DiagID(Other.DiagID), DiagStorage(DiagStorage), + PartialDiagnostic(const PartialDiagnostic &Other, Storage *DiagStorage) + : DiagID(Other.DiagID), DiagStorage(DiagStorage), Allocator(reinterpret_cast<StorageAllocator *>(~uintptr_t(0))) { if (Other.DiagStorage) *this->DiagStorage = *Other.DiagStorage; } - + PartialDiagnostic(const Diagnostic &Other, StorageAllocator &Allocator) : DiagID(Other.getID()), DiagStorage(0), Allocator(&Allocator) { @@ -202,22 +209,22 @@ public: else AddTaggedVal(Other.getRawArg(I), Other.getArgKind(I)); } - + // Copy source ranges. for (unsigned I = 0, N = Other.getNumRanges(); I != N; ++I) AddSourceRange(Other.getRange(I)); - + // Copy fix-its. for (unsigned I = 0, N = Other.getNumFixItHints(); I != N; ++I) AddFixItHint(Other.getFixItHint(I)); } - + PartialDiagnostic &operator=(const PartialDiagnostic &Other) { DiagID = Other.DiagID; if (Other.DiagStorage) { if (!DiagStorage) DiagStorage = getStorage(); - + *DiagStorage = *Other.DiagStorage; } else { freeStorage(); @@ -245,7 +252,7 @@ public: void AddString(StringRef V) const { if (!DiagStorage) DiagStorage = getStorage(); - + assert(DiagStorage->NumDiagArgs < Storage::MaxArguments && "Too many arguments to diagnostic!"); DiagStorage->DiagArgumentsKind[DiagStorage->NumDiagArgs] @@ -256,7 +263,7 @@ public: void Emit(const DiagnosticBuilder &DB) const { if (!DiagStorage) return; - + // Add all arguments. for (unsigned i = 0, e = DiagStorage->NumDiagArgs; i != e; ++i) { if ((DiagnosticsEngine::ArgumentKind)DiagStorage->DiagArgumentsKind[i] @@ -266,25 +273,25 @@ public: DB.AddTaggedVal(DiagStorage->DiagArgumentsVal[i], (DiagnosticsEngine::ArgumentKind)DiagStorage->DiagArgumentsKind[i]); } - + // Add all ranges. for (unsigned i = 0, e = DiagStorage->NumDiagRanges; i != e; ++i) DB.AddSourceRange(DiagStorage->DiagRanges[i]); - + // Add all fix-its. - for (unsigned i = 0, e = DiagStorage->NumFixItHints; i != e; ++i) + for (unsigned i = 0, e = DiagStorage->FixItHints.size(); i != e; ++i) DB.AddFixItHint(DiagStorage->FixItHints[i]); } - + /// \brief Clear out this partial diagnostic, giving it a new diagnostic ID /// and removing all of its arguments, ranges, and fix-it hints. void Reset(unsigned DiagID = 0) { this->DiagID = DiagID; freeStorage(); } - + bool hasStorage() const { return DiagStorage != 0; } - + friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, unsigned I) { PD.AddTaggedVal(I, DiagnosticsEngine::ak_uint); @@ -306,11 +313,11 @@ public: friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, StringRef S) { - + PD.AddString(S); return PD; } - + friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, const SourceRange &R) { PD.AddSourceRange(CharSourceRange::getTokenRange(R)); @@ -322,13 +329,13 @@ public: PD.AddSourceRange(R); return PD; } - + friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, const FixItHint &Hint) { PD.AddFixItHint(Hint); return PD; } - + }; inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, @@ -336,7 +343,7 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, PD.Emit(DB); return DB; } - + /// \brief A partial diagnostic along with the source location where this /// diagnostic occurs. typedef std::pair<SourceLocation, PartialDiagnostic> PartialDiagnosticAt; diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index 154148c16b03c..d5fa7e74acf58 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -16,6 +16,7 @@ #include "clang/Basic/LLVM.h" #include "llvm/Support/PointerLikeTypeTraits.h" +#include "llvm/Support/Compiler.h" #include <utility> #include <functional> #include <cassert> @@ -245,6 +246,7 @@ public: /// the last token. Return false if the end of this range specifies the last /// character in the range. bool isTokenRange() const { return IsTokenRange; } + bool isCharRange() const { return !IsTokenRange; } SourceLocation getBegin() const { return Range.getBegin(); } SourceLocation getEnd() const { return Range.getEnd(); } @@ -323,7 +325,7 @@ public: /// Prints information about this FullSourceLoc to stderr. Useful for /// debugging. - void dump() const { SourceLocation::dump(*SrcMgr); } + LLVM_ATTRIBUTE_USED void dump() const; friend inline bool operator==(const FullSourceLoc &LHS, const FullSourceLoc &RHS) { diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 985ddd641271c..bcb2d561a4e4d 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -102,7 +102,39 @@ namespace SrcMgr { /// NumLines - The number of lines in this ContentCache. This is only valid /// if SourceLineCache is non-null. - unsigned NumLines; + unsigned NumLines : 31; + + /// \brief Indicates whether the buffer itself was provided to override + /// the actual file contents. + /// + /// When true, the original entry may be a virtual file that does not + /// exist. + unsigned BufferOverridden : 1; + + ContentCache(const FileEntry *Ent = 0) + : Buffer(0, false), OrigEntry(Ent), ContentsEntry(Ent), + SourceLineCache(0), NumLines(0), BufferOverridden(false) {} + + ContentCache(const FileEntry *Ent, const FileEntry *contentEnt) + : Buffer(0, false), OrigEntry(Ent), ContentsEntry(contentEnt), + SourceLineCache(0), NumLines(0), BufferOverridden(false) {} + + ~ContentCache(); + + /// The copy ctor does not allow copies where source object has either + /// a non-NULL Buffer or SourceLineCache. Ownership of allocated memory + /// is not transferred, so this is a logical error. + ContentCache(const ContentCache &RHS) + : Buffer(0, false), SourceLineCache(0), BufferOverridden(false) + { + OrigEntry = RHS.OrigEntry; + ContentsEntry = RHS.ContentsEntry; + + assert (RHS.Buffer.getPointer() == 0 && RHS.SourceLineCache == 0 && + "Passed ContentCache object cannot own a buffer."); + + NumLines = RHS.NumLines; + } /// getBuffer - Returns the memory buffer for the associated content. /// @@ -159,31 +191,6 @@ namespace SrcMgr { return (Buffer.getInt() & DoNotFreeFlag) == 0; } - ContentCache(const FileEntry *Ent = 0) - : Buffer(0, false), OrigEntry(Ent), ContentsEntry(Ent), - SourceLineCache(0), NumLines(0) {} - - ContentCache(const FileEntry *Ent, const FileEntry *contentEnt) - : Buffer(0, false), OrigEntry(Ent), ContentsEntry(contentEnt), - SourceLineCache(0), NumLines(0) {} - - ~ContentCache(); - - /// The copy ctor does not allow copies where source object has either - /// a non-NULL Buffer or SourceLineCache. Ownership of allocated memory - /// is not transferred, so this is a logical error. - ContentCache(const ContentCache &RHS) - : Buffer(0, false), SourceLineCache(0) - { - OrigEntry = RHS.OrigEntry; - ContentsEntry = RHS.ContentsEntry; - - assert (RHS.Buffer.getPointer() == 0 && RHS.SourceLineCache == 0 && - "Passed ContentCache object cannot own a buffer."); - - NumLines = RHS.NumLines; - } - private: // Disable assignments. ContentCache &operator=(const ContentCache& RHS); @@ -293,6 +300,11 @@ namespace SrcMgr { SourceLocation::getFromRawEncoding(ExpansionLocEnd).isInvalid(); } + bool isFunctionMacroExpansion() const { + return getExpansionLocStart().isValid() && + getExpansionLocStart() != getExpansionLocEnd(); + } + /// create - Return a ExpansionInfo for an expansion. Start and End specify /// the expansion range (where the macro is expanded), and SpellingLoc /// specifies the spelling location (where the characters from the token @@ -431,8 +443,7 @@ public: // to determine which came first. This will also take care the case where // one of the locations points at the inclusion/expansion point of the other // in which case its FileID will come before the other. - if (LOffset == ROffset && - (LQueryFID != CommonFID || RQueryFID != CommonFID)) + if (LOffset == ROffset) return IsLQFIDBeforeRQFID; return LOffset < ROffset; @@ -472,7 +483,7 @@ public: /// the case of a macro expansion, for example, the spelling location indicates /// where the expanded token came from and the expansion location specifies /// where it was expanded. -class SourceManager : public llvm::RefCountedBase<SourceManager> { +class SourceManager : public RefCountedBase<SourceManager> { /// \brief DiagnosticsEngine object. DiagnosticsEngine &Diag; @@ -508,7 +519,7 @@ class SourceManager : public llvm::RefCountedBase<SourceManager> { /// /// Negative FileIDs are indexes into this table. To get from ID to an index, /// use (-ID - 2). - std::vector<SrcMgr::SLocEntry> LoadedSLocEntryTable; + mutable std::vector<SrcMgr::SLocEntry> LoadedSLocEntryTable; /// \brief The starting offset of the next local SLocEntry. /// @@ -565,11 +576,13 @@ class SourceManager : public llvm::RefCountedBase<SourceManager> { // Cache for the "fake" buffer used for error-recovery purposes. mutable llvm::MemoryBuffer *FakeBufferForRecovery; + mutable SrcMgr::ContentCache *FakeContentCacheForRecovery; + /// \brief Lazily computed map of macro argument chunks to their expanded /// source location. typedef std::map<unsigned, SourceLocation> MacroArgsMap; - mutable llvm::DenseMap<FileID, MacroArgsMap *> MacroArgsCacheMap; + mutable llvm::DenseMap<FileID, MacroArgsMap *> MacroArgsCacheMap; // SourceManager doesn't support copy construction. explicit SourceManager(const SourceManager&); @@ -607,12 +620,19 @@ public: FileID getMainFileID() const { return MainFileID; } /// createMainFileID - Create the FileID for the main source file. - FileID createMainFileID(const FileEntry *SourceFile) { + FileID createMainFileID(const FileEntry *SourceFile, + SrcMgr::CharacteristicKind Kind = SrcMgr::C_User) { assert(MainFileID.isInvalid() && "MainFileID already set!"); - MainFileID = createFileID(SourceFile, SourceLocation(), SrcMgr::C_User); + MainFileID = createFileID(SourceFile, SourceLocation(), Kind); return MainFileID; } + /// \brief Set the file ID for the main source file. + void setMainFileID(FileID FID) { + assert(MainFileID.isInvalid() && "MainFileID already set!"); + MainFileID = FID; + } + /// \brief Set the file ID for the precompiled preamble. void setPreambleFileID(FileID Preamble) { assert(PreambleFileID.isInvalid() && "PreambleFileID already set!"); @@ -641,8 +661,9 @@ public: /// specified memory buffer. This does no caching of the buffer and takes /// ownership of the MemoryBuffer, so only pass a MemoryBuffer to this once. FileID createFileIDForMemBuffer(const llvm::MemoryBuffer *Buffer, - int LoadedID = 0, unsigned LoadedOffset = 0) { - return createFileID(createMemBufferContentCache(Buffer), SourceLocation(), + int LoadedID = 0, unsigned LoadedOffset = 0, + SourceLocation IncludeLoc = SourceLocation()) { + return createFileID(createMemBufferContentCache(Buffer), IncludeLoc, SrcMgr::C_User, LoadedID, LoadedOffset); } @@ -738,13 +759,19 @@ public: if (MyInvalid || !Entry.isFile()) return 0; - return Entry.getFile().getContentCache()->OrigEntry; + const SrcMgr::ContentCache *Content = Entry.getFile().getContentCache(); + if (!Content) + return 0; + return Content->OrigEntry; } /// Returns the FileEntry record for the provided SLocEntry. const FileEntry *getFileEntryForSLocEntry(const SrcMgr::SLocEntry &sloc) const { - return sloc.getFile().getContentCache()->OrigEntry; + const SrcMgr::ContentCache *Content = sloc.getFile().getContentCache(); + if (!Content) + return 0; + return Content->OrigEntry; } /// getBufferData - Return a StringRef to the source buffer data for the @@ -755,7 +782,7 @@ public: StringRef getBufferData(FileID FID, bool *Invalid = 0) const; /// \brief Get the number of FileIDs (files and macros) that were created - /// during preprocessing of \arg FID, including it. + /// during preprocessing of \p FID, including it. unsigned getNumCreatedFIDsForFileID(FileID FID) const { bool Invalid = false; const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid); @@ -766,7 +793,7 @@ public: } /// \brief Set the number of FileIDs (files and macros) that were created - /// during preprocessing of \arg FID, including it. + /// during preprocessing of \p FID, including it. void setNumCreatedFIDsForFileID(FileID FID, unsigned NumFIDs) const { bool Invalid = false; const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid); @@ -807,8 +834,20 @@ public: unsigned FileOffset = Entry.getOffset(); return SourceLocation::getFileLoc(FileOffset); } + + /// \brief Return the source location corresponding to the last byte of the + /// specified file. + SourceLocation getLocForEndOfFile(FileID FID) const { + bool Invalid = false; + const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid); + if (Invalid || !Entry.isFile()) + return SourceLocation(); + + unsigned FileOffset = Entry.getOffset(); + return SourceLocation::getFileLoc(FileOffset + getFileIDSize(FID) - 1); + } - /// \brief Returns the include location if \arg FID is a #include'd file + /// \brief Returns the include location if \p FID is a #include'd file /// otherwise it returns an invalid location. SourceLocation getIncludeLoc(FileID FID) const { bool Invalid = false; @@ -828,7 +867,7 @@ public: return getExpansionLocSlowCase(Loc); } - /// \brief Given \arg Loc, if it is a macro location return the expansion + /// \brief Given \p Loc, if it is a macro location return the expansion /// location or the spelling location, depending on if it comes from a /// macro argument or not. SourceLocation getFileLoc(SourceLocation Loc) const { @@ -868,7 +907,11 @@ public: /// offset from the start of the buffer of the location. std::pair<FileID, unsigned> getDecomposedLoc(SourceLocation Loc) const { FileID FID = getFileID(Loc); - return std::make_pair(FID, Loc.getOffset()-getSLocEntry(FID).getOffset()); + bool Invalid = false; + const SrcMgr::SLocEntry &E = getSLocEntry(FID, &Invalid); + if (Invalid) + return std::make_pair(FileID(), 0); + return std::make_pair(FID, Loc.getOffset()-E.getOffset()); } /// getDecomposedExpansionLoc - Decompose the specified location into a raw @@ -877,7 +920,10 @@ public: std::pair<FileID, unsigned> getDecomposedExpansionLoc(SourceLocation Loc) const { FileID FID = getFileID(Loc); - const SrcMgr::SLocEntry *E = &getSLocEntry(FID); + bool Invalid = false; + const SrcMgr::SLocEntry *E = &getSLocEntry(FID, &Invalid); + if (Invalid) + return std::make_pair(FileID(), 0); unsigned Offset = Loc.getOffset()-E->getOffset(); if (Loc.isFileID()) @@ -892,7 +938,10 @@ public: std::pair<FileID, unsigned> getDecomposedSpellingLoc(SourceLocation Loc) const { FileID FID = getFileID(Loc); - const SrcMgr::SLocEntry *E = &getSLocEntry(FID); + bool Invalid = false; + const SrcMgr::SLocEntry *E = &getSLocEntry(FID, &Invalid); + if (Invalid) + return std::make_pair(FileID(), 0); unsigned Offset = Loc.getOffset()-E->getOffset(); if (Loc.isFileID()) @@ -914,10 +963,10 @@ public: /// expanded. bool isMacroArgExpansion(SourceLocation Loc) const; - /// \brief Returns true if \arg Loc is inside the [\arg Start, +\arg Length) + /// \brief Returns true if \p Loc is inside the [\p Start, +\p Length) /// chunk of the source location address space. - /// If it's true and \arg RelativeOffset is non-null, it will be set to the - /// relative offset of \arg Loc inside the chunk. + /// If it's true and \p RelativeOffset is non-null, it will be set to the + /// relative offset of \p Loc inside the chunk. bool isInSLocAddrSpace(SourceLocation Loc, SourceLocation Start, unsigned Length, unsigned *RelativeOffset = 0) const { @@ -938,10 +987,10 @@ public: return false; } - /// \brief Return true if both \arg LHS and \arg RHS are in the local source - /// location address space or the loaded one. If it's true and - /// \arg RelativeOffset is non-null, it will be set to the offset of \arg RHS - /// relative to \arg LHS. + /// \brief Return true if both \p LHS and \p RHS are in the local source + /// location address space or the loaded one. If it's true and \p + /// RelativeOffset is non-null, it will be set to the offset of \p RHS + /// relative to \p LHS. bool isInSameSLocAddrSpace(SourceLocation LHS, SourceLocation RHS, int *RelativeOffset) const { unsigned LHSOffs = LHS.getOffset(), RHSOffs = RHS.getOffset(); @@ -1041,12 +1090,17 @@ public: return getFileCharacteristic(Loc) == SrcMgr::C_ExternCSystem; } - /// \brief The size of the SLocEnty that \arg FID represents. + /// \brief Returns whether \p Loc is expanded from a macro in a system header. + bool isInSystemMacro(SourceLocation loc) { + return loc.isMacroID() && isInSystemHeader(getSpellingLoc(loc)); + } + + /// \brief The size of the SLocEnty that \p FID represents. unsigned getFileIDSize(FileID FID) const; - /// \brief Given a specific FileID, returns true if \arg Loc is inside that - /// FileID chunk and sets relative offset (offset of \arg Loc from beginning - /// of FileID) to \arg relativeOffset. + /// \brief Given a specific FileID, returns true if \p Loc is inside that + /// FileID chunk and sets relative offset (offset of \p Loc from beginning + /// of FileID) to \p relativeOffset. bool isInFileID(SourceLocation Loc, FileID FID, unsigned *RelativeOffset = 0) const { unsigned Offs = Loc.getOffset(); @@ -1124,12 +1178,12 @@ public: /// first inclusion. FileID translateFile(const FileEntry *SourceFile) const; - /// \brief Get the source location in \arg FID for the given line:col. - /// Returns null location if \arg FID is not a file SLocEntry. + /// \brief Get the source location in \p FID for the given line:col. + /// Returns null location if \p FID is not a file SLocEntry. SourceLocation translateLineCol(FileID FID, unsigned Line, unsigned Col) const; - /// \brief If \arg Loc points inside a function macro argument, the returned + /// \brief If \p Loc points inside a function macro argument, the returned /// location will be the macro location in which the argument was expanded. /// If a macro argument is used multiple times, the expanded location will /// be at the first expansion of the argument. @@ -1205,14 +1259,19 @@ public: unsigned loaded_sloc_entry_size() const { return LoadedSLocEntryTable.size();} /// \brief Get a loaded SLocEntry. This is exposed for indexing. - const SrcMgr::SLocEntry &getLoadedSLocEntry(unsigned Index, bool *Invalid=0) const { + const SrcMgr::SLocEntry &getLoadedSLocEntry(unsigned Index, + bool *Invalid = 0) const { assert(Index < LoadedSLocEntryTable.size() && "Invalid index"); - if (!SLocEntryLoaded[Index]) - ExternalSLocEntries->ReadSLocEntry(-(static_cast<int>(Index) + 2)); - return LoadedSLocEntryTable[Index]; + if (SLocEntryLoaded[Index]) + return LoadedSLocEntryTable[Index]; + return loadSLocEntry(Index, Invalid); } const SrcMgr::SLocEntry &getSLocEntry(FileID FID, bool *Invalid = 0) const { + if (FID.ID == 0 || FID.ID == -1) { + if (Invalid) *Invalid = true; + return LocalSLocEntryTable[0]; + } return getSLocEntryByID(FID.ID); } @@ -1233,18 +1292,32 @@ public: std::pair<int, unsigned> AllocateLoadedSLocEntries(unsigned NumSLocEntries, unsigned TotalSize); - /// \brief Returns true if \arg Loc came from a PCH/Module. + /// \brief Returns true if \p Loc came from a PCH/Module. bool isLoadedSourceLocation(SourceLocation Loc) const { return Loc.getOffset() >= CurrentLoadedOffset; } - /// \brief Returns true if \arg Loc did not come from a PCH/Module. + /// \brief Returns true if \p Loc did not come from a PCH/Module. bool isLocalSourceLocation(SourceLocation Loc) const { return Loc.getOffset() < NextLocalOffset; } + /// \brief Returns true if \p FID came from a PCH/Module. + bool isLoadedFileID(FileID FID) const { + assert(FID.ID != -1 && "Using FileID sentinel value"); + return FID.ID < 0; + } + + /// \brief Returns true if \p FID did not come from a PCH/Module. + bool isLocalFileID(FileID FID) const { + return !isLoadedFileID(FID); + } + private: const llvm::MemoryBuffer *getFakeBufferForRecovery() const; + const SrcMgr::ContentCache *getFakeContentCacheForRecovery() const; + + const SrcMgr::SLocEntry &loadSLocEntry(unsigned Index, bool *Invalid) const; /// \brief Get the entry with the given unwrapped FileID. const SrcMgr::SLocEntry &getSLocEntryByID(int ID) const { @@ -1254,8 +1327,9 @@ private: return getLocalSLocEntry(static_cast<unsigned>(ID)); } - const SrcMgr::SLocEntry &getLoadedSLocEntryByID(int ID) const { - return getLoadedSLocEntry(static_cast<unsigned>(-ID - 2)); + const SrcMgr::SLocEntry &getLoadedSLocEntryByID(int ID, + bool *Invalid = 0) const { + return getLoadedSLocEntry(static_cast<unsigned>(-ID - 2), Invalid); } /// createExpansionLoc - Implements the common elements of storing an diff --git a/include/clang/Basic/Specifiers.h b/include/clang/Basic/Specifiers.h index 2a95d6165c0d1..9e71827b67bce 100644 --- a/include/clang/Basic/Specifiers.h +++ b/include/clang/Basic/Specifiers.h @@ -40,6 +40,7 @@ namespace clang { TST_char16, // C++0x char16_t TST_char32, // C++0x char32_t TST_int, + TST_int128, TST_half, // OpenCL half, ARM NEON __fp16 TST_float, TST_double, @@ -58,7 +59,7 @@ namespace clang { TST_underlyingType, // __underlying_type for C++0x TST_auto, // C++0x auto TST_unknown_anytype, // __unknown_anytype extension - TST_atomic, // C1X _Atomic + TST_atomic, // C11 _Atomic TST_error // erroneous type }; @@ -113,7 +114,12 @@ namespace clang { /// An Objective C property is a logical field of an Objective-C /// object which is read and written via Objective C method calls. - OK_ObjCProperty + OK_ObjCProperty, + + /// An Objective C array/dictionary subscripting which reads an object + /// or writes at the subscripted array/dictionary element via + /// Objective C method calls. + OK_ObjCSubscript }; // \brief Describes the kind of template specialization that a diff --git a/include/clang/Basic/StmtNodes.td b/include/clang/Basic/StmtNodes.td index 7b3d7762c24aa..67d71e44c0a4a 100644 --- a/include/clang/Basic/StmtNodes.td +++ b/include/clang/Basic/StmtNodes.td @@ -77,6 +77,7 @@ def ImplicitValueInitExpr : DStmt<Expr>; def ParenListExpr : DStmt<Expr>; def VAArgExpr : DStmt<Expr>; def GenericSelectionExpr : DStmt<Expr>; +def PseudoObjectExpr : DStmt<Expr>; // Atomic expressions def AtomicExpr : DStmt<Expr>; @@ -97,6 +98,7 @@ def CXXReinterpretCastExpr : DStmt<CXXNamedCastExpr>; def CXXConstCastExpr : DStmt<CXXNamedCastExpr>; def CXXFunctionalCastExpr : DStmt<ExplicitCastExpr>; def CXXTypeidExpr : DStmt<Expr>; +def UserDefinedLiteral : DStmt<CallExpr>; def CXXBoolLiteralExpr : DStmt<Expr>; def CXXNullPtrLiteralExpr : DStmt<Expr>; def CXXThisExpr : DStmt<Expr>; @@ -106,6 +108,7 @@ def CXXScalarValueInitExpr : DStmt<Expr>; def CXXNewExpr : DStmt<Expr>; def CXXDeleteExpr : DStmt<Expr>; def CXXPseudoDestructorExpr : DStmt<Expr>; +def TypeTraitExpr : DStmt<Expr>; def UnaryTypeTraitExpr : DStmt<Expr>; def BinaryTypeTraitExpr : DStmt<Expr>; def ArrayTypeTraitExpr : DStmt<Expr>; @@ -126,9 +129,13 @@ def SizeOfPackExpr : DStmt<Expr>; def SubstNonTypeTemplateParmExpr : DStmt<Expr>; def SubstNonTypeTemplateParmPackExpr : DStmt<Expr>; def MaterializeTemporaryExpr : DStmt<Expr>; +def LambdaExpr : DStmt<Expr>; // Obj-C Expressions. def ObjCStringLiteral : DStmt<Expr>; +def ObjCNumericLiteral : DStmt<Expr>; +def ObjCArrayLiteral : DStmt<Expr>; +def ObjCDictionaryLiteral : DStmt<Expr>; def ObjCEncodeExpr : DStmt<Expr>; def ObjCMessageExpr : DStmt<Expr>; def ObjCSelectorExpr : DStmt<Expr>; @@ -137,6 +144,8 @@ def ObjCIvarRefExpr : DStmt<Expr>; def ObjCPropertyRefExpr : DStmt<Expr>; def ObjCIsaExpr : DStmt<Expr>; def ObjCIndirectCopyRestoreExpr : DStmt<Expr>; +def ObjCBoolLiteralExpr : DStmt<Expr>; +def ObjCSubscriptRefExpr : DStmt<Expr>; // Obj-C ARC Expressions. def ObjCBridgedCastExpr : DStmt<ExplicitCastExpr>; @@ -147,7 +156,6 @@ def CUDAKernelCallExpr : DStmt<CallExpr>; // Clang Extensions. def ShuffleVectorExpr : DStmt<Expr>; def BlockExpr : DStmt<Expr>; -def BlockDeclRefExpr : DStmt<Expr>; def OpaqueValueExpr : DStmt<Expr>; // Microsoft Extensions. @@ -155,6 +163,7 @@ def CXXUuidofExpr : DStmt<Expr>; def SEHTryStmt : Stmt; def SEHExceptStmt : Stmt; def SEHFinallyStmt : Stmt; +def MSDependentExistsStmt : Stmt; // OpenCL Extensions. def AsTypeExpr : DStmt<Expr>; diff --git a/include/clang/Basic/TargetBuiltins.h b/include/clang/Basic/TargetBuiltins.h index 8bc60ff5386d9..7c04bf7edf5b4 100644 --- a/include/clang/Basic/TargetBuiltins.h +++ b/include/clang/Basic/TargetBuiltins.h @@ -56,6 +56,55 @@ namespace clang { }; } + /// NeonTypeFlags - Flags to identify the types for overloaded Neon + /// builtins. These must be kept in sync with the flags in + /// utils/TableGen/NeonEmitter.h. + class NeonTypeFlags { + enum { + EltTypeMask = 0xf, + UnsignedFlag = 0x10, + QuadFlag = 0x20 + }; + uint32_t Flags; + + public: + enum EltType { + Int8, + Int16, + Int32, + Int64, + Poly8, + Poly16, + Float16, + Float32 + }; + + NeonTypeFlags(unsigned F) : Flags(F) {} + NeonTypeFlags(EltType ET, bool IsUnsigned, bool IsQuad) : Flags(ET) { + if (IsUnsigned) + Flags |= UnsignedFlag; + if (IsQuad) + Flags |= QuadFlag; + } + + EltType getEltType() const { return (EltType)(Flags & EltTypeMask); } + bool isPoly() const { + EltType ET = getEltType(); + return ET == Poly8 || ET == Poly16; + } + bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; } + bool isQuad() const { return (Flags & QuadFlag) != 0; } + }; + + /// Hexagon builtins + namespace Hexagon { + enum { + LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, +#define BUILTIN(ID, TYPE, ATTRS) BI##ID, +#include "clang/Basic/BuiltinsHexagon.def" + LastTSBuiltin + }; + } } // end namespace clang. #endif diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index a87af2fbbc7a1..bbd376a824158 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -59,11 +59,12 @@ enum TargetCXXABI { /// TargetInfo - This class exposes information about the current target. /// -class TargetInfo : public llvm::RefCountedBase<TargetInfo> { +class TargetInfo : public RefCountedBase<TargetInfo> { llvm::Triple Triple; protected: // Target values set by the ctor of the actual target implementation. Default // values are specified by the TargetInfo constructor. + bool BigEndian; bool TLSSupported; bool NoAsmVariants; // True if {|} are normal characters. unsigned char PointerWidth, PointerAlign; @@ -76,6 +77,7 @@ protected: unsigned char LargeArrayMinWidth, LargeArrayAlign; unsigned char LongWidth, LongAlign; unsigned char LongLongWidth, LongLongAlign; + unsigned char SuitableAlign; unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth; const char *DescriptionString; const char *UserLabelPrefix; @@ -91,6 +93,7 @@ protected: unsigned HasAlignMac68kSupport : 1; unsigned RealTypeUsesObjCFPRet : 3; + unsigned ComplexLongDoubleUsesFP2Ret : 1; // TargetInfo Constructor. Default initializes all fields. TargetInfo(const std::string &T); @@ -211,6 +214,10 @@ public: unsigned getLongLongWidth() const { return LongLongWidth; } unsigned getLongLongAlign() const { return LongLongAlign; } + /// getSuitableAlign - Return the alignment that is suitable for storing any + /// object with a fundamental alignment requirement. + unsigned getSuitableAlign() const { return SuitableAlign; } + /// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in /// bits. unsigned getWCharWidth() const { return getTypeWidth(WCharType); } @@ -249,6 +256,9 @@ public: return *LongDoubleFormat; } + /// getFloatEvalMethod - Return the value for the C99 FLT_EVAL_METHOD macro. + virtual unsigned getFloatEvalMethod() const { return 0; } + // getLargeArrayMinWidth/Align - Return the minimum array size that is // 'large' and its alignment. unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; } @@ -327,6 +337,12 @@ public: return RealTypeUsesObjCFPRet & (1 << T); } + /// \brief Check whether _Complex long double should use the "fp2ret" flavor + /// of Obj-C message passing on this target. + bool useObjCFP2RetForComplexLongDouble() const { + return ComplexLongDoubleUsesFP2Ret; + } + ///===---- Other target property query methods --------------------------===// /// getTargetDefines - Appends the target-specific #define values for this @@ -341,6 +357,13 @@ public: virtual void getTargetBuiltins(const Builtin::Info *&Records, unsigned &NumRecords) const = 0; + /// isCLZForZeroUndef - The __builtin_clz* and __builtin_ctz* built-in + /// functions are specified to have undefined results for zero inputs, but + /// on targets that support these operations in a way that provides + /// well-defined results for zero without loss of performance, it is a good + /// idea to avoid optimizing based on that undef behavior. + virtual bool isCLZForZeroUndef() const { return true; } + /// getVAListDeclaration - Return the declaration to use for /// __builtin_va_list, which is target-specific. virtual const char *getVAListDeclaration() const = 0; @@ -456,6 +479,19 @@ public: const unsigned RegNum; }; + /// hasProtectedVisibility - Does this target support "protected" + /// visibility? + /// + /// Any target which dynamic libraries will naturally support + /// something like "default" (meaning that the symbol is visible + /// outside this shared object) and "hidden" (meaning that it isn't) + /// visibilities, but "protected" is really an ELF-specific concept + /// with wierd semantics designed around the convenience of dynamic + /// linker implementations. Which is not to suggest that there's + /// consistent target-independent semantics for "default" visibility + /// either; the entire thing is pretty badly mangled. + virtual bool hasProtectedVisibility() const { return true; } + virtual bool useGlobalsForAutomaticVariables() const { return false; } /// getCFStringSection - Return the section to use for CFString @@ -551,7 +587,7 @@ public: /// /// \return - False on error (invalid feature name). virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features, - const std::string &Name, + StringRef Name, bool Enabled) const { return false; } @@ -565,6 +601,11 @@ public: virtual void HandleTargetFeatures(std::vector<std::string> &Features) { } + /// \brief Determine whether the given target has the given feature. + virtual bool hasFeature(StringRef Feature) const { + return false; + } + // getRegParmMax - Returns maximal number of args passed in registers. unsigned getRegParmMax() const { assert(RegParmMax < 7 && "RegParmMax value is larger than AST can handle"); @@ -609,6 +650,8 @@ public: /// which the program should be compiled. VersionTuple getPlatformMinVersion() const { return PlatformMinVersion; } + bool isBigEndian() const { return BigEndian; } + protected: virtual uint64_t getPointerWidthV(unsigned AddrSpace) const { return PointerWidth; diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def index 35a881c660a29..2e4d34dff0ba5 100644 --- a/include/clang/Basic/TokenKinds.def +++ b/include/clang/Basic/TokenKinds.def @@ -90,7 +90,8 @@ PPKEYWORD(assert) PPKEYWORD(unassert) // Clang extensions -PPKEYWORD(__export_macro__) +PPKEYWORD(__public_macro) +PPKEYWORD(__private_macro) //===----------------------------------------------------------------------===// // Language keywords. @@ -203,7 +204,7 @@ PUNCTUATOR(greatergreatergreater, ">>>") // is a keyword in the implementation namespace that should // always be treated as a keyword // KEYC99 - This is a keyword introduced to C in C99 -// KEYC1X - This is a keyword introduced to C in C1X +// KEYC11 - This is a keyword introduced to C in C11 // KEYCXX - This is a C++ keyword, or a C++-specific keyword in the // implementation namespace // KEYNOCXX - This is a keyword in every non-C++ dialect. @@ -257,6 +258,9 @@ KEYWORD(_Generic , KEYALL) KEYWORD(_Imaginary , KEYALL) KEYWORD(_Static_assert , KEYALL) KEYWORD(__func__ , KEYALL) +KEYWORD(__objc_yes , KEYALL) +KEYWORD(__objc_no , KEYALL) + // C++ 2.11p1: Keywords. KEYWORD(asm , KEYCXX|KEYGNU) @@ -328,6 +332,7 @@ KEYWORD(__builtin_types_compatible_p, KEYALL) KEYWORD(__builtin_va_arg , KEYALL) KEYWORD(__extension__ , KEYALL) KEYWORD(__imag , KEYALL) +KEYWORD(__int128 , KEYALL) KEYWORD(__label__ , KEYALL) KEYWORD(__real , KEYALL) KEYWORD(__thread , KEYALL) @@ -352,6 +357,7 @@ KEYWORD(__is_class , KEYCXX) KEYWORD(__is_convertible_to , KEYCXX) KEYWORD(__is_empty , KEYCXX) KEYWORD(__is_enum , KEYCXX) +KEYWORD(__is_final , KEYCXX) // Tentative name - there's no implementation of std::is_literal_type yet. KEYWORD(__is_literal , KEYCXX) // Name for GCC 4.6 compatibility - people have already written libraries using @@ -363,7 +369,9 @@ KEYWORD(__is_trivial , KEYCXX) KEYWORD(__is_union , KEYCXX) // Clang-only C++ Type Traits +KEYWORD(__is_trivially_constructible, KEYCXX) KEYWORD(__is_trivially_copyable , KEYCXX) +KEYWORD(__is_trivially_assignable , KEYCXX) KEYWORD(__underlying_type , KEYCXX) // Embarcadero Expression Traits @@ -403,7 +411,6 @@ KEYWORD(__array_extent , KEYCXX) // Apple Extension. KEYWORD(__private_extern__ , KEYALL) -KEYWORD(__import_module__ , KEYALL) KEYWORD(__module_private__ , KEYALL) // Microsoft Extension. @@ -484,7 +491,6 @@ KEYWORD(__ptr32 , KEYMS) KEYWORD(__w64 , KEYMS) KEYWORD(__uuidof , KEYMS | KEYBORLAND) KEYWORD(__try , KEYMS | KEYBORLAND) -KEYWORD(__except , KEYMS | KEYBORLAND) KEYWORD(__finally , KEYMS | KEYBORLAND) KEYWORD(__leave , KEYMS | KEYBORLAND) KEYWORD(__int64 , KEYMS) @@ -501,7 +507,7 @@ ALIAS("_thiscall" , __thiscall , KEYMS) ALIAS("_uuidof" , __uuidof , KEYMS | KEYBORLAND) ALIAS("_inline" , inline , KEYMS) ALIAS("_declspec" , __declspec , KEYMS) -ALIAS("__interface" , class , KEYMS) +ALIAS("__interface" , struct , KEYMS) // Borland Extensions which should be disabled in strict conformance mode. ALIAS("_pascal" , __pascal , KEYBORLAND) @@ -547,6 +553,7 @@ OBJC2_AT_KEYWORD(required) OBJC2_AT_KEYWORD(optional) OBJC2_AT_KEYWORD(synthesize) OBJC2_AT_KEYWORD(dynamic) +OBJC2_AT_KEYWORD(__experimental_modules_import) // TODO: What to do about context-sensitive keywords like: // bycopy/byref/in/inout/oneway/out? @@ -559,12 +566,24 @@ ANNOTATION(template_id) // annotation for a C++ template-id that names a // function template specialization (not a type), // e.g., "std::swap<int>" ANNOTATION(primary_expr) // annotation for a primary expression +ANNOTATION(decltype) // annotation for a decltype expression, + // e.g., "decltype(foo.bar())" // Annotation for #pragma unused(...) // For each argument inside the parentheses the pragma handler will produce // one 'pragma_unused' annotation token followed by the argument token. ANNOTATION(pragma_unused) +// Annotation for #pragma GCC visibility... +// The lexer produces these so that they only take effect when the parser +// handles them. +ANNOTATION(pragma_vis) + +// Annotation for #pragma pack... +// The lexer produces these so that they only take effect when the parser +// handles them. +ANNOTATION(pragma_pack) + #undef ANNOTATION #undef TESTING_KEYWORD #undef OBJC2_AT_KEYWORD diff --git a/include/clang/Basic/TypeTraits.h b/include/clang/Basic/TypeTraits.h index a7a45bded8207..721f44f408151 100644 --- a/include/clang/Basic/TypeTraits.h +++ b/include/clang/Basic/TypeTraits.h @@ -35,6 +35,7 @@ namespace clang { UTT_IsConst, UTT_IsEmpty, UTT_IsEnum, + UTT_IsFinal, UTT_IsFloatingPoint, UTT_IsFunction, UTT_IsFundamental, @@ -67,7 +68,8 @@ namespace clang { BTT_IsConvertible, BTT_IsConvertibleTo, BTT_IsSame, - BTT_TypeCompatible + BTT_TypeCompatible, + BTT_IsTriviallyAssignable }; /// ArrayTypeTrait - Names for the array type traits. @@ -82,6 +84,12 @@ namespace clang { UETT_AlignOf, UETT_VecStep }; + + /// \brief Names for type traits that operate specifically on types. + enum TypeTrait { + TT_IsTriviallyConstructible + }; + } #endif diff --git a/include/clang/Basic/Version.h b/include/clang/Basic/Version.h index 15cdf1fa02e6b..f3f5b5a53a99f 100644 --- a/include/clang/Basic/Version.h +++ b/include/clang/Basic/Version.h @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This header defines version macros and version-related utility functions +// This header defines version macros and version-related utility functions // for Clang. // //===----------------------------------------------------------------------===// @@ -29,7 +29,8 @@ /// \brief A string that describes the Clang version number, e.g., /// "1.0". #define CLANG_VERSION_STRING \ - CLANG_MAKE_VERSION_STRING(CLANG_VERSION_MAJOR,CLANG_VERSION_MINOR,CLANG_VERSION_PATCHLEVEL) + CLANG_MAKE_VERSION_STRING(CLANG_VERSION_MAJOR,CLANG_VERSION_MINOR, \ + CLANG_VERSION_PATCHLEVEL) #else /// \brief Helper macro for CLANG_VERSION_STRING. #define CLANG_MAKE_VERSION_STRING(X,Y) CLANG_MAKE_VERSION_STRING2(X.Y) @@ -41,21 +42,30 @@ #endif namespace clang { - /// \brief Retrieves the repository path (e.g., Subversion path) that + /// \brief Retrieves the repository path (e.g., Subversion path) that /// identifies the particular Clang branch, tag, or trunk from which this /// Clang was built. std::string getClangRepositoryPath(); - + + /// \brief Retrieves the repository path from which LLVM was built. Supports + /// LLVM residing in a separate repository from clang. + std::string getLLVMRepositoryPath(); + /// \brief Retrieves the repository revision number (or identifer) from which /// this Clang was built. std::string getClangRevision(); - + + /// \brief Retrieves the repository revision number (or identifer) from which + /// LLVM was built. If Clang and LLVM are in the same repository, this returns + /// the same string as getClangRevision. + std::string getLLVMRevision(); + /// \brief Retrieves the full repository version that is an amalgamation of /// the information in getClangRepositoryPath() and getClangRevision(). std::string getClangFullRepositoryVersion(); - + /// \brief Retrieves a string representing the complete clang version, - /// which includes the clang version number, the repository version, + /// which includes the clang version number, the repository version, /// and the vendor tag. std::string getClangFullVersion(); |