diff options
Diffstat (limited to 'include/clang/Basic')
38 files changed, 2748 insertions, 877 deletions
diff --git a/include/clang/Basic/ABI.h b/include/clang/Basic/ABI.h new file mode 100644 index 0000000..018f500 --- /dev/null +++ b/include/clang/Basic/ABI.h @@ -0,0 +1,126 @@ +//===----- ABI.h - ABI related declarations ---------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// These enums/classes describe ABI related information about constructors, +// destructors and thunks. +// +//===----------------------------------------------------------------------===// + +#ifndef CLANG_BASIC_ABI_H +#define CLANG_BASIC_ABI_H + +#include "llvm/Support/DataTypes.h" + +namespace clang { + +/// CXXCtorType - C++ constructor types +enum CXXCtorType { + Ctor_Complete, // Complete object ctor + Ctor_Base, // Base object ctor + Ctor_CompleteAllocating // Complete object allocating ctor +}; + +/// CXXDtorType - C++ destructor types +enum CXXDtorType { + Dtor_Deleting, // Deleting dtor + Dtor_Complete, // Complete object dtor + Dtor_Base // Base object dtor +}; + +/// ReturnAdjustment - A return adjustment. +struct ReturnAdjustment { + /// NonVirtual - The non-virtual adjustment from the derived object to its + /// nearest virtual base. + int64_t NonVirtual; + + /// VBaseOffsetOffset - The offset (in bytes), relative to the address point + /// of the virtual base class offset. + int64_t VBaseOffsetOffset; + + ReturnAdjustment() : NonVirtual(0), VBaseOffsetOffset(0) { } + + bool isEmpty() const { return !NonVirtual && !VBaseOffsetOffset; } + + friend bool operator==(const ReturnAdjustment &LHS, + const ReturnAdjustment &RHS) { + return LHS.NonVirtual == RHS.NonVirtual && + LHS.VBaseOffsetOffset == RHS.VBaseOffsetOffset; + } + + friend bool operator<(const ReturnAdjustment &LHS, + const ReturnAdjustment &RHS) { + if (LHS.NonVirtual < RHS.NonVirtual) + return true; + + return LHS.NonVirtual == RHS.NonVirtual && + LHS.VBaseOffsetOffset < RHS.VBaseOffsetOffset; + } +}; + +/// ThisAdjustment - A 'this' pointer adjustment. +struct ThisAdjustment { + /// NonVirtual - The non-virtual adjustment from the derived object to its + /// nearest virtual base. + int64_t NonVirtual; + + /// VCallOffsetOffset - The offset (in bytes), relative to the address point, + /// of the virtual call offset. + int64_t VCallOffsetOffset; + + ThisAdjustment() : NonVirtual(0), VCallOffsetOffset(0) { } + + bool isEmpty() const { return !NonVirtual && !VCallOffsetOffset; } + + friend bool operator==(const ThisAdjustment &LHS, + const ThisAdjustment &RHS) { + return LHS.NonVirtual == RHS.NonVirtual && + LHS.VCallOffsetOffset == RHS.VCallOffsetOffset; + } + + friend bool operator<(const ThisAdjustment &LHS, + const ThisAdjustment &RHS) { + if (LHS.NonVirtual < RHS.NonVirtual) + return true; + + return LHS.NonVirtual == RHS.NonVirtual && + LHS.VCallOffsetOffset < RHS.VCallOffsetOffset; + } +}; + +/// ThunkInfo - The 'this' pointer adjustment as well as an optional return +/// adjustment for a thunk. +struct ThunkInfo { + /// This - The 'this' pointer adjustment. + ThisAdjustment This; + + /// Return - The return adjustment. + ReturnAdjustment Return; + + ThunkInfo() { } + + ThunkInfo(const ThisAdjustment &This, const ReturnAdjustment &Return) + : This(This), Return(Return) { } + + friend bool operator==(const ThunkInfo &LHS, const ThunkInfo &RHS) { + return LHS.This == RHS.This && LHS.Return == RHS.Return; + } + + friend bool operator<(const ThunkInfo &LHS, const ThunkInfo &RHS) { + if (LHS.This < RHS.This) + return true; + + return LHS.This == RHS.This && LHS.Return < RHS.Return; + } + + bool isEmpty() const { return This.isEmpty() && Return.isEmpty(); } +}; + +} // end namespace clang + +#endif // CLANG_BASIC_ABI_H diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 2f2267f..3e62d41 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -89,171 +89,224 @@ class Attr { code AdditionalMembers = [{}]; } +class InheritableAttr : Attr; + // // Attributes begin here // -def Alias : Attr { +def Alias : InheritableAttr { let Spellings = ["alias"]; let Args = [StringArgument<"Aliasee">]; } -def Aligned : Attr { +def Aligned : InheritableAttr { let Spellings = ["align", "aligned"]; let Subjects = [NonBitField, NormalVar, Tag]; let Args = [AlignedArgument<"Alignment">]; let Namespaces = ["", "std"]; } -def AlignMac68k : Attr { +def AlignMac68k : InheritableAttr { let Spellings = []; } -def AlwaysInline : Attr { +def AlwaysInline : InheritableAttr { let Spellings = ["always_inline"]; } -def AnalyzerNoReturn : Attr { +def AnalyzerNoReturn : InheritableAttr { let Spellings = ["analyzer_noreturn"]; } -def Annotate : Attr { +def Annotate : InheritableAttr { let Spellings = ["annotate"]; let Args = [StringArgument<"Annotation">]; } -def AsmLabel : Attr { +def AsmLabel : InheritableAttr { let Spellings = []; let Args = [StringArgument<"Label">]; } -def BaseCheck : Attr { - let Spellings = ["base_check"]; - let Subjects = [CXXRecord]; - let Namespaces = ["", "std"]; -} - -def Blocks : Attr { +def Blocks : InheritableAttr { let Spellings = ["blocks"]; let Args = [EnumArgument<"Type", "BlockType", ["byref"], ["ByRef"]>]; } -def CarriesDependency : Attr { +def CarriesDependency : InheritableAttr { let Spellings = ["carries_dependency"]; let Subjects = [ParmVar, Function]; let Namespaces = ["", "std"]; } -def CDecl : Attr { +def CDecl : InheritableAttr { let Spellings = ["cdecl", "__cdecl"]; } -def CFReturnsRetained : Attr { +def CFReturnsRetained : InheritableAttr { let Spellings = ["cf_returns_retained"]; + let Subjects = [ObjCMethod, Function]; } -def CFReturnsNotRetained : Attr { +def CFReturnsNotRetained : InheritableAttr { let Spellings = ["cf_returns_not_retained"]; + let Subjects = [ObjCMethod, Function]; +} + +def CFConsumed : InheritableAttr { + let Spellings = ["cf_consumed"]; + let Subjects = [ParmVar]; } -def Cleanup : Attr { +def Cleanup : InheritableAttr { let Spellings = ["cleanup"]; let Args = [FunctionArgument<"FunctionDecl">]; } -def Const : Attr { +def Common : InheritableAttr { + let Spellings = ["common"]; +} + +def Const : InheritableAttr { let Spellings = ["const"]; } -def Constructor : Attr { +def Constructor : InheritableAttr { let Spellings = ["constructor"]; let Args = [IntArgument<"Priority">]; } -def Deprecated : Attr { +def CUDAConstant : InheritableAttr { + let Spellings = ["constant"]; +} + +def CUDADevice : Attr { + let Spellings = ["device"]; +} + +def CUDAGlobal : InheritableAttr { + let Spellings = ["global"]; +} + +def CUDAHost : Attr { + let Spellings = ["host"]; +} + +def CUDALaunchBounds : InheritableAttr { + let Spellings = ["launch_bounds"]; + let Args = [IntArgument<"MaxThreads">, DefaultIntArgument<"MinBlocks", 0>]; +} + +def CUDAShared : InheritableAttr { + let Spellings = ["shared"]; +} + +def OpenCLKernel : Attr { + let Spellings = ["opencl_kernel_function"]; +} + +def Deprecated : InheritableAttr { let Spellings = ["deprecated"]; + let Args = [StringArgument<"Message">]; } -def Destructor : Attr { +def Destructor : InheritableAttr { let Spellings = ["destructor"]; let Args = [IntArgument<"Priority">]; } -def DLLExport : Attr { +def DLLExport : InheritableAttr { let Spellings = ["dllexport"]; } -def DLLImport : Attr { +def DLLImport : InheritableAttr { let Spellings = ["dllimport"]; } -def FastCall : Attr { +def Explicit : InheritableAttr { + let Spellings = []; +} + +def FastCall : InheritableAttr { let Spellings = ["fastcall", "__fastcall"]; } -def Final : Attr { - let Spellings = ["final"]; - let Subjects = [CXXRecord, CXXVirtualMethod]; - let Namespaces = ["", "std"]; +def Final : InheritableAttr { + let Spellings = []; } -def Format : Attr { +def Format : InheritableAttr { let Spellings = ["format"]; let Args = [StringArgument<"Type">, IntArgument<"FormatIdx">, IntArgument<"FirstArg">]; } -def FormatArg : Attr { +def FormatArg : InheritableAttr { let Spellings = ["format_arg"]; let Args = [IntArgument<"FormatIdx">]; } -def GNUInline : Attr { +def GNUInline : InheritableAttr { let Spellings = ["gnu_inline"]; } -def Hiding : Attr { - let Spellings = ["hiding"]; - let Subjects = [Field, CXXMethod]; - let Namespaces = ["", "std"]; -} - -def IBAction : Attr { +def IBAction : InheritableAttr { let Spellings = ["ibaction"]; } -def IBOutlet : Attr { +def IBOutlet : InheritableAttr { let Spellings = ["iboutlet"]; } -def IBOutletCollection : Attr { +def IBOutletCollection : InheritableAttr { let Spellings = ["iboutletcollection"]; let Args = [TypeArgument<"Interface">]; } -def Malloc : Attr { +def Malloc : InheritableAttr { let Spellings = ["malloc"]; } -def MaxFieldAlignment : Attr { +def MaxFieldAlignment : InheritableAttr { let Spellings = []; let Args = [UnsignedArgument<"Alignment">]; } -def MSP430Interrupt : Attr { +def MayAlias : InheritableAttr { + let Spellings = ["may_alias"]; +} + +def MSP430Interrupt : InheritableAttr { let Spellings = []; let Args = [UnsignedArgument<"Number">]; } -def NoDebug : Attr { +def MBlazeInterruptHandler : InheritableAttr { + let Spellings = []; +} + +def MBlazeSaveVolatiles : InheritableAttr { + let Spellings = []; +} + +def Naked : InheritableAttr { + let Spellings = ["naked"]; +} + +def NoCommon : InheritableAttr { + let Spellings = ["nocommon"]; +} + +def NoDebug : InheritableAttr { let Spellings = ["nodebug"]; } -def NoInline : Attr { +def NoInline : InheritableAttr { let Spellings = ["noinline"]; } -def NonNull : Attr { +def NonNull : InheritableAttr { let Spellings = ["nonnull"]; let Args = [VariadicUnsignedArgument<"Args">]; let AdditionalMembers = @@ -266,49 +319,64 @@ def NonNull : Attr { } }]; } -def NoReturn : Attr { +def NoReturn : InheritableAttr { let Spellings = ["noreturn"]; // FIXME: Does GCC allow this on the function instead? let Subjects = [Function]; let Namespaces = ["", "std"]; } -def NoInstrumentFunction : Attr { +def NoInstrumentFunction : InheritableAttr { let Spellings = ["no_instrument_function"]; let Subjects = [Function]; } -def NoThrow : Attr { +def NoThrow : InheritableAttr { let Spellings = ["nothrow"]; } -def NSReturnsRetained : Attr { +def NSReturnsRetained : InheritableAttr { let Spellings = ["ns_returns_retained"]; + let Subjects = [ObjCMethod, Function]; } -def NSReturnsNotRetained : Attr { +def NSReturnsNotRetained : InheritableAttr { let Spellings = ["ns_returns_not_retained"]; + let Subjects = [ObjCMethod, Function]; } -def ObjCException : Attr { - let Spellings = ["objc_exception"]; +def NSReturnsAutoreleased : InheritableAttr { + let Spellings = ["ns_returns_autoreleased"]; + let Subjects = [ObjCMethod, Function]; } -def ObjCNSObject : Attr { - let Spellings = ["NSOjbect"]; +def NSConsumesSelf : InheritableAttr { + let Spellings = ["ns_consumes_self"]; + let Subjects = [ObjCMethod]; } -def Override : Attr { - let Spellings = ["override"]; - let Subjects = [CXXVirtualMethod]; - let Namespaces = ["", "std"]; +def NSConsumed : InheritableAttr { + let Spellings = ["ns_consumed"]; + let Subjects = [ParmVar]; +} + +def ObjCException : InheritableAttr { + let Spellings = ["objc_exception"]; +} + +def ObjCNSObject : InheritableAttr { + let Spellings = ["NSObject"]; } def Overloadable : Attr { let Spellings = ["overloadable"]; } -def Ownership : Attr { +def Override : InheritableAttr { + let Spellings = []; +} + +def Ownership : InheritableAttr { let Spellings = ["ownership_holds", "ownership_returns", "ownership_takes"]; let Args = [EnumArgument<"OwnKind", "OwnershipKind", ["ownership_holds", "ownership_returns", "ownership_takes"], @@ -316,97 +384,104 @@ def Ownership : Attr { StringArgument<"Module">, VariadicUnsignedArgument<"Args">]; } -def Packed : Attr { +def Packed : InheritableAttr { let Spellings = ["packed"]; } -def Pure : Attr { +def Pure : InheritableAttr { let Spellings = ["pure"]; } -def Regparm : Attr { +def Regparm : InheritableAttr { let Spellings = ["regparm"]; let Args = [UnsignedArgument<"NumParams">]; } -def ReqdWorkGroupSize : Attr { +def ReqdWorkGroupSize : InheritableAttr { let Spellings = ["reqd_work_group_size"]; let Args = [UnsignedArgument<"XDim">, UnsignedArgument<"YDim">, UnsignedArgument<"ZDim">]; } -def InitPriority : Attr { +def InitPriority : InheritableAttr { let Spellings = ["init_priority"]; let Args = [UnsignedArgument<"Priority">]; } -def Section : Attr { +def Section : InheritableAttr { let Spellings = ["section"]; let Args = [StringArgument<"Name">]; } -def Sentinel : Attr { +def Sentinel : InheritableAttr { let Spellings = ["sentinel"]; let Args = [DefaultIntArgument<"Sentinel", 0>, DefaultIntArgument<"NullPos", 0>]; } -def StdCall : Attr { +def StdCall : InheritableAttr { let Spellings = ["stdcall", "__stdcall"]; } -def ThisCall : Attr { +def ThisCall : InheritableAttr { let Spellings = ["thiscall", "__thiscall"]; } -def Pascal : Attr { +def Pascal : InheritableAttr { let Spellings = ["pascal", "__pascal"]; } -def TransparentUnion : Attr { +def TransparentUnion : InheritableAttr { let Spellings = ["transparent_union"]; } -def Unavailable : Attr { +def Unavailable : InheritableAttr { let Spellings = ["unavailable"]; + let Args = [StringArgument<"Message">]; } -def Unused : Attr { +def Unused : InheritableAttr { let Spellings = ["unused"]; } -def Used : Attr { +def Used : InheritableAttr { let Spellings = ["used"]; } -def Visibility : Attr { +def Uuid : InheritableAttr { + let Spellings = ["uuid"]; + let Args = [StringArgument<"Guid">]; + let Subjects = [CXXRecord]; +} + +def Visibility : InheritableAttr { let Spellings = ["visibility"]; let Args = [EnumArgument<"Visibility", "VisibilityType", ["default", "hidden", "internal", "protected"], ["Default", "Hidden", "Hidden", "Protected"]>]; } -def VecReturn : Attr { +def VecReturn : InheritableAttr { let Spellings = ["vecreturn"]; let Subjects = [CXXRecord]; } -def WarnUnusedResult : Attr { +def WarnUnusedResult : InheritableAttr { let Spellings = ["warn_unused_result"]; } -def Weak : Attr { +def Weak : InheritableAttr { let Spellings = ["weak"]; } -def WeakImport : Attr { +def WeakImport : InheritableAttr { let Spellings = ["weak_import"]; } -def WeakRef : Attr { +def WeakRef : InheritableAttr { let Spellings = ["weakref"]; } -def X86ForceAlignArgPointer : Attr { +def X86ForceAlignArgPointer : InheritableAttr { let Spellings = []; } diff --git a/include/clang/Basic/AttrKinds.h b/include/clang/Basic/AttrKinds.h index 822573b..65c4f98 100644 --- a/include/clang/Basic/AttrKinds.h +++ b/include/clang/Basic/AttrKinds.h @@ -21,6 +21,7 @@ namespace attr { // Kind - This is a list of all the recognized kinds of attributes. enum Kind { #define ATTR(X) X, +#define LAST_INHERITABLE_ATTR(X) X, LAST_INHERITABLE = X, #include "clang/Basic/AttrList.inc" NUM_ATTRS }; diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index 0da8938..7d270ad 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -29,6 +29,8 @@ // d -> double // z -> size_t // F -> constant CFString +// G -> id +// H -> SEL // a -> __builtin_va_list // A -> "reference" to __builtin_va_list // V -> Vector, following num elements and a base type. @@ -38,12 +40,13 @@ // SJ -> sigjmp_buf // . -> "...". This may only occur at the end of the function list. // -// Types maybe prefixed with the following modifiers: +// Types may be prefixed with the following modifiers: // L -> long (e.g. Li for 'long int') // LL -> long long // LLL -> __int128_t (e.g. LLLi) // S -> signed // U -> unsigned +// I -> Required to constant fold to an integer constant expression. // // Types may be postfixed with the following modifiers: // * -> pointer (optionally followed by an address space number) @@ -75,7 +78,7 @@ // FIXME: gcc has nonnull #if defined(BUILTIN) && !defined(LIBBUILTIN) -# define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) BUILTIN(ID, TYPE, ATTRS) +# define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS) #endif // Standard libc/libm functions: @@ -124,12 +127,24 @@ BUILTIN(__builtin_powl, "LdLdLd", "Fnc") BUILTIN(__builtin_acos , "dd" , "Fnc") BUILTIN(__builtin_acosf, "ff" , "Fnc") BUILTIN(__builtin_acosl, "LdLd", "Fnc") +BUILTIN(__builtin_acosh , "dd" , "Fnc") +BUILTIN(__builtin_acoshf, "ff" , "Fnc") +BUILTIN(__builtin_acoshl, "LdLd", "Fnc") BUILTIN(__builtin_asin , "dd" , "Fnc") BUILTIN(__builtin_asinf, "ff" , "Fnc") BUILTIN(__builtin_asinl, "LdLd", "Fnc") +BUILTIN(__builtin_asinh , "dd" , "Fnc") +BUILTIN(__builtin_asinhf, "ff" , "Fnc") +BUILTIN(__builtin_asinhl, "LdLd", "Fnc") BUILTIN(__builtin_atan , "dd" , "Fnc") BUILTIN(__builtin_atanf, "ff" , "Fnc") BUILTIN(__builtin_atanl, "LdLd", "Fnc") +BUILTIN(__builtin_atanh , "dd", "Fnc") +BUILTIN(__builtin_atanhf, "ff", "Fnc") +BUILTIN(__builtin_atanhl, "LdLd", "Fnc") +BUILTIN(__builtin_cbrt , "dd", "Fnc") +BUILTIN(__builtin_cbrtf, "ff", "Fnc") +BUILTIN(__builtin_cbrtl, "LdLd", "Fnc") BUILTIN(__builtin_ceil , "dd" , "Fnc") BUILTIN(__builtin_ceilf, "ff" , "Fnc") BUILTIN(__builtin_ceill, "LdLd", "Fnc") @@ -139,21 +154,99 @@ BUILTIN(__builtin_cosh , "dd" , "Fnc") BUILTIN(__builtin_coshf, "ff" , "Fnc") BUILTIN(__builtin_coshl, "LdLd", "Fnc") BUILTIN(__builtin_cosl, "LdLd", "Fnc") +BUILTIN(__builtin_erf , "dd", "Fnc") +BUILTIN(__builtin_erff, "ff", "Fnc") +BUILTIN(__builtin_erfl, "LdLd", "Fnc") +BUILTIN(__builtin_erfc , "dd", "Fnc") +BUILTIN(__builtin_erfcf, "ff", "Fnc") +BUILTIN(__builtin_erfcl, "LdLd", "Fnc") BUILTIN(__builtin_exp , "dd" , "Fnc") BUILTIN(__builtin_expf, "ff" , "Fnc") BUILTIN(__builtin_expl, "LdLd", "Fnc") +BUILTIN(__builtin_exp2 , "dd" , "Fnc") +BUILTIN(__builtin_exp2f, "ff" , "Fnc") +BUILTIN(__builtin_exp2l, "LdLd", "Fnc") +BUILTIN(__builtin_expm1 , "dd", "Fnc") +BUILTIN(__builtin_expm1f, "ff", "Fnc") +BUILTIN(__builtin_expm1l, "LdLd", "Fnc") +BUILTIN(__builtin_fdim, "ddd", "Fnc") +BUILTIN(__builtin_fdimf, "fff", "Fnc") +BUILTIN(__builtin_fdiml, "LdLdLd", "Fnc") BUILTIN(__builtin_floor , "dd" , "Fnc") BUILTIN(__builtin_floorf, "ff" , "Fnc") BUILTIN(__builtin_floorl, "LdLd", "Fnc") +BUILTIN(__builtin_fma, "dddd", "Fnc") +BUILTIN(__builtin_fmaf, "ffff", "Fnc") +BUILTIN(__builtin_fmal, "LdLdLdLd", "Fnc") +BUILTIN(__builtin_fmax, "ddd", "Fnc") +BUILTIN(__builtin_fmaxf, "fff", "Fnc") +BUILTIN(__builtin_fmaxl, "LdLdLd", "Fnc") +BUILTIN(__builtin_fmin, "ddd", "Fnc") +BUILTIN(__builtin_fminf, "fff", "Fnc") +BUILTIN(__builtin_fminl, "LdLdLd", "Fnc") BUILTIN(__builtin_hypot , "ddd" , "Fnc") BUILTIN(__builtin_hypotf, "fff" , "Fnc") BUILTIN(__builtin_hypotl, "LdLdLd", "Fnc") +BUILTIN(__builtin_ilogb , "id", "Fnc") +BUILTIN(__builtin_ilogbf, "if", "Fnc") +BUILTIN(__builtin_ilogbl, "iLd", "Fnc") +BUILTIN(__builtin_lgamma , "dd", "Fnc") +BUILTIN(__builtin_lgammaf, "ff", "Fnc") +BUILTIN(__builtin_lgammal, "LdLd", "Fnc") +BUILTIN(__builtin_llrint, "LLid", "Fnc") +BUILTIN(__builtin_llrintf, "LLif", "Fnc") +BUILTIN(__builtin_llrintl, "LLiLd", "Fnc") +BUILTIN(__builtin_llround , "LLid", "Fnc") +BUILTIN(__builtin_llroundf, "LLif", "Fnc") +BUILTIN(__builtin_llroundl, "LLiLd", "Fnc") BUILTIN(__builtin_log , "dd" , "Fnc") BUILTIN(__builtin_log10 , "dd" , "Fnc") BUILTIN(__builtin_log10f, "ff" , "Fnc") BUILTIN(__builtin_log10l, "LdLd", "Fnc") +BUILTIN(__builtin_log1p , "dd" , "Fnc") +BUILTIN(__builtin_log1pf, "ff" , "Fnc") +BUILTIN(__builtin_log1pl, "LdLd", "Fnc") +BUILTIN(__builtin_log2, "dd" , "Fnc") +BUILTIN(__builtin_log2f, "ff" , "Fnc") +BUILTIN(__builtin_log2l, "LdLd" , "Fnc") +BUILTIN(__builtin_logb , "dd", "Fnc") +BUILTIN(__builtin_logbf, "ff", "Fnc") +BUILTIN(__builtin_logbl, "LdLd", "Fnc") BUILTIN(__builtin_logf, "ff" , "Fnc") BUILTIN(__builtin_logl, "LdLd", "Fnc") +BUILTIN(__builtin_lrint , "Lid", "Fnc") +BUILTIN(__builtin_lrintf, "Lif", "Fnc") +BUILTIN(__builtin_lrintl, "LiLd", "Fnc") +BUILTIN(__builtin_lround , "Lid", "Fnc") +BUILTIN(__builtin_lroundf, "Lif", "Fnc") +BUILTIN(__builtin_lroundl, "LiLd", "Fnc") +BUILTIN(__builtin_nearbyint , "dd", "Fnc") +BUILTIN(__builtin_nearbyintf, "ff", "Fnc") +BUILTIN(__builtin_nearbyintl, "LdLd", "Fnc") +BUILTIN(__builtin_nextafter , "ddd", "Fnc") +BUILTIN(__builtin_nextafterf, "fff", "Fnc") +BUILTIN(__builtin_nextafterl, "LdLdLd", "Fnc") +BUILTIN(__builtin_nexttoward , "ddd", "Fnc") +BUILTIN(__builtin_nexttowardf, "fff", "Fnc") +BUILTIN(__builtin_nexttowardl, "LdLdLd", "Fnc") +BUILTIN(__builtin_remainder , "ddd", "Fnc") +BUILTIN(__builtin_remainderf, "fff", "Fnc") +BUILTIN(__builtin_remainderl, "LdLdLd", "Fnc") +BUILTIN(__builtin_remquo , "dddi*", "Fnc") +BUILTIN(__builtin_remquof, "fffi*", "Fnc") +BUILTIN(__builtin_remquol, "LdLdLdi*", "Fnc") +BUILTIN(__builtin_rint , "dd", "Fnc") +BUILTIN(__builtin_rintf, "ff", "Fnc") +BUILTIN(__builtin_rintl, "LdLd", "Fnc") +BUILTIN(__builtin_round, "dd" , "Fnc") +BUILTIN(__builtin_roundf, "ff" , "Fnc") +BUILTIN(__builtin_roundl, "LdLd" , "Fnc") +BUILTIN(__builtin_scalbln , "ddLi", "Fnc") +BUILTIN(__builtin_scalblnf, "ffLi", "Fnc") +BUILTIN(__builtin_scalblnl, "LdLdLi", "Fnc") +BUILTIN(__builtin_scalbn , "ddi", "Fnc") +BUILTIN(__builtin_scalbnf, "ffi", "Fnc") +BUILTIN(__builtin_scalbnl, "LdLdi", "Fnc") BUILTIN(__builtin_sin , "dd" , "Fnc") BUILTIN(__builtin_sinf, "ff" , "Fnc") BUILTIN(__builtin_sinh , "dd" , "Fnc") @@ -169,6 +262,12 @@ BUILTIN(__builtin_tanh , "dd" , "Fnc") BUILTIN(__builtin_tanhf, "ff" , "Fnc") BUILTIN(__builtin_tanhl, "LdLd", "Fnc") BUILTIN(__builtin_tanl, "LdLd", "Fnc") +BUILTIN(__builtin_tgamma , "dd", "Fnc") +BUILTIN(__builtin_tgammaf, "ff", "Fnc") +BUILTIN(__builtin_tgammal, "LdLd", "Fnc") +BUILTIN(__builtin_trunc , "dd", "Fnc") +BUILTIN(__builtin_truncf, "ff", "Fnc") +BUILTIN(__builtin_truncl, "LdLd", "Fnc") // C99 complex builtins BUILTIN(__builtin_cabs, "dXd", "Fnc") @@ -176,15 +275,24 @@ BUILTIN(__builtin_cabsf, "fXf", "Fnc") BUILTIN(__builtin_cabsl, "LdXLd", "Fnc") BUILTIN(__builtin_cacos, "XdXd", "Fnc") BUILTIN(__builtin_cacosf, "XfXf", "Fnc") +BUILTIN(__builtin_cacosh, "XdXd", "Fnc") +BUILTIN(__builtin_cacoshf, "XfXf", "Fnc") +BUILTIN(__builtin_cacoshl, "XLdXLd", "Fnc") BUILTIN(__builtin_cacosl, "XLdXLd", "Fnc") BUILTIN(__builtin_carg, "dXd", "Fnc") BUILTIN(__builtin_cargf, "fXf", "Fnc") BUILTIN(__builtin_cargl, "LdXLd", "Fnc") BUILTIN(__builtin_casin, "XdXd", "Fnc") BUILTIN(__builtin_casinf, "XfXf", "Fnc") +BUILTIN(__builtin_casinh, "XdXd", "Fnc") +BUILTIN(__builtin_casinhf, "XfXf", "Fnc") +BUILTIN(__builtin_casinhl, "XLdXLd", "Fnc") BUILTIN(__builtin_casinl, "XLdXLd", "Fnc") BUILTIN(__builtin_catan, "XdXd", "Fnc") BUILTIN(__builtin_catanf, "XfXf", "Fnc") +BUILTIN(__builtin_catanh, "XdXd", "Fnc") +BUILTIN(__builtin_catanhf, "XfXf", "Fnc") +BUILTIN(__builtin_catanhl, "XLdXLd", "Fnc") BUILTIN(__builtin_catanl, "XLdXLd", "Fnc") BUILTIN(__builtin_ccos, "XdXd", "Fnc") BUILTIN(__builtin_ccosf, "XfXf", "Fnc") @@ -275,7 +383,7 @@ BUILTIN(__builtin_bswap32, "UiUi", "nc") BUILTIN(__builtin_bswap64, "ULLiULLi", "nc") // Random GCC builtins -BUILTIN(__builtin_constant_p, "Us.", "nc") +BUILTIN(__builtin_constant_p, "i.", "nc") BUILTIN(__builtin_classify_type, "i.", "nc") BUILTIN(__builtin___CFStringMakeConstantString, "FC*cC*", "nc") BUILTIN(__builtin___NSStringMakeConstantString, "FC*cC*", "nc") @@ -313,14 +421,14 @@ BUILTIN(__builtin_strpbrk, "c*cC*cC*", "nF") BUILTIN(__builtin_strrchr, "c*cC*i", "nF") BUILTIN(__builtin_strspn, "zcC*cC*", "nF") BUILTIN(__builtin_strstr, "c*cC*cC*", "nF") -BUILTIN(__builtin_return_address, "v*Ui", "n") +BUILTIN(__builtin_return_address, "v*IUi", "n") BUILTIN(__builtin_extract_return_addr, "v*v*", "n") -BUILTIN(__builtin_frame_address, "v*Ui", "n") +BUILTIN(__builtin_frame_address, "v*IUi", "n") BUILTIN(__builtin_flt_rounds, "i", "nc") BUILTIN(__builtin_setjmp, "iv**", "") BUILTIN(__builtin_longjmp, "vv**i", "r") BUILTIN(__builtin_unwind_init, "v", "") -BUILTIN(__builtin_eh_return_data_regno, "ii", "nc") +BUILTIN(__builtin_eh_return_data_regno, "iIi", "nc") BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:") BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:") BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:") @@ -485,92 +593,135 @@ BUILTIN(__builtin_abort, "v", "Fnr") BUILTIN(__builtin_index, "c*cC*i", "Fn") BUILTIN(__builtin_rindex, "c*cC*i", "Fn") - +// Microsoft builtins. +BUILTIN(__assume, "vb", "n") +BUILTIN(__noop, "v.", "n") // C99 library functions // C99 stdlib.h -LIBBUILTIN(abort, "v", "fr", "stdlib.h") -LIBBUILTIN(calloc, "v*zz", "f", "stdlib.h") -LIBBUILTIN(exit, "vi", "fr", "stdlib.h") -LIBBUILTIN(_Exit, "vi", "fr", "stdlib.h") -LIBBUILTIN(malloc, "v*z", "f", "stdlib.h") -LIBBUILTIN(realloc, "v*v*z", "f", "stdlib.h") +LIBBUILTIN(abort, "v", "fr", "stdlib.h", ALL_LANGUAGES) +LIBBUILTIN(calloc, "v*zz", "f", "stdlib.h", ALL_LANGUAGES) +LIBBUILTIN(exit, "vi", "fr", "stdlib.h", ALL_LANGUAGES) +LIBBUILTIN(_Exit, "vi", "fr", "stdlib.h", ALL_LANGUAGES) +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") -LIBBUILTIN(memmove, "v*v*vC*z", "f", "string.h") -LIBBUILTIN(strcpy, "c*c*cC*", "f", "string.h") -LIBBUILTIN(strncpy, "c*c*cC*z", "f", "string.h") -LIBBUILTIN(strcat, "c*c*cC*", "f", "string.h") -LIBBUILTIN(strncat, "c*c*cC*z", "f", "string.h") -LIBBUILTIN(strxfrm, "zc*cC*z", "f", "string.h") -LIBBUILTIN(memchr, "v*vC*iz", "f", "string.h") -LIBBUILTIN(strchr, "c*cC*i", "f", "string.h") -LIBBUILTIN(strcspn, "zcC*cC*", "f", "string.h") -LIBBUILTIN(strpbrk, "c*cC*cC*", "f", "string.h") -LIBBUILTIN(strrchr, "c*cC*i", "f", "string.h") -LIBBUILTIN(strspn, "zcC*cC*", "f", "string.h") -LIBBUILTIN(strstr, "c*cC*cC*", "f", "string.h") -LIBBUILTIN(strtok, "c*c*cC*", "f", "string.h") -LIBBUILTIN(memset, "v*v*iz", "f", "string.h") -LIBBUILTIN(strerror, "c*i", "f", "string.h") -LIBBUILTIN(strlen, "zcC*", "f", "string.h") +LIBBUILTIN(memcpy, "v*v*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(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) +LIBBUILTIN(memchr, "v*vC*iz", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strchr, "c*cC*i", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strcspn, "zcC*cC*", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strpbrk, "c*cC*cC*", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strrchr, "c*cC*i", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strspn, "zcC*cC*", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strstr, "c*cC*cC*", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strtok, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(memset, "v*v*iz", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strerror, "c*i", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strlen, "zcC*", "f", "string.h", ALL_LANGUAGES) // C99 stdio.h -LIBBUILTIN(printf, "icC*.", "fp:0:", "stdio.h") -LIBBUILTIN(fprintf, "iP*cC*.", "fp:1:", "stdio.h") -LIBBUILTIN(snprintf, "ic*zcC*.", "fp:2:", "stdio.h") -LIBBUILTIN(sprintf, "ic*cC*.", "fp:1:", "stdio.h") -LIBBUILTIN(vprintf, "icC*a", "fP:0:", "stdio.h") -LIBBUILTIN(vfprintf, "i.", "fP:1:", "stdio.h") -LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h") -LIBBUILTIN(vsprintf, "ic*cC*a", "fP:1:", "stdio.h") -LIBBUILTIN(scanf, "icC*.", "fs:0:", "stdio.h") +LIBBUILTIN(printf, "icC*.", "fp:0:", "stdio.h", ALL_LANGUAGES) +LIBBUILTIN(fprintf, "iP*cC*.", "fp:1:", "stdio.h", ALL_LANGUAGES) +LIBBUILTIN(snprintf, "ic*zcC*.", "fp:2:", "stdio.h", ALL_LANGUAGES) +LIBBUILTIN(sprintf, "ic*cC*.", "fp:1:", "stdio.h", ALL_LANGUAGES) +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) // C99 -LIBBUILTIN(longjmp, "vJi", "fr", "setjmp.h") +LIBBUILTIN(longjmp, "vJi", "fr", "setjmp.h", ALL_LANGUAGES) // Non-C library functions // FIXME: Non-C-standard stuff shouldn't be builtins in non-GNU mode! -LIBBUILTIN(alloca, "v*z", "f", "stdlib.h") +LIBBUILTIN(alloca, "v*z", "f", "stdlib.h", ALL_LANGUAGES) // POSIX string.h -LIBBUILTIN(stpcpy, "c*c*cC*", "f", "string.h") -LIBBUILTIN(stpncpy, "c*c*cC*z", "f", "string.h") -LIBBUILTIN(strdup, "c*cC*", "f", "string.h") -LIBBUILTIN(strndup, "c*cC*z", "f", "string.h") +LIBBUILTIN(stpcpy, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(stpncpy, "c*c*cC*z", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strdup, "c*cC*", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(strndup, "c*cC*z", "f", "string.h", ALL_LANGUAGES) // POSIX strings.h -LIBBUILTIN(index, "c*cC*i", "f", "strings.h") -LIBBUILTIN(rindex, "c*cC*i", "f", "strings.h") -LIBBUILTIN(bzero, "vv*z", "f", "strings.h") +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) // POSIX unistd.h -LIBBUILTIN(_exit, "vi", "fr", "unistd.h") +LIBBUILTIN(_exit, "vi", "fr", "unistd.h", ALL_LANGUAGES) // POSIX setjmp.h -LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h") -LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h") +LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h", ALL_LANGUAGES) +LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h", ALL_LANGUAGES) +// id objc_msgSend(id, SEL, ...) +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) +// 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, ...) +LIBBUILTIN(objc_msgSendSuper, "Gv*H.", "f", "objc/message.h", OBJC_LANG) +// void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...) +LIBBUILTIN(objc_msgSendSuper_stret, "vv*H.", "f", "objc/message.h", OBJC_LANG) +// id objc_getClass(const char *name) +LIBBUILTIN(objc_getClass, "GcC*", "f", "objc/runtime.h", OBJC_LANG) +// id objc_getMetaClass(const char *name) +LIBBUILTIN(objc_getMetaClass, "GcC*", "f", "objc/runtime.h", OBJC_LANG) +// void objc_enumerationMutation(id) +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) +// id objc_assign_weak(id value, id *location) +LIBBUILTIN(objc_assign_weak, "GGG*", "f", "/objc/objc-auto.h", OBJC_LANG) +// id objc_assign_ivar(id value, id dest, ptrdiff_t offset) +// FIXME. Darwin has ptrdiff_t typedef'ed to int. +LIBBUILTIN(objc_assign_ivar, "GGGi", "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) +// id objc_assign_strongCast(id val, id *dest +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) +// void objc_exception_try_enter(void *localExceptionData) +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) +// int objc_exception_match(Class exceptionClass, id exception) +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) + +// int objc_sync_enter(id obj) +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) -// FIXME: This type isn't very correct, it should be -// id objc_msgSend(id, SEL) -// but we need new type letters for that. -LIBBUILTIN(objc_msgSend, "v*.", "f", "objc/message.h") BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF") // Builtin math library functions -LIBBUILTIN(pow, "ddd", "fe", "math.h") -LIBBUILTIN(powl, "LdLdLd", "fe", "math.h") -LIBBUILTIN(powf, "fff", "fe", "math.h") +LIBBUILTIN(pow, "ddd", "fe", "math.h", ALL_LANGUAGES) +LIBBUILTIN(powl, "LdLdLd", "fe", "math.h", ALL_LANGUAGES) +LIBBUILTIN(powf, "fff", "fe", "math.h", ALL_LANGUAGES) -LIBBUILTIN(sqrt, "dd", "fe", "math.h") -LIBBUILTIN(sqrtl, "LdLd", "fe", "math.h") -LIBBUILTIN(sqrtf, "ff", "fe", "math.h") +LIBBUILTIN(sqrt, "dd", "fe", "math.h", ALL_LANGUAGES) +LIBBUILTIN(sqrtl, "LdLd", "fe", "math.h", ALL_LANGUAGES) +LIBBUILTIN(sqrtf, "ff", "fe", "math.h", ALL_LANGUAGES) -LIBBUILTIN(sin, "dd", "fe", "math.h") -LIBBUILTIN(sinl, "LdLd", "fe", "math.h") -LIBBUILTIN(sinf, "ff", "fe", "math.h") +LIBBUILTIN(sin, "dd", "fe", "math.h", ALL_LANGUAGES) +LIBBUILTIN(sinl, "LdLd", "fe", "math.h", ALL_LANGUAGES) +LIBBUILTIN(sinf, "ff", "fe", "math.h", ALL_LANGUAGES) -LIBBUILTIN(cos, "dd", "fe", "math.h") -LIBBUILTIN(cosl, "LdLd", "fe", "math.h") -LIBBUILTIN(cosf, "ff", "fe", "math.h") +LIBBUILTIN(cos, "dd", "fe", "math.h", ALL_LANGUAGES) +LIBBUILTIN(cosl, "LdLd", "fe", "math.h", ALL_LANGUAGES) +LIBBUILTIN(cosf, "ff", "fe", "math.h", ALL_LANGUAGES) // Blocks runtime Builtin math library functions -LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", "Blocks.h") -LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h") +LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", "Blocks.h", ALL_LANGUAGES) +LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h", ALL_LANGUAGES) // FIXME: Also declare NSConcreteGlobalBlock and NSConcreteStackBlock. #undef BUILTIN diff --git a/include/clang/Basic/Builtins.h b/include/clang/Basic/Builtins.h index 94d5e69..4df4c8f 100644 --- a/include/clang/Basic/Builtins.h +++ b/include/clang/Basic/Builtins.h @@ -30,7 +30,15 @@ namespace clang { class IdentifierTable; class ASTContext; class QualType; - + class LangOptions; + + enum LanguageID { + C_LANG = 0x1, // builtin for c only. + CXX_LANG = 0x2, // builtin for cplusplus only. + OBJC_LANG = 0x4, // builtin for objective-c and objective-c++ + ALL_LANGUAGES = (C_LANG|CXX_LANG|OBJC_LANG) //builtin is for all languages. + }; + namespace Builtin { enum ID { NotBuiltin = 0, // This is not a builtin function. @@ -41,6 +49,7 @@ enum ID { struct Info { const char *Name, *Type, *Attributes, *HeaderName; + LanguageID builtin_lang; bool Suppressed; bool operator==(const Info &RHS) const { @@ -62,7 +71,7 @@ public: /// InitializeBuiltins - Mark the identifiers for all the builtins with their /// appropriate builtin ID # and mark any non-portable builtin identifiers as /// such. - void InitializeBuiltins(IdentifierTable &Table, bool NoBuiltins = false); + void InitializeBuiltins(IdentifierTable &Table, const LangOptions& LangOpts); /// \brief Popular the vector with the names of all of the builtins. void GetBuiltinNames(llvm::SmallVectorImpl<const char *> &Names, @@ -108,6 +117,10 @@ public: return strchr(GetRecord(ID).Attributes, 'f') != 0; } + /// \brief Completely forget that the given ID was ever considered a builtin, + /// e.g., because the user provided a conflicting signature. + void ForgetBuiltin(unsigned ID, IdentifierTable &Table); + /// \brief If this is a library function that comes from a specific /// header, retrieve that header name. const char *getHeaderName(unsigned ID) const { @@ -124,12 +137,6 @@ public: /// argument and whether this function as a va_list argument. bool isScanfLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg); - /// hasVAListUse - Return true of the specified builtin uses __builtin_va_list - /// as an operand or return type. - bool hasVAListUse(unsigned ID) const { - return strpbrk(GetRecord(ID).Type, "Aa") != 0; - } - /// isConstWithoutErrno - Return true if this function has no side /// effects and doesn't read memory, except for possibly errno. Such /// functions can be const when the MathErrno lang option is diff --git a/include/clang/Basic/BuiltinsPPC.def b/include/clang/Basic/BuiltinsPPC.def index e0518dc..8a751e4 100644 --- a/include/clang/Basic/BuiltinsPPC.def +++ b/include/clang/Basic/BuiltinsPPC.def @@ -50,25 +50,25 @@ BUILTIN(__builtin_altivec_vctuxs, "V4UiV4fi", "") BUILTIN(__builtin_altivec_dss, "vUi", "") BUILTIN(__builtin_altivec_dssall, "v", "") -BUILTIN(__builtin_altivec_dst, "vv*iUi", "") -BUILTIN(__builtin_altivec_dstt, "vv*iUi", "") -BUILTIN(__builtin_altivec_dstst, "vv*iUi", "") -BUILTIN(__builtin_altivec_dststt, "vv*iUi", "") +BUILTIN(__builtin_altivec_dst, "vvC*iUi", "") +BUILTIN(__builtin_altivec_dstt, "vvC*iUi", "") +BUILTIN(__builtin_altivec_dstst, "vvC*iUi", "") +BUILTIN(__builtin_altivec_dststt, "vvC*iUi", "") BUILTIN(__builtin_altivec_vexptefp, "V4fV4f", "") BUILTIN(__builtin_altivec_vrfim, "V4fV4f", "") -BUILTIN(__builtin_altivec_lvx, "V4iiv*", "") -BUILTIN(__builtin_altivec_lvxl, "V4iiv*", "") -BUILTIN(__builtin_altivec_lvebx, "V16civ*", "") -BUILTIN(__builtin_altivec_lvehx, "V8siv*", "") -BUILTIN(__builtin_altivec_lvewx, "V4iiv*", "") +BUILTIN(__builtin_altivec_lvx, "V4iivC*", "") +BUILTIN(__builtin_altivec_lvxl, "V4iivC*", "") +BUILTIN(__builtin_altivec_lvebx, "V16civC*", "") +BUILTIN(__builtin_altivec_lvehx, "V8sivC*", "") +BUILTIN(__builtin_altivec_lvewx, "V4iivC*", "") BUILTIN(__builtin_altivec_vlogefp, "V4fV4f", "") -BUILTIN(__builtin_altivec_lvsl, "V16cUcv*", "") -BUILTIN(__builtin_altivec_lvsr, "V16cUcv*", "") +BUILTIN(__builtin_altivec_lvsl, "V16cUcvC*", "") +BUILTIN(__builtin_altivec_lvsr, "V16cUcvC*", "") BUILTIN(__builtin_altivec_vmaddfp, "V4fV4fV4fV4f", "") BUILTIN(__builtin_altivec_vmhaddshs, "V8sV8sV8sV8s", "") diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index 5ad64b9..da106da 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -25,11 +25,16 @@ // FIXME: Are these nothrow/const? // MMX +// +// FIXME: All MMX instructions will be generated via builtins. Any MMX vector +// types (<1 x i64>, <2 x i32>, etc.) that aren't used by these builtins will be +// expanded by the back-end. BUILTIN(__builtin_ia32_emms, "v", "") BUILTIN(__builtin_ia32_femms, "v", "") BUILTIN(__builtin_ia32_paddb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_paddw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_paddd, "V2iV2iV2i", "") +BUILTIN(__builtin_ia32_paddq, "V1LLiV1LLiV1LLi", "") BUILTIN(__builtin_ia32_paddsb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_paddsw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_paddusb, "V8cV8cV8c", "") @@ -37,6 +42,7 @@ BUILTIN(__builtin_ia32_paddusw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_psubb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_psubw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_psubd, "V2iV2iV2i", "") +BUILTIN(__builtin_ia32_psubq, "V1LLiV1LLiV1LLi", "") BUILTIN(__builtin_ia32_psubsb, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_psubsw, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_psubusb, "V8cV8cV8c", "") @@ -76,6 +82,7 @@ BUILTIN(__builtin_ia32_psradi, "V2iV2ii", "") BUILTIN(__builtin_ia32_packsswb, "V8cV4sV4s", "") BUILTIN(__builtin_ia32_packssdw, "V4sV2iV2i", "") BUILTIN(__builtin_ia32_packuswb, "V8cV4sV4s", "") +BUILTIN(__builtin_ia32_pshufw, "V4sV4sIc", "") BUILTIN(__builtin_ia32_punpckhbw, "V8cV8cV8c", "") BUILTIN(__builtin_ia32_punpckhwd, "V4sV4sV4s", "") BUILTIN(__builtin_ia32_punpckhdq, "V2iV2iV2i", "") @@ -91,7 +98,7 @@ BUILTIN(__builtin_ia32_pcmpgtd, "V2iV2iV2i", "") BUILTIN(__builtin_ia32_maskmovq, "vV8cV8cc*", "") BUILTIN(__builtin_ia32_pmovmskb, "iV8c", "") BUILTIN(__builtin_ia32_movntq, "vV1LLi*V1LLi", "") -BUILTIN(__builtin_ia32_palignr, "V8cV8cV8cc", "") // FIXME: Correct type? +BUILTIN(__builtin_ia32_palignr, "V8cV8cV8cIc", "") BUILTIN(__builtin_ia32_vec_init_v2si, "V2iii", "") BUILTIN(__builtin_ia32_vec_init_v4hi, "V4sssss", "") BUILTIN(__builtin_ia32_vec_init_v8qi, "V8ccccccccc", "") @@ -249,8 +256,8 @@ BUILTIN(__builtin_ia32_psraw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_psrad128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_psrlw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_psrld128, "V4iV4iV4i", "") -BUILTIN(__builtin_ia32_pslldqi128, "V2LLiV2LLii", "") -BUILTIN(__builtin_ia32_psrldqi128, "V2LLiV2LLii", "") +BUILTIN(__builtin_ia32_pslldqi128, "V2LLiV2LLiIi", "") +BUILTIN(__builtin_ia32_psrldqi128, "V2LLiV2LLiIi", "") BUILTIN(__builtin_ia32_psrlq128, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_psllw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pslld128, "V4iV4iV4i", "") @@ -267,7 +274,7 @@ BUILTIN(__builtin_ia32_pmaddwd128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_monitor, "vv*UiUi", "") BUILTIN(__builtin_ia32_mwait, "vUiUi", "") BUILTIN(__builtin_ia32_lddqu, "V16ccC*", "") -BUILTIN(__builtin_ia32_palignr128, "V16cV16cV16cc", "") // FIXME: Correct type? +BUILTIN(__builtin_ia32_palignr128, "V16cV16cV16cIc", "") // FIXME: Correct type? BUILTIN(__builtin_ia32_insertps128, "V4fV4fV4fi", "") BUILTIN(__builtin_ia32_storelv4si, "vV2i*V2LLi", "") diff --git a/include/clang/Basic/DeclNodes.td b/include/clang/Basic/DeclNodes.td index e2f93e0..2ec7427 100644 --- a/include/clang/Basic/DeclNodes.td +++ b/include/clang/Basic/DeclNodes.td @@ -15,6 +15,7 @@ def Named : Decl<1>; def Namespace : DDecl<Named>, DeclContext; def UsingDirective : DDecl<Named>; def NamespaceAlias : DDecl<Named>; + def Label : DDecl<Named>; def Type : DDecl<Named, 1>; def Typedef : DDecl<Type>; def UnresolvedUsingTypename : DDecl<Type>; @@ -29,6 +30,7 @@ def Named : Decl<1>; def Value : DDecl<Named, 1>; def EnumConstant : DDecl<Value>; def UnresolvedUsingValue : DDecl<Value>; + def IndirectField : DDecl<Value>; def Declarator : DDecl<Value, 1>; def Function : DDecl<Declarator>, DeclContext; def CXXMethod : DDecl<Function>; @@ -41,7 +43,7 @@ def Named : Decl<1>; def Var : DDecl<Declarator>; def ImplicitParam : DDecl<Var>; def ParmVar : DDecl<Var>; - def NonTypeTemplateParm : DDecl<Var>; + def NonTypeTemplateParm : DDecl<Declarator>; def Template : DDecl<Named, 1>; def RedeclarableTemplate : DDecl<Template, 1>; def FunctionTemplate : DDecl<RedeclarableTemplate>; diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 37d2694..19e7c91 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -14,76 +14,24 @@ #ifndef LLVM_CLANG_DIAGNOSTIC_H #define LLVM_CLANG_DIAGNOSTIC_H +#include "clang/Basic/DiagnosticIDs.h" #include "clang/Basic/SourceLocation.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/OwningPtr.h" -#include "llvm/ADT/StringRef.h" #include "llvm/Support/type_traits.h" -#include <string> -#include <vector> -#include <cassert> -namespace llvm { - template <typename T> class SmallVectorImpl; -} +#include <vector> +#include <list> namespace clang { - class DeclContext; - class DiagnosticBuilder; class DiagnosticClient; - class FileManager; + class DiagnosticBuilder; class IdentifierInfo; + class DeclContext; class LangOptions; - class PartialDiagnostic; class Preprocessor; - - // Import the diagnostic enums themselves. - namespace diag { - // Start position for diagnostics. - enum { - DIAG_START_DRIVER = 300, - DIAG_START_FRONTEND = DIAG_START_DRIVER + 100, - DIAG_START_LEX = DIAG_START_FRONTEND + 100, - 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 + 1500, - DIAG_UPPER_LIMIT = DIAG_START_ANALYSIS + 100 - }; - - class CustomDiagInfo; - - /// diag::kind - All of the diagnostics that can be emitted by the frontend. - typedef unsigned kind; - - // Get typedefs for common diagnostics. - enum { -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,SFINAE,CATEGORY) ENUM, -#include "clang/Basic/DiagnosticCommonKinds.inc" - NUM_BUILTIN_COMMON_DIAGNOSTICS -#undef DIAG - }; - - /// Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs - /// to either MAP_IGNORE (nothing), MAP_WARNING (emit a warning), MAP_ERROR - /// (emit as an error). It allows clients to map errors to - /// MAP_ERROR/MAP_DEFAULT or MAP_FATAL (stop emitting diagnostics after this - /// one). - enum Mapping { - // NOTE: 0 means "uncomputed". - MAP_IGNORE = 1, //< Map this diagnostic to nothing, ignore it. - MAP_WARNING = 2, //< Map this diagnostic to a warning. - MAP_ERROR = 3, //< Map this diagnostic to an error. - MAP_FATAL = 4, //< Map this diagnostic to a fatal error. - - /// Map this diagnostic to "warning", but make it immune to -Werror. This - /// happens when you specify -Wno-error=foo. - MAP_WARNING_NO_WERROR = 5, - /// Map this diagnostic to "error", but make it immune to -Wfatal-errors. - /// This happens for -Wno-fatal-errors=foo. - MAP_ERROR_NO_WFATAL = 6 - }; - } + class DiagnosticErrorTrap; /// \brief Annotates a diagnostic with some code that should be /// inserted, removed, or replaced to fix the problem. @@ -153,12 +101,17 @@ public: /// Diagnostic - This concrete class is used by the front-end to report /// problems and issues. It massages the diagnostics (e.g. handling things like /// "report warnings as errors" and passes them off to the DiagnosticClient for -/// reporting to the user. +/// reporting to the user. Diagnostic is tied to one translation unit and +/// one SourceManager. class Diagnostic : public llvm::RefCountedBase<Diagnostic> { public: /// Level - The level of the diagnostic, after it has been through mapping. enum Level { - Ignored, Note, Warning, Error, Fatal + Ignored = DiagnosticIDs::Ignored, + Note = DiagnosticIDs::Note, + Warning = DiagnosticIDs::Warning, + Error = DiagnosticIDs::Error, + Fatal = DiagnosticIDs::Fatal }; /// ExtensionHandling - How do we handle otherwise-unmapped extension? This @@ -203,33 +156,94 @@ private: unsigned TemplateBacktraceLimit; // Cap on depth of template backtrace stack, // 0 -> no limit. ExtensionHandling ExtBehavior; // Map extensions onto warnings or errors? - llvm::OwningPtr<DiagnosticClient> Client; - - /// DiagMappings - Mapping information for diagnostics. Mapping info is + llvm::IntrusiveRefCntPtr<DiagnosticIDs> Diags; + DiagnosticClient *Client; + bool OwnsDiagClient; + SourceManager *SourceMgr; + + /// \brief Mapping information for diagnostics. Mapping info is /// packed into four bits per diagnostic. The low three bits are the mapping /// (an instance of diag::Mapping), or zero if unset. The high bit is set /// when the mapping was established as a user mapping. If the high bit is /// clear, then the low bits are set to the default value, and should be /// mapped with -pedantic, -Werror, etc. - class DiagMappings { - unsigned char Values[diag::DIAG_UPPER_LIMIT/2]; + /// + /// A new DiagState is created and kept around when diagnostic pragmas modify + /// the state so that we know what is the diagnostic state at any given + /// source location. + class DiagState { + llvm::DenseMap<unsigned, unsigned> DiagMap; public: - DiagMappings() { - memset(Values, 0, diag::DIAG_UPPER_LIMIT/2); - } + typedef llvm::DenseMap<unsigned, unsigned>::const_iterator iterator; - void setMapping(diag::kind Diag, unsigned Map) { - size_t Shift = (Diag & 1)*4; - Values[Diag/2] = (Values[Diag/2] & ~(15 << Shift)) | (Map << Shift); - } + void setMapping(diag::kind Diag, unsigned Map) { DiagMap[Diag] = Map; } diag::Mapping getMapping(diag::kind Diag) const { - return (diag::Mapping)((Values[Diag/2] >> (Diag & 1)*4) & 15); + iterator I = DiagMap.find(Diag); + if (I != DiagMap.end()) + return (diag::Mapping)I->second; + return diag::Mapping(); + } + + iterator begin() const { return DiagMap.begin(); } + iterator end() const { return DiagMap.end(); } + }; + + /// \brief Keeps and automatically disposes all DiagStates that we create. + std::list<DiagState> DiagStates; + + /// \brief Represents a point in source where the diagnostic state was + /// modified because of a pragma. 'Loc' can be null if the point represents + /// the diagnostic state modifications done through the command-line. + struct DiagStatePoint { + DiagState *State; + FullSourceLoc Loc; + DiagStatePoint(DiagState *State, FullSourceLoc Loc) + : State(State), Loc(Loc) { } + + bool operator<(const DiagStatePoint &RHS) const { + // If Loc is invalid it means it came from <command-line>, in which case + // we regard it as coming before any valid source location. + if (RHS.Loc.isInvalid()) + return false; + if (Loc.isInvalid()) + return true; + return Loc.isBeforeInTranslationUnitThan(RHS.Loc); } }; - mutable std::vector<DiagMappings> DiagMappingsStack; + /// \brief A vector of all DiagStatePoints representing changes in diagnostic + /// state due to diagnostic pragmas. The vector is always sorted according to + /// the SourceLocation of the DiagStatePoint. + typedef std::vector<DiagStatePoint> DiagStatePointsTy; + mutable DiagStatePointsTy DiagStatePoints; + + /// \brief Keeps the DiagState that was active during each diagnostic 'push' + /// so we can get back at it when we 'pop'. + std::vector<DiagState *> DiagStateOnPushStack; + + DiagState *GetCurDiagState() const { + assert(!DiagStatePoints.empty()); + return DiagStatePoints.back().State; + } + + void PushDiagStatePoint(DiagState *State, SourceLocation L) { + FullSourceLoc Loc(L, *SourceMgr); + // Make sure that DiagStatePoints is always sorted according to Loc. + assert((Loc.isValid() || DiagStatePoints.empty()) && + "Adding invalid loc point after another point"); + assert((Loc.isInvalid() || DiagStatePoints.empty() || + DiagStatePoints.back().Loc.isInvalid() || + DiagStatePoints.back().Loc.isBeforeInTranslationUnitThan(Loc)) && + "Previous point loc comes after or is the same as new one"); + DiagStatePoints.push_back(DiagStatePoint(State, + FullSourceLoc(Loc, *SourceMgr))); + } + + /// \brief Finds the DiagStatePoint that contains the diagnostic state of + /// the given source location. + DiagStatePointsTy::iterator GetDiagStatePointForLoc(SourceLocation Loc) const; /// ErrorOccurred / FatalErrorOccurred - This is set to true when an error or /// fatal error is emitted, and is sticky. @@ -239,14 +253,11 @@ private: /// LastDiagLevel - This is the level of the last diagnostic emitted. This is /// used to emit continuation diagnostics with the same level as the /// diagnostic that they follow. - Diagnostic::Level LastDiagLevel; + DiagnosticIDs::Level LastDiagLevel; unsigned NumWarnings; // Number of warnings reported unsigned NumErrors; // Number of errors reported unsigned NumErrorsSuppressed; // Number of errors suppressed - - /// CustomDiagInfo - Information for uniquing and looking up custom diags. - diag::CustomDiagInfo *CustomDiagInfo; /// ArgToStringFn - A function pointer that converts an opaque diagnostic /// argument to a strings. This takes the modifiers and argument that was @@ -279,34 +290,52 @@ private: std::string DelayedDiagArg2; public: - explicit Diagnostic(DiagnosticClient *client = 0); + explicit Diagnostic(const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &Diags, + DiagnosticClient *client = 0, + bool ShouldOwnClient = true); ~Diagnostic(); - //===--------------------------------------------------------------------===// - // Diagnostic characterization methods, used by a client to customize how - // + const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &getDiagnosticIDs() const { + return Diags; + } + + DiagnosticClient *getClient() { return Client; } + const DiagnosticClient *getClient() const { return Client; } - DiagnosticClient *getClient() { return Client.get(); } - const DiagnosticClient *getClient() const { return Client.get(); } - /// \brief Return the current diagnostic client along with ownership of that /// client. - DiagnosticClient *takeClient() { return Client.take(); } + DiagnosticClient *takeClient() { + OwnsDiagClient = false; + return Client; + } + + bool hasSourceManager() const { return SourceMgr != 0; } + SourceManager &getSourceManager() const { + assert(SourceMgr && "SourceManager not set!"); + return *SourceMgr; + } + void setSourceManager(SourceManager *SrcMgr) { SourceMgr = SrcMgr; } + + //===--------------------------------------------------------------------===// + // Diagnostic characterization methods, used by a client to customize how + // diagnostics are emitted. + // /// pushMappings - Copies the current DiagMappings and pushes the new copy /// onto the top of the stack. - void pushMappings(); + void pushMappings(SourceLocation Loc); /// popMappings - Pops the current DiagMappings off the top of the stack /// causing the new top of the stack to be the active mappings. Returns /// true if the pop happens, false if there is only one DiagMapping on the /// stack. - bool popMappings(); + bool popMappings(SourceLocation Loc); /// \brief Set the diagnostic client associated with this diagnostic object. /// - /// The diagnostic object takes ownership of \c client. - void setClient(DiagnosticClient* client) { Client.reset(client); } + /// \param ShouldOwnClient true if the diagnostic object should take + /// ownership of \c client. + void setClient(DiagnosticClient *client, bool ShouldOwnClient = true); /// setErrorLimit - Specify a limit for the number of errors we should /// emit before giving up. Zero disables the limit. @@ -362,7 +391,7 @@ public: /// \brief Pretend that the last diagnostic issued was ignored. This can /// be used by clients who suppress diagnostics themselves. void setLastDiagnosticIgnored() { - LastDiagLevel = Ignored; + LastDiagLevel = DiagnosticIDs::Ignored; } /// setExtensionHandlingBehavior - This controls whether otherwise-unmapped @@ -379,28 +408,29 @@ public: void DecrementAllExtensionsSilenced() { --AllExtensionsSilenced; } bool hasAllExtensionsSilenced() { return AllExtensionsSilenced != 0; } - /// setDiagnosticMapping - This allows the client to specify that certain + /// \brief This allows the client to specify that certain /// warnings are ignored. Notes can never be mapped, errors can only be /// mapped to fatal, and WARNINGs and EXTENSIONs can be mapped arbitrarily. - void setDiagnosticMapping(diag::kind Diag, diag::Mapping Map) { - assert(Diag < diag::DIAG_UPPER_LIMIT && - "Can only map builtin diagnostics"); - assert((isBuiltinWarningOrExtension(Diag) || - (Map == diag::MAP_FATAL || Map == diag::MAP_ERROR)) && - "Cannot map errors into warnings!"); - setDiagnosticMappingInternal(Diag, Map, true); - } + /// + /// \param Loc The source location that this change of diagnostic state should + /// take affect. It can be null if we are setting the latest state. + void setDiagnosticMapping(diag::kind Diag, diag::Mapping Map, + SourceLocation Loc); /// setDiagnosticGroupMapping - Change an entire diagnostic group (e.g. /// "unknown-pragmas" to have the specified mapping. This returns true and /// ignores the request if "Group" was unknown, false otherwise. - bool setDiagnosticGroupMapping(const char *Group, diag::Mapping Map); + /// + /// 'Loc' is the source location that this change of diagnostic state should + /// take affect. It can be null if we are setting the state from command-line. + bool setDiagnosticGroupMapping(const char *Group, diag::Mapping Map, + SourceLocation Loc = SourceLocation()) { + return Diags->setDiagnosticGroupMapping(Group, Map, Loc, *this); + } bool hasErrorOccurred() const { return ErrorOccurred; } bool hasFatalErrorOccurred() const { return FatalErrorOccurred; } - unsigned getNumErrors() const { return NumErrors; } - unsigned getNumErrorsSuppressed() const { return NumErrorsSuppressed; } unsigned getNumWarnings() const { return NumWarnings; } void setNumWarnings(unsigned NumWarnings) { @@ -410,8 +440,9 @@ public: /// getCustomDiagID - Return an ID for a diagnostic with the specified message /// and level. If this is the first request for this diagnosic, it is /// registered and created, otherwise the existing ID is returned. - unsigned getCustomDiagID(Level L, llvm::StringRef Message); - + unsigned getCustomDiagID(Level L, llvm::StringRef Message) { + return Diags->getCustomDiagID((DiagnosticIDs::Level)L, Message); + } /// ConvertArgToString - This method converts a diagnostic argument (as an /// intptr_t) into the string that represents it. @@ -437,92 +468,22 @@ public: // Diagnostic classification and reporting interfaces. // - /// getDescription - Given a diagnostic ID, return a description of the - /// issue. - const char *getDescription(unsigned DiagID) const; - - /// isNoteWarningOrExtension - Return true if the unmapped diagnostic - /// level of the specified diagnostic ID is a Warning or Extension. - /// This only works on builtin diagnostics, not custom ones, and is not legal to - /// call on NOTEs. - static bool isBuiltinWarningOrExtension(unsigned DiagID); - - /// \brief Determine whether the given built-in diagnostic ID is a - /// Note. - static bool isBuiltinNote(unsigned DiagID); - - /// isBuiltinExtensionDiag - Determine whether the given built-in diagnostic - /// ID is for an extension of some sort. - /// - static bool isBuiltinExtensionDiag(unsigned DiagID) { - bool ignored; - return isBuiltinExtensionDiag(DiagID, ignored); - } - - /// isBuiltinExtensionDiag - Determine whether the given built-in diagnostic - /// ID is for an extension of some sort. This also returns EnabledByDefault, - /// which is set to indicate whether the diagnostic is ignored by default (in - /// which case -pedantic enables it) or treated as a warning/error by default. - /// - static bool isBuiltinExtensionDiag(unsigned DiagID, bool &EnabledByDefault); - - - /// getWarningOptionForDiag - Return the lowest-level warning option that - /// enables the specified diagnostic. If there is no -Wfoo flag that controls - /// the diagnostic, this returns null. - static const char *getWarningOptionForDiag(unsigned DiagID); - - /// getWarningOptionForDiag - Return the category number that a specified - /// DiagID belongs to, or 0 if no category. - static unsigned getCategoryNumberForDiag(unsigned DiagID); - - /// getCategoryNameFromID - Given a category ID, return the name of the - /// category. - static const char *getCategoryNameFromID(unsigned CategoryID); - - /// \brief Enumeration describing how the the emission of a diagnostic should - /// be treated when it occurs during C++ template argument deduction. - enum SFINAEResponse { - /// \brief The diagnostic should not be reported, but it should cause - /// template argument deduction to fail. - /// - /// The vast majority of errors that occur during template argument - /// deduction fall into this category. - SFINAE_SubstitutionFailure, - - /// \brief The diagnostic should be suppressed entirely. - /// - /// Warnings generally fall into this category. - SFINAE_Suppress, - - /// \brief The diagnostic should be reported. - /// - /// The diagnostic should be reported. Various fatal errors (e.g., - /// template instantiation depth exceeded) fall into this category. - SFINAE_Report - }; - - /// \brief Determines whether the given built-in diagnostic ID is - /// for an error that is suppressed if it occurs during C++ template - /// argument deduction. - /// - /// When an error is suppressed due to SFINAE, the template argument - /// deduction fails but no diagnostic is emitted. Certain classes of - /// errors, such as those errors that involve C++ access control, - /// are not SFINAE errors. - static SFINAEResponse getDiagnosticSFINAEResponse(unsigned DiagID); - - /// getDiagnosticLevel - Based on the way the client configured the Diagnostic + /// \brief Based on the way the client configured the Diagnostic /// object, classify the specified diagnostic ID into a Level, consumable by /// the DiagnosticClient. - Level getDiagnosticLevel(unsigned DiagID) const; + /// + /// \param Loc The source location we are interested in finding out the + /// diagnostic state. Can be null in order to query the latest state. + Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc) const { + return (Level)Diags->getDiagnosticLevel(DiagID, Loc, *this); + } /// Report - Issue the message to the client. @c DiagID is a member of the /// @c diag::kind enum. This actually returns aninstance of DiagnosticBuilder /// which emits the diagnostics (through @c ProcessDiag) when it is destroyed. /// @c Pos represents the source location associated with the diagnostic, /// which can be an invalid location if no position information is available. - inline DiagnosticBuilder Report(FullSourceLoc Pos, unsigned DiagID); + inline DiagnosticBuilder Report(SourceLocation Pos, unsigned DiagID); inline DiagnosticBuilder Report(unsigned DiagID); /// \brief Determine whethere there is already a diagnostic in flight. @@ -563,32 +524,34 @@ private: /// getDiagnosticMappingInfo - Return the mapping info currently set for the /// specified builtin diagnostic. This returns the high bit encoding, or zero /// if the field is completely uninitialized. - diag::Mapping getDiagnosticMappingInfo(diag::kind Diag) const { - return DiagMappingsStack.back().getMapping(Diag); + diag::Mapping getDiagnosticMappingInfo(diag::kind Diag, + DiagState *State) const { + return State->getMapping(Diag); } void setDiagnosticMappingInternal(unsigned DiagId, unsigned Map, - bool isUser) const { + DiagState *State, + bool isUser, bool isPragma) const { if (isUser) Map |= 8; // Set the high bit for user mappings. - DiagMappingsStack.back().setMapping((diag::kind)DiagId, Map); + if (isPragma) Map |= 0x10; // Set the bit for diagnostic pragma mappings. + State->setMapping((diag::kind)DiagId, Map); } - /// getDiagnosticLevel - This is an internal implementation helper used when - /// DiagClass is already known. - Level getDiagnosticLevel(unsigned DiagID, unsigned DiagClass) const; - // This is private state used by DiagnosticBuilder. We put it here instead of // in DiagnosticBuilder in order to keep DiagnosticBuilder a small lightweight // object. This implementation choice means that we can only have one // diagnostic "in flight" at a time, but this seems to be a reasonable // tradeoff to keep these objects small. Assertions verify that only one // diagnostic is in flight at a time. + friend class DiagnosticIDs; friend class DiagnosticBuilder; friend class DiagnosticInfo; - + friend class PartialDiagnostic; + friend class DiagnosticErrorTrap; + /// CurDiagLoc - This is the location of the current diagnostic that is in /// flight. - FullSourceLoc CurDiagLoc; + SourceLocation CurDiagLoc; /// CurDiagID - This is the ID of the current diagnostic that is in flight. /// This is set to ~0U when there is no diagnostic in flight. @@ -640,7 +603,33 @@ private: /// /// \returns true if the diagnostic was emitted, false if it was /// suppressed. - bool ProcessDiag(); + bool ProcessDiag() { + return Diags->ProcessDiag(*this); + } + + friend class ASTReader; + friend class ASTWriter; +}; + +/// \brief RAII class that determines when any errors have occurred +/// between the time the instance was created and the time it was +/// queried. +class DiagnosticErrorTrap { + Diagnostic &Diag; + unsigned PrevErrors; + +public: + explicit DiagnosticErrorTrap(Diagnostic &Diag) + : Diag(Diag), PrevErrors(Diag.NumErrors) {} + + /// \brief Determine whether any errors have occurred since this + /// object instance was created. + bool hasErrorOccurred() const { + return Diag.NumErrors > PrevErrors; + } + + // Set to initial state of "no errors occurred". + void reset() { PrevErrors = Diag.NumErrors; } }; //===----------------------------------------------------------------------===// @@ -667,6 +656,11 @@ class DiagnosticBuilder { explicit DiagnosticBuilder(Diagnostic *diagObj) : DiagObj(diagObj), NumArgs(0), NumRanges(0), NumFixItHints(0) {} + friend class PartialDiagnostic; + +protected: + void FlushCounts(); + public: /// Copy constructor. When copied, this "takes" the diagnostic info from the /// input and neuters it. @@ -703,6 +697,17 @@ public: /// isActive - Determine whether this diagnostic is still active. bool isActive() const { return DiagObj != 0; } + /// \brief Retrieve the active diagnostic ID. + /// + /// \pre \c isActive() + unsigned getDiagID() const { + assert(isActive() && "Diagnostic is inactive"); + return DiagObj->CurDiagID; + } + + /// \brief Clear out the current diagnostic. + void Clear() { DiagObj = 0; } + /// Operator bool: conversion of DiagnosticBuilder to bool always returns /// true. This allows is to be used in boolean error contexts like: /// return Diag(...); @@ -816,14 +821,15 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, /// Report - Issue the message to the client. DiagID is a member of the /// diag::kind enum. This actually returns a new instance of DiagnosticBuilder /// which emits the diagnostics (through ProcessDiag) when it is destroyed. -inline DiagnosticBuilder Diagnostic::Report(FullSourceLoc Loc, unsigned DiagID){ +inline DiagnosticBuilder Diagnostic::Report(SourceLocation Loc, + unsigned DiagID){ assert(CurDiagID == ~0U && "Multiple diagnostics in flight at once!"); CurDiagLoc = Loc; CurDiagID = DiagID; return DiagnosticBuilder(this); } inline DiagnosticBuilder Diagnostic::Report(unsigned DiagID) { - return Report(FullSourceLoc(), DiagID); + return Report(SourceLocation(), DiagID); } //===----------------------------------------------------------------------===// @@ -840,7 +846,9 @@ public: const Diagnostic *getDiags() const { return DiagObj; } unsigned getID() const { return DiagObj->CurDiagID; } - const FullSourceLoc &getLocation() const { return DiagObj->CurDiagLoc; } + const SourceLocation &getLocation() const { return DiagObj->CurDiagLoc; } + bool hasSourceManager() const { return DiagObj->hasSourceManager(); } + SourceManager &getSourceManager() const { return DiagObj->getSourceManager();} unsigned getNumArgs() const { return DiagObj->NumDiagArgs; } @@ -930,10 +938,11 @@ public: }; /** - * \brief Represents a diagnostic in a form that can be serialized and - * deserialized. + * \brief Represents a diagnostic in a form that can be retained until its + * corresponding source manager is destroyed. */ class StoredDiagnostic { + unsigned ID; Diagnostic::Level Level; FullSourceLoc Loc; std::string Message; @@ -943,12 +952,14 @@ class StoredDiagnostic { public: StoredDiagnostic(); StoredDiagnostic(Diagnostic::Level Level, const DiagnosticInfo &Info); - StoredDiagnostic(Diagnostic::Level Level, llvm::StringRef Message); + StoredDiagnostic(Diagnostic::Level Level, unsigned ID, + llvm::StringRef Message); ~StoredDiagnostic(); /// \brief Evaluates true when this object stores a diagnostic. operator bool() const { return Message.size() > 0; } + unsigned getID() const { return ID; } Diagnostic::Level getLevel() const { return Level; } const FullSourceLoc &getLocation() const { return Loc; } llvm::StringRef getMessage() const { return Message; } @@ -964,25 +975,21 @@ public: fixit_iterator fixit_begin() const { return FixIts.begin(); } fixit_iterator fixit_end() const { return FixIts.end(); } unsigned fixit_size() const { return FixIts.size(); } - - /// Serialize - Serialize the given diagnostic (with its diagnostic - /// level) to the given stream. Serialization is a lossy operation, - /// since the specific diagnostic ID and any macro-instantiation - /// information is lost. - void Serialize(llvm::raw_ostream &OS) const; - - /// Deserialize - Deserialize the first diagnostic within the memory - /// [Memory, MemoryEnd), producing a new diagnostic builder describing the - /// deserialized diagnostic. If the memory does not contain a - /// diagnostic, returns a diagnostic builder with no diagnostic ID. - static StoredDiagnostic Deserialize(FileManager &FM, SourceManager &SM, - const char *&Memory, const char *MemoryEnd); }; /// DiagnosticClient - This is an abstract interface implemented by clients of /// the front-end, which formats and prints fully processed diagnostics. class DiagnosticClient { +protected: + unsigned NumWarnings; // Number of warnings reported + unsigned NumErrors; // Number of errors reported + public: + DiagnosticClient() : NumWarnings(0), NumErrors(0) { } + + unsigned getNumErrors() const { return NumErrors; } + unsigned getNumWarnings() const { return NumWarnings; } + virtual ~DiagnosticClient(); /// BeginSourceFile - Callback to inform the diagnostic client that processing @@ -1012,8 +1019,11 @@ public: /// HandleDiagnostic - Handle this diagnostic, reporting it to the user or /// capturing it to a log as needed. + /// + /// Default implementation just keeps track of the total number of warnings + /// and errors. virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, - const DiagnosticInfo &Info) = 0; + const DiagnosticInfo &Info); }; } // end namespace clang diff --git a/include/clang/Basic/Diagnostic.td b/include/clang/Basic/Diagnostic.td index fabf9eb..be510ed 100644 --- a/include/clang/Basic/Diagnostic.td +++ b/include/clang/Basic/Diagnostic.td @@ -56,6 +56,7 @@ class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> { string Text = text; DiagClass Class = DC; bit SFINAE = 1; + bit AccessControl = 0; DiagMapping DefaultMapping = defaultmapping; DiagGroup Group; string CategoryName = ""; @@ -74,6 +75,7 @@ class DefaultError { DiagMapping DefaultMapping = MAP_ERROR; } class DefaultFatal { DiagMapping DefaultMapping = MAP_FATAL; } class NoSFINAE { bit SFINAE = 0; } +class AccessControl { bit AccessControl = 1; } // Definitions for Diagnostics. include "DiagnosticASTKinds.td" diff --git a/include/clang/Basic/DiagnosticASTKinds.td b/include/clang/Basic/DiagnosticASTKinds.td index d755d99..7d45bc5 100644 --- a/include/clang/Basic/DiagnosticASTKinds.td +++ b/include/clang/Basic/DiagnosticASTKinds.td @@ -56,6 +56,8 @@ def note_odr_number_of_bases : Note< "class has %0 base %plural{1:class|:classes}0">; def note_odr_enumerator : Note<"enumerator %0 with value %1 here">; def note_odr_missing_enumerator : Note<"no corresponding enumerator here">; + +// Importing Objective-C ASTs def err_odr_ivar_type_inconsistent : Error< "instance variable %0 declared with incompatible types in different " "translation units (%1 vs. %2)">; @@ -80,5 +82,32 @@ def note_odr_objc_method_here : Note< def err_odr_objc_property_type_inconsistent : Error< "property %0 declared with incompatible types in different " "translation units (%1 vs. %2)">; +def err_odr_objc_property_impl_kind_inconsistent : Error< + "property %0 is implemented with %select{@synthesize|@dynamic}1 in one " + "translation but %select{@dynamic|@synthesize}1 in another translation unit">; +def note_odr_objc_property_impl_kind : Note< + "property %0 is implemented with %select{@synthesize|@dynamic}1 here">; +def err_odr_objc_synthesize_ivar_inconsistent : Error< + "property %0 is synthesized to different ivars in different translation " + "units (%1 vs. %2)">; +def note_odr_objc_synthesize_ivar_here : Note< + "property is synthesized to ivar %0 here">; + +// Importing C++ ASTs +def err_odr_different_num_template_parameters : Error< + "template parameter lists have a different number of parameters (%0 vs %1)">; +def note_odr_template_parameter_list : Note< + "template parameter list also declared here">; +def err_odr_different_template_parameter_kind : Error< + "template parameter has different kinds in different translation units">; +def note_odr_template_parameter_here : Note< + "template parameter declared here">; +def err_odr_parameter_pack_non_pack : Error< + "parameter kind mismatch; parameter is %select{not a|a}0 parameter pack">; +def note_odr_parameter_pack_non_pack : Note< + "%select{parameter|parameter pack}0 declared here">; +def err_odr_non_type_parameter_type_inconsistent : Error< + "non-type template parameter declared with incompatible types in different " + "translation units (%0 vs. %1)">; def err_unsupported_ast_node: Error<"cannot import unsupported AST node %0">; } diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td index 98ea9d4..85c64c5 100644 --- a/include/clang/Basic/DiagnosticCommonKinds.td +++ b/include/clang/Basic/DiagnosticCommonKinds.td @@ -44,9 +44,12 @@ def err_expected_colon_after_setter_name : Error< def ext_no_declarators : ExtWarn<"declaration does not declare anything">, InGroup<MissingDeclarations>; def err_param_redefinition : Error<"redefinition of parameter %0">; +def warn_method_param_redefinition : Warning<"redefinition of method parameter %0">; def err_invalid_storage_class_in_func_decl : Error< "invalid storage class specifier in function declarator">; def err_expected_namespace_name : Error<"expected namespace name">; +def ext_variadic_templates : ExtWarn< + "variadic templates are a C++0x extension">, InGroup<CXX0x>; // Sema && Lex def ext_longlong : Extension< diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index 34cd600..ef1c9e7 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -11,11 +11,15 @@ let Component = "Driver" in { def err_drv_no_such_file : Error<"no such file or directory: '%0'">; def err_drv_unsupported_opt : Error<"unsupported option '%0'">; +def err_drv_unsupported_option_argument : Error< + "unsupported argument '%1' to option '%0'">; def err_drv_unknown_stdin_type : Error< "-E or -x required when input is from standard input">; 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_stdlib_name : Error< + "invalid library name in argument '%0'">; def err_drv_invalid_opt_with_multiple_archs : Error< "option '%0' cannot be used with multiple -arch options">; def err_drv_invalid_output_with_multiple_archs : Error< @@ -49,6 +53,8 @@ def err_drv_no_ast_support : Error< "'%0': unable to use AST files with this tool">; def err_drv_clang_unsupported : Error< "the clang compiler does not support '%0'">; +def err_drv_clang_unsupported_per_platform : Error< + "the clang compiler does not support '%0' on this platform">; def err_drv_clang_unsupported_opt_cxx_darwin_i386 : Error< "the clang compiler does not support '%0' for C++ on Darwin/i386">; def err_drv_command_failed : Error< @@ -71,6 +77,10 @@ def err_drv_cc_print_options_failure : Error< def err_drv_preamble_format : Error< "incorrect format for -preamble-bytes=N,END">; +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< @@ -91,8 +101,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_missing_resource_library : Warning< - "missing resource library '%0', link may fail">; 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< @@ -100,5 +108,7 @@ def warn_drv_treating_input_as_cxx : Warning< InGroup<Deprecated>; def warn_drv_objc_gc_unsupported : Warning< "Objective-C garbage collection is not supported on this platform, ignoring '%0'">; +def warn_drv_pch_not_first_include : Warning< + "precompiled header '%0' was ignored because '%1' is not first '-include'">; } diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index 7c74bf4..5f9f4a7 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -18,7 +18,7 @@ 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<"instantated into assembly here">; +def note_fe_inline_asm_here : Note<"instantiated into assembly here">; @@ -69,12 +69,16 @@ def err_fe_pch_file_modified : Error< DefaultFatal; def err_fe_unable_to_open_output : Error< "unable to open output file '%0': '%1'">; +def err_fe_unable_to_rename_temp : Error< + "unable to rename temporary '%0' to output file '%1': '%2'">; def err_fe_unable_to_open_logfile : Error< "unable to open logfile file '%0': '%1'">; def err_fe_pth_file_has_no_source_header : Error< "PTH file '%0' does not designate an original source header file for -include-pth">; def warn_fe_macro_contains_embedded_newline : Warning< "macro '%0' contains embedded newline, text after the newline is ignored.">; +def warn_fe_cc_print_header_failure : Warning< + "unable to open CC_PRINT_HEADERS file: %0 (using stderr)">; def err_verify_missing_start : Error< "cannot find start ('{{') of expected %0">; @@ -83,7 +87,8 @@ def err_verify_missing_end : Error< def err_verify_invalid_content : Error< "invalid expected %0: %1">; def err_verify_inconsistent_diags : Error< - "'%0' diagnostics %select{expected|seen}1 but not %select{seen|expected}1: %2">; + "'%0' diagnostics %select{expected|seen}1 but not %select{seen|expected}1: " + "%2">; def note_fixit_applied : Note<"FIX-IT applied suggested code changes">; def note_fixit_in_macro : Note< @@ -127,6 +132,12 @@ def warn_pch_nonfragile_abi2 : Error< "PCH file was compiled with the %select{32-bit|enhanced non-fragile}0 " "Objective-C ABI but the %select{32-bit|enhanced non-fragile}1 " "Objective-C ABI is selected">; +def warn_pch_apple_kext : Error< + "PCH file was compiled %select{with|without}0 support for Apple's kernel " + "extensions ABI but it is currently %select{disabled|enabled}1">; +def warn_pch_objc_auto_properties : Error< + "PCH file was compiled %select{with|without}0 support for auto-synthesized " + "@properties but it is currently %select{disabled|enabled}1">; def warn_pch_no_constant_cfstrings : Error< "Objctive-C NSstring generation support was %select{disabled|enabled}0 " "in PCH file but currently %select{disabled|enabled}1">; @@ -142,6 +153,9 @@ def warn_pch_gnu_keywords : Error< def warn_pch_microsoft_extensions : Error< "Microsoft extensions were %select{disabled|enabled}0 in PCH file but are " "currently %select{disabled|enabled}1">; +def warn_pch_ms_bitfields : Error< + "Microsoft-compatible structure layout was %select{disabled|enabled}0 in " + "PCH file but is currently %select{disabled|enabled}1">; def warn_pch_heinous_extensions : Error< "heinous extensions were %select{disabled|enabled}0 in PCH file but are " "currently %select{disabled|enabled}1">; @@ -154,6 +168,9 @@ def warn_pch_altivec : Error< def warn_pch_opencl : Error< "OpenCL language extensions were %select{disabled|enabled}0 in PCH file " "but are currently %select{disabled|enabled}1">; +def warn_pch_cuda : Error< + "CUDA language extensions were %select{disabled|enabled}0 in PCH file " + "but are currently %select{disabled|enabled}1">; def warn_pch_elide_constructors : Error< "Elidable copy constructors were %select{disabled|enabled}0 in PCH file " "but are currently %select{disabled|enabled}1">; @@ -163,6 +180,9 @@ def warn_pch_exceptions : Error< def warn_pch_sjlj_exceptions : Error< "sjlj-exceptions were %select{disabled|enabled}0 in PCH file but " "are currently %select{disabled|enabled}1">; +def warn_pch_objc_exceptions : Error< + "Objective-C exceptions were %select{disabled|enabled}0 in PCH file but " + "are currently %select{disabled|enabled}1">; def warn_pch_objc_runtime : Error< "PCH file was compiled with the %select{NeXT|GNU}0 runtime but the " "%select{NeXT|GNU}1 runtime is selected">; @@ -241,6 +261,9 @@ def warn_pch_char_signed : Error< def warn_pch_short_wchar : Error< "-fshort-wchar was %select{disabled|enabled}0 in the PCH file but " "is currently %select{disabled|enabled}1">; +def warn_pch_short_enums : Error< + "-fshort-enums was %select{disabled|enabled}0 in the PCH file but " + "is currently %select{disabled|enabled}1">; def err_not_a_pch_file : Error< "'%0' does not appear to be a precompiled header file">, DefaultFatal; @@ -250,4 +273,7 @@ def warn_unknown_warning_option : Warning< def warn_unknown_warning_specifier : Warning< "unknown %0 warning specifier: '%1'">, InGroup<DiagGroup<"unknown-warning-option"> >; + +def warn_unkwown_analyzer_checker : Warning< + "no analyzer checkers are associated with '%0'">; } diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index d4b7f1f..d4377c9 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -35,9 +35,12 @@ def : DiagGroup<"declaration-after-statement">; def GNUDesignator : DiagGroup<"gnu-designator">; def DeprecatedDeclarations : DiagGroup<"deprecated-declarations">; +def DeprecatedWritableStr : DiagGroup<"deprecated-writable-strings">; def Deprecated : DiagGroup<"deprecated", [ DeprecatedDeclarations] >, DiagCategory<"Deprecations">; +def DeprecatedImplementations :DiagGroup<"deprecated-implementations">; + def : DiagGroup<"disabled-optimization">; def : DiagGroup<"discard-qual">; def : DiagGroup<"div-by-zero">; @@ -54,6 +57,7 @@ def : DiagGroup<"effc++">; def FourByteMultiChar : DiagGroup<"four-char-constants">; def GlobalConstructors : DiagGroup<"global-constructors">; def : DiagGroup<"idiomatic-parentheses">; +def LogicalOpParentheses: DiagGroup<"logical-op-parentheses">; def IgnoredQualifiers : DiagGroup<"ignored-qualifiers">; def : DiagGroup<"import">; def : DiagGroup<"init-self">; @@ -74,17 +78,19 @@ def : DiagGroup<"newline-eof">; def LongLong : DiagGroup<"long-long">; def MismatchedTags : DiagGroup<"mismatched-tags">; def MissingFieldInitializers : DiagGroup<"missing-field-initializers">; +def NullDereference : DiagGroup<"null-dereference">; def InitializerOverrides : DiagGroup<"initializer-overrides">; def NonNull : DiagGroup<"nonnull">; def : DiagGroup<"nonportable-cfstrings">; -def : DiagGroup<"non-virtual-dtor">; +def NonVirtualDtor : DiagGroup<"non-virtual-dtor">; 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 : DiagGroup<"overloaded-virtual">; -def : DiagGroup<"packed">; +def OverloadedVirtual : DiagGroup<"overloaded-virtual">; +def Packed : DiagGroup<"packed">; +def Padded : DiagGroup<"padded">; def PointerArith : DiagGroup<"pointer-arith">; def PoundWarning : DiagGroup<"#warnings">, DiagCategory<"#warning Directive">; @@ -92,6 +98,7 @@ def : DiagGroup<"pointer-to-int-cast">; def : DiagGroup<"redundant-decls">; def ReturnType : DiagGroup<"return-type">; def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy">; +def SelfAssignment : DiagGroup<"self-assign">; def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">; def : DiagGroup<"sequence-point">; def Shadow : DiagGroup<"shadow">; @@ -101,6 +108,7 @@ def SignCompare : DiagGroup<"sign-compare">; def : DiagGroup<"stack-protector">; def : DiagGroup<"switch-default">; def : DiagGroup<"synth">; +def TautologicalCompare : DiagGroup<"tautological-compare">; // Preprocessor warnings. def : DiagGroup<"builtin-macro-redefined">; @@ -140,9 +148,14 @@ def UnusedLabel : DiagGroup<"unused-label">; def UnusedParameter : DiagGroup<"unused-parameter">; def UnusedValue : DiagGroup<"unused-value">; def UnusedVariable : DiagGroup<"unused-variable">; +def UsedButMarkedUnused : DiagGroup<"used-but-marked-unused">; def ReadOnlySetterAttrs : DiagGroup<"readonly-setter-attrs">; def Reorder : DiagGroup<"reorder">; def UndeclaredSelector : DiagGroup<"undeclared-selector">; +def ImplicitAtomic : DiagGroup<"implicit-atomic-properties">; +def CustomAtomic : DiagGroup<"custom-atomic-properties">; +def AtomicProperties : DiagGroup<"atomic-properties", + [ImplicitAtomic, CustomAtomic]>; def Selector : DiagGroup<"selector">; def NonfragileAbi2 : DiagGroup<"nonfragile-abi2">; def Protocol : DiagGroup<"protocol">; @@ -154,17 +167,27 @@ def VLA : DiagGroup<"vla">; def VolatileRegisterVar : DiagGroup<"volatile-register-var">; def : DiagGroup<"write-strings">; def CharSubscript : DiagGroup<"char-subscripts">; +def LargeByValueCopy : DiagGroup<"large-by-value-copy">; // Aggregation warning settings. // -Widiomatic-parentheses contains warnings about 'idiomatic' // missing parentheses; it is off by default. -def Parentheses : DiagGroup<"parentheses", [DiagGroup<"idiomatic-parentheses">]>; +def Parentheses : DiagGroup<"parentheses", + [LogicalOpParentheses, + DiagGroup<"idiomatic-parentheses">]>; -// -Wconversion has its own warnings, but we split this one out for -// legacy reasons. +// -Wconversion has its own warnings, but we split a few out for +// legacy reasons: +// - some people want just 64-to-32 warnings +// - 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 def Conversion : DiagGroup<"conversion", - [DiagGroup<"shorten-64-to-32">, BoolConversions]>, + [DiagGroup<"shorten-64-to-32">, + DiagGroup<"constant-conversion">, + DiagGroup<"literal-conversion">, + BoolConversions]>, DiagCategory<"Value Conversion Issue">; def Unused : DiagGroup<"unused", @@ -202,13 +225,15 @@ def Most : DiagGroup<"most", [ MultiChar, Reorder, ReturnType, + SelfAssignment, Switch, Trigraphs, Uninitialized, UnknownPragmas, Unused, VectorConversions, - VolatileRegisterVar + VolatileRegisterVar, + OverloadedVirtual ]>; // -Wall is -Wmost -Wparentheses @@ -224,5 +249,12 @@ def : DiagGroup<"comments", [Comment]>; // -Wcomments = -Wcomment def NonGCC : DiagGroup<"non-gcc", [SignCompare, Conversion, LiteralRange]>; +// A warning group for warnings about using C++0x features as extensions in +// earlier C++ versions. +def CXX0x : DiagGroup<"c++0x-extensions">; + // A warning group for warnings about GCC extensions. def GNU : DiagGroup<"gnu", [GNUDesignator, VLA]>; + +// A warning group for warnings about Microsoft extensions. +def Microsoft : DiagGroup<"microsoft">; diff --git a/include/clang/Basic/DiagnosticIDs.h b/include/clang/Basic/DiagnosticIDs.h new file mode 100644 index 0000000..b463805 --- /dev/null +++ b/include/clang/Basic/DiagnosticIDs.h @@ -0,0 +1,212 @@ +//===--- DiagnosticIDs.h - Diagnostic IDs Handling --------------*- 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 Diagnostic IDs-related interfaces. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_DIAGNOSTICIDS_H +#define LLVM_CLANG_DIAGNOSTICIDS_H + +#include "llvm/ADT/IntrusiveRefCntPtr.h" +#include "llvm/ADT/StringRef.h" + +namespace clang { + class Diagnostic; + class SourceLocation; + + // Import the diagnostic enums themselves. + 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 + }; + + class CustomDiagInfo; + + /// diag::kind - All of the diagnostics that can be emitted by the frontend. + typedef unsigned kind; + + // Get typedefs for common diagnostics. + enum { +#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,SFINAE,ACCESS,CATEGORY) ENUM, +#include "clang/Basic/DiagnosticCommonKinds.inc" + NUM_BUILTIN_COMMON_DIAGNOSTICS +#undef DIAG + }; + + /// Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs + /// to either MAP_IGNORE (nothing), MAP_WARNING (emit a warning), MAP_ERROR + /// (emit as an error). It allows clients to map errors to + /// MAP_ERROR/MAP_DEFAULT or MAP_FATAL (stop emitting diagnostics after this + /// one). + enum Mapping { + // NOTE: 0 means "uncomputed". + MAP_IGNORE = 1, //< Map this diagnostic to nothing, ignore it. + MAP_WARNING = 2, //< Map this diagnostic to a warning. + MAP_ERROR = 3, //< Map this diagnostic to an error. + MAP_FATAL = 4, //< Map this diagnostic to a fatal error. + + /// Map this diagnostic to "warning", but make it immune to -Werror. This + /// happens when you specify -Wno-error=foo. + MAP_WARNING_NO_WERROR = 5, + /// Map this diagnostic to "error", but make it immune to -Wfatal-errors. + /// This happens for -Wno-fatal-errors=foo. + MAP_ERROR_NO_WFATAL = 6 + }; + } + +/// \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> { +public: + /// Level - The level of the diagnostic, after it has been through mapping. + enum Level { + Ignored, Note, Warning, Error, Fatal + }; + +private: + /// CustomDiagInfo - Information for uniquing and looking up custom diags. + diag::CustomDiagInfo *CustomDiagInfo; + +public: + DiagnosticIDs(); + ~DiagnosticIDs(); + + /// getCustomDiagID - Return an ID for a diagnostic with the specified message + /// and level. If this is the first request for this diagnosic, it is + /// registered and created, otherwise the existing ID is returned. + unsigned getCustomDiagID(Level L, llvm::StringRef Message); + + //===--------------------------------------------------------------------===// + // Diagnostic classification and reporting interfaces. + // + + /// getDescription - Given a diagnostic ID, return a description of the + /// issue. + const char *getDescription(unsigned DiagID) const; + + /// isNoteWarningOrExtension - Return true if the unmapped diagnostic + /// level of the specified diagnostic ID is a Warning or Extension. + /// This only works on builtin diagnostics, not custom ones, and is not legal to + /// call on NOTEs. + static bool isBuiltinWarningOrExtension(unsigned DiagID); + + /// \brief Determine whether the given built-in diagnostic ID is a + /// Note. + static bool isBuiltinNote(unsigned DiagID); + + /// isBuiltinExtensionDiag - Determine whether the given built-in diagnostic + /// ID is for an extension of some sort. + /// + static bool isBuiltinExtensionDiag(unsigned DiagID) { + bool ignored; + return isBuiltinExtensionDiag(DiagID, ignored); + } + + /// isBuiltinExtensionDiag - Determine whether the given built-in diagnostic + /// ID is for an extension of some sort. This also returns EnabledByDefault, + /// which is set to indicate whether the diagnostic is ignored by default (in + /// which case -pedantic enables it) or treated as a warning/error by default. + /// + static bool isBuiltinExtensionDiag(unsigned DiagID, bool &EnabledByDefault); + + + /// getWarningOptionForDiag - Return the lowest-level warning option that + /// enables the specified diagnostic. If there is no -Wfoo flag that controls + /// the diagnostic, this returns null. + static const char *getWarningOptionForDiag(unsigned DiagID); + + /// getWarningOptionForDiag - Return the category number that a specified + /// DiagID belongs to, or 0 if no category. + static unsigned getCategoryNumberForDiag(unsigned DiagID); + + /// getCategoryNameFromID - Given a category ID, return the name of the + /// category. + static const char *getCategoryNameFromID(unsigned CategoryID); + + /// \brief Enumeration describing how the the emission of a diagnostic should + /// be treated when it occurs during C++ template argument deduction. + enum SFINAEResponse { + /// \brief The diagnostic should not be reported, but it should cause + /// template argument deduction to fail. + /// + /// The vast majority of errors that occur during template argument + /// deduction fall into this category. + SFINAE_SubstitutionFailure, + + /// \brief The diagnostic should be suppressed entirely. + /// + /// Warnings generally fall into this category. + SFINAE_Suppress, + + /// \brief The diagnostic should be reported. + /// + /// The diagnostic should be reported. Various fatal errors (e.g., + /// template instantiation depth exceeded) fall into this category. + SFINAE_Report, + + /// \brief The diagnostic is an access-control diagnostic, which will be + /// substitution failures in some contexts and reported in others. + SFINAE_AccessControl + }; + + /// \brief Determines whether the given built-in diagnostic ID is + /// for an error that is suppressed if it occurs during C++ template + /// argument deduction. + /// + /// When an error is suppressed due to SFINAE, the template argument + /// deduction fails but no diagnostic is emitted. Certain classes of + /// errors, such as those errors that involve C++ access control, + /// are not SFINAE errors. + static SFINAEResponse getDiagnosticSFINAEResponse(unsigned DiagID); + +private: + /// setDiagnosticGroupMapping - Change an entire diagnostic group (e.g. + /// "unknown-pragmas" to have the specified mapping. This returns true and + /// ignores the request if "Group" was unknown, false otherwise. + bool setDiagnosticGroupMapping(const char *Group, diag::Mapping Map, + SourceLocation Loc, Diagnostic &Diag) const; + + /// \brief Based on the way the client configured the Diagnostic + /// object, classify the specified diagnostic ID into a Level, consumable by + /// the DiagnosticClient. + /// + /// \param Loc The source location we are interested in finding out the + /// diagnostic state. Can be null in order to query the latest state. + DiagnosticIDs::Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc, + const Diagnostic &Diag) const; + + /// getDiagnosticLevel - This is an internal implementation helper used when + /// DiagClass is already known. + DiagnosticIDs::Level getDiagnosticLevel(unsigned DiagID, + unsigned DiagClass, + SourceLocation Loc, + const Diagnostic &Diag) const; + + /// ProcessDiag - This is the method used to report a diagnostic that is + /// finally fully formed. + /// + /// \returns true if the diagnostic was emitted, false if it was + /// suppressed. + bool ProcessDiag(Diagnostic &Diag) const; + + friend class Diagnostic; +}; + +} // end namespace clang + +#endif diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index dcb05c8..6d1d9b6 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -45,8 +45,8 @@ def charize_microsoft_ext : Extension<"@# is a microsoft extension">; def ext_token_used : Extension<"extension used">; -def err_unterminated_string : Error<"missing terminating '\"' character">; -def err_unterminated_char : Error<"missing terminating ' character">; +def warn_unterminated_string : ExtWarn<"missing terminating '\"' character">; +def warn_unterminated_char : ExtWarn<"missing terminating ' character">; def err_empty_character : Error<"empty character constant">; def err_unterminated_block_comment : Error<"unterminated /* comment">; def err_invalid_character_to_charify : Error< @@ -98,6 +98,10 @@ 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 warn_ucn_not_valid_in_c89 : ExtWarn< + "unicode escape sequences are only valid in C99 or C++">; //===----------------------------------------------------------------------===// // PTH Diagnostics @@ -240,11 +244,11 @@ def warn_pragma_ignored : Warning<"unknown pragma ignored">, InGroup<UnknownPragmas>, DefaultIgnore; def ext_stdc_pragma_ignored : ExtWarn<"unknown pragma in STDC namespace">, InGroup<UnknownPragmas>; -def ext_stdc_pragma_syntax : +def ext_on_off_switch_syntax : ExtWarn<"expected 'ON' or 'OFF' or 'DEFAULT' in pragma">, InGroup<UnknownPragmas>; -def ext_stdc_pragma_syntax_eom : - ExtWarn<"expected end of macro in STDC pragma">, +def ext_pragma_syntax_eom : + ExtWarn<"expected end of macro in pragma">, InGroup<UnknownPragmas>; def warn_stdc_fenv_access_not_supported : Warning<"pragma STDC FENV_ACCESS ON is not supported, ignoring pragma">, diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 646fd0d..9d7ec9d 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -55,11 +55,15 @@ def ext_c99_compound_literal : Extension< def ext_enumerator_list_comma : Extension< "commas at the end of enumerator lists are a %select{C99|C++0x}0-specific " "feature">; +def err_enumerator_list_missing_comma : Error< + "missing ',' between enumerators">; def ext_gnu_indirect_goto : Extension< "use of GNU indirect-goto extension">, InGroup<GNU>; def ext_gnu_address_of_label : Extension< "use of GNU address-of-label extension">, InGroup<GNU>; +def ext_gnu_local_label : Extension< + "use of GNU locally declared label extension">, InGroup<GNU>; def ext_gnu_statement_expr : Extension< "use of GNU statement expression extension">, InGroup<GNU>; def ext_gnu_conditional_expr : Extension< @@ -93,6 +97,7 @@ def err_expected_lsquare : Error<"expected '['">; def err_expected_rsquare : Error<"expected ']'">; def err_expected_rbrace : Error<"expected '}'">; def err_expected_greater : Error<"expected '>'">; +def err_expected_ggg : Error<"expected '>>>'">; def err_expected_semi_declaration : Error< "expected ';' at end of declaration">; def err_expected_semi_decl_list : Error< @@ -110,6 +115,8 @@ def err_expected_fn_body : Error< 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_expected_statement : Error<"expected statement">; def err_expected_lparen_after : Error<"expected '(' after '%0'">; def err_expected_lparen_after_id : Error<"expected '(' after %0">; @@ -122,6 +129,8 @@ def err_expected_while : Error<"expected 'while' in do/while loop">; def err_expected_semi_after : Error<"expected ';' after %0">; def err_expected_semi_after_stmt : Error<"expected ';' after %0 statement">; def err_expected_semi_after_expr : Error<"expected ';' after expression">; +def err_extraneous_token_before_semi : Error<"extraneous '%0' before ';'">; + def err_expected_semi_after_method_proto : Error< "expected ';' after method prototype">; def err_expected_semi_after_namespace_name : Error< @@ -139,6 +148,8 @@ def err_expected_semi_for : Error<"expected ';' in 'for' statement specifier">; def err_expected_colon_after : Error<"expected ':' after %0">; def err_label_end_of_compound_statement : Error< "label at end of compound statement: expected statement">; +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; @@ -152,10 +163,12 @@ def err_invalid_reference_qualifier_application : Error< "'%0' qualifier may not be applied to a reference">; def err_illegal_decl_reference_to_reference : Error< "%0 declared as a reference to a reference">; -def err_rvalue_reference : Error< - "rvalue references are only allowed in C++0x">; -def ext_inline_namespace : Extension< - "inline namespaces are a C++0x feature">; +def ext_rvalue_reference : ExtWarn< + "rvalue references are a C++0x extension">, InGroup<CXX0x>; +def ext_ref_qualifier : ExtWarn< + "reference qualifiers on functions are a C++0x extension">, InGroup<CXX0x>; +def ext_inline_namespace : ExtWarn< + "inline namespaces are a C++0x feature">, InGroup<CXX0x>; def err_argument_required_after_attribute : Error< "argument required after attribute">; def err_missing_param : Error<"expected parameter declarator">; @@ -194,10 +207,16 @@ def err_unknown_typename : Error< "unknown type name %0">; def err_use_of_tag_name_without_tag : Error< "must use '%1' tag to refer to type %0%select{| in this scope}2">; +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'">; /// Objective-C parser diagnostics def err_expected_minus_or_plus : Error< @@ -214,13 +233,17 @@ def err_illegal_super_cast : Error< def err_objc_illegal_visibility_spec : Error< "illegal visibility specification">; def err_objc_illegal_interface_qual : Error<"illegal interface qualifier">; -def err_objc_expected_equal : Error< - "setter/getter expects '=' followed by name">; +def err_objc_expected_equal_for_getter : Error< + "expected '=' for Objective-C getter">; +def err_objc_expected_equal_for_setter : Error< + "expected '=' for Objective-C setter">; +def err_objc_expected_selector_for_getter_setter : Error< + "expected selector for Objective-C %select{setter|getter}0">; def err_objc_property_requires_field_name : Error< "property requires fields to be named">; def err_objc_property_bitfield : Error<"property name cannot be a bitfield">; def err_objc_expected_property_attr : Error<"unknown property attribute %0">; -def err_objc_propertoes_require_objc2 : Error< +def err_objc_properties_require_objc2 : Error< "properties are an Objective-C 2 feature">; def err_objc_unexpected_attr : Error< "prefix attribute must be followed by an interface or protocol">; @@ -283,8 +306,6 @@ def err_default_arg_unparsed : Error< def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">; // C++ operator overloading -def err_operator_missing_type_specifier : Error< - "missing type specifier after 'operator'">; def err_operator_string_not_empty : Error< "string literal after 'operator' must be '\"\"'">; @@ -334,6 +355,10 @@ def err_enum_template : Error<"enumeration cannot be a template">; def err_missing_dependent_template_keyword : Error< "use 'template' keyword to treat '%0' as a dependent template name">; +def warn_static_inline_explicit_inst_ignored : Warning< + "ignoring '%select{static|inline}0' keyword on explicit template " + "instantiation">; + // Constructor template diagnostics. def err_out_of_line_constructor_template_id : Error< "out-of-line constructor for %0 cannot have template arguments">; @@ -356,18 +381,42 @@ def err_expected_type_name_after_typename : Error< def err_explicit_spec_non_template : Error< "explicit %select{specialization|instantiation}0 of non-template " "%select{class|struct|union}1 %2">; - -def err_variadic_templates : Error< - "variadic templates are only allowed in C++0x">; def err_default_template_template_parameter_not_template : Error< "default template argument for a template template parameter must be a class " "template">; +def err_ctor_init_missing_comma : Error< + "missing ',' between base or member initializers">; + // C++ declarations def err_friend_decl_defines_class : Error< "cannot define a type in a friend declaration">; - + +def warn_deleted_function_accepted_as_extension: ExtWarn< + "deleted function definition accepted as a C++0x extension">, InGroup<CXX0x>; + +// C++0x override control +def ext_override_control_keyword : Extension< + "'%0' keyword accepted as a C++0x extension">, InGroup<CXX0x>; +def ext_override_inline: Extension< + "'%0' keyword only allowed in declarations, allowed as an extension">; + +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 err_expected_parameter_pack : Error< + "expected the name of a parameter pack">; +def err_paren_sizeof_parameter_pack : Error< + "missing parentheses around the size of parameter pack %0">; +def err_sizeof_parameter_pack : Error< + "expected parenthesized parameter pack name in 'sizeof...' expression">; + // Language specific pragmas // - Generic warnings def warn_pragma_expected_lparen : Warning< @@ -398,5 +447,17 @@ def warn_pragma_unused_expected_var : Warning< def warn_pragma_unused_expected_punc : Warning< "expected ')' or ',' in '#pragma unused'">; +// OpenCL Section 6.8.g +def err_not_opencl_storage_class_specifier : Error< + "OpenCL does not support the '%0' storage class specifier">; + +// OpenCL EXTENSION pragma (OpenCL 1.1 [9.1]) +def warn_pragma_expected_colon : Warning< + "missing ':' after %0 - ignoring">; +def warn_pragma_expected_enable_disable : Warning< + "expected 'enable' or 'disable' - ignoring">; +def warn_pragma_unknown_extension : Warning< + "unknown OpenCL extension %0 - ignoring">; + } // end of Parse Issue category. } // end of Parser diagnostics diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index a25b2a3..2e7f274 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -46,14 +46,18 @@ def err_vla_decl_has_static_storage : Error< "variable length array declaration can not have 'static' storage duration">; def err_vla_decl_has_extern_linkage : Error< "variable length array declaration can not have 'extern' linkage">; - + // C99 variably modified types def err_variably_modified_template_arg : Error< "variably modified type %0 cannot be used as a template argument">; def err_variably_modified_nontype_template_param : Error< "non-type template parameter of variably modified type %0">; +def err_variably_modified_new_type : Error< + "'new' cannot allocate object of variably modified type %0">; // C99 Designated Initializers +def ext_designated_init : 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< @@ -93,6 +97,8 @@ 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< + "'%0' cannot be the name of a parameter">; def err_parameter_name_omitted : Error<"parameter name omitted">; def warn_unused_parameter : Warning<"unused parameter %0">, InGroup<UnusedParameter>, DefaultIgnore; @@ -106,7 +112,16 @@ def warn_unused_function : Warning<"unused function %0">, InGroup<UnusedFunction>, DefaultIgnore; def warn_unused_member_function : Warning<"unused member function %0">, InGroup<UnusedMemberFunction>, DefaultIgnore; - +def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">, + InGroup<UsedButMarkedUnused>, DefaultIgnore; + +def warn_parameter_size: Warning< + "%0 is a large (%1 bytes) pass-by-value argument; " + "pass it by reference instead ?">, InGroup<LargeByValueCopy>; +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_implicit_function_decl : Warning< "implicit declaration of function %0">, InGroup<ImplicitFunctionDeclare>, DefaultIgnore; @@ -147,6 +162,17 @@ def err_using_decl_nested_name_specifier_is_current_class : Error< "using declaration refers to its own class">; def err_using_decl_nested_name_specifier_is_not_base_class : Error< "using declaration refers into '%0', which is not a base class of %1">; +def err_using_decl_constructor_not_in_direct_base : Error< + "%0 is not a direct base of %1, can not inherit constructors">; +def err_using_decl_constructor_conflict : Error< + "can not inherit constructor, already inherited constructor with " + "the same signature">; +def note_using_decl_constructor_conflict_current_ctor : Note< + "conflicting constructor">; +def note_using_decl_constructor_conflict_previous_ctor : Note< + "previous constructor">; +def note_using_decl_constructor_conflict_previous_using : Note< + "previously inherited here">; def err_using_decl_can_not_refer_to_class_member : Error< "using declaration can not refer to class member">; def err_using_decl_can_not_refer_to_namespace : Error< @@ -210,10 +236,12 @@ 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 err_implicit_decl_requires_stdio : Error< - "implicit declaration of '%0' requires inclusion of the header <stdio.h>">; -def err_implicit_decl_requires_setjmp : Error< - "implicit declaration of '%0' requires inclusion of the header <setjmp.h>">; +def warn_implicit_decl_requires_stdio : Warning< + "declaration of built-in function '%0' requires inclusion of the header " + "<stdio.h>">; +def warn_implicit_decl_requires_setjmp : Warning< + "declaration of built-in function '%0' requires inclusion of the header " + "<setjmp.h>">; def warn_redecl_library_builtin : Warning< "incompatible redeclaration of library function %0">; def err_builtin_definition : Error<"definition of builtin function %0">; @@ -227,6 +255,7 @@ def warn_unusual_main_decl : Warning<"'main' should not be declared " "%select{static|inline|static or inline}0">; def err_unusual_main_decl : Error<"'main' is not allowed to be declared " "%select{static|inline|static or inline}0">; +def err_main_template_decl : Error<"'main' cannot be a template">; def err_main_returns_nonint : Error<"'main' must return 'int'">; def err_main_surplus_args : Error<"too many parameters (%0) for 'main': " "must be 0, 2, or 3">; @@ -261,8 +290,8 @@ def warn_pragma_pack_pop_failed : Warning<"#pragma pack(pop, ...) failed: %0">; def warn_pragma_unused_undeclared_var : Warning< "undeclared variable %0 used as an argument for '#pragma unused'">; -def warn_pragma_unused_expected_localvar : Warning< - "only local variables can be arguments to '#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">; @@ -314,16 +343,23 @@ def err_conflicting_ivar_name : Error< "conflicting instance variable names: %0 vs %1">; def err_inconsistant_ivar_count : Error< "inconsistent number of instance variables specified">; -def warn_incomplete_impl : Warning<"incomplete implementation">; +def warn_incomplete_impl : Warning<"incomplete implementation">, + InGroup<DiagGroup<"incomplete-implementation">>; def note_undef_method_impl : Note<"method definition for %0 not found">; def note_required_for_protocol_at : Note<"required for direct or indirect protocol %0">; def warn_conflicting_ret_types : Warning< "conflicting return type in implementation of %0: %1 vs %2">; +def warn_non_covariant_ret_types : Warning< + "conflicting return type in implementation of %0: %1 vs %2">, + InGroup<DiagGroup<"method-signatures">>, DefaultIgnore; def warn_conflicting_param_types : Warning< "conflicting parameter types in implementation of %0: %1 vs %2">; +def warn_non_contravariant_param_types : Warning< + "conflicting parameter types in implementation of %0: %1 vs %2">, + InGroup<DiagGroup<"method-signatures">>, DefaultIgnore; def warn_conflicting_variadic :Warning< "conflicting variadic declaration of method and its implementation">; @@ -337,6 +373,7 @@ def warn_strict_multiple_method_decl : Warning< 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 err_setter_type_void : Error<"type of setter must be void">; def err_duplicate_method_decl : Error<"duplicate declaration of method %0">; def warn_missing_atend : Warning<"'@end' is missing in implementation context">; @@ -361,9 +398,17 @@ def warn_objc_property_copy_missing_on_block : Warning< def warn_atomic_property_rule : Warning< "writable atomic property %0 cannot pair a synthesized setter/getter " "with a user defined setter/getter">; +def warn_default_atomic_custom_getter_setter : Warning< + "atomic by default property %0 has a user defined %select{getter|setter}1 " + "(property should be marked 'atomic' if this is intended)">, + InGroup<CustomAtomic>, DefaultIgnore; def err_use_continuation_class : Error< - "illegal declaration of property in continuation class %0" - ": attribute must be readwrite, while its primary must be readonly">; + "illegal redeclaration of property in continuation class %0" + " (attribute must be 'readwrite', while its primary must be 'readonly')">; +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 " + "'readonly' public property?)">; def err_continuation_class : Error<"continuation class has no primary class">; def err_property_type : Error<"property cannot have array or function type %0">; def error_missing_property_context : Error< @@ -400,7 +445,7 @@ def error_ivar_in_superclass_use : Error< def error_weak_property : Error< "existing ivar %1 for __weak property %0 must be __weak">; def error_strong_property : Error< - "existing ivar %1 for a __strong property %0 must be garbage collectable">; + "property %0 must be declared __weak to match existing ivar %1 with __weak attribute">; def error_dynamic_property_ivar_decl : Error< "dynamic property can not have ivar specification">; def error_duplicate_ivar_use : Error< @@ -411,6 +456,11 @@ def warn_objc_property_attr_mutually_exclusive : Warning< InGroup<ReadOnlySetterAttrs>, DefaultIgnore; def warn_undeclared_selector : Warning< "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore; +def warn_implicit_atomic_property : Warning< + "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore; +def warn_auto_implicit_atomic_property : Warning< + "property is assumed atomic when auto-synthesizing the property">, + InGroup<ImplicitAtomic>, DefaultIgnore; def warn_unimplemented_selector: Warning< "unimplemented selector %0">, InGroup<Selector>, DefaultIgnore; def warn_unimplemented_protocol_method : Warning< @@ -442,11 +492,15 @@ def err_introducing_special_friend : Error< "destructor|conversion operator}0 as a friend">; def err_tagless_friend_type_template : Error< "friend type templates must use an elaborated type">; +def err_no_matching_local_friend : Error< + "no matching function found in local scope">; +def err_partial_specialization_friend : Error< + "partial specialization cannot be declared as a friend">; def err_abstract_type_in_decl : Error< "%select{return|parameter|variable|field}0 type %1 is an abstract class">; def err_allocation_of_abstract_type : Error< - "allocation of an object of abstract type %0">; + "allocating an object of abstract class type %0">; def err_throw_abstract_type : Error< "cannot throw an object of abstract type %0">; def err_array_of_abstract_type : Error<"array of abstract class type %0">; @@ -463,7 +517,7 @@ def err_type_defined_in_param_type : Error< "%0 can not be defined in a parameter type">; def note_pure_virtual_function : Note< - "pure virtual function %0">; + "unimplemented pure virtual method %0 in %1">; def err_deleted_non_function : Error< "only functions can have deleted definitions">; @@ -503,65 +557,70 @@ def warn_missing_exception_specification : Warning< 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">, NoSFINAE; + "%1 is a %select{private|protected}0 member of %3">, AccessControl; def err_access_ctor : Error< - "calling a %select{private|protected}0 constructor of class %2">, NoSFINAE; + "calling a %select{private|protected}0 constructor of class %2">, + AccessControl; def ext_rvalue_to_reference_access_ctor : ExtWarn< "C++98 requires an accessible copy constructor for class %2 when binding " "a reference to a temporary; was %select{private|protected}0">, - NoSFINAE, InGroup<BindToTemporaryCopy>; + AccessControl, InGroup<BindToTemporaryCopy>; def err_access_base : Error< "%select{base class|inherited virtual base class}0 %1 has %select{private|" "protected}3 %select{constructor|copy constructor|copy assignment operator|" - "destructor}2">, NoSFINAE; + "destructor}2">, AccessControl; def err_access_field: Error< "field of type %0 has %select{private|protected}2 %select{constructor|copy " - "constructor|copy assignment operator|destructor}1">, NoSFINAE; + "constructor|copy assignment operator|destructor}1">, AccessControl; def err_access_ctor_field : Error<"field of type %1 has %select{private|protected}2 constructor">, - NoSFINAE; + AccessControl; +def err_access_dtor : Error< + "calling a %select{private|protected}1 destructor of class %0">, + AccessControl; def err_access_dtor_base : Error<"base class %0 has %select{private|protected}1 destructor">, - NoSFINAE; + AccessControl; def err_access_dtor_vbase : Error<"inherited virtual base class %0 has " "%select{private|protected}1 destructor">, - NoSFINAE; + AccessControl; def err_access_dtor_temp : Error<"temporary of type %0 has %select{private|protected}1 destructor">, - NoSFINAE; + AccessControl; def err_access_dtor_exception : Error<"exception object of type %0 has %select{private|protected}1 " - "destructor">, NoSFINAE; + "destructor">, AccessControl; def err_access_dtor_field : Error<"field of type %1 has %select{private|protected}2 destructor">, - NoSFINAE; + AccessControl; def err_access_dtor_var : Error<"variable of type %1 has %select{private|protected}2 destructor">, - NoSFINAE; + AccessControl; def err_access_assign_field : Error<"field of type %1 has %select{private|protected}2 copy assignment" " operator">, - NoSFINAE; + AccessControl; def err_access_assign_base : Error<"base class %0 has %select{private|protected}1 copy assignment" " operator">, - NoSFINAE; + AccessControl; def err_access_copy_field : Error<"field of type %1 has %select{private|protected}2 copy constructor">, - NoSFINAE; + AccessControl; def err_access_copy_base : Error<"base class %0 has %select{private|protected}1 copy constructor">, - NoSFINAE; + AccessControl; def err_access_dtor_ivar : Error<"instance variable of type %0 has %select{private|protected}1 " "destructor">, - NoSFINAE; + 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">; + "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< @@ -604,6 +663,10 @@ def err_virtual_non_function : Error< "'virtual' can only appear on non-static member functions">; def err_virtual_out_of_class : Error< "'virtual' can only be specified inside the class definition">; +def err_virtual_member_function_template : Error< + "'virtual' can not be specified on member function templates">; +def err_static_overrides_virtual : Error< + "'static' member function %0 overrides a virtual function in a base class">; def err_explicit_non_function : Error< "'explicit' can only appear on non-static member functions">; def err_explicit_out_of_class : Error< @@ -619,7 +682,7 @@ def err_not_integral_type_bitfield : Error< def err_not_integral_type_anon_bitfield : Error< "anonymous bit-field has non-integral type %0">; def err_member_initialization : Error< - "%0 can only be initialized if it is a static const integral data member">; + "fields can only be initialized in constructors">; def err_member_function_initialization : Error< "initializer on function does not look like a pure-specifier">; def err_non_virtual_pure : Error< @@ -652,6 +715,10 @@ def note_nontrivial_has_nontrivial : Note< def note_nontrivial_user_defined : Note< "because type %0 has a user-declared %select{constructor|copy constructor|" "copy 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_union_member_of_reference_type : Error< + "union member %0 has reference type %1">; def err_different_return_type_for_overriding_virtual_function : Error< "virtual function %0 has a different return type (%1) than the " @@ -661,7 +728,7 @@ def note_overridden_virtual_function : Note< def err_covariant_return_inaccessible_base : Error< "invalid covariant return for virtual function: %1 is a " - "%select{private|protected}2 base class of %0">, NoSFINAE; + "%select{private|protected}2 base class of %0">, AccessControl; def err_covariant_return_ambiguous_derived_to_base_conv : Error< "return type of virtual function %3 is not covariant with the return type of " "the function it overrides (ambiguous conversion from derived class " @@ -684,6 +751,9 @@ def err_covariant_return_type_class_type_more_qualified : Error< def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">; def err_invalid_qualified_constructor : Error< "'%0' qualifier is not allowed on a constructor">; +def err_ref_qualifier_constructor : Error< + "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">; + def err_constructor_return_type : Error< "constructor cannot have a return type">; def err_constructor_redeclared : Error<"constructor cannot be redeclared">; @@ -694,6 +764,8 @@ def warn_no_constructor_for_refconst : Warning< "initialize its non-modifiable members">; def note_refconst_member_not_initialized : Note< "%select{const|reference}0 member %1 will never be initialized">; +def ext_ms_explicit_constructor_call : ExtWarn< + "explicit constructor calls are a Microsoft extension">, InGroup<Microsoft>; // C++ destructors def err_destructor_not_member : Error< @@ -701,6 +773,8 @@ def err_destructor_not_member : Error< def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">; def err_invalid_qualified_destructor : Error< "'%0' qualifier is not allowed on a destructor">; +def err_ref_qualifier_destructor : Error< + "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">; def err_destructor_return_type : Error<"destructor cannot have a return type">; def err_destructor_redeclared : Error<"destructor cannot be redeclared">; def err_destructor_with_params : Error<"destructor cannot have any parameters">; @@ -721,7 +795,8 @@ def err_init_conversion_failed : Error< "base class|a vector element}0 of type %1 with an %select{rvalue|lvalue}2 of " "type %3">; -def err_lvalue_to_rvalue_ref : Error<"rvalue reference cannot bind to lvalue">; +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 " @@ -745,6 +820,10 @@ def err_reference_bind_init_list : Error< def err_init_list_bad_dest_type : Error< "%select{|non-aggregate }0type %1 cannot be initialized with an initializer " "list">; +def err_member_function_call_bad_cvr : Error<"member function %0 not viable: " + "'this' argument has type %1, but function is not marked " + "%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 " @@ -768,7 +847,16 @@ def err_init_reference_member_uninitialized : Error< def note_uninit_reference_member : Note< "uninitialized reference member is here">; def warn_field_is_uninit : Warning<"field is uninitialized when used here">, - InGroup<DiagGroup<"uninitialized">>; + InGroup<Uninitialized>; +def warn_uninit_var : Warning<"variable %0 is possibly uninitialized when used here">, + InGroup<DiagGroup<"uninitialized-experimental">>, DefaultIgnore; +def note_uninit_var_def : Note< + "variable %0 is declared here">; +def warn_uninit_var_captured_by_block : Warning< + "variable %0 is possibly uninitialized when captured by block">, + InGroup<DiagGroup<"uninitialized-experimental">>, DefaultIgnore; +def note_var_fixit_add_initialization : Note< + "add initialization to silence this warning">; def err_init_incomplete_type : Error<"initialization of incomplete type %0">; def err_temp_copy_no_viable : Error< @@ -798,20 +886,46 @@ def err_temp_copy_incomplete : Error< // C++0x decltype def err_cannot_determine_declared_type_of_overloaded_function : Error< - "cannot determine the %select{type|declared type}0 of an overloaded " - "function">; + "cannot determine the type of an overloaded function">; // C++0x auto 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< - "'%0' declared as array of 'auto'">; + "'%0' declared as array of %1">; +def err_new_array_of_auto : Error< + "cannot allocate array of 'auto'">; def err_auto_not_allowed : Error< - "'auto' not allowed in %select{function prototype|struct member|union member" - "|class member|exception declaration|template parameter|block literal}0">; + "'auto' not allowed %select{in function prototype|in struct member" + "|in union member|in class member|in exception declaration" + "|in template parameter|in block literal|in template argument|here}0">; 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_var_init_multiple_expressions : Error< + "initializer for variable %0 with type %1 contains multiple expressions">; +def err_auto_new_ctor_multiple_expressions : Error< + "new expression for type %0 contains multiple constructor arguments">; +def err_auto_missing_trailing_return : Error< + "'auto' return without trailing return type">; +def err_trailing_return_without_auto : Error< + "function with trailing return type must specify return type 'auto', not %0">; +def err_auto_var_deduction_failure : Error< + "variable %0 with type %1 has incompatible initializer of type %2">; +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">; + +// C++0x override control +def override_keyword_only_allowed_on_virtual_member_functions : Error< + "only virtual member functions can be marked '%0'">; +def err_function_marked_override_not_overriding : Error< + "%0 marked 'override' but does not override any member functions">; +def err_class_marked_final_used_as_base : Error< + "base %0 is marked 'final'">; + // C++0x attributes def err_repeat_attribute : Error<"'%0' attribute cannot be repeated">; @@ -820,6 +934,32 @@ def err_final_function_overridden : Error< "declaration of %0 overrides a 'final' function">; def err_final_base : Error< "derivation from 'final' %0">; + +def err_function_overriding_without_override : Error< + "%0 overrides function%s1 without being marked 'override'">; + +// C++0x scoped enumerations +def err_enum_invalid_underlying : Error< + "non-integral type %0 is an invalid underlying type">; +def err_enumerator_too_large : Error< + "enumerator value is not representable in the underlying type %0">; +def ext_enumerator_too_large : ExtWarn< + "enumerator value is not representable in the underlying type %0">, + InGroup<Microsoft>; +def err_enumerator_wrapped : Error< + "enumerator value %0 is not representable in the underlying type %1">; +def err_enum_redeclare_type_mismatch : Error< + "enumeration redeclared with different underlying type %0 (was %1)">; +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">; + +// C++0x delegating constructors +def err_delegation_0x_only : Error< + "delegating constructors are permitted only in C++0x">; +def err_delegation_unimplemented : Error< + "delegating constructors are not fully implemented">; // Objective-C++ def err_objc_decls_may_only_appear_in_global_scope : Error< @@ -842,13 +982,15 @@ def err_iboutletcollection_object_type : Error< def err_attribute_missing_parameter_name : Error< "attribute requires unquoted parameter">; def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">; +def err_attribute_bad_neon_vector_size : Error< + "Neon vector size must be 64 or 128 bits">; def err_attribute_argument_not_int : Error< "'%0' attribute requires integer constant">; def err_attribute_argument_outof_range : Error< "init_priority attribute requires integer constant between " "101 and 65535 inclusive">; def err_init_priority_object_attr : Error< - "can only use ‘init_priority’ attribute on file-scope definitions " + "can only use 'init_priority' attribute on file-scope definitions " "of objects of class type">; def err_attribute_argument_n_not_int : Error< "'%0' attribute requires parameter %1 to be an integer constant">; @@ -858,8 +1000,12 @@ def err_attribute_argument_out_of_bounds : Error< "'%0' attribute parameter %1 is out of bounds">; def err_attribute_requires_objc_interface : Error< "attribute may only be applied to an Objective-C interface">; +def err_attribute_uuid_malformed_guid : Error< + "uuid attribute contains a malformed GUID">; def warn_nonnull_pointers_only : Warning< "nonnull attribute only applies to pointer arguments">; +def err_attribute_invalid_implicit_this_argument : Error< + "'%0' attribute is invalid for the implicit this argument">; def err_ownership_type : Error< "%0 attribute only applies to %1 arguments">; def err_format_strftime_third_parameter : Error< @@ -868,6 +1014,9 @@ def err_format_attribute_requires_variadic : Error< "format attribute requires variadic function">; def err_format_attribute_not : Error<"format argument not %0">; def err_format_attribute_result_not : Error<"function does not return %0">; +def err_format_attribute_implicit_this_format_string : Error< + "format attribute cannot specify the implicit this argument as the format " + "string">; def err_attribute_invalid_size : Error< "vector size not an integral multiple of component size">; def err_attribute_zero_size : Error<"zero vector size">; @@ -889,9 +1038,6 @@ def err_attribute_address_space_too_high : Error< "address space is larger than the maximum supported (%0)">; def err_attribute_address_multiple_qualifiers : Error< "multiple address spaces specified for type">; -def err_implicit_pointer_address_space_cast : Error< - "illegal implicit conversion between two pointers with different address " - "spaces">; def err_as_qualified_auto_decl : Error< "automatic variable qualified with an address space">; def err_arg_with_address_space : Error< @@ -921,32 +1067,39 @@ def warn_attribute_weak_on_local : Warning< def warn_weak_identifier_undeclared : Warning< "weak identifier %0 never declared">; def err_attribute_weak_static : Error< - "weak declaration of '%0' must be public">; + "weak declaration cannot have internal linkage">; def warn_attribute_weak_import_invalid_on_definition : Warning< "'weak_import' attribute cannot be specified on a definition">; def err_attribute_weakref_not_static : Error< - "weakref declaration of '%0' must be static">; + "weakref declaration must have internal linkage">; def err_attribute_weakref_not_global_context : Error< "weakref declaration of '%0' must be in a global context">; def err_attribute_weakref_without_alias : Error< "weakref declaration of '%0' must also have an alias attribute">; +def err_alias_not_supported_on_darwin : Error < + "only weak aliases are supported on darwin">; def warn_attribute_wrong_decl_type : Warning< - "%0 attribute only applies to %select{function|union|" - "variable and function|function or method|parameter|" - "parameter or Objective-C method |function, method or block|" - "virtual method or class|function, method, or parameter|class|virtual method" - "|member}1 types">; + "%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}1">; def err_attribute_wrong_decl_type : Error< - "%0 attribute only applies to %select{function|union|" - "variable and function|function or method|parameter|" - "parameter or Objective-C method |function, method or block|" - "virtual method or class|function, method, or parameter|class|virtual method" - "|member}1 types">; + "%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}1">; def warn_function_attribute_wrong_type : Warning< "%0 only applies to function types; type here is %1">; def warn_gnu_inline_attribute_requires_inline : Warning< "'gnu_inline' attribute requires function to be marked 'inline'," " attribute ignored">; +def err_attribute_vecreturn_only_vector_member : Error< + "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">; +def err_attribute_vecreturn_only_pod_record : Error< + "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">; def err_cconv_change : Error< "function declared '%0' here was previously declared " "%select{'%2'|without calling convention}1">; @@ -955,9 +1108,8 @@ def err_cconv_knr : Error< def err_cconv_varargs : Error< "variadic function cannot use %0 calling convention">; def err_regparm_mismatch : Error<"function declared with with regparm(%0) " - "attribute was previously declared %plural{0:without the regparm|1:" - "with the regparm(1)|2:with the regparm(2)|3:with the regparm(3)|:with the" - "regparm}1 attribute">; + "attribute was previously declared " + "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">; def warn_impcast_vector_scalar : Warning< "implicit conversion turns vector to scalar: %0 to %1">, @@ -983,6 +1135,16 @@ def warn_impcast_integer_precision : Warning< def warn_impcast_integer_64_32 : Warning< "implicit conversion loses integer precision: %0 to %1">, 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">>; +def warn_impcast_bitfield_precision_constant : Warning< + "implicit truncation from %2 to bitfield changes value from %0 to %1">, + InGroup<DiagGroup<"constant-conversion">>; +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; def warn_cast_align : Warning< "cast from %0 to %1 increases required alignment from %2 to %3">, @@ -1023,7 +1185,6 @@ def warn_attribute_malloc_pointer_only : Warning< 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< @@ -1048,9 +1209,9 @@ def err_attribute_regparm_invalid_number : Error< // Clang-Specific Attributes -def err_attribute_iboutlet : Error< +def warn_attribute_iboutlet : Warning< "%0 attribute can only be applied to instance variables or properties">; -def err_attribute_ibaction: Error< +def warn_attribute_ibaction: Warning< "ibaction attribute can only be applied to Objective-C instance methods">; def err_attribute_overloadable_not_function : Error< "'overloadable' attribute can only be applied to a function">; @@ -1062,8 +1223,11 @@ def note_attribute_overloadable_prev_overload : Note< def err_attribute_overloadable_no_prototype : Error< "'overloadable' function %0 must have a prototype">; def warn_ns_attribute_wrong_return_type : Warning< - "%0 attribute only applies to functions or methods that " - "return a pointer or Objective-C object">; + "%0 attribute only applies to %select{functions|methods}1 that " + "return %select{an Objective-C object|a pointer}2">; +def warn_ns_attribute_wrong_parameter_type : Warning< + "%0 attribute only applies to %select{Objective-C object|pointer}1 " + "parameters">; // Function Parameter Semantic Analysis. def err_param_with_void_type : Error<"argument may not have 'void' type">; @@ -1148,12 +1312,14 @@ def note_ovl_candidate : Note<"candidate " "function |function |constructor |" "is the implicit default constructor|" "is the implicit copy constructor|" - "is the implicit copy assignment operator}0%1">; + "is the implicit copy assignment operator|" + "is an inherited constructor}0%1">; def warn_init_pointer_from_false : Warning< "initialization of pointer of type %0 from literal 'false'">, InGroup<BoolConversions>; +def note_ovl_candidate_inherited_constructor : Note<"inherited from here">; def note_ovl_candidate_bad_deduction : Note< "candidate template ignored: failed template argument deduction">; def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: " @@ -1181,14 +1347,15 @@ def note_ovl_candidate_arity : Note<"candidate " "%select{function|function|constructor|function|function|constructor|" "constructor (the implicit default constructor)|" "constructor (the implicit copy constructor)|" - "function (the implicit copy assignment operator)}0 %select{|template }1" + "function (the implicit copy assignment operator)|" + "constructor (inherited)}0 %select{|template }1" "not viable: requires%select{ at least| at most|}2 %3 argument%s3, but %4 " "%plural{1:was|:were}4 provided">; def note_ovl_candidate_deleted : Note< - "candidate %select{function|function|constructor|" - "function |function |constructor |||}0%1 " - "has been explicitly %select{made unavailable|deleted}2">; + "candidate %select{function|function|constructor|" + "function |function |constructor ||||constructor (inherited)}0%1 " + "has been explicitly %select{made unavailable|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 @@ -1200,21 +1367,24 @@ def note_ovl_candidate_bad_conv_incomplete : Note<"candidate " "function |function |constructor |" "constructor (the implicit default constructor)|" "constructor (the implicit copy constructor)|" - "function (the implicit copy assignment operator)}0%1 " + "function (the implicit copy assignment operator)|" + "constructor (inherited)}0%1 " "not viable: cannot convert argument of incomplete type %2 to %3">; def note_ovl_candidate_bad_overload : Note<"candidate " "%select{function|function|constructor|" "function |function |constructor |" "constructor (the implicit default constructor)|" "constructor (the implicit copy constructor)|" - "function (the implicit copy assignment operator)}0%1" + "function (the implicit copy assignment operator)|" + "constructor (inherited)}0%1" " not viable: no overload of %3 matching %2 for %ordinal4 argument">; def note_ovl_candidate_bad_conv : Note<"candidate " "%select{function|function|constructor|" "function |function |constructor |" "constructor (the implicit default constructor)|" "constructor (the implicit copy constructor)|" - "function (the implicit copy assignment operator)}0%1" + "function (the implicit copy assignment operator)|" + "constructor (inherited)}0%1" " not viable: no known conversion from %2 to %3 for " "%select{%ordinal5 argument|object argument}4">; def note_ovl_candidate_bad_addrspace : Note<"candidate " @@ -1222,12 +1392,13 @@ def note_ovl_candidate_bad_addrspace : Note<"candidate " "function |function |constructor |" "constructor (the implicit default constructor)|" "constructor (the implicit copy constructor)|" - "function (the implicit copy assignment operator)}0%1 not viable: " + "function (the implicit copy assignment operator)|" + "constructor (inherited)}0%1 not viable: " "%select{%ordinal6|'this'}5 argument (%2) is in " "address space %3, but parameter must be in address space %4">; def note_ovl_candidate_bad_cvr_this : Note<"candidate " "%select{|function|||function||||" - "function (the implicit copy assignment operator)}0 not viable: " + "function (the implicit copy assignment operator)|}0 not viable: " "'this' argument has type %2, but method is not marked " "%select{const|restrict|const or restrict|volatile|const or volatile|" "volatile or restrict|const, volatile, or restrict}3">; @@ -1236,7 +1407,8 @@ def note_ovl_candidate_bad_cvr : Note<"candidate " "function |function |constructor |" "constructor (the implicit default constructor)|" "constructor (the implicit copy constructor)|" - "function (the implicit copy assignment operator)}0%1 not viable: " + "function (the implicit copy assignment operator)|" + "constructor (inherited)}0%1 not viable: " "%ordinal4 argument (%2) would lose " "%select{const|restrict|const and restrict|volatile|const and volatile|" "volatile and restrict|const, volatile, and restrict}3 qualifier" @@ -1246,7 +1418,8 @@ def note_ovl_candidate_bad_base_to_derived_conv : Note<"candidate " "function |function |constructor |" "constructor (the implicit default constructor)|" "constructor (the implicit copy constructor)|" - "function (the implicit copy assignment operator)}0%1" + "function (the implicit copy assignment operator)|" + "constructor (inherited)}0%1" " not viable: cannot %select{convert from|convert from|bind}2 " "%select{base class pointer|superclass|base class object of type}2 %3 to " "%select{derived class pointer|subclass|derived class reference}2 %4 for " @@ -1260,13 +1433,26 @@ def note_ovl_builtin_unary_candidate : Note< "built-in candidate %0">; def err_ovl_no_viable_function_in_init : Error< "no matching constructor for initialization of %0">; +def err_ovl_no_conversion_in_cast : Error< + "cannot convert %1 to %2 without a conversion operator">; +def err_ovl_no_viable_conversion_in_cast : Error< + "no matching conversion for %select{|static_cast|reinterpret_cast|" + "dynamic_cast|C-style cast|functional-style cast}0 from %1 to %2">; +def err_ovl_ambiguous_conversion_in_cast : Error< + "ambiguous conversion for %select{|static_cast|reinterpret_cast|" + "dynamic_cast|C-style cast|functional-style cast}0 from %1 to %2">; +def err_ovl_deleted_conversion_in_cast : Error< + "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|" + "functional-style cast}0 from %1 to %2 uses deleted function">; def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">; 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_ambiguous_oper : Error< - "use of overloaded operator '%0' is ambiguous">; +def err_ovl_ambiguous_oper_unary : Error< + "use of overloaded operator '%0' is ambiguous (operand type %1)">; +def err_ovl_ambiguous_oper_binary : Error< + "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">; def 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'">; @@ -1274,6 +1460,9 @@ def err_ovl_no_viable_subscript : Error<"no viable overloaded operator[] for type %0">; def err_ovl_no_oper : Error<"type %0 does not provide a %select{subscript|call}1 operator">; +def err_ovl_unresolvable : + Error<"cannot resolve overloaded function from context">; + def err_ovl_no_viable_object_call : Error< "no matching function for call to object of type %0">; @@ -1337,14 +1526,16 @@ def note_template_param_prev_default_arg : Note< "previous default template argument defined here">; def err_template_param_default_arg_missing : Error< "template parameter missing a default argument">; -def err_template_parameter_default_in_function_template : Error< - "a template parameter of a function template cannot have a default argument " - "in C++98">; +def ext_template_parameter_default_in_function_template : ExtWarn< + "default template arguments for a function template are a C++0x extension">, + InGroup<CXX0x>; def err_template_parameter_default_template_member : Error< "cannot add a default template argument to the definition of a member of a " "class template">; def err_template_parameter_default_friend_template : Error< "default template argument not permitted on a friend template">; +def err_template_template_parm_no_parms : Error< + "template template parameter must have its own template parameters">; def err_template_variable : Error<"variable %0 declared as a template">; def err_template_variable_noparams : Error< @@ -1401,10 +1592,10 @@ def err_template_arg_not_convertible : Error< "of type %1">; def warn_template_arg_negative : Warning< "non-type template argument with value '%0' converted to '%1' for unsigned " - "template parameter of type %2">; + "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore; def warn_template_arg_too_large : Warning< "non-type template argument value '%0' truncated to '%1' for " - "template parameter of type %2">; + "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore; def err_template_arg_no_ref_bind : Error< "non-type template parameter of reference type %0 cannot bind to template " "argument of type %1">; @@ -1440,10 +1631,15 @@ def err_template_arg_not_object_or_func : Error< "non-type template argument does not refer to an object or function">; def err_template_arg_not_pointer_to_member_form : Error< "non-type template argument is not a pointer to member constant">; -def err_template_arg_extra_parens : Error< - "non-type template argument cannot be surrounded by parentheses">; +def ext_template_arg_extra_parens : ExtWarn< + "address non-type template argument cannot be surrounded by parentheses">; 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< + "call to pointer to member function of type %0 drops '%1' qualifier%s2">; +def err_pointer_to_member_oper_value_classify: Error< + "pointer-to-member function type %0 can only be called on an " + "%select{rvalue|lvalue}1">; // C++ template specialization def err_template_spec_unknown_kind : Error< @@ -1462,10 +1658,20 @@ 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++0x extension">, + InGroup<CXX0x>; 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">; +def ext_template_spec_decl_out_of_scope : 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 namespace %2; accepted as a C++0x extension">, + InGroup<CXX0x>; 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 " @@ -1549,6 +1755,8 @@ def err_function_template_spec_ambiguous : Error< "arguments to identify a particular function template">; def note_function_template_spec_matched : Note< "function template matches specialization %0">; +def err_function_template_partial_spec : Error< + "function template partial specialization is not allowed">; // C++ Template Instantiation def err_template_recursion_depth_exceeded : Error< @@ -1597,6 +1805,8 @@ def note_instantiation_contexts_suppressed : Note< def err_field_instantiates_to_function : Error< "data member instantiated with function type %0">; +def err_variable_instantiates_to_function : Error< + "%select{variable|static data member}0 instantiated with function type %1">; def err_nested_name_spec_non_tag : Error< "type %0 cannot be used prior to '::' because it has no members">; @@ -1607,7 +1817,8 @@ def note_previous_explicit_instantiation : Note< "previous explicit instantiation is here">; def ext_explicit_instantiation_after_specialization : Extension< "explicit instantiation of %0 that occurs after an explicit " - "specialization will be ignored (C++0x extension)">; + "specialization will be ignored (C++0x extension)">, + InGroup<CXX0x>; def note_previous_template_specialization : Note< "previous template specialization is here">; def err_explicit_instantiation_enum : Error< @@ -1678,7 +1889,12 @@ def note_typename_refers_here : Note< def err_typename_missing : Error< "missing 'typename' prior to dependent type name '%0%1'">; def ext_typename_outside_of_template : ExtWarn< - "'typename' occurs outside of a template">; + "'typename' occurs outside of a template">, InGroup<CXX0x>; +def err_typename_refers_to_using_value_decl : Error< + "typename specifier refers to a dependent using declaration for a value " + "%0 in %1">; +def note_using_value_decl_missing_typename : Note< + "add 'typename' to treat this using declaration as a type">; def err_template_kw_refers_to_non_template : Error< "%0 following the 'template' keyword does not refer to a template">; @@ -1691,7 +1907,7 @@ def note_referenced_class_template : Error< 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">; + "'template' keyword outside of a template">, InGroup<CXX0x>; // C++0x Variadic Templates def err_template_param_pack_default_arg : Error< @@ -1700,17 +1916,62 @@ def err_template_param_pack_must_be_last_template_parameter : Error< "template parameter pack must be the last template parameter">; def err_template_parameter_pack_non_pack : Error< - "template %select{type|non-type|template}0 parameter%select{| pack}1 " - "conflicts with previous template %select{type|non-type|template}0 " - "parameter%select{ pack|}1">; + "%select{template type|non-type template|template template}0 parameter" + "%select{| pack}1 conflicts with previous %select{template type|" + "non-type template|template template}0 parameter%select{ pack|}1">; def note_template_parameter_pack_non_pack : Note< - "template %select{type|non-type|template}0 parameter%select{| pack}1 " - "does not match template %select{type|non-type|template}0 " - "parameter%select{ pack|}1 in template argument">; + "%select{template type|non-type template|template template}0 parameter" + "%select{| pack}1 does not match %select{template type|non-type template" + "|template template}0 parameter%select{ pack|}1 in template argument">; def note_template_parameter_pack_here : Note< - "previous template %select{type|non-type|template}0 " + "previous %select{template type|non-type template|template template}0 " "parameter%select{| pack}1 declared here">; +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 " + "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 " + "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 " + "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 " + "contains unexpanded parameter packs %1, %2, ...">; + +def err_pack_expansion_without_parameter_packs : Error< + "pack expansion does not contain any unexpanded parameter packs">; +def err_pack_expansion_length_conflict : Error< + "pack expansion contains parameter packs %0 and %1 that have different " + "lengths (%2 vs. %3)">; +def err_pack_expansion_length_conflict_multilevel : Error< + "pack expansion contains parameter pack %0 that has a different " + "length (%1 vs. %2) from outer parameter packs">; +def err_pack_expansion_member_init : Error< + "pack expansion for initialization of member %0">; + +def err_function_parameter_pack_without_parameter_packs : Error< + "type %0 of function parameter pack does not contain any unexpanded " + "parameter packs">; +def err_ellipsis_in_declarator_not_parameter : Error< + "only function and template parameters can be parameter packs">; + +def err_sizeof_pack_no_pack_name : Error< + "%0 does not refer to the name of a parameter pack">; + def err_unexpected_typedef : Error< "unexpected type name %0: expected expression">; def err_unexpected_namespace : Error< @@ -1721,9 +1982,20 @@ def note_dependent_var_use : Note<"must qualify identifier to find this " def err_undeclared_use : Error<"use of undeclared %0">; def warn_deprecated : Warning<"%0 is deprecated">, InGroup<DeprecatedDeclarations>; +def warn_deprecated_message : Warning<"%0 is deprecated: %1">, + InGroup<DeprecatedDeclarations>; +def warn_deprecated_fwdclass_message : Warning< + "%0 maybe deprecated because receiver type is unknown">, + InGroup<DeprecatedDeclarations>; +def warn_deprecated_def : Warning< + "Implementing deprecated %select{method|class|category}0">, + InGroup<DeprecatedImplementations>, DefaultIgnore; def err_unavailable : Error<"%0 is unavailable">; +def err_unavailable_message : Error<"%0 is unavailable: %1">; +def warn_unavailable_fwdclass_message : Warning< + "%0 maybe unavailable because receiver type is unknown">; def note_unavailable_here : Note< - "function has been explicitly marked %select{unavailable|deleted}0 here">; + "function has been explicitly marked %select{unavailable|deleted|deprecated}0 here">; def warn_not_enough_argument : Warning< "not enough variable arguments in %0 declaration to fit a sentinel">; def warn_missing_sentinel : Warning < @@ -1737,6 +2009,14 @@ def err_redefinition : Error<"redefinition of %0">; def err_definition_of_implicitly_declared_member : Error< "definition of implicitly declared %select{constructor|copy constructor|" "copy assignment operator|destructor}1">; +def err_redefinition_extern_inline : Error< + "redefinition of a 'extern inline' function %0 is not supported in " + "%select{C99 mode|C++}1">; + +// This should eventually be an error. +def warn_undefined_internal : Warning< + "%select{function|variable}0 %q1 has internal linkage but is not defined">; +def note_used_here : Note<"used here">; def warn_redefinition_of_typedef : Warning< "redefinition of typedef %0 is invalid in C">, @@ -1748,6 +2028,10 @@ def err_static_non_static : Error< "static declaration of %0 follows non-static declaration">; def err_non_static_static : Error< "non-static declaration of %0 follows static declaration">; +def err_extern_non_extern : Error< + "extern declaration of %0 follows non-extern declaration">; +def err_non_extern_extern : Error< + "non-extern declaration of %0 follows extern declaration">; def err_non_thread_thread : Error< "non-thread-local declaration of %0 follows thread-local declaration">; def err_thread_non_thread : Error< @@ -1780,6 +2064,8 @@ def ext_forward_ref_enum : Extension< "ISO C forbids forward references to 'enum' types">; def err_forward_ref_enum : Error< "ISO C++ forbids forward references to 'enum' types">; +def ext_ms_forward_ref_enum : Extension< + "forward references to 'enum' types are a Microsoft extension">, InGroup<Microsoft>; def ext_forward_ref_enum_def : Extension< "redeclaration of already-defined enum %0 is a GNU extension">, InGroup<GNU>; @@ -1809,6 +2095,19 @@ def err_vm_func_decl : Error< def err_array_too_large : Error< "array is too large (%0 elements)">; +// -Wpadded, -Wpacked +def warn_padded_struct_field : Warning< + "padding %select{struct|class}0 %1 with %2 %select{byte|bit}3%select{|s}4 " + "to align %5">, InGroup<Padded>, DefaultIgnore; +def warn_padded_struct_anon_field : Warning< + "padding %select{struct|class}0 %1 with %2 %select{byte|bit}3%select{|s}4 " + "to align anonymous bit-field">, InGroup<Padded>, DefaultIgnore; +def warn_padded_struct_size : Warning< + "padding size of %0 with %1 %select{byte|bit}2%select{|s}3 " + "to alignment boundary">, InGroup<Padded>, DefaultIgnore; +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_function_qualifiers : Warning< "qualifier on function type %0 has unspecified behavior">; @@ -1881,17 +2180,18 @@ def warn_missing_braces : Warning< "suggest braces around initialization of subobject">, InGroup<DiagGroup<"missing-braces">>, DefaultIgnore; -def err_redefinition_of_label : Error<"redefinition of label '%0'">; -def err_undeclared_label_use : Error<"use of undeclared label '%0'">; +def err_redefinition_of_label : Error<"redefinition of label %0">; +def err_undeclared_label_use : Error<"use of undeclared label %0">; +def warn_unused_label : Warning<"unused label %0">, + InGroup<UnusedLabel>, DefaultIgnore; def err_goto_into_protected_scope : Error<"goto into protected scope">; def err_switch_into_protected_scope : Error< "switch case is in protected scope">; def err_indirect_goto_without_addrlabel : Error< "indirect goto in function with no address-of-label expressions">; -def warn_indirect_goto_in_protected_scope : Warning< - "indirect goto might cross protected scopes">, - InGroup<DiagGroup<"label-address-scope">>; +def err_indirect_goto_in_protected_scope : Error< + "indirect goto might cross protected scopes">; def note_indirect_goto_target : Note<"possible target of indirect goto">; def note_protected_by_variable_init : Note< "jump bypasses variable initialization">; @@ -1953,6 +2253,13 @@ def ext_flexible_array_in_array : Extension< "%0 may not be used as an array element due to flexible array member">; def err_flexible_array_init_nonempty : Error< "non-empty initialization of flexible array member inside subobject">; +def ext_flexible_array_empty_aggregate : Extension< + "flexible array member %0 in otherwise empty %select{struct|class}1 " + "is a Microsoft extension">, InGroup<Microsoft>; +def ext_flexible_array_union : Extension< + "flexible array member %0 in a union is a Microsoft extension">, + InGroup<Microsoft>; + def err_flexible_array_init_needs_braces : Error< "flexible array requires brace-enclosed initializer">; def err_illegal_decl_array_of_functions : Error< @@ -1963,6 +2270,8 @@ def err_illegal_message_expr_incomplete_type : Error< "objective-c message has incomplete result type %0">; def err_illegal_decl_array_of_references : Error< "'%0' declared as array of references of type %1">; +def err_decl_negative_array_size : Error< + "'%0' declared as an array with a negative size">; def err_array_star_outside_prototype : Error< "star modifier used outside of function prototype">; def err_illegal_decl_pointer_to_reference : Error< @@ -2031,7 +2340,16 @@ def note_precedence_bitwise_silence : Note< def warn_logical_instead_of_bitwise : Warning< "use of logical %0 with constant operand; switch to bitwise %1 or " "remove constant">, InGroup<DiagGroup<"constant-logical-operand">>; - + +def warn_logical_and_in_logical_or : Warning< + "'&&' within '||'">, InGroup<LogicalOpParentheses>; +def note_logical_and_in_logical_or_silence : Note< + "place parentheses around the '&&' expression to silence this warning">; + +def warn_self_assignment : Warning< + "explicitly assigning a variable of type %0 to itself">, + InGroup<SelfAssignment>, DefaultIgnore; + def err_sizeof_nonfragile_interface : Error< "invalid application of '%select{alignof|sizeof}1' to interface %0 in " "non-fragile ABI">; @@ -2069,6 +2387,11 @@ def err_typecheck_member_reference_type : Error< 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 an overloaded function; perhaps you meant " + "to call %select{it|the 0-argument overload}0?">; +def note_member_ref_possible_intended_overload : Note< + "possibly valid overload here">; +def err_member_reference_needs_call_zero_arg : Error< "base of member reference has function type %0; perhaps you meant to call " "this function with '()'?">; def warn_subscript_is_char : Warning<"array subscript is of type 'char'">, @@ -2078,12 +2401,17 @@ def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">; def err_no_member : Error<"no member named %0 in %1">; 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< "out-of-line definition of %0 from class %1 without definition">; 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_ret_type : Error< + "out-of-line definition of %q0 differ 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< @@ -2091,6 +2419,10 @@ def err_qualified_param_declarator : Error< def ext_out_of_line_declaration : ExtWarn< "out-of-line declaration of a member must be a definition">, InGroup<OutOfLineDeclaration>, DefaultError; +def warn_member_extra_qualification : Warning< + "extra qualification on member %0">; +def err_member_qualification : Error< + "non-friend class member %0 cannot have a qualified name">; def note_member_def_close_match : Note<"member declaration nearly matches">; def err_typecheck_ivar_variable_size : Error< "instance variables must have a constant size">; @@ -2121,7 +2453,7 @@ def err_array_init_not_init_list : Error< "array initializer must be an initializer " "list%select{| or string literal}0">; def warn_deprecated_string_literal_conversion : Warning< - "conversion from string literal to %0 is deprecated">, InGroup<Deprecated>; + "conversion from string literal to %0 is deprecated">, InGroup<DeprecatedWritableStr>; def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">; def err_typecheck_sclass_fscope : Error< "illegal storage class on file-scoped variable">; @@ -2151,7 +2483,7 @@ def err_typecheck_unary_expr : Error< def err_typecheck_indirection_requires_pointer : Error< "indirection requires pointer operand (%0 invalid)">; def warn_indirection_through_null : Warning< - "indirection of non-volatile null pointer will be deleted, not trap">; + "indirection of non-volatile null pointer will be deleted, not trap">, InGroup<NullDereference>; def note_indirection_through_null : Note< "consider using __builtin_trap() or qualifying pointer with 'volatile'">; @@ -2200,11 +2532,14 @@ def warn_mixed_sign_conditional : Warning< "operands of ? are integers of different signs: %0 and %1">, InGroup<SignCompare>, DefaultIgnore; def warn_lunsigned_always_true_comparison : Warning< - "comparison of unsigned expression %0 is always %1">, - InGroup<SignCompare>, DefaultIgnore; + "comparison of unsigned%select{| enum}2 expression %0 is always %1">, + InGroup<TautologicalCompare>; def warn_runsigned_always_true_comparison : Warning< - "comparison of %0 unsigned expression is always %1">, - InGroup<SignCompare>, DefaultIgnore; + "comparison of %0 unsigned%select{| enum}2 expression is always %1">, + InGroup<TautologicalCompare>; +def warn_comparison_of_mixed_enum_types : Warning< + "comparison of two values with different enumeration types (%0 and %1)">, + InGroup<DiagGroup<"enum-compare">>; def err_invalid_this_use : Error< "invalid use of 'this' outside of a nonstatic member function">; @@ -2212,11 +2547,26 @@ 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'">; + +def err_ref_qualifier_overload : Error< + "cannot overload a member function %select{without a ref-qualifier|with " + "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{" + "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">; @@ -2244,6 +2594,15 @@ def err_ref_array_type : Error< "cannot refer to declaration with an array type inside block">; def err_property_not_found : Error< "property %0 not found on object of type %1">; +def err_getter_not_found : Error< + "expected getter method not found on object of type %0">; +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">; def err_duplicate_property : Error< "property has a previous declaration">; def ext_gnu_void_ptr : Extension< @@ -2265,6 +2624,8 @@ def error_no_subobject_property_setting : Error< def ext_freestanding_complex : Extension< "complex numbers are an extension in a freestanding C99 implementation">; +// FIXME: Remove when we support imaginary. +def err_imaginary_not_supported : Error<"imaginary types are not supported">; // Obj-c expressions def warn_root_inst_method_not_found : Warning< @@ -2275,14 +2636,16 @@ def warn_inst_method_not_found : Warning< "method %objcinstance0 not found (return type defaults to 'id')">; def error_no_super_class_message : Error< "no @interface declaration found in class messaging of %0">; -def error_no_super_class : Error< - "no super class declared in @interface for %0">; +def error_root_class_cannot_use_super : Error< + "%0 cannot use 'super' because it is a root class">; def err_invalid_receiver_to_message : Error< "invalid receiver to message expression">; def err_invalid_receiver_to_message_super : Error< "'super' is only valid in a method body">; def err_invalid_receiver_class_message : Error< "receiver type %0 is not an Objective-C class">; +def err_missing_open_square_message_send : Error< + "missing '[' at start of message send expression">; def warn_bad_receiver_type : Warning< "receiver type %0 is not 'id' or interface pointer, consider " "casting it to 'id'">; @@ -2332,6 +2695,16 @@ def note_parameter_here : Note< // C++ casts // These messages adhere to the TryCast pattern: %0 is an int specifying the // cast type, %1 is the source type, %2 is the destination type. +def err_bad_reinterpret_cast_overload : Error< + "reinterpret_cast cannot resolve overloaded function %0 to type %1">; + +def err_bad_static_cast_overload : Error< + "address of overloaded function %0 cannot be static_cast to type %1">; + +def err_bad_cstyle_cast_overload : Error< + "address of overloaded function %0 cannot be cast to type %1">; + + def err_bad_cxx_cast_generic : Error< "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|" "functional-style cast}0 from %1 to %2 is not allowed">; @@ -2389,6 +2762,10 @@ def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">; // Other C++ expressions def err_need_header_before_typeid : Error< "you need to include <typeinfo> before using the 'typeid' operator">; +def err_need_header_before_ms_uuidof : Error< + "you need to include <guiddef.h> before using the '__uuidof' operator">; +def err_uuidof_without_guid : Error< + "cannot call operator __uuidof on a type with no GUID">; def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">; def err_static_illegal_in_new : Error< "the 'static' modifier for the array size is not legal in new expressions">; @@ -2420,7 +2797,8 @@ def err_array_size_ambiguous_conversion : Error< "enumeration type">; 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++0x extension">; + "%select{integral|enumeration}1 type %2 is a C++0x extension">, + InGroup<CXX0x>; def err_default_init_const : Error< "default initialization of an object of const type %0" @@ -2434,6 +2812,8 @@ def warn_delete_incomplete : Warning< "deleting pointer to incomplete type %0 may cause undefined behaviour">; def err_delete_incomplete_class_type : Warning< "deleting incomplete class type %0; no conversions to pointer type">; +def warn_delete_array_type : Warning< + "'delete' applied to a pointer-to-array type %0 treated as delete[]">; def err_no_suitable_delete_member_function_found : Error< "no suitable member %0 in %1">; def err_ambiguous_suitable_delete_member_function_found : Error< @@ -2462,6 +2842,18 @@ def err_bad_memptr_lhs : Error< def warn_exception_caught_by_earlier_handler : Warning< "exception of type %0 will be caught by earlier handler">; def note_previous_exception_handler : Note<"for type %0">; +def err_exceptions_disabled : Error< + "cannot use '%0' with exceptions disabled">; +def err_objc_exceptions_disabled : Error< + "cannot use '%0' with Objective-C exceptions disabled">; +def warn_non_virtual_dtor : Warning< + "%0 has virtual functions but non-virtual destructor">, + InGroup<NonVirtualDtor>, DefaultIgnore; +def warn_overloaded_virtual : Warning< + "%q0 hides overloaded virtual %select{function|functions}1">, + InGroup<OverloadedVirtual>, DefaultIgnore; +def note_hidden_overloaded_virtual_declared_here : Note< + "hidden overloaded virtual function %q0 declared here">; def err_conditional_void_nonvoid : Error< "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand " @@ -2527,6 +2919,8 @@ def err_not_tag_in_scope : Error< 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_invalid_use_of_bound_member_func : Error< + "a bound member function may only be called">; def err_incomplete_object_call : Error< "incomplete type in call to object of type %0">; def err_incomplete_pointer_to_member_return : Error< @@ -2541,9 +2935,21 @@ def warn_condition_is_idiomatic_assignment : Warning<"using the result " InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore; def note_condition_assign_to_comparison : Note< "use '==' to turn this assignment into an equality comparison">; +def note_condition_or_assign_to_comparison : Note< + "use '!=' to turn this compound assignment into an inequality comparison">; def note_condition_assign_silence : Note< "place parentheses around the assignment to silence this warning">; +def warn_equality_with_extra_parens : Warning<"equality comparison with " + "extraneous parentheses">, InGroup<Parentheses>; +def note_equality_comparison_to_assign : Note< + "use '=' to turn this equality comparison into an assignment">; +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 warn_ivar_variable_conflict : Warning< "when default property synthesis is on, " "%0 lookup will access property ivar instead of global variable">, @@ -2629,7 +3035,15 @@ def err_typecheck_convert_incompatible_block_pointer : Error< " %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">; - +def err_typecheck_incompatible_address_space : Error< + "%select{assigning %1 to %0" + "|passing %0 to parameter of type %1" + "|returning %0 from a function with result type %1" + "|converting %0 to type %1" + "|initializing %0 with an expression of type %1" + "|sending %0 to parameter of type %1" + "|casting %0 to type %1}2" + " changes address space of pointer">; def err_typecheck_convert_ambiguous : Error< "ambiguity in initializing value of type %0 with initializer of type %1">; def err_cannot_initialize_decl_noname : Error< @@ -2688,9 +3102,14 @@ def err_atomic_builtin_pointer_size : Error< "first argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte " "type (%0 invalid)">; - def err_deleted_function_use : Error<"attempt to use a deleted function">; +def err_kern_type_not_void_return : Error< + "kernel function type %0 must have void return type">; +def err_config_scalar_return : Error< + "CUDA special function 'cudaConfigureCall' must have scalar return type">; + + def err_cannot_pass_objc_interface_to_vararg : Error< "cannot pass object with interface type %0 by-value through variadic " "%select{function|block|method}1">; @@ -2709,6 +3128,8 @@ def err_typecheck_cond_expect_scalar : Error< "used type %0 where arithmetic or pointer type is required">; def ext_typecheck_cond_one_void : Extension< "C99 forbids conditional expressions with only one void side">; +def err_typecheck_cond_expect_scalar_or_vector : Error< + "used type %0 where arithmetic, pointer, or vector type is required">; def err_typecheck_cast_to_incomplete : Error< "cast to incomplete type %0">; def ext_typecheck_cast_nonscalar : Extension< @@ -2754,6 +3175,8 @@ def err_incomplete_type_used_in_type_trait_expr : Error< "incomplete type %0 used in type trait expression">; def err_expected_ident_or_lparen : Error<"expected identifier or '('">; +def err_typecheck_cond_incompatible_operands_null : Error< + "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">; } // End of general sema category. // inline asm. @@ -2771,6 +3194,8 @@ let CategoryName = "Inline Assembly Issue" in { def err_asm_tying_incompatible_types : Error< "unsupported inline asm: input with type %0 matching output with type %1">; def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">; + def warn_asm_label_on_auto_decl : Warning< + "ignored asm label '%0' on automatic variable">; def err_invalid_asm_cast_lvalue : Error< "invalid use of a cast in a inline asm context requiring an l-value: " "remove the cast or build with -fheinous-gnu-extensions">; @@ -2824,10 +3249,15 @@ def err_base_init_direct_and_virtual : Error< def err_not_direct_base_or_virtual : Error< "type %0 is not a direct or virtual base of %1">; -def err_in_class_initializer_non_integral_type : Error< - "in-class initializer has non-integral, non-enumeration type %0">; +def err_in_class_initializer_non_const : Error< + "non-const static data member must be initialized out of line">; +def err_in_class_initializer_bad_type : Error< + "static data member of type %0 must be initialized out of line">; +def ext_in_class_initializer_float_type : ExtWarn< + "in-class initializer for static data member of type %0 " + "is a C++0x extension">, InGroup<CXX0x>; def err_in_class_initializer_non_constant : Error< - "in-class initializer is not an integral constant expression">; + "in-class initializer is not a constant expression">; // C++ anonymous unions and GNU anonymous structs/unions def ext_anonymous_union : Extension< @@ -2847,6 +3277,9 @@ def err_anonymous_struct_member_redecl : Error< "member of anonymous struct redeclares %0">; def err_anonymous_record_with_type : Error< "types cannot be declared in an anonymous %select{struct|union}0">; +def ext_anonymous_record_with_type : Extension< + "types declared in an anonymous %select{struct|union}0 are a Microsoft " + "extension">, InGroup<Microsoft>; def err_anonymous_record_with_function : Error< "functions cannot be declared in an anonymous %select{struct|union}0">; def err_anonymous_record_with_static : Error< @@ -2856,6 +3289,8 @@ def err_anonymous_record_bad_member : Error< def err_anonymous_record_nonpublic_member : Error< "anonymous %select{struct|union}0 cannot contain a " "%select{private|protected}1 data member">; +def ext_ms_anonymous_struct : ExtWarn< + "anonymous structs are a Microsoft extension">, InGroup<Microsoft>; // C++ local classes def err_reference_to_local_var_in_enclosing_function : Error< @@ -2885,7 +3320,7 @@ def err_memptr_conv_via_virtual : Error< // C++ access control def err_conv_to_inaccessible_base : Error< - "conversion from %0 to inaccessible base class %1">, NoSFINAE; + "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< @@ -2986,7 +3421,16 @@ def warn_not_compound_assign : Warning< // C++0x explicit conversion operators def warn_explicit_conversion_functions : Warning< - "explicit conversion functions are a C++0x extension">; + "explicit conversion functions are a C++0x extension">, InGroup<CXX0x>; + +def warn_array_index_precedes_bounds : Warning< + "array index of '%0' indexes 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 elements)">, + InGroup<DiagGroup<"array-bounds">>; +def note_array_index_out_of_bounds : Note< + "array %0 declared here">; def warn_printf_write_back : Warning< "use of '%%n' in format string discouraged (potentially insecure)">, @@ -3054,10 +3498,16 @@ def warn_ret_stack_addr : Warning< "address of stack memory associated with local variable %0 returned">; def warn_ret_stack_ref : Warning< "reference to stack memory associated with local variable %0 returned">; +def warn_ret_local_temp_addr : Warning< + "returning address of local temporary object">; +def warn_ret_local_temp_ref : Warning< + "returning reference to local temporary object">; def warn_ret_addr_label : Warning< "returning address of label, which is local">; def err_ret_local_block : Error< "returning block that lives on the local stack">; +def note_ref_var_local_bind : Note< + "binding reference variable %0 here">; // For non-floating point, expressions of the form x == x or x != x @@ -3065,7 +3515,7 @@ def err_ret_local_block : Error< // Array comparisons have similar warnings def warn_comparison_always : Warning< "%select{self-|array }0comparison always evaluates to %select{false|true|a constant}1">, - InGroup<DiagGroup<"tautological-compare">>; + InGroup<TautologicalCompare>; def warn_stringcompare : Warning< "result of comparison against %select{a string literal|@encode}0 is " @@ -3079,8 +3529,8 @@ def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks" 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_returns_array : Error< - "block declared as returning an array">; +def err_block_returning_array_function : Error< + "block cannot return %select{array|function}0 type %1">; // CFString checking @@ -3088,6 +3538,9 @@ def err_cfstring_literal_not_string_constant : Error< "CFString literal is not a string constant">; def warn_cfstring_literal_contains_nul_character : Warning< "CFString literal contains NUL character">; +def warn_cfstring_truncated : Warning< + "input conversion stopped due to an input byte that does not " + "belong to the input codeset UTF-8">; // Statements. def err_continue_not_in_loop : Error< @@ -3106,8 +3559,18 @@ 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_missing_cases : Warning<"enumeration value %0 not handled in switch">, +def warn_missing_case1 : Warning<"enumeration value %0 not handled in switch">, + InGroup<DiagGroup<"switch-enum"> >; +def warn_missing_case2 : Warning< + "enumeration values %0 and %1 not handled in switch">, + InGroup<DiagGroup<"switch-enum"> >; +def warn_missing_case3 : Warning< + "enumeration values %0, %1, and %2 not handled in switch">, InGroup<DiagGroup<"switch-enum"> >; +def warn_missing_cases : Warning< + "%0 enumeration values not handled in switch: %1, %2, %3...">, + InGroup<DiagGroup<"switch-enum"> >; + def warn_not_in_enum : Warning<"case value not in enumerated type %0">, InGroup<DiagGroup<"switch-enum"> >; def err_typecheck_statement_requires_scalar : Error< @@ -3225,6 +3688,8 @@ def ext_c99_array_usage : Extension< "use of C99-specific array features, accepted as an extension">; def err_c99_array_usage_cxx : Error< "C99-specific array features are not permitted in C++">; +def err_double_requires_fp64 : Error< + "use of type 'double' requires cl_khr_fp64 extension to be enabled">; def note_getter_unavailable : Note< "or because setter is declared here, but no getter method %0 is found">; @@ -3235,9 +3700,9 @@ def warn_ivar_use_hidden : Warning< def error_ivar_use_in_class_method : Error< "instance variable %0 accessed in class method">; def error_private_ivar_access : Error<"instance variable %0 is private">, - NoSFINAE; + AccessControl; def error_protected_ivar_access : Error<"instance variable %0 is protected">, - NoSFINAE; + 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">; @@ -3284,6 +3749,9 @@ def err_using_directive_suggest : Error< def err_using_directive_member_suggest : Error< "no namespace named %0 in %1; did you mean %2?">; def note_namespace_defined_here : Note<"namespace %0 defined here">; +def err_sizeof_pack_no_pack_name_suggest : Error< + "%0 does not refer to the name of a parameter pack; did you mean %1?">; +def note_parameter_pack_here : Note<"parameter pack %0 declared here">; } // end of sema category } // end of sema component. diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h index e71f51a..563157f 100644 --- a/include/clang/Basic/FileManager.h +++ b/include/clang/Basic/FileManager.h @@ -14,6 +14,7 @@ #ifndef LLVM_CLANG_FILEMANAGER_H #define LLVM_CLANG_FILEMANAGER_H +#include "clang/Basic/FileSystemOptions.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" @@ -22,12 +23,20 @@ #include "llvm/Config/config.h" // for mode_t // FIXME: Enhance libsystem to support inode and other fields in stat. #include <sys/types.h> -#include <sys/stat.h> + +struct stat; + +namespace llvm { +class MemoryBuffer; +namespace sys { class Path; } +} namespace clang { class FileManager; - -/// DirectoryEntry - Cached information about one directory on the disk. +class FileSystemStatCache; + +/// DirectoryEntry - Cached information about one directory (either on +/// the disk or in the virtual file system). /// class DirectoryEntry { const char *Name; // Name of the directory. @@ -37,7 +46,9 @@ public: const char *getName() const { return Name; } }; -/// FileEntry - Cached information about one file on the disk. +/// FileEntry - Cached information about one file (either on the disk +/// or in the virtual file system). If the 'FD' member is valid, then +/// this FileEntry has an open file descriptor for the file. /// class FileEntry { const char *Name; // Name of the file. @@ -48,12 +59,29 @@ 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) {} + : Name(0), Device(device), Inode(inode), FileMode(m), FD(-1) {} // Add a default constructor for use with llvm::StringMap - FileEntry() : Name(0), Device(0), Inode(0), FileMode(0) {} + FileEntry() : Name(0), Device(0), Inode(0), FileMode(0), FD(-1) {} + + FileEntry(const FileEntry &FE) { + 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"); + } + + ~FileEntry(); const char *getName() const { return Name; } off_t getSize() const { return Size; } @@ -67,111 +95,68 @@ public: /// const DirectoryEntry *getDir() const { return Dir; } - bool operator<(const FileEntry& RHS) const { + bool operator<(const FileEntry &RHS) const { return Device < RHS.Device || (Device == RHS.Device && Inode < RHS.Inode); } }; -/// \brief Abstract interface for introducing a FileManager cache for 'stat' -/// system calls, which is used by precompiled and pretokenized headers to -/// improve performance. -class StatSysCallCache { -protected: - llvm::OwningPtr<StatSysCallCache> NextStatCache; - -public: - virtual ~StatSysCallCache() {} - virtual int stat(const char *path, struct stat *buf) { - if (getNextStatCache()) - return getNextStatCache()->stat(path, buf); - - return ::stat(path, buf); - } - - /// \brief Sets the next stat call cache in the chain of stat caches. - /// Takes ownership of the given stat cache. - void setNextStatCache(StatSysCallCache *Cache) { - NextStatCache.reset(Cache); - } - - /// \brief Retrieve the next stat call cache in the chain. - StatSysCallCache *getNextStatCache() { return NextStatCache.get(); } - - /// \brief Retrieve the next stat call cache in the chain, transferring - /// ownership of this cache (and, transitively, all of the remaining caches) - /// to the caller. - StatSysCallCache *takeNextStatCache() { return NextStatCache.take(); } -}; - -/// \brief A stat "cache" that can be used by FileManager to keep -/// track of the results of stat() calls that occur throughout the -/// execution of the front end. -class MemorizeStatCalls : public StatSysCallCache { -public: - /// \brief The result of a stat() call. - /// - /// The first member is the result of calling stat(). If stat() - /// found something, the second member is a copy of the stat - /// structure. - typedef std::pair<int, struct stat> StatResult; - - /// \brief The set of stat() calls that have been - llvm::StringMap<StatResult, llvm::BumpPtrAllocator> StatCalls; - - typedef llvm::StringMap<StatResult, llvm::BumpPtrAllocator>::const_iterator - iterator; - - iterator begin() const { return StatCalls.begin(); } - iterator end() const { return StatCalls.end(); } - - virtual int stat(const char *path, struct stat *buf); -}; - /// FileManager - Implements support for file system lookup, file system /// caching, and directory search management. This also handles more advanced /// 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 { + FileSystemOptions FileSystemOpts; class UniqueDirContainer; class UniqueFileContainer; - /// UniqueDirs/UniqueFiles - Cache for existing directories/files. + /// UniqueRealDirs/UniqueRealFiles - Cache for existing real directories/files. /// - UniqueDirContainer &UniqueDirs; - UniqueFileContainer &UniqueFiles; + UniqueDirContainer &UniqueRealDirs; + UniqueFileContainer &UniqueRealFiles; - /// DirEntries/FileEntries - This is a cache of directory/file entries we have - /// looked up. The actual Entry is owned by UniqueFiles/UniqueDirs above. + /// \brief The virtual directories that we have allocated. For each + /// virtual file (e.g. foo/bar/baz.cpp), we add all of its parent + /// directories (foo/ and foo/bar/) here. + llvm::SmallVector<DirectoryEntry*, 4> VirtualDirectoryEntries; + /// \brief The virtual files that we have allocated. + llvm::SmallVector<FileEntry*, 4> VirtualFileEntries; + + /// SeenDirEntries/SeenFileEntries - This is a cache that maps paths + /// to directory/file entries (either real or virtual) we have + /// looked up. The actual Entries for real directories/files are + /// owned by UniqueRealDirs/UniqueRealFiles above, while the Entries + /// for virtual directories/files are owned by + /// VirtualDirectoryEntries/VirtualFileEntries above. /// - llvm::StringMap<DirectoryEntry*, llvm::BumpPtrAllocator> DirEntries; - llvm::StringMap<FileEntry*, llvm::BumpPtrAllocator> FileEntries; + llvm::StringMap<DirectoryEntry*, llvm::BumpPtrAllocator> SeenDirEntries; + llvm::StringMap<FileEntry*, llvm::BumpPtrAllocator> SeenFileEntries; /// NextFileUID - Each FileEntry we create is assigned a unique ID #. /// unsigned NextFileUID; - /// \brief The virtual files that we have allocated. - llvm::SmallVector<FileEntry *, 4> VirtualFileEntries; - // Statistics. unsigned NumDirLookups, NumFileLookups; unsigned NumDirCacheMisses, NumFileCacheMisses; // Caching. - llvm::OwningPtr<StatSysCallCache> StatCache; + llvm::OwningPtr<FileSystemStatCache> StatCache; - int stat_cached(const char* path, struct stat* buf) { - return StatCache.get() ? StatCache->stat(path, buf) : stat(path, buf); - } + bool getStatValue(const char *Path, struct stat &StatBuf, + int *FileDescriptor); + + /// Add all ancestors of the given path (pointing to either a file + /// or a directory) as virtual directories. + void addAncestorsAsVirtualDirs(llvm::StringRef Path); public: - FileManager(); + FileManager(const FileSystemOptions &FileSystemOpts); ~FileManager(); - /// \brief Installs the provided StatSysCallCache object within - /// the FileManager. + /// \brief Installs the provided FileSystemStatCache object within + /// the FileManager. /// /// Ownership of this object is transferred to the FileManager. /// @@ -181,33 +166,46 @@ public: /// \param AtBeginning whether this new stat cache must be installed at the /// beginning of the chain of stat caches. Otherwise, it will be added to /// the end of the chain. - void addStatCache(StatSysCallCache *statCache, bool AtBeginning = false); + void addStatCache(FileSystemStatCache *statCache, bool AtBeginning = false); - /// \brief Removes the provided StatSysCallCache object from the file manager. - void removeStatCache(StatSysCallCache *statCache); - - /// getDirectory - Lookup, cache, and verify the specified directory. This - /// returns null if the directory doesn't exist. + /// \brief Removes the specified FileSystemStatCache object from the manager. + void removeStatCache(FileSystemStatCache *statCache); + + /// getDirectory - Lookup, cache, and verify the specified directory + /// (real or virtual). This returns NULL if the directory doesn't exist. /// - const DirectoryEntry *getDirectory(llvm::StringRef Filename) { - return getDirectory(Filename.begin(), Filename.end()); - } - const DirectoryEntry *getDirectory(const char *FileStart,const char *FileEnd); + const DirectoryEntry *getDirectory(llvm::StringRef DirName); - /// getFile - Lookup, cache, and verify the specified file. This returns null - /// if the file doesn't exist. + /// getFile - Lookup, cache, and verify the specified file (real or + /// virtual). This returns NULL if the file doesn't exist. /// - const FileEntry *getFile(llvm::StringRef Filename) { - return getFile(Filename.begin(), Filename.end()); - } - const FileEntry *getFile(const char *FilenameStart, - const char *FilenameEnd); + const FileEntry *getFile(llvm::StringRef Filename); /// \brief Retrieve a file entry for a "virtual" file that acts as /// if there were a file with the given name on disk. The file /// itself is not accessed. const FileEntry *getVirtualFile(llvm::StringRef Filename, off_t Size, time_t ModificationTime); + + /// \brief Open the specified file as a MemoryBuffer, returning a new + /// MemoryBuffer if successful, otherwise returning null. + llvm::MemoryBuffer *getBufferForFile(const FileEntry *Entry, + std::string *ErrorStr = 0); + llvm::MemoryBuffer *getBufferForFile(llvm::StringRef Filename, + std::string *ErrorStr = 0); + + /// \brief If path is not absolute and FileSystemOptions set the working + /// directory, the path is modified to be relative to the given + /// working directory. + static void FixupRelativePath(llvm::sys::Path &path, + const FileSystemOptions &FSOpts); + + + /// \brief Produce an array mapping from the unique IDs assigned to each + /// file to the corresponding FileEntry pointer. + void GetUniqueIDMapping( + llvm::SmallVectorImpl<const FileEntry *> &UIDToFiles) const; + void PrintStats() const; }; diff --git a/include/clang/Basic/FileSystemOptions.h b/include/clang/Basic/FileSystemOptions.h new file mode 100644 index 0000000..81e928d --- /dev/null +++ b/include/clang/Basic/FileSystemOptions.h @@ -0,0 +1,31 @@ +//===--- FileSystemOptions.h - File System Options --------------*- 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 FileSystemOptions interface. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_BASIC_FILESYSTEMOPTIONS_H +#define LLVM_CLANG_BASIC_FILESYSTEMOPTIONS_H + +#include <string> + +namespace clang { + +/// \brief Keeps track of options that affect how file operations are performed. +class FileSystemOptions { +public: + /// \brief If set, paths are resolved as if the working directory was + /// set to the value of WorkingDir. + std::string WorkingDir; +}; + +} // end namespace clang + +#endif diff --git a/include/clang/Basic/FileSystemStatCache.h b/include/clang/Basic/FileSystemStatCache.h new file mode 100644 index 0000000..77828b3 --- /dev/null +++ b/include/clang/Basic/FileSystemStatCache.h @@ -0,0 +1,101 @@ +//===--- FileSystemStatCache.h - Caching for 'stat' calls -------*- 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 FileSystemStatCache interface. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_FILESYSTEMSTATCACHE_H +#define LLVM_CLANG_FILESYSTEMSTATCACHE_H + +#include "llvm/ADT/OwningPtr.h" +#include "llvm/ADT/StringMap.h" +#include <sys/types.h> +#include <sys/stat.h> + +namespace clang { + +/// \brief Abstract interface for introducing a FileManager cache for 'stat' +/// system calls, which is used by precompiled and pretokenized headers to +/// improve performance. +class FileSystemStatCache { +protected: + llvm::OwningPtr<FileSystemStatCache> NextStatCache; + +public: + virtual ~FileSystemStatCache() {} + + enum LookupResult { + CacheExists, //< We know the file exists and its cached stat data. + CacheMissing //< We know that the file doesn't exist. + }; + + /// FileSystemStatCache::get - Get the 'stat' information for the specified + /// path, using the cache to accellerate it if possible. This returns true if + /// the path does not exist or false if it exists. + /// + /// If FileDescriptor is non-null, then this lookup should only return success + /// for files (not directories). If it is null this lookup should only return + /// success for directories (not files). On a successful file lookup, the + /// implementation can optionally fill in FileDescriptor with a valid + /// descriptor and the client guarantees that it will close it. + static bool get(const char *Path, struct stat &StatBuf, int *FileDescriptor, + FileSystemStatCache *Cache); + + + /// \brief Sets the next stat call cache in the chain of stat caches. + /// Takes ownership of the given stat cache. + void setNextStatCache(FileSystemStatCache *Cache) { + NextStatCache.reset(Cache); + } + + /// \brief Retrieve the next stat call cache in the chain. + FileSystemStatCache *getNextStatCache() { return NextStatCache.get(); } + + /// \brief Retrieve the next stat call cache in the chain, transferring + /// ownership of this cache (and, transitively, all of the remaining caches) + /// to the caller. + FileSystemStatCache *takeNextStatCache() { return NextStatCache.take(); } + +protected: + virtual LookupResult getStat(const char *Path, struct stat &StatBuf, + int *FileDescriptor) = 0; + + LookupResult statChained(const char *Path, struct stat &StatBuf, + int *FileDescriptor) { + if (FileSystemStatCache *Next = getNextStatCache()) + return Next->getStat(Path, StatBuf, FileDescriptor); + + // If we hit the end of the list of stat caches to try, just compute and + // return it without a cache. + return get(Path, StatBuf, FileDescriptor, 0) ? CacheMissing : CacheExists; + } +}; + +/// \brief A stat "cache" that can be used by FileManager to keep +/// track of the results of stat() calls that occur throughout the +/// execution of the front end. +class MemorizeStatCalls : public FileSystemStatCache { +public: + /// \brief The set of stat() calls that have been seen. + llvm::StringMap<struct stat, llvm::BumpPtrAllocator> StatCalls; + + typedef llvm::StringMap<struct stat, llvm::BumpPtrAllocator>::const_iterator + iterator; + + iterator begin() const { return StatCalls.begin(); } + iterator end() const { return StatCalls.end(); } + + virtual LookupResult getStat(const char *Path, struct stat &StatBuf, + int *FileDescriptor); +}; + +} // end namespace clang + +#endif diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index 24fe086..d576643 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -22,8 +22,9 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/Support/PointerLikeTypeTraits.h" -#include <string> #include <cassert> +#include <cctype> +#include <string> namespace llvm { template <typename T> struct DenseMapInfo; @@ -53,7 +54,7 @@ class IdentifierInfo { // Objective-C keyword ('protocol' in '@protocol') or builtin (__builtin_inf). // First NUM_OBJC_KEYWORDS values are for Objective-C, the remaining values // are for builtins. - unsigned ObjCOrBuiltinID :10; + unsigned ObjCOrBuiltinID :11; bool HasMacro : 1; // True if there is a #define for this. bool IsExtension : 1; // True if identifier is a lang extension. bool IsPoisoned : 1; // True if identifier is poisoned. @@ -63,7 +64,7 @@ class IdentifierInfo { // file and wasn't modified since. bool RevertedTokenID : 1; // True if RevertTokenIDToIdentifier was // called. - // 7 bits left in 32-bit word. + // 6 bits left in 32-bit word. void *FETokenInfo; // Managed by the language front-end. llvm::StringMapEntry<IdentifierInfo*> *Entry; @@ -71,7 +72,7 @@ class IdentifierInfo { void operator=(const IdentifierInfo&); // NONASSIGNABLE. friend class IdentifierTable; - + public: IdentifierInfo(); @@ -254,6 +255,35 @@ private: } }; +/// \brief An iterator that walks over all of the known identifiers +/// in the lookup table. +/// +/// Since this iterator uses an abstract interface via virtual +/// functions, it uses an object-oriented interface rather than the +/// more standard C++ STL iterator interface. In this OO-style +/// iteration, the single function \c Next() provides dereference, +/// advance, and end-of-sequence checking in a single +/// operation. Subclasses of this iterator type will provide the +/// actual functionality. +class IdentifierIterator { +private: + IdentifierIterator(const IdentifierIterator&); // Do not implement + IdentifierIterator &operator=(const IdentifierIterator&); // Do not implement + +protected: + IdentifierIterator() { } + +public: + virtual ~IdentifierIterator(); + + /// \brief Retrieve the next string in the identifier table and + /// advances the iterator for the following string. + /// + /// \returns The next string in the identifier table. If there is + /// no such string, returns an empty \c llvm::StringRef. + virtual llvm::StringRef Next() = 0; +}; + /// IdentifierInfoLookup - An abstract class used by IdentifierTable that /// provides an interface for performing lookups from strings /// (const char *) to IdentiferInfo objects. @@ -266,6 +296,18 @@ public: /// of a reference. If the pointer is NULL then the IdentifierInfo cannot /// be found. virtual IdentifierInfo* get(llvm::StringRef Name) = 0; + + /// \brief Retrieve an iterator into the set of all identifiers + /// known to this identifier lookup source. + /// + /// This routine provides access to all of the identifiers known to + /// the identifier lookup, allowing access to the contents of the + /// identifiers without introducing the overhead of constructing + /// IdentifierInfo objects for each. + /// + /// \returns A new iterator into the set of known identifiers. The + /// caller is responsible for deleting this iterator. + virtual IdentifierIterator *getIdentifiers() const; }; /// \brief An abstract class used to resolve numerical identifier @@ -304,6 +346,11 @@ public: ExternalLookup = IILookup; } + /// \brief Retrieve the external identifier lookup object, if any. + IdentifierInfoLookup *getExternalIdentifierLookup() const { + return ExternalLookup; + } + llvm::BumpPtrAllocator& getAllocator() { return HashTable.getAllocator(); } @@ -463,8 +510,33 @@ public: return getIdentifierInfoFlag() == ZeroArg; } unsigned getNumArgs() const; + + + /// \brief Retrieve the identifier at a given position in the selector. + /// + /// Note that the identifier pointer returned may be NULL. Clients that only + /// care about the text of the identifier string, and not the specific, + /// uniqued identifier pointer, should use \c getNameForSlot(), which returns + /// an empty string when the identifier pointer would be NULL. + /// + /// \param argIndex The index for which we want to retrieve the identifier. + /// This index shall be less than \c getNumArgs() unless this is a keyword + /// selector, in which case 0 is the only permissible value. + /// + /// \returns the uniqued identifier for this slot, or NULL if this slot has + /// no corresponding identifier. IdentifierInfo *getIdentifierInfoForSlot(unsigned argIndex) const; - + + /// \brief Retrieve the name at a given position in the selector. + /// + /// \param argIndex The index for which we want to retrieve the name. + /// This index shall be less than \c getNumArgs() unless this is a keyword + /// selector, in which case 0 is the only permissible value. + /// + /// \returns the name for this slot, which may be the empty string if no + /// name was supplied. + llvm::StringRef getNameForSlot(unsigned argIndex) const; + /// getAsString - Derive the full selector name (e.g. "foo:bar:") and return /// it as an std::string. std::string getAsString() const; @@ -570,6 +642,17 @@ struct DenseMapInfo<clang::Selector> { template <> struct isPodLike<clang::Selector> { static const bool value = true; }; +template<> +class PointerLikeTypeTraits<clang::Selector> { +public: + static inline const void *getAsVoidPointer(clang::Selector P) { + return P.getAsOpaquePtr(); + } + static inline clang::Selector getFromVoidPointer(const void *P) { + return clang::Selector(reinterpret_cast<uintptr_t>(P)); + } + enum { NumLowBitsAvailable = 0 }; +}; // Provide PointerLikeTypeTraits for IdentifierInfo pointers, which // are not guaranteed to be 8-byte aligned. diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h index 5bd0d04..f4db55a 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -15,6 +15,7 @@ #define LLVM_CLANG_LANGOPTIONS_H #include <string> +#include "clang/Basic/Visibility.h" namespace clang { @@ -43,6 +44,8 @@ public: unsigned ObjC2 : 1; // Objective-C 2 support enabled. unsigned ObjCNonFragileABI : 1; // Objective-C modern abi enabled unsigned ObjCNonFragileABI2 : 1; // Objective-C enhanced modern abi enabled + unsigned ObjCDefaultSynthProperties : 1; // Objective-C auto-synthesized properties. + unsigned AppleKext : 1; // Allow apple kext features. unsigned PascalStrings : 1; // Allow Pascal strings unsigned WritableStrings : 1; // Allow writable strings @@ -51,8 +54,10 @@ public: unsigned AltiVec : 1; // Support AltiVec-style vector initializers. unsigned Exceptions : 1; // Support exception handling. unsigned SjLjExceptions : 1; // Use setjmp-longjump exception handling. + unsigned ObjCExceptions : 1; // Support Objective-C exceptions. unsigned RTTI : 1; // Support RTTI information. + unsigned MSBitfields : 1; // MS-compatible structure layout unsigned NeXTRuntime : 1; // Use NeXT runtime. unsigned Freestanding : 1; // Freestanding implementation unsigned NoBuiltin : 1; // Do not use builtin functions (-fno-builtin) @@ -89,8 +94,12 @@ public: unsigned CharIsSigned : 1; // Whether char is a signed or unsigned type unsigned ShortWChar : 1; // Force wchar_t to be unsigned short int. + unsigned ShortEnums : 1; // The enum type will be equivalent to the + // smallest integer type with enough room. + unsigned OpenCL : 1; // OpenCL C99 language extensions. - + unsigned CUDA : 1; // CUDA C++ language extensions. + unsigned AssumeSaneOperatorNew : 1; // Whether to add __attribute__((malloc)) // to the declaration of C++'s new // operators @@ -101,10 +110,16 @@ public: unsigned DumpVTableLayouts : 1; /// Dump the layouts of emitted vtables. unsigned NoConstantCFStrings : 1; // Do not do CF strings unsigned InlineVisibilityHidden : 1; // Whether inline C++ methods have - // hidden visibility by default. + // hidden visibility by default. unsigned SpellChecking : 1; // Whether to perform spell-checking for error // recovery. + unsigned SinglePrecisionConstants : 1; // Whether to treat double-precision + // floating point constants as + // single precision constants. + unsigned FastRelaxedMath : 1; // OpenCL fast relaxed math (on its own, + // defines __FAST_RELAXED_MATH__). + unsigned DefaultFPContract : 1; // Default setting for FP_CONTRACT // FIXME: This is just a temporary option, for testing purposes. unsigned NoBitFieldTypeAlign : 1; @@ -118,47 +133,56 @@ private: public: unsigned InstantiationDepth; // Maximum template instantiation depth. + unsigned NumLargeByValueCopy; // Warn if parameter/return value is larger + // in bytes than this setting. 0 is no check. + + // Version of Microsoft Visual C/C++ we are pretending to be. This is + // temporary until we support all MS extensions used in Windows SDK and stdlib + // headers. Sets _MSC_VER. + unsigned MSCVersion; std::string ObjCConstantStringClass; enum GCMode { NonGC, GCOnly, HybridGC }; enum StackProtectorMode { SSPOff, SSPOn, SSPReq }; - enum VisibilityMode { - Default, - Protected, - Hidden - }; - + enum SignedOverflowBehaviorTy { SOB_Undefined, // Default C standard behavior. SOB_Defined, // -fwrapv SOB_Trapping // -ftrapv }; + /// The name of the handler function to be called when -ftrapv is specified. + /// If none is specified, abort (GCC-compatible behaviour). + std::string OverflowHandler; LangOptions() { Trigraphs = BCPLComment = Bool = DollarIdents = AsmPreprocessor = 0; GNUMode = GNUKeywords = ImplicitInt = Digraphs = 0; HexFloats = 0; GC = ObjC1 = ObjC2 = ObjCNonFragileABI = ObjCNonFragileABI2 = 0; + AppleKext = 0; + ObjCDefaultSynthProperties = 0; NoConstantCFStrings = 0; InlineVisibilityHidden = 0; C99 = Microsoft = Borland = CPlusPlus = CPlusPlus0x = 0; CXXOperatorNames = PascalStrings = WritableStrings = ConstStrings = 0; Exceptions = SjLjExceptions = Freestanding = NoBuiltin = 0; + ObjCExceptions = 1; + MSBitfields = 0; NeXTRuntime = 1; RTTI = 1; LaxVectorConversions = 1; HeinousExtensions = 0; - AltiVec = OpenCL = StackProtector = 0; + AltiVec = OpenCL = CUDA = StackProtector = 0; + + SymbolVisibility = (unsigned) DefaultVisibility; - SymbolVisibility = (unsigned) Default; - ThreadsafeStatics = 1; POSIXThreads = 0; Blocks = 0; EmitAllDecls = 0; MathErrno = 1; SignedOverflowBehavior = SOB_Undefined; - + AssumeSaneOperatorNew = 1; AccessControl = 1; ElideConstructors = 1; @@ -168,6 +192,9 @@ public: InstantiationDepth = 1024; + NumLargeByValueCopy = 0; + MSCVersion = 0; + Optimize = 0; OptimizeSize = 0; @@ -179,10 +206,14 @@ public: CharIsSigned = 1; ShortWChar = 0; + ShortEnums = 0; CatchUndefined = 0; DumpRecordLayouts = 0; DumpVTableLayouts = 0; SpellChecking = 1; + SinglePrecisionConstants = 0; + FastRelaxedMath = 0; + DefaultFPContract = 0; NoBitFieldTypeAlign = 0; } @@ -196,17 +227,44 @@ public: StackProtector = static_cast<unsigned>(m); } - VisibilityMode getVisibilityMode() const { - return (VisibilityMode) SymbolVisibility; + Visibility getVisibilityMode() const { + return (Visibility) SymbolVisibility; } - void setVisibilityMode(VisibilityMode v) { SymbolVisibility = (unsigned) v; } - + void setVisibilityMode(Visibility v) { SymbolVisibility = (unsigned) v; } + SignedOverflowBehaviorTy getSignedOverflowBehavior() const { return (SignedOverflowBehaviorTy)SignedOverflowBehavior; } void setSignedOverflowBehavior(SignedOverflowBehaviorTy V) { SignedOverflowBehavior = (unsigned)V; } + + bool areExceptionsEnabled() const { + return Exceptions; + } +}; + +/// Floating point control options +class FPOptions { +public: + unsigned fp_contract : 1; + + FPOptions() : fp_contract(0) {} + + FPOptions(const LangOptions &LangOpts) : + fp_contract(LangOpts.DefaultFPContract) {} +}; + +/// OpenCL volatile options +class OpenCLOptions { +public: +#define OPENCLEXT(nm) unsigned nm : 1; +#include "clang/Basic/OpenCLExtensions.def" + + OpenCLOptions() { +#define OPENCLEXT(nm) nm = 0; +#include "clang/Basic/OpenCLExtensions.def" + } }; } // end namespace clang diff --git a/include/clang/Basic/OnDiskHashTable.h b/include/clang/Basic/OnDiskHashTable.h index 8909e47..267ecbc 100644 --- a/include/clang/Basic/OnDiskHashTable.h +++ b/include/clang/Basic/OnDiskHashTable.h @@ -15,10 +15,10 @@ #define LLVM_CLANG_BASIC_ON_DISK_HASH_TABLE_H #include "llvm/Support/Allocator.h" -#include "llvm/System/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/System/Host.h" +#include "llvm/Support/Host.h" #include <cassert> #include <cstdlib> @@ -320,7 +320,7 @@ public: InfoPtr->ReadKey((const unsigned char* const) Items, L.first); // If the key doesn't match just skip reading the value. - if (!Info::EqualKey(X, iKey)) { + if (!InfoPtr->EqualKey(X, iKey)) { Items += item_len; continue; } @@ -334,6 +334,70 @@ public: iterator end() const { return iterator(); } + /// \brief Iterates over all of the keys in the table. + class key_iterator { + const unsigned char* Ptr; + unsigned NumItemsInBucketLeft; + unsigned NumEntriesLeft; + Info *InfoObj; + public: + typedef external_key_type value_type; + + key_iterator(const unsigned char* const Ptr, unsigned NumEntries, + Info *InfoObj) + : Ptr(Ptr), NumItemsInBucketLeft(0), NumEntriesLeft(NumEntries), + InfoObj(InfoObj) { } + key_iterator() + : Ptr(0), NumItemsInBucketLeft(0), NumEntriesLeft(0), InfoObj(0) { } + + friend bool operator==(const key_iterator &X, const key_iterator &Y) { + return X.NumEntriesLeft == Y.NumEntriesLeft; + } + 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 + // number of items in this bucket. + NumItemsInBucketLeft = io::ReadUnalignedLE16(Ptr); + } + Ptr += 4; // Skip the hash. + // Determine the length of the key and the data. + const std::pair<unsigned, unsigned>& L = Info::ReadKeyDataLength(Ptr); + Ptr += L.first + L.second; + assert(NumItemsInBucketLeft); + --NumItemsInBucketLeft; + assert(NumEntriesLeft); + --NumEntriesLeft; + return *this; + } + key_iterator operator++(int) { // Postincrement + key_iterator tmp = *this; ++*this; return tmp; + } + + value_type operator*() const { + const unsigned char* LocalPtr = Ptr; + if (!NumItemsInBucketLeft) + LocalPtr += 2; // number of items in bucket + LocalPtr += 4; // Skip the hash. + + // Determine the length of the key and the data. + const std::pair<unsigned, unsigned>& L + = Info::ReadKeyDataLength(LocalPtr); + + // Read the key. + const internal_key_type& Key = InfoObj->ReadKey(LocalPtr, L.first); + return InfoObj->GetExternalKey(Key); + } + }; + + key_iterator key_begin() { + return key_iterator(Base + 4, getNumEntries(), &InfoObj); + } + key_iterator key_end() { return key_iterator(); } + /// \brief Iterates over all the entries in the table, returning /// a key/data pair. class item_iterator { diff --git a/include/clang/Basic/OpenCLExtensions.def b/include/clang/Basic/OpenCLExtensions.def new file mode 100644 index 0000000..95cc1a9 --- /dev/null +++ b/include/clang/Basic/OpenCLExtensions.def @@ -0,0 +1,28 @@ +//===--- OpenCLExtensions.def - OpenCL extension list -----------*- 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 list of supported OpenCL extensions. +// +//===----------------------------------------------------------------------===// + +OPENCLEXT(cl_khr_fp64) +OPENCLEXT(cl_khr_int64_base_atomics) +OPENCLEXT(cl_khr_int64_extended_atomics) +OPENCLEXT(cl_khr_fp16) +OPENCLEXT(cl_khr_gl_sharing) +OPENCLEXT(cl_khr_gl_event) +OPENCLEXT(cl_khr_d3d10_sharing) +OPENCLEXT(cl_khr_global_int32_base_atomics) +OPENCLEXT(cl_khr_global_int32_extended_atomics) +OPENCLEXT(cl_khr_local_int32_base_atomics) +OPENCLEXT(cl_khr_local_int32_extended_atomics) +OPENCLEXT(cl_khr_byte_addressable_store) +OPENCLEXT(cl_khr_3d_image_writes) + +#undef OPENCLEXT diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h index cd0da97..d00195b 100644 --- a/include/clang/Basic/PartialDiagnostic.h +++ b/include/clang/Basic/PartialDiagnostic.h @@ -18,7 +18,7 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/System/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include <cassert> namespace clang { @@ -57,6 +57,10 @@ public: /// 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]; @@ -186,6 +190,26 @@ public: *this->DiagStorage = *Other.DiagStorage; } + PartialDiagnostic(const DiagnosticInfo &Other, StorageAllocator &Allocator) + : DiagID(Other.getID()), DiagStorage(0), Allocator(&Allocator) + { + // Copy arguments. + for (unsigned I = 0, N = Other.getNumArgs(); I != N; ++I) { + if (Other.getArgKind(I) == Diagnostic::ak_std_string) + AddString(Other.getArgStdStr(I)); + 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) { @@ -216,13 +240,28 @@ public: DiagStorage->DiagArgumentsVal[DiagStorage->NumDiagArgs++] = V; } + void AddString(llvm::StringRef V) const { + if (!DiagStorage) + DiagStorage = getStorage(); + + assert(DiagStorage->NumDiagArgs < Storage::MaxArguments && + "Too many arguments to diagnostic!"); + DiagStorage->DiagArgumentsKind[DiagStorage->NumDiagArgs] + = Diagnostic::ak_std_string; + DiagStorage->DiagArgumentsStr[DiagStorage->NumDiagArgs++] = V; + } + void Emit(const DiagnosticBuilder &DB) const { if (!DiagStorage) return; // Add all arguments. for (unsigned i = 0, e = DiagStorage->NumDiagArgs; i != e; ++i) { - DB.AddTaggedVal(DiagStorage->DiagArgumentsVal[i], + if ((Diagnostic::ArgumentKind)DiagStorage->DiagArgumentsKind[i] + == Diagnostic::ak_std_string) + DB.AddString(DiagStorage->DiagArgumentsStr[i]); + else + DB.AddTaggedVal(DiagStorage->DiagArgumentsVal[i], (Diagnostic::ArgumentKind)DiagStorage->DiagArgumentsKind[i]); } @@ -230,7 +269,7 @@ public: for (unsigned i = 0, e = DiagStorage->NumDiagRanges; i != e; ++i) DB.AddSourceRange(DiagStorage->DiagRanges[i]); - // Add all code modification hints + // Add all fix-its. for (unsigned i = 0, e = DiagStorage->NumFixItHints; i != e; ++i) DB.AddFixItHint(DiagStorage->FixItHints[i]); } @@ -263,6 +302,13 @@ public: } friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, + llvm::StringRef S) { + + PD.AddString(S); + return PD; + } + + friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, const SourceRange &R) { PD.AddSourceRange(CharSourceRange::getTokenRange(R)); return PD; @@ -288,6 +334,9 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, return DB; } +/// \brief A partial diagnostic along with the source location where this +/// diagnostic occurs. +typedef std::pair<SourceLocation, PartialDiagnostic> PartialDiagnosticAt; } // end namespace clang #endif diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index 35f27fb..605c4bb 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -14,6 +14,7 @@ #ifndef LLVM_CLANG_SOURCELOCATION_H #define LLVM_CLANG_SOURCELOCATION_H +#include "llvm/Support/PointerLikeTypeTraits.h" #include <utility> #include <cassert> @@ -121,7 +122,6 @@ public: /// directly. unsigned getRawEncoding() const { return ID; } - /// getFromRawEncoding - Turn a raw encoding of a SourceLocation object into /// a real SourceLocation. static SourceLocation getFromRawEncoding(unsigned Encoding) { @@ -130,6 +130,22 @@ public: return X; } + /// getPtrEncoding - When a SourceLocation itself cannot be used, this returns + /// an (opaque) pointer encoding for it. This should only be passed + /// to SourceLocation::getFromPtrEncoding, it should not be inspected + /// directly. + void* getPtrEncoding() const { + // Double cast to avoid a warning "cast to pointer from integer of different + // size". + return (void*)(uintptr_t)getRawEncoding(); + } + + /// getFromPtrEncoding - Turn a pointer encoding of a SourceLocation object + /// into a real SourceLocation. + static SourceLocation getFromPtrEncoding(void *Encoding) { + return getFromRawEncoding((unsigned)(uintptr_t)Encoding); + } + void print(llvm::raw_ostream &OS, const SourceManager &SM) const; void dump(const SourceManager &SM) const; }; @@ -265,6 +281,20 @@ public: bool isInSystemHeader() const; + /// \brief Determines the order of 2 source locations in the translation unit. + /// + /// \returns true if this source location comes before 'Loc', false otherwise. + bool isBeforeInTranslationUnitThan(SourceLocation Loc) const; + + /// \brief Determines the order of 2 source locations in the translation unit. + /// + /// \returns true if this source location comes before 'Loc', false otherwise. + bool isBeforeInTranslationUnitThan(FullSourceLoc Loc) const { + assert(Loc.isValid()); + assert(SrcMgr == Loc.SrcMgr && "Loc comes from another SourceManager!"); + return isBeforeInTranslationUnitThan((SourceLocation)Loc); + } + /// Prints information about this FullSourceLoc to stderr. Useful for /// debugging. void dump() const { SourceLocation::dump(*SrcMgr); } @@ -350,6 +380,19 @@ namespace llvm { template <> struct isPodLike<clang::FileID> { static const bool value = true; }; + // Teach SmallPtrSet how to handle SourceLocation. + template<> + class PointerLikeTypeTraits<clang::SourceLocation> { + public: + static inline void *getAsVoidPointer(clang::SourceLocation L) { + return L.getPtrEncoding(); + } + static inline clang::SourceLocation getFromVoidPointer(void *P) { + return clang::SourceLocation::getFromRawEncoding((unsigned)(uintptr_t)P); + } + enum { NumLowBitsAvailable = 0 }; + }; + } // end namespace llvm #endif diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 7a66117..c0fbd08 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -16,7 +16,7 @@ #include "clang/Basic/SourceLocation.h" #include "llvm/Support/Allocator.h" -#include "llvm/System/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/PointerUnion.h" #include "llvm/ADT/DenseMap.h" @@ -369,7 +369,9 @@ public: class SourceManager { /// \brief Diagnostic object. Diagnostic &Diag; - + + FileManager &FileMgr; + mutable llvm::BumpPtrAllocator ContentCacheAlloc; /// FileInfos - Memoized information about all of the files tracked by this @@ -427,15 +429,15 @@ class SourceManager { explicit SourceManager(const SourceManager&); void operator=(const SourceManager&); public: - SourceManager(Diagnostic &Diag) - : Diag(Diag), ExternalSLocEntries(0), LineTable(0), NumLinearScans(0), - NumBinaryProbes(0) { - clearIDTables(); - } + SourceManager(Diagnostic &Diag, FileManager &FileMgr); ~SourceManager(); void clearIDTables(); + Diagnostic &getDiagnostics() const { return Diag; } + + FileManager &getFileManager() const { return FileMgr; } + //===--------------------------------------------------------------------===// // MainFileID creation and querying methods. //===--------------------------------------------------------------------===// @@ -450,6 +452,13 @@ public: return MainFileID; } + /// \brief Set the file ID for the precompiled preamble, which is also the + /// main file. + void SetPreambleFileID(FileID Preamble) { + assert(MainFileID.isInvalid() && "MainFileID already set!"); + MainFileID = Preamble; + } + //===--------------------------------------------------------------------===// // Methods to create new FileID's and instantiations. //===--------------------------------------------------------------------===// @@ -464,7 +473,7 @@ public: unsigned PreallocatedID = 0, unsigned Offset = 0) { const SrcMgr::ContentCache *IR = getOrCreateContentCache(SourceFile); - if (IR == 0) return FileID(); // Error opening file? + assert(IR && "getOrCreateContentCache() cannot return NULL"); return createFileID(IR, IncludePos, FileCharacter, PreallocatedID, Offset); } @@ -514,9 +523,7 @@ public: /// /// \param DoNotFree If true, then the buffer will not be freed when the /// source manager is destroyed. - /// - /// \returns true if an error occurred, false otherwise. - bool overrideFileContents(const FileEntry *SourceFile, + void overrideFileContents(const FileEntry *SourceFile, const llvm::MemoryBuffer *Buffer, bool DoNotFree = false); @@ -715,6 +722,11 @@ public: /// /// Note that a presumed location is always given as the instantiation point /// of an instantiation location, not at the spelling location. + /// + /// \returns The presumed location of the specified SourceLocation. If the + /// presumed location cannot be calculate (e.g., because \p Loc is invalid + /// or the file containing \p Loc has changed on disk), returns an invalid + /// presumed location. PresumedLoc getPresumedLoc(SourceLocation Loc) const; /// isFromSameFile - Returns true if both SourceLocations correspond to @@ -771,7 +783,7 @@ public: /// If the source file is included multiple times, the source location will /// be based upon the first inclusion. SourceLocation getLocation(const FileEntry *SourceFile, - unsigned Line, unsigned Col) const; + unsigned Line, unsigned Col); /// \brief Determines the order of 2 source locations in the translation unit. /// diff --git a/include/clang/Basic/Specifiers.h b/include/clang/Basic/Specifiers.h index e757a2f..e6b6218 100644 --- a/include/clang/Basic/Specifiers.h +++ b/include/clang/Basic/Specifiers.h @@ -95,6 +95,23 @@ namespace clang { VK_XValue }; + /// A further classification of the kind of object referenced by an + /// l-value or x-value. + enum ExprObjectKind { + /// An ordinary object is located at an address in memory. + OK_Ordinary, + + /// A bitfield object is a bitfield on a C or C++ record. + OK_BitField, + + /// A vector component is an element or range of elements on a vector. + OK_VectorComponent, + + /// 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 + }; + // \brief Describes the kind of template specialization that a // particular template specialization declaration represents. enum TemplateSpecializationKind { diff --git a/include/clang/Basic/StmtNodes.td b/include/clang/Basic/StmtNodes.td index 4aa055e..be0d8ff 100644 --- a/include/clang/Basic/StmtNodes.td +++ b/include/clang/Basic/StmtNodes.td @@ -23,7 +23,7 @@ def ContinueStmt : Stmt; def BreakStmt : Stmt; def ReturnStmt : Stmt; def DeclStmt : Stmt; -def SwitchCase : Stmt; +def SwitchCase : Stmt<1>; def CaseStmt : DStmt<SwitchCase>; def DefaultStmt : DStmt<SwitchCase>; @@ -61,7 +61,9 @@ def MemberExpr : DStmt<Expr>; def CastExpr : DStmt<Expr, 1>; def BinaryOperator : DStmt<Expr>; def CompoundAssignOperator : DStmt<BinaryOperator>; -def ConditionalOperator : DStmt<Expr>; +def AbstractConditionalOperator : DStmt<Expr, 1>; +def ConditionalOperator : DStmt<AbstractConditionalOperator>; +def BinaryConditionalOperator : DStmt<AbstractConditionalOperator>; def ImplicitCastExpr : DStmt<CastExpr>; def ExplicitCastExpr : DStmt<CastExpr, 1>; def CStyleCastExpr : DStmt<ExplicitCastExpr>; @@ -76,7 +78,6 @@ def VAArgExpr : DStmt<Expr>; // GNU Extensions. def AddrLabelExpr : DStmt<Expr>; def StmtExpr : DStmt<Expr>; -def TypesCompatibleExpr : DStmt<Expr>; def ChooseExpr : DStmt<Expr>; def GNUNullExpr : DStmt<Expr>; @@ -100,16 +101,21 @@ def CXXNewExpr : DStmt<Expr>; def CXXDeleteExpr : DStmt<Expr>; def CXXPseudoDestructorExpr : DStmt<Expr>; def UnaryTypeTraitExpr : DStmt<Expr>; +def BinaryTypeTraitExpr : DStmt<Expr>; def DependentScopeDeclRefExpr : DStmt<Expr>; def CXXConstructExpr : DStmt<Expr>; def CXXBindTemporaryExpr : DStmt<Expr>; -def CXXExprWithTemporaries : DStmt<Expr>; +def ExprWithCleanups : DStmt<Expr>; def CXXTemporaryObjectExpr : DStmt<CXXConstructExpr>; def CXXUnresolvedConstructExpr : DStmt<Expr>; def CXXDependentScopeMemberExpr : DStmt<Expr>; def OverloadExpr : DStmt<Expr, 1>; def UnresolvedLookupExpr : DStmt<OverloadExpr>; def UnresolvedMemberExpr : DStmt<OverloadExpr>; +def CXXNoexceptExpr : DStmt<Expr>; +def PackExpansionExpr : DStmt<Expr>; +def SizeOfPackExpr : DStmt<Expr>; +def SubstNonTypeTemplateParmPackExpr : DStmt<Expr>; // Obj-C Expressions. def ObjCStringLiteral : DStmt<Expr>; @@ -119,11 +125,17 @@ def ObjCSelectorExpr : DStmt<Expr>; def ObjCProtocolExpr : DStmt<Expr>; def ObjCIvarRefExpr : DStmt<Expr>; def ObjCPropertyRefExpr : DStmt<Expr>; -def ObjCImplicitSetterGetterRefExpr : DStmt<Expr>; -def ObjCSuperExpr : DStmt<Expr>; def ObjCIsaExpr : DStmt<Expr>; +// CUDA Expressions. +def CUDAKernelCallExpr : DStmt<CallExpr>; + // Clang Extensions. def ShuffleVectorExpr : DStmt<Expr>; def BlockExpr : DStmt<Expr>; def BlockDeclRefExpr : DStmt<Expr>; +def OpaqueValueExpr : DStmt<Expr>; + +// Microsoft Extensions. +def CXXUuidofExpr : DStmt<Expr>; + diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 40df9ba..b9087f2 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -18,7 +18,7 @@ #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" -#include "llvm/System/DataTypes.h" +#include "llvm/Support/DataTypes.h" #include <cassert> #include <vector> #include <string> @@ -64,6 +64,7 @@ protected: bool TLSSupported; bool NoAsmVariants; // True if {|} are normal characters. unsigned char PointerWidth, PointerAlign; + unsigned char BoolWidth, BoolAlign; unsigned char IntWidth, IntAlign; unsigned char FloatWidth, FloatAlign; unsigned char DoubleWidth, DoubleAlign; @@ -73,6 +74,7 @@ protected: unsigned char LongLongWidth, LongLongAlign; const char *DescriptionString; const char *UserLabelPrefix; + const char *MCountName; const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat; unsigned char RegParmMax, SSERegParmMax; TargetCXXABI CXXABI; @@ -139,7 +141,7 @@ public: IntType getSigAtomicType() const { return SigAtomicType; } - /// getTypeWidth - Return the width (in bits) of the specified integer type + /// getTypeWidth - Return the width (in bits) of the specified integer type /// enum. For example, SignedInt -> getIntWidth(). unsigned getTypeWidth(IntType T) const; @@ -149,7 +151,7 @@ public: /// isTypeSigned - Return whether an integer types is signed. Returns true if /// the type is signed; false otherwise. - bool isTypeSigned(IntType T) const; + static bool isTypeSigned(IntType T); /// getPointerWidth - Return the width of pointers on this target, for the /// specified address space. @@ -162,8 +164,8 @@ public: /// getBoolWidth/Align - Return the size of '_Bool' and C++ 'bool' for this /// target, in bits. - unsigned getBoolWidth(bool isWide = false) const { return 8; } // FIXME - unsigned getBoolAlign(bool isWide = false) const { return 8; } // FIXME + unsigned getBoolWidth() const { return BoolWidth; } + unsigned getBoolAlign() const { return BoolAlign; } unsigned getCharWidth() const { return 8; } // FIXME unsigned getCharAlign() const { return 8; } // FIXME @@ -240,6 +242,11 @@ public: return UserLabelPrefix; } + /// MCountName - This returns name of the mcount instrumentation function. + const char *getMCountName() const { + return MCountName; + } + bool useBitFieldTypeAlignment() const { return UseBitFieldTypeAlignment; } @@ -306,7 +313,7 @@ public: std::string Name; // Operand name: [foo] with no []'s. public: ConstraintInfo(llvm::StringRef ConstraintStr, llvm::StringRef Name) - : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()), + : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()), Name(Name.str()) {} const std::string &getConstraintStr() const { return ConstraintStr; } @@ -356,6 +363,9 @@ public: unsigned NumOutputs, unsigned &Index) const; virtual std::string convertConstraint(const char Constraint) const { + // 'p' defaults to 'r', but can be overridden by targets. + if (Constraint == 'p') + return std::string("r"); return std::string(1, Constraint); } @@ -391,7 +401,7 @@ public: return "__OBJC,__cstring_object,regular,no_dead_strip"; } - /// getNSStringNonFragileABISection - Return the section to use for + /// getNSStringNonFragileABISection - Return the section to use for /// NSString literals, or 0 if no special section is used (NonFragile ABI). virtual const char *getNSStringNonFragileABISection() const { return "__DATA, __objc_stringobj, regular, no_dead_strip"; @@ -499,7 +509,7 @@ public: bool isTLSSupported() const { return TLSSupported; } - + /// hasNoAsmVariants - Return true if {|} are normal characters in the /// asm string. If this returns false (the default), then {abc|xyz} is syntax /// that says that when compiling for asm variant #0, "abc" should be @@ -508,19 +518,18 @@ public: bool hasNoAsmVariants() const { return NoAsmVariants; } - + /// getEHDataRegisterNumber - Return the register number that /// __builtin_eh_return_regno would return with the specified argument. virtual int getEHDataRegisterNumber(unsigned RegNo) const { - return -1; + return -1; } - - /// getStaticInitSectionSpecifier - Return the section to use for C++ static + + /// getStaticInitSectionSpecifier - Return the section to use for C++ static /// initialization functions. virtual const char *getStaticInitSectionSpecifier() const { return 0; } - 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 dc360ad..b84b04d 100644 --- a/include/clang/Basic/TokenKinds.def +++ b/include/clang/Basic/TokenKinds.def @@ -103,6 +103,7 @@ TOK(comment) // Comment (only in -E -C[C] mode) // C99 6.4.2: Identifiers. TOK(identifier) // abcde123 +TOK(raw_identifier) // Used only in raw lexing mode. // C99 6.4.4.1: Integer Constants // C99 6.4.4.2: Floating Constants @@ -175,6 +176,10 @@ PUNCTUATOR(coloncolon, "::") // Objective C support. PUNCTUATOR(at, "@") +// CUDA support. +PUNCTUATOR(lesslessless, "<<<") +PUNCTUATOR(greatergreatergreater, ">>>") + // C99 6.4.1: Keywords. These turn into kw_* tokens. // Flags allowed: // KEYALL - This is a keyword in all variants of C and C++, or it @@ -183,9 +188,12 @@ PUNCTUATOR(at, "@") // KEYC99 - This is a keyword introduced to C in C99 // 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. // KEYCXX0X - This is a C++ keyword introduced to C++ in C++0x // KEYGNU - This is a keyword if GNU extensions are enabled // KEYMS - This is a keyword if Microsoft extensions are enabled +// KEYOPENCL - This is a keyword in OpenCL +// KEYALTIVEC - This is a keyword in AltiVec // KEYBORLAND - This is a keyword if Borland extensions are enabled // KEYWORD(auto , KEYALL) @@ -222,7 +230,7 @@ KEYWORD(unsigned , KEYALL) KEYWORD(void , KEYALL) KEYWORD(volatile , KEYALL) KEYWORD(while , KEYALL) -KEYWORD(_Bool , KEYNOMS) +KEYWORD(_Bool , KEYNOCXX) KEYWORD(_Complex , KEYALL) KEYWORD(_Imaginary , KEYALL) KEYWORD(__func__ , KEYALL) @@ -278,6 +286,7 @@ KEYWORD(char16_t , KEYCXX0X) KEYWORD(char32_t , KEYCXX0X) KEYWORD(constexpr , KEYCXX0X) KEYWORD(decltype , KEYCXX0X) +KEYWORD(noexcept , KEYCXX0X) KEYWORD(nullptr , KEYCXX0X) KEYWORD(static_assert , KEYCXX0X) KEYWORD(thread_local , KEYCXX0X) @@ -316,6 +325,7 @@ KEYWORD(__has_virtual_destructor , KEYCXX) KEYWORD(__is_abstract , KEYCXX) KEYWORD(__is_base_of , KEYCXX) KEYWORD(__is_class , KEYCXX) +KEYWORD(__is_convertible_to , KEYCXX) KEYWORD(__is_empty , KEYCXX) KEYWORD(__is_enum , KEYCXX) KEYWORD(__is_pod , KEYCXX) @@ -323,7 +333,6 @@ KEYWORD(__is_polymorphic , KEYCXX) KEYWORD(__is_union , KEYCXX) // Tentative name - there's no implementation of std::is_literal_type yet. KEYWORD(__is_literal , KEYCXX) -// FIXME: Add MS's traits, too. // Apple Extension. KEYWORD(__private_extern__ , KEYALL) @@ -336,7 +345,11 @@ KEYWORD(__fastcall , KEYALL) KEYWORD(__thiscall , KEYALL) KEYWORD(__forceinline , KEYALL) -// Borland Extension. +// OpenCL-specific keywords (see OpenCL 1.1 [6.1.9]) +KEYWORD(__kernel , KEYOPENCL) +ALIAS("kernel", __kernel , KEYOPENCL) + +// Borland Extensions. KEYWORD(__pascal , KEYALL) // Altivec Extension. @@ -356,6 +369,7 @@ ALIAS("__complex__" , _Complex , KEYALL) ALIAS("__imag__" , __imag , KEYALL) ALIAS("__inline" , inline , KEYALL) ALIAS("__inline__" , inline , KEYALL) +ALIAS("__nullptr" , nullptr , KEYCXX) ALIAS("__real__" , __real , KEYALL) ALIAS("__restrict" , restrict , KEYALL) ALIAS("__restrict__" , restrict , KEYALL) @@ -369,15 +383,23 @@ ALIAS("__volatile__" , volatile , KEYALL) // Microsoft extensions which should be disabled in strict conformance mode KEYWORD(__ptr64 , KEYMS) KEYWORD(__w64 , KEYMS) +KEYWORD(__uuidof , KEYMS | KEYBORLAND) ALIAS("_asm" , asm , KEYMS) -ALIAS("_cdecl" , __cdecl , KEYMS) -ALIAS("_fastcall" , __fastcall , KEYMS) -ALIAS("_stdcall" , __stdcall , KEYMS) +ALIAS("_cdecl" , __cdecl , KEYMS | KEYBORLAND) +ALIAS("_fastcall" , __fastcall , KEYMS | KEYBORLAND) +ALIAS("_stdcall" , __stdcall , KEYMS | KEYBORLAND) ALIAS("_thiscall" , __thiscall , KEYMS) +ALIAS("_uuidof" , __uuidof , KEYMS | KEYBORLAND) +ALIAS("_inline" , inline , KEYMS) // Borland Extensions which should be disabled in strict conformance mode. ALIAS("_pascal" , __pascal , KEYBORLAND) +// Clang Extensions. +ALIAS("__char16_t" , char16_t , KEYCXX) +ALIAS("__char32_t" , char32_t , KEYCXX) + + //===----------------------------------------------------------------------===// // Objective-C @-preceeded keywords. //===----------------------------------------------------------------------===// @@ -421,6 +443,12 @@ ANNOTATION(typename) // annotation for a C typedef name, a C++ (possibly ANNOTATION(template_id) // annotation for a C++ template-id that names a // function template specialization (not a type), // e.g., "std::swap<int>" + +// Annotation 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) + #undef ANNOTATION #undef OBJC2_AT_KEYWORD #undef OBJC1_AT_KEYWORD diff --git a/include/clang/Basic/TokenKinds.h b/include/clang/Basic/TokenKinds.h index 85dc067..515390a 100644 --- a/include/clang/Basic/TokenKinds.h +++ b/include/clang/Basic/TokenKinds.h @@ -43,6 +43,12 @@ enum ObjCKeywordKind { NUM_OBJC_KEYWORDS }; +/// OnOffSwitch - This defines the possible values of an on-off-switch +/// (C99 6.10.6p2). +enum OnOffSwitch { + OOS_ON, OOS_OFF, OOS_DEFAULT +}; + /// \brief Determines the name of a token as used within the front end. /// /// The name of a token will be an internal name (such as "l_square") diff --git a/include/clang/Basic/TypeTraits.h b/include/clang/Basic/TypeTraits.h index 36b8300..00c6e9e 100644 --- a/include/clang/Basic/TypeTraits.h +++ b/include/clang/Basic/TypeTraits.h @@ -36,6 +36,12 @@ namespace clang { UTT_IsLiteral }; + /// BinaryTypeTrait - Names for the binary type traits. + enum BinaryTypeTrait { + BTT_IsBaseOf, + BTT_TypeCompatible, + BTT_IsConvertibleTo + }; } #endif diff --git a/include/clang/Basic/Version.h b/include/clang/Basic/Version.h index 9948677..ede68ed 100644 --- a/include/clang/Basic/Version.h +++ b/include/clang/Basic/Version.h @@ -44,7 +44,7 @@ namespace clang { /// \brief Retrieves the repository path (e.g., Subversion path) that /// identifies the particular Clang branch, tag, or trunk from which this /// Clang was built. - llvm::StringRef getClangRepositoryPath(); + std::string getClangRepositoryPath(); /// \brief Retrieves the repository revision number (or identifer) from which /// this Clang was built. diff --git a/include/clang/Basic/Visibility.h b/include/clang/Basic/Visibility.h new file mode 100644 index 0000000..90e288a --- /dev/null +++ b/include/clang/Basic/Visibility.h @@ -0,0 +1,48 @@ +//===--- Visibility.h - Visibility enumeration and utilities ----*- 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 Visibility enumeration and various utility +// functions. +// +//===----------------------------------------------------------------------===// +#ifndef LLVM_CLANG_BASIC_VISIBILITY_H +#define LLVM_CLANG_BASIC_VISIBILITY_H + +namespace clang { + +/// \link Describes the different kinds of visibility that a +/// declaration may have. Visibility determines how a declaration +/// interacts with the dynamic linker. It may also affect whether the +/// symbol can be found by runtime symbol lookup APIs. +/// +/// Visibility is not described in any language standard and +/// (nonetheless) sometimes has odd behavior. Not all platforms +/// support all visibility kinds. +enum Visibility { + /// Objects with "hidden" visibility are not seen by the dynamic + /// linker. + HiddenVisibility, + + /// Objects with "protected" visibility are seen by the dynamic + /// linker but always dynamically resolve to an object within this + /// shared object. + ProtectedVisibility, + + /// Objects with "default" visibility are seen by the dynamic linker + /// and act like normal objects. + DefaultVisibility +}; + +inline Visibility minVisibility(Visibility L, Visibility R) { + return L < R ? L : R; +} + +} + +#endif // LLVM_CLANG_BASIC_VISIBILITY_H diff --git a/include/clang/Basic/arm_neon.td b/include/clang/Basic/arm_neon.td index fa6ebb7..880a0da 100644 --- a/include/clang/Basic/arm_neon.td +++ b/include/clang/Basic/arm_neon.td @@ -16,13 +16,34 @@ class Op; def OP_NONE : Op; def OP_ADD : Op; +def OP_ADDL : Op; +def OP_ADDW : Op; def OP_SUB : Op; +def OP_SUBL : Op; +def OP_SUBW : Op; def OP_MUL : Op; +def OP_MULL : Op; def OP_MLA : Op; +def OP_MLAL : Op; def OP_MLS : Op; +def OP_MLSL : Op; def OP_MUL_N : Op; +def OP_MULL_N: Op; def OP_MLA_N : Op; def OP_MLS_N : Op; +def OP_MLAL_N : Op; +def OP_MLSL_N : Op; +def OP_MUL_LN: Op; +def OP_MULL_LN : Op; +def OP_MLA_LN: Op; +def OP_MLS_LN: Op; +def OP_MLAL_LN : Op; +def OP_MLSL_LN : Op; +def OP_QDMULL_LN : Op; +def OP_QDMLAL_LN : Op; +def OP_QDMLSL_LN : Op; +def OP_QDMULH_LN : Op; +def OP_QRDMULH_LN : Op; def OP_EQ : Op; def OP_GE : Op; def OP_LE : Op; @@ -40,22 +61,31 @@ def OP_HI : Op; def OP_LO : Op; def OP_CONC : Op; def OP_DUP : Op; +def OP_DUP_LN: Op; def OP_SEL : Op; def OP_REV64 : Op; def OP_REV32 : Op; def OP_REV16 : Op; +def OP_REINT : Op; +def OP_ABDL : Op; +def OP_ABA : Op; +def OP_ABAL : Op; -class Inst <string p, string t, Op o> { +class Inst <string n, string p, string t, Op o> { + string Name = n; string Prototype = p; string Types = t; Op Operand = o; bit isShift = 0; } -// Used to generate Builtins.def -class SInst<string p, string t> : Inst<p, t, OP_NONE> {} -class IInst<string p, string t> : Inst<p, t, OP_NONE> {} -class WInst<string p, string t> : Inst<p, t, OP_NONE> {} +// Used to generate Builtins.def: +// SInst: Instruction with signed/unsigned suffix (e.g., "s8", "u8", "p8") +// IInst: Instruction with generic integer suffix (e.g., "i8") +// WInst: Instruction with only bit size suffix (e.g., "8") +class SInst<string n, string p, string t> : Inst<n, p, t, OP_NONE> {} +class IInst<string n, string p, string t> : Inst<n, p, t, OP_NONE> {} +class WInst<string n, string p, string t> : Inst<n, p, t, OP_NONE> {} // prototype: return (arg, arg, ...) // v: void @@ -93,251 +123,273 @@ class WInst<string p, string t> : Inst<p, t, OP_NONE> {} //////////////////////////////////////////////////////////////////////////////// // E.3.1 Addition -def VADD : Inst<"ddd", "csilfUcUsUiUlQcQsQiQlQfQUcQUsQUiQUl", OP_ADD>; -def VADDL : SInst<"wdd", "csiUcUsUi">; -def VADDW : SInst<"wwd", "csiUcUsUi">; -def VHADD : SInst<"ddd", "csiUcUsUiQcQsQiQUcQUsQUi">; -def VRHADD : SInst<"ddd", "csiUcUsUiQcQsQiQUcQUsQUi">; -def VQADD : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; -def VADDHN : IInst<"dww", "csiUcUsUi">; -def VRADDHN : IInst<"dww", "csiUcUsUi">; +def VADD : Inst<"vadd", "ddd", "csilfUcUsUiUlQcQsQiQlQfQUcQUsQUiQUl", OP_ADD>; +def VADDL : Inst<"vaddl", "wdd", "csiUcUsUi", OP_ADDL>; +def VADDW : Inst<"vaddw", "wwd", "csiUcUsUi", OP_ADDW>; +def VHADD : SInst<"vhadd", "ddd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VRHADD : SInst<"vrhadd", "ddd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VQADD : SInst<"vqadd", "ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VADDHN : IInst<"vaddhn", "hkk", "silUsUiUl">; +def VRADDHN : IInst<"vraddhn", "hkk", "silUsUiUl">; //////////////////////////////////////////////////////////////////////////////// // E.3.2 Multiplication -def VMUL : Inst<"ddd", "csifUcUsUiPcQcQsQiQfQUcQUsQUiQPc", OP_MUL>; -def VMLA : Inst<"dddd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_MLA>; -def VMLAL : SInst<"wwdd", "csiUcUsUi">; -def VMLS : Inst<"dddd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_MLS>; -def VMLSL : SInst<"wwdd", "csiUcUsUi">; -def VQDMULH : SInst<"ddd", "siQsQi">; -def VQRDMULH : SInst<"ddd", "siQsQi">; -def VQDMLAL : SInst<"wwdd", "si">; -def VQDMLSL : SInst<"wwdd", "si">; -def VMULL : SInst<"wdd", "csiUcUsUiPc">; -def VQDMULL : SInst<"wdd", "si">; +def VMUL : Inst<"vmul", "ddd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_MUL>; +def VMULP : SInst<"vmul", "ddd", "PcQPc">; +def VMLA : Inst<"vmla", "dddd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_MLA>; +def VMLAL : Inst<"vmlal", "wwdd", "csiUcUsUi", OP_MLAL>; +def VMLS : Inst<"vmls", "dddd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_MLS>; +def VMLSL : Inst<"vmlsl", "wwdd", "csiUcUsUi", OP_MLSL>; +def VQDMULH : SInst<"vqdmulh", "ddd", "siQsQi">; +def VQRDMULH : SInst<"vqrdmulh", "ddd", "siQsQi">; +def VQDMLAL : SInst<"vqdmlal", "wwdd", "si">; +def VQDMLSL : SInst<"vqdmlsl", "wwdd", "si">; +def VMULL : Inst<"vmull", "wdd", "csiUcUsUi", OP_MULL>; +def VMULLP : SInst<"vmull", "wdd", "Pc">; +def VQDMULL : SInst<"vqdmull", "wdd", "si">; //////////////////////////////////////////////////////////////////////////////// // E.3.3 Subtraction -def VSUB : Inst<"ddd", "csilfUcUsUiUlQcQsQiQlQfQUcQUsQUiQUl", OP_SUB>; -def VSUBL : SInst<"wdd", "csiUcUsUi">; -def VSUBW : SInst<"wwd", "csiUcUsUi">; -def VQSUB : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; -def VHSUB : SInst<"ddd", "csiUcUsUiQcQsQiQUcQUsQUi">; -def VSUBHN : IInst<"dww", "csiUcUsUi">; -def VRSUBHN : IInst<"dww", "csiUcUsUi">; +def VSUB : Inst<"vsub", "ddd", "csilfUcUsUiUlQcQsQiQlQfQUcQUsQUiQUl", OP_SUB>; +def VSUBL : Inst<"vsubl", "wdd", "csiUcUsUi", OP_SUBL>; +def VSUBW : Inst<"vsubw", "wwd", "csiUcUsUi", OP_SUBW>; +def VQSUB : SInst<"vqsub", "ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VHSUB : SInst<"vhsub", "ddd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VSUBHN : IInst<"vsubhn", "hkk", "silUsUiUl">; +def VRSUBHN : IInst<"vrsubhn", "hkk", "silUsUiUl">; //////////////////////////////////////////////////////////////////////////////// // E.3.4 Comparison -def VCEQ : Inst<"udd", "csifUcUsUiPcQcQsQiQfQUcQUsQUiQPc", OP_EQ>; -def VCGE : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_GE>; -def VCLE : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_LE>; -def VCGT : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_GT>; -def VCLT : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_LT>; -def VCAGE : IInst<"udd", "fQf">; -def VCALE : IInst<"udd", "fQf">; -def VCAGT : IInst<"udd", "fQf">; -def VCALT : IInst<"udd", "fQf">; -def VTST : WInst<"udd", "csiUcUsUiPcQcQsQiQUcQUsQUiQPc">; +def VCEQ : Inst<"vceq", "udd", "csifUcUsUiPcQcQsQiQfQUcQUsQUiQPc", OP_EQ>; +def VCGE : Inst<"vcge", "udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_GE>; +def VCLE : Inst<"vcle", "udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_LE>; +def VCGT : Inst<"vcgt", "udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_GT>; +def VCLT : Inst<"vclt", "udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_LT>; +def VCAGE : IInst<"vcage", "udd", "fQf">; +def VCALE : IInst<"vcale", "udd", "fQf">; +def VCAGT : IInst<"vcagt", "udd", "fQf">; +def VCALT : IInst<"vcalt", "udd", "fQf">; +def VTST : WInst<"vtst", "udd", "csiUcUsUiPcQcQsQiQUcQUsQUiQPc">; //////////////////////////////////////////////////////////////////////////////// // E.3.5 Absolute Difference -def VABD : SInst<"ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">; -def VABDL : SInst<"wdd", "csiUcUsUi">; -def VABA : SInst<"dddd", "csiUcUsUiQcQsQiQUcQUsQUi">; -def VABAL : SInst<"wwdd", "csiUcUsUi">; +def VABD : SInst<"vabd", "ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">; +def VABDL : Inst<"vabdl", "wdd", "csiUcUsUi", OP_ABDL>; +def VABA : Inst<"vaba", "dddd", "csiUcUsUiQcQsQiQUcQUsQUi", OP_ABA>; +def VABAL : Inst<"vabal", "wwdd", "csiUcUsUi", OP_ABAL>; //////////////////////////////////////////////////////////////////////////////// // E.3.6 Max/Min -def VMAX : SInst<"ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">; -def VMIN : SInst<"ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">; +def VMAX : SInst<"vmax", "ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">; +def VMIN : SInst<"vmin", "ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">; //////////////////////////////////////////////////////////////////////////////// // E.3.7 Pairdise Addition -def VPADD : IInst<"ddd", "csiUcUsUif">; -def VPADDL : SInst<"nd", "csiUcUsUiQcQsQiQUcQUsQUi">; -def VPADAL : SInst<"nnd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VPADD : IInst<"vpadd", "ddd", "csiUcUsUif">; +def VPADDL : SInst<"vpaddl", "nd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VPADAL : SInst<"vpadal", "nnd", "csiUcUsUiQcQsQiQUcQUsQUi">; //////////////////////////////////////////////////////////////////////////////// // E.3.8-9 Folding Max/Min -def VPMAX : SInst<"ddd", "csiUcUsUif">; -def VPMIN : SInst<"ddd", "csiUcUsUif">; +def VPMAX : SInst<"vpmax", "ddd", "csiUcUsUif">; +def VPMIN : SInst<"vpmin", "ddd", "csiUcUsUif">; //////////////////////////////////////////////////////////////////////////////// // E.3.10 Reciprocal/Sqrt -def VRECPS : IInst<"ddd", "fQf">; -def VRSQRTS : IInst<"ddd", "fQf">; +def VRECPS : IInst<"vrecps", "ddd", "fQf">; +def VRSQRTS : IInst<"vrsqrts", "ddd", "fQf">; //////////////////////////////////////////////////////////////////////////////// // E.3.11 Shifts by signed variable -def VSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; -def VQSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; -def VRSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; -def VQRSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VSHL : SInst<"vshl", "ddx", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VQSHL : SInst<"vqshl", "ddx", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VRSHL : SInst<"vrshl", "ddx", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VQRSHL : SInst<"vqrshl", "ddx", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; //////////////////////////////////////////////////////////////////////////////// // E.3.12 Shifts by constant let isShift = 1 in { -def VSHR_N : SInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; -def VSHL_N : IInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; -def VRSHR_N : SInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; -def VSRA_N : SInst<"dddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; -def VRSRA_N : SInst<"dddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; -def VQSHL_N : SInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; -def VQSHLU_N : SInst<"udi", "csilQcQsQiQl">; -def VSHRN_N : IInst<"hki", "silUsUiUl">; -def VQSHRUN_N : SInst<"eki", "sil">; -def VQRSHRUN_N : SInst<"eki", "sil">; -def VQSHRN_N : SInst<"hki", "silUsUiUl">; -def VRSHRN_N : IInst<"hki", "silUsUiUl">; -def VQRSHRN_N : SInst<"hki", "silUsUiUl">; -def VSHLL_N : SInst<"wdi", "csiUcUsUi">; +def VSHR_N : SInst<"vshr_n", "ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VSHL_N : IInst<"vshl_n", "ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VRSHR_N : SInst<"vrshr_n", "ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VSRA_N : SInst<"vsra_n", "dddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VRSRA_N : SInst<"vrsra_n", "dddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VQSHL_N : SInst<"vqshl_n", "ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">; +def VQSHLU_N : SInst<"vqshlu_n", "udi", "csilQcQsQiQl">; +def VSHRN_N : IInst<"vshrn_n", "hki", "silUsUiUl">; +def VQSHRUN_N : SInst<"vqshrun_n", "eki", "sil">; +def VQRSHRUN_N : SInst<"vqrshrun_n", "eki", "sil">; +def VQSHRN_N : SInst<"vqshrn_n", "hki", "silUsUiUl">; +def VRSHRN_N : IInst<"vrshrn_n", "hki", "silUsUiUl">; +def VQRSHRN_N : SInst<"vqrshrn_n", "hki", "silUsUiUl">; +def VSHLL_N : SInst<"vshll_n", "wdi", "csiUcUsUi">; //////////////////////////////////////////////////////////////////////////////// // E.3.13 Shifts with insert -def VSRI_N : WInst<"dddi", "csilUcUsUiUlPcPsQcQsQiQlQUcQUsQUiQUlQPcQPs">; -def VSLI_N : WInst<"dddi", "csilUcUsUiUlPcPsQcQsQiQlQUcQUsQUiQUlQPcQPs">; +def VSRI_N : WInst<"vsri_n", "dddi", + "csilUcUsUiUlPcPsQcQsQiQlQUcQUsQUiQUlQPcQPs">; +def VSLI_N : WInst<"vsli_n", "dddi", + "csilUcUsUiUlPcPsQcQsQiQlQUcQUsQUiQUlQPcQPs">; } //////////////////////////////////////////////////////////////////////////////// // E.3.14 Loads and stores of a single vector -def VLD1 : WInst<"dc", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; -def VLD1_LANE : WInst<"dcdi", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; -def VLD1_DUP : WInst<"dc", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; -def VST1 : WInst<"vpd", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; -def VST1_LANE : WInst<"vpdi", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD1 : WInst<"vld1", "dc", + "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD1_LANE : WInst<"vld1_lane", "dcdi", + "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD1_DUP : WInst<"vld1_dup", "dc", + "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST1 : WInst<"vst1", "vpd", + "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST1_LANE : WInst<"vst1_lane", "vpdi", + "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">; //////////////////////////////////////////////////////////////////////////////// // E.3.15 Loads and stores of an N-element structure -def VLD2 : WInst<"2c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; -def VLD3 : WInst<"3c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; -def VLD4 : WInst<"4c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; -def VLD2_DUP : WInst<"2c", "UcUsUiUlcsilhfPcPs">; -def VLD3_DUP : WInst<"3c", "UcUsUiUlcsilhfPcPs">; -def VLD4_DUP : WInst<"4c", "UcUsUiUlcsilhfPcPs">; -def VLD2_LANE : WInst<"2c2i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; -def VLD3_LANE : WInst<"3c3i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; -def VLD4_LANE : WInst<"4c4i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; -def VST2 : WInst<"vp2", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; -def VST3 : WInst<"vp3", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; -def VST4 : WInst<"vp4", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; -def VST2_LANE : WInst<"vp2i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; -def VST3_LANE : WInst<"vp3i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; -def VST4_LANE : WInst<"vp4i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VLD2 : WInst<"vld2", "2c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD3 : WInst<"vld3", "3c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD4 : WInst<"vld4", "4c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VLD2_DUP : WInst<"vld2_dup", "2c", "UcUsUiUlcsilhfPcPs">; +def VLD3_DUP : WInst<"vld3_dup", "3c", "UcUsUiUlcsilhfPcPs">; +def VLD4_DUP : WInst<"vld4_dup", "4c", "UcUsUiUlcsilhfPcPs">; +def VLD2_LANE : WInst<"vld2_lane", "2c2i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VLD3_LANE : WInst<"vld3_lane", "3c3i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VLD4_LANE : WInst<"vld4_lane", "4c4i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VST2 : WInst<"vst2", "vp2", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST3 : WInst<"vst3", "vp3", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST4 : WInst<"vst4", "vp4", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">; +def VST2_LANE : WInst<"vst2_lane", "vp2i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VST3_LANE : WInst<"vst3_lane", "vp3i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; +def VST4_LANE : WInst<"vst4_lane", "vp4i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">; //////////////////////////////////////////////////////////////////////////////// // E.3.16 Extract lanes from a vector -def VGET_LANE : IInst<"sdi", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl">; +def VGET_LANE : IInst<"vget_lane", "sdi", + "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl">; //////////////////////////////////////////////////////////////////////////////// // E.3.17 Set lanes within a vector -def VSET_LANE : IInst<"dsdi", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl">; +def VSET_LANE : IInst<"vset_lane", "dsdi", + "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl">; //////////////////////////////////////////////////////////////////////////////// // E.3.18 Initialize a vector from bit pattern -def VCREATE: Inst<"dl", "csihfUcUsUiUlPcPsl", OP_CAST>; +def VCREATE: Inst<"vcreate", "dl", "csihfUcUsUiUlPcPsl", OP_CAST>; //////////////////////////////////////////////////////////////////////////////// // E.3.19 Set all lanes to same value -def VDUP_N : Inst<"ds", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl", OP_DUP>; -def VMOV_N : Inst<"ds", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl", OP_DUP>; -def VDUP_LANE : WInst<"dgi", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl">; +def VDUP_N : Inst<"vdup_n", "ds", + "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl", OP_DUP>; +def VMOV_N : Inst<"vmov_n", "ds", + "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl", OP_DUP>; +def VDUP_LANE : Inst<"vdup_lane", "dgi", + "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl",OP_DUP_LN>; //////////////////////////////////////////////////////////////////////////////// // E.3.20 Combining vectors -def VCOMBINE : Inst<"kdd", "csilhfUcUsUiUlPcPs", OP_CONC>; +def VCOMBINE : Inst<"vcombine", "kdd", "csilhfUcUsUiUlPcPs", OP_CONC>; //////////////////////////////////////////////////////////////////////////////// // E.3.21 Splitting vectors -def VGET_HIGH : Inst<"dk", "csilhfUcUsUiUlPcPs", OP_HI>; -def VGET_LOW : Inst<"dk", "csilhfUcUsUiUlPcPs", OP_LO>; +def VGET_HIGH : Inst<"vget_high", "dk", "csilhfUcUsUiUlPcPs", OP_HI>; +def VGET_LOW : Inst<"vget_low", "dk", "csilhfUcUsUiUlPcPs", OP_LO>; //////////////////////////////////////////////////////////////////////////////// // E.3.22 Converting vectors -def VCVT_S32 : SInst<"xd", "fQf">; -def VCVT_U32 : SInst<"ud", "fQf">; -def VCVT_F16 : SInst<"hk", "f">; -def VCVT_N_S32 : SInst<"xdi", "fQf">; -def VCVT_N_U32 : SInst<"udi", "fQf">; -def VCVT_F32 : SInst<"fd", "iUiQiQUi">; -def VCVT_F32_F16 : SInst<"kh", "f">; -def VCVT_N_F32 : SInst<"fdi", "iUiQiQUi">; -def VMOVN : IInst<"hk", "silUsUiUl">; -def VMOVL : SInst<"wd", "csiUcUsUi">; -def VQMOVN : SInst<"hk", "silUsUiUl">; -def VQMOVUN : SInst<"ek", "sil">; +def VCVT_S32 : SInst<"vcvt_s32", "xd", "fQf">; +def VCVT_U32 : SInst<"vcvt_u32", "ud", "fQf">; +def VCVT_F16 : SInst<"vcvt_f16", "hk", "f">; +def VCVT_N_S32 : SInst<"vcvt_n_s32", "xdi", "fQf">; +def VCVT_N_U32 : SInst<"vcvt_n_u32", "udi", "fQf">; +def VCVT_F32 : SInst<"vcvt_f32", "fd", "iUiQiQUi">; +def VCVT_F32_F16 : SInst<"vcvt_f32_f16", "fd", "h">; +def VCVT_N_F32 : SInst<"vcvt_n_f32", "fdi", "iUiQiQUi">; +def VMOVN : IInst<"vmovn", "hk", "silUsUiUl">; +def VMOVL : SInst<"vmovl", "wd", "csiUcUsUi">; +def VQMOVN : SInst<"vqmovn", "hk", "silUsUiUl">; +def VQMOVUN : SInst<"vqmovun", "ek", "sil">; //////////////////////////////////////////////////////////////////////////////// // E.3.23-24 Table lookup, Extended table lookup -def VTBL1 : WInst<"ddt", "UccPc">; -def VTBL2 : WInst<"d2t", "UccPc">; -def VTBL3 : WInst<"d3t", "UccPc">; -def VTBL4 : WInst<"d4t", "UccPc">; -def VTBX1 : WInst<"dddt", "UccPc">; -def VTBX2 : WInst<"dd2t", "UccPc">; -def VTBX3 : WInst<"dd3t", "UccPc">; -def VTBX4 : WInst<"dd4t", "UccPc">; +def VTBL1 : WInst<"vtbl1", "ddt", "UccPc">; +def VTBL2 : WInst<"vtbl2", "d2t", "UccPc">; +def VTBL3 : WInst<"vtbl3", "d3t", "UccPc">; +def VTBL4 : WInst<"vtbl4", "d4t", "UccPc">; +def VTBX1 : WInst<"vtbx1", "dddt", "UccPc">; +def VTBX2 : WInst<"vtbx2", "dd2t", "UccPc">; +def VTBX3 : WInst<"vtbx3", "dd3t", "UccPc">; +def VTBX4 : WInst<"vtbx4", "dd4t", "UccPc">; //////////////////////////////////////////////////////////////////////////////// // E.3.25 Operations with a scalar value -def VMLA_LANE : IInst<"ddddi", "siUsUifQsQiQUsQUiQf">; -def VMLAL_LANE : SInst<"wwddi", "siUsUi">; -def VQDMLAL_LANE : SInst<"wwddi", "si">; -def VMLS_LANE : IInst<"ddddi", "siUsUifQsQiQUsQUiQf">; -def VMLSL_LANE : SInst<"wwddi", "siUsUi">; -def VQDMLSL_LANE : SInst<"wwddi", "si">; -def VMUL_N : Inst<"dds", "sifUsUiQsQiQfQUsQUi", OP_MUL_N>; -def VMULL_N : SInst<"wda", "siUsUi">; -def VMULL_LANE : SInst<"wddi", "siUsUi">; -def VQDMULL_N : SInst<"wda", "si">; -def VQDMULL_LANE : SInst<"wddi", "si">; -def VQDMULH_N : SInst<"dda", "siQsQi">; -def VQDMULH_LANE : SInst<"dddi", "siQsQi">; -def VQRDMULH_N : SInst<"dda", "siQsQi">; -def VQRDMULH_LANE : SInst<"dddi", "siQsQi">; -def VMLA_N : Inst<"ddda", "siUsUifQsQiQUsQUiQf", OP_MLA_N>; -def VMLAL_N : SInst<"wwda", "siUsUi">; -def VQDMLAL_N : SInst<"wwda", "si">; -def VMLS_N : Inst<"ddds", "siUsUifQsQiQUsQUiQf", OP_MLS_N>; -def VMLSL_N : SInst<"wwda", "siUsUi">; -def VQDMLSL_N : SInst<"wwda", "si">; +def VMLA_LANE : Inst<"vmla_lane", "dddgi", "siUsUifQsQiQUsQUiQf", OP_MLA_LN>; +def VMLAL_LANE : Inst<"vmlal_lane", "wwddi", "siUsUi", OP_MLAL_LN>; +def VQDMLAL_LANE : Inst<"vqdmlal_lane", "wwddi", "si", OP_QDMLAL_LN>; +def VMLS_LANE : Inst<"vmls_lane", "dddgi", "siUsUifQsQiQUsQUiQf", OP_MLS_LN>; +def VMLSL_LANE : Inst<"vmlsl_lane", "wwddi", "siUsUi", OP_MLSL_LN>; +def VQDMLSL_LANE : Inst<"vqdmlsl_lane", "wwddi", "si", OP_QDMLSL_LN>; +def VMUL_N : Inst<"vmul_n", "dds", "sifUsUiQsQiQfQUsQUi", OP_MUL_N>; +def VMUL_LANE : Inst<"vmul_lane", "ddgi", "sifUsUiQsQiQfQUsQUi", OP_MUL_LN>; +def VMULL_N : Inst<"vmull_n", "wda", "siUsUi", OP_MULL_N>; +def VMULL_LANE : Inst<"vmull_lane", "wddi", "siUsUi", OP_MULL_LN>; +def VQDMULL_N : SInst<"vqdmull_n", "wda", "si">; +def VQDMULL_LANE : Inst<"vqdmull_lane", "wddi", "si", OP_QDMULL_LN>; +def VQDMULH_N : SInst<"vqdmulh_n", "dda", "siQsQi">; +def VQDMULH_LANE : Inst<"vqdmulh_lane", "ddgi", "siQsQi", OP_QDMULH_LN>; +def VQRDMULH_N : SInst<"vqrdmulh_n", "dda", "siQsQi">; +def VQRDMULH_LANE : Inst<"vqrdmulh_lane", "ddgi", "siQsQi", OP_QRDMULH_LN>; +def VMLA_N : Inst<"vmla_n", "ddda", "siUsUifQsQiQUsQUiQf", OP_MLA_N>; +def VMLAL_N : Inst<"vmlal_n", "wwda", "siUsUi", OP_MLAL_N>; +def VQDMLAL_N : SInst<"vqdmlal_n", "wwda", "si">; +def VMLS_N : Inst<"vmls_n", "ddds", "siUsUifQsQiQUsQUiQf", OP_MLS_N>; +def VMLSL_N : Inst<"vmlsl_n", "wwda", "siUsUi", OP_MLSL_N>; +def VQDMLSL_N : SInst<"vqdmlsl_n", "wwda", "si">; //////////////////////////////////////////////////////////////////////////////// // E.3.26 Vector Extract -def VEXT : WInst<"dddi", "cUcPcsUsPsiUilUlQcQUcQPcQsQUsQPsQiQUiQlQUl">; +def VEXT : WInst<"vext", "dddi", + "cUcPcsUsPsiUilUlfQcQUcQPcQsQUsQPsQiQUiQlQUlQf">; //////////////////////////////////////////////////////////////////////////////// // E.3.27 Reverse vector elements (sdap endianness) -def VREV64 : Inst<"dd", "csiUcUsUiPcPsfQcQsQiQUcQUsQUiQPcQPsQf", OP_REV64>; -def VREV32 : Inst<"dd", "csUcUsPcQcQsQUcQUsQPc", OP_REV32>; -def VREV16 : Inst<"dd", "cUcPcQcQUcQPc", OP_REV16>; +def VREV64 : Inst<"vrev64", "dd", "csiUcUsUiPcPsfQcQsQiQUcQUsQUiQPcQPsQf", + OP_REV64>; +def VREV32 : Inst<"vrev32", "dd", "csUcUsPcPsQcQsQUcQUsQPcQPs", OP_REV32>; +def VREV16 : Inst<"vrev16", "dd", "cUcPcQcQUcQPc", OP_REV16>; //////////////////////////////////////////////////////////////////////////////// // E.3.28 Other single operand arithmetic -def VABS : SInst<"dd", "csifQcQsQiQf">; -def VQABS : SInst<"dd", "csiQcQsQi">; -def VNEG : Inst<"dd", "csifQcQsQiQf", OP_NEG>; -def VQNEG : SInst<"dd", "csiQcQsQi">; -def VCLS : SInst<"dd", "csiQcQsQi">; -def VCLZ : IInst<"dd", "csiUcUsUiQcQsQiQUcQUsQUi">; -def VCNT : WInst<"dd", "UccPcQUcQcQPc">; -def VRECPE : SInst<"dd", "fUiQfQUi">; -def VRSQRTE : SInst<"dd", "fUiQfQUi">; +def VABS : SInst<"vabs", "dd", "csifQcQsQiQf">; +def VQABS : SInst<"vqabs", "dd", "csiQcQsQi">; +def VNEG : Inst<"vneg", "dd", "csifQcQsQiQf", OP_NEG>; +def VQNEG : SInst<"vqneg", "dd", "csiQcQsQi">; +def VCLS : SInst<"vcls", "dd", "csiQcQsQi">; +def VCLZ : IInst<"vclz", "dd", "csiUcUsUiQcQsQiQUcQUsQUi">; +def VCNT : WInst<"vcnt", "dd", "UccPcQUcQcQPc">; +def VRECPE : SInst<"vrecpe", "dd", "fUiQfQUi">; +def VRSQRTE : SInst<"vrsqrte", "dd", "fUiQfQUi">; //////////////////////////////////////////////////////////////////////////////// // E.3.29 Logical operations -def VMVN : Inst<"dd", "csiUcUsUiPcQcQsQiQUcQUsQUiQPc", OP_NOT>; -def VAND : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_AND>; -def VORR : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_OR>; -def VEOR : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_XOR>; -def VBIC : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_ANDN>; -def VORN : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_ORN>; -def VBSL : Inst<"dudd", "csilUcUsUiUlfPcPsQcQsQiQlQUcQUsQUiQUlQfQPcQPs", OP_SEL>; +def VMVN : Inst<"vmvn", "dd", "csiUcUsUiPcQcQsQiQUcQUsQUiQPc", OP_NOT>; +def VAND : Inst<"vand", "ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_AND>; +def VORR : Inst<"vorr", "ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_OR>; +def VEOR : Inst<"veor", "ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_XOR>; +def VBIC : Inst<"vbic", "ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_ANDN>; +def VORN : Inst<"vorn", "ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_ORN>; +def VBSL : Inst<"vbsl", "dudd", + "csilUcUsUiUlfPcPsQcQsQiQlQUcQUsQUiQUlQfQPcQPs", OP_SEL>; //////////////////////////////////////////////////////////////////////////////// // E.3.30 Transposition operations -def VTRN: WInst<"2dd", "csiUcUsUifPcPsQcQsQiQUcQUsQUiQfQPcQPs">; -def VZIP: WInst<"2dd", "csUcUsfPcPsQcQsQiQUcQUsQUiQfQPcQPs">; -def VUZP: WInst<"2dd", "csiUcUsUifPcPsQcQsQiQUcQUsQUiQfQPcQPs">; +def VTRN : WInst<"vtrn", "2dd", "csiUcUsUifPcPsQcQsQiQUcQUsQUiQfQPcQPs">; +def VZIP : WInst<"vzip", "2dd", "csiUcUsUifPcPsQcQsQiQUcQUsQUiQfQPcQPs">; +def VUZP : WInst<"vuzp", "2dd", "csiUcUsUifPcPsQcQsQiQUcQUsQUiQfQPcQPs">; //////////////////////////////////////////////////////////////////////////////// // E.3.31 Vector reinterpret cast operations +def VREINTERPRET + : Inst<"vreinterpret", "dd", + "csilUcUsUiUlhfPcPsQcQsQiQlQUcQUsQUiQUlQhQfQPcQPs", OP_REINT>; + |