diff options
Diffstat (limited to 'include/clang/Basic')
38 files changed, 1243 insertions, 150 deletions
diff --git a/include/clang/Basic/AddressSpaces.h b/include/clang/Basic/AddressSpaces.h new file mode 100644 index 0000000..d44a9c3b --- /dev/null +++ b/include/clang/Basic/AddressSpaces.h @@ -0,0 +1,44 @@ +//===--- AddressSpaces.h - Language-specific address spaces -----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file provides definitions for the various language-specific address +// spaces. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_BASIC_ADDRESSSPACES_H +#define LLVM_CLANG_BASIC_ADDRESSSPACES_H + +namespace clang { + +namespace LangAS { + +/// This enum defines the set of possible language-specific address spaces. +/// It uses a high starting offset so as not to conflict with any address +/// space used by a target. +enum ID { + Offset = 0xFFFF00, + + opencl_global = Offset, + opencl_local, + opencl_constant, + + Last, + Count = Last-Offset +}; + +/// The type of a lookup table which maps from language-specific address spaces +/// to target-specific ones. +typedef unsigned Map[Count]; + +} + +} + +#endif diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 3e62d41..e4c6722 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -46,6 +46,7 @@ class Argument<string name> { string Name = name; } +class BoolArgument<string name> : Argument<name>; class IdentifierArgument<string name> : Argument<name>; class IntArgument<string name> : Argument<name>; class StringArgument<string name> : Argument<name>; @@ -55,6 +56,9 @@ class TypeArgument<string name> : Argument<name>; class UnsignedArgument<string name> : Argument<name>; class VariadicUnsignedArgument<string name> : Argument<name>; +// A version of the form major.minor[.subminor]. +class VersionArgument<string name> : Argument<name>; + // This one's a doozy, so it gets its own special type // It can be an unsigned integer, or a type. Either can // be dependent. @@ -89,8 +93,13 @@ class Attr { code AdditionalMembers = [{}]; } +/// An inheritable attribute is inherited by later redeclarations. class InheritableAttr : Attr; +/// An inheritable parameter attribute is inherited by later +/// redeclarations, even when it's written on a parameter. +class InheritableParamAttr : InheritableAttr; + // // Attributes begin here // @@ -129,12 +138,26 @@ def AsmLabel : InheritableAttr { let Args = [StringArgument<"Label">]; } +def Availability : InheritableAttr { + let Spellings = ["availability"]; + let Args = [IdentifierArgument<"platform">, VersionArgument<"introduced">, + VersionArgument<"deprecated">, VersionArgument<"obsoleted">, + BoolArgument<"unavailable">]; + let AdditionalMembers = +[{static llvm::StringRef getPrettyPlatformName(llvm::StringRef Platform) { + return llvm::StringSwitch<llvm::StringRef>(Platform) + .Case("ios", "iOS") + .Case("macosx", "Mac OS X") + .Default(llvm::StringRef()); +} }]; +} + def Blocks : InheritableAttr { let Spellings = ["blocks"]; let Args = [EnumArgument<"Type", "BlockType", ["byref"], ["ByRef"]>]; } -def CarriesDependency : InheritableAttr { +def CarriesDependency : InheritableParamAttr { let Spellings = ["carries_dependency"]; let Subjects = [ParmVar, Function]; let Namespaces = ["", "std"]; @@ -154,7 +177,7 @@ def CFReturnsNotRetained : InheritableAttr { let Subjects = [ObjCMethod, Function]; } -def CFConsumed : InheritableAttr { +def CFConsumed : InheritableParamAttr { let Spellings = ["cf_consumed"]; let Subjects = [ParmVar]; } @@ -224,10 +247,6 @@ def DLLImport : InheritableAttr { let Spellings = ["dllimport"]; } -def Explicit : InheritableAttr { - let Spellings = []; -} - def FastCall : InheritableAttr { let Spellings = ["fastcall", "__fastcall"]; } @@ -236,6 +255,10 @@ def Final : InheritableAttr { let Spellings = []; } +def MsStruct : InheritableAttr { + let Spellings = ["__ms_struct__"]; +} + def Format : InheritableAttr { let Spellings = ["format"]; let Args = [StringArgument<"Type">, IntArgument<"FormatIdx">, @@ -261,7 +284,7 @@ def IBOutlet : InheritableAttr { def IBOutletCollection : InheritableAttr { let Spellings = ["iboutletcollection"]; - let Args = [TypeArgument<"Interface">]; + let Args = [TypeArgument<"InterFace">]; } def Malloc : InheritableAttr { @@ -355,7 +378,7 @@ def NSConsumesSelf : InheritableAttr { let Subjects = [ObjCMethod]; } -def NSConsumed : InheritableAttr { +def NSConsumed : InheritableParamAttr { let Spellings = ["ns_consumed"]; let Subjects = [ParmVar]; } @@ -364,6 +387,15 @@ def ObjCException : InheritableAttr { let Spellings = ["objc_exception"]; } +def ObjCMethodFamily : InheritableAttr { + let Spellings = ["objc_method_family"]; + let Subjects = [ObjCMethod]; + let Args = [EnumArgument<"Family", "FamilyKind", + ["none", "alloc", "copy", "init", "mutableCopy", "new"], + ["OMF_None", "OMF_alloc", "OMF_copy", "OMF_init", + "OMF_mutableCopy", "OMF_new"]>]; +} + def ObjCNSObject : InheritableAttr { let Spellings = ["NSObject"]; } @@ -388,6 +420,13 @@ def Packed : InheritableAttr { let Spellings = ["packed"]; } +def Pcs : InheritableAttr { + let Spellings = ["pcs"]; + let Args = [EnumArgument<"PCS", "PCSType", + ["aapcs", "aapcs-vfp"], + ["AAPCS", "AAPCS_VFP"]>]; +} + def Pure : InheritableAttr { let Spellings = ["pure"]; } diff --git a/include/clang/Basic/AttrKinds.h b/include/clang/Basic/AttrKinds.h index 65c4f98..9d5ae58 100644 --- a/include/clang/Basic/AttrKinds.h +++ b/include/clang/Basic/AttrKinds.h @@ -22,6 +22,7 @@ namespace attr { enum Kind { #define ATTR(X) X, #define LAST_INHERITABLE_ATTR(X) X, LAST_INHERITABLE = X, +#define LAST_INHERITABLE_PARAM_ATTR(X) X, LAST_INHERITABLE_PARAM = X, #include "clang/Basic/AttrList.inc" NUM_ATTRS }; diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index b73ac1f..9a4c768 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -443,7 +443,7 @@ BUILTIN(__builtin_dwarf_sp_column, "Ui", "n") BUILTIN(__builtin_extend_pointer, "ULLiv*", "n") // _Unwind_Word == uint64_t // GCC Object size checking builtins -BUILTIN(__builtin_object_size, "zv*i", "n") +BUILTIN(__builtin_object_size, "zvC*i", "n") BUILTIN(__builtin___memcpy_chk, "v*v*vC*zz", "nF") BUILTIN(__builtin___memmove_chk, "v*v*vC*zz", "nF") BUILTIN(__builtin___mempcpy_chk, "v*v*vC*zz", "nF") @@ -577,6 +577,13 @@ BUILTIN(__sync_lock_release_4, "viD*.", "n") BUILTIN(__sync_lock_release_8, "vLLiD*.", "n") BUILTIN(__sync_lock_release_16, "vLLLiD*.", "n") +BUILTIN(__sync_swap, "v.", "") +BUILTIN(__sync_swap_1, "ccD*c.", "n") +BUILTIN(__sync_swap_2, "ssD*s.", "n") +BUILTIN(__sync_swap_4, "iiD*i.", "n") +BUILTIN(__sync_swap_8, "LLiLLiD*LLi.", "n") +BUILTIN(__sync_swap_16, "LLLiLLLiD*LLLi.", "n") + // Non-overloaded atomic builtins. diff --git a/include/clang/Basic/BuiltinsPTX.def b/include/clang/Basic/BuiltinsPTX.def new file mode 100644 index 0000000..f90a43f --- /dev/null +++ b/include/clang/Basic/BuiltinsPTX.def @@ -0,0 +1,62 @@ +//===--- BuiltinsPTX.def - PTX Builtin function database ----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the PTX-specific builtin function database. Users of +// this file must define the BUILTIN macro to make use of this information. +// +//===----------------------------------------------------------------------===// + +// The format of this database matches clang/Basic/Builtins.def. + +BUILTIN(__builtin_ptx_read_tid_x, "i", "nc") +BUILTIN(__builtin_ptx_read_tid_y, "i", "nc") +BUILTIN(__builtin_ptx_read_tid_z, "i", "nc") +BUILTIN(__builtin_ptx_read_tid_w, "i", "nc") + +BUILTIN(__builtin_ptx_read_ntid_x, "i", "nc") +BUILTIN(__builtin_ptx_read_ntid_y, "i", "nc") +BUILTIN(__builtin_ptx_read_ntid_z, "i", "nc") +BUILTIN(__builtin_ptx_read_ntid_w, "i", "nc") + +BUILTIN(__builtin_ptx_read_ctaid_x, "i", "nc") +BUILTIN(__builtin_ptx_read_ctaid_y, "i", "nc") +BUILTIN(__builtin_ptx_read_ctaid_z, "i", "nc") +BUILTIN(__builtin_ptx_read_ctaid_w, "i", "nc") + +BUILTIN(__builtin_ptx_read_nctaid_x, "i", "nc") +BUILTIN(__builtin_ptx_read_nctaid_y, "i", "nc") +BUILTIN(__builtin_ptx_read_nctaid_z, "i", "nc") +BUILTIN(__builtin_ptx_read_nctaid_w, "i", "nc") + +BUILTIN(__builtin_ptx_read_laneid, "i", "nc") +BUILTIN(__builtin_ptx_read_warpid, "i", "nc") +BUILTIN(__builtin_ptx_read_nwarpid, "i", "nc") + +BUILTIN(__builtin_ptx_read_smid, "i", "nc") +BUILTIN(__builtin_ptx_read_nsmid, "i", "nc") +BUILTIN(__builtin_ptx_read_gridid, "i", "nc") + +BUILTIN(__builtin_ptx_read_lanemask_eq, "i", "nc") +BUILTIN(__builtin_ptx_read_lanemask_le, "i", "nc") +BUILTIN(__builtin_ptx_read_lanemask_lt, "i", "nc") +BUILTIN(__builtin_ptx_read_lanemask_ge, "i", "nc") +BUILTIN(__builtin_ptx_read_lanemask_gt, "i", "nc") + +BUILTIN(__builtin_ptx_read_clock, "i", "n") +BUILTIN(__builtin_ptx_read_clock64, "Li", "n") + +BUILTIN(__builtin_ptx_read_pm0, "i", "n") +BUILTIN(__builtin_ptx_read_pm1, "i", "n") +BUILTIN(__builtin_ptx_read_pm2, "i", "n") +BUILTIN(__builtin_ptx_read_pm3, "i", "n") + +BUILTIN(__builtin_ptx_bar_sync, "vi", "n") + + +#undef BUILTIN diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index da106da..2c2a84a 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -24,6 +24,37 @@ // FIXME: Are these nothrow/const? +// 3DNow! +// +BUILTIN(__builtin_ia32_pavgusb, "V8cV8cV8c", "nc") +BUILTIN(__builtin_ia32_pf2id, "V2iV2f", "nc") +BUILTIN(__builtin_ia32_pfacc, "V2fV2fV2f", "nc") +BUILTIN(__builtin_ia32_pfadd, "V2fV2fV2f", "nc") +BUILTIN(__builtin_ia32_pfcmpeq, "V2iV2fV2f", "nc") +BUILTIN(__builtin_ia32_pfcmpge, "V2iV2fV2f", "nc") +BUILTIN(__builtin_ia32_pfcmpgt, "V2iV2fV2f", "nc") +BUILTIN(__builtin_ia32_pfmax, "V2fV2fV2f", "nc") +BUILTIN(__builtin_ia32_pfmin, "V2fV2fV2f", "nc") +BUILTIN(__builtin_ia32_pfmul, "V2fV2fV2f", "nc") +BUILTIN(__builtin_ia32_pfrcp, "V2fV2f", "nc") +BUILTIN(__builtin_ia32_pfrcpit1, "V2fV2fV2f", "nc") +BUILTIN(__builtin_ia32_pfrcpit2, "V2fV2fV2f", "nc") +BUILTIN(__builtin_ia32_pfrsqrt, "V2fV2f", "nc") +BUILTIN(__builtin_ia32_pfrsqit1, "V2fV2fV2f", "nc") +// GCC has pfrsqrtit1, even though this is not the name of the instruction. +BUILTIN(__builtin_ia32_pfrsqrtit1, "V2fV2fV2f", "nc") +BUILTIN(__builtin_ia32_pfsub, "V2fV2fV2f", "nc") +BUILTIN(__builtin_ia32_pfsubr, "V2fV2fV2f", "nc") +BUILTIN(__builtin_ia32_pi2fd, "V2fV2i", "nc") +BUILTIN(__builtin_ia32_pmulhrw, "V4sV4sV4s", "nc") +// 3DNow! Extensions. +BUILTIN(__builtin_ia32_pf2iw, "V2iV2f", "nc") +BUILTIN(__builtin_ia32_pfnacc, "V2fV2fV2f", "nc") +BUILTIN(__builtin_ia32_pfpnacc, "V2fV2fV2f", "nc") +BUILTIN(__builtin_ia32_pi2fw, "V2fV2i", "nc") +BUILTIN(__builtin_ia32_pswapdsf, "V2fV2f", "nc") +BUILTIN(__builtin_ia32_pswapdsi, "V2iV2i", "nc") + // MMX // // FIXME: All MMX instructions will be generated via builtins. Any MMX vector @@ -209,7 +240,6 @@ BUILTIN(__builtin_ia32_cvtps2pi, "V2iV4f", "") BUILTIN(__builtin_ia32_cvtss2si, "iV4f", "") BUILTIN(__builtin_ia32_cvtss2si64, "LLiV4f", "") BUILTIN(__builtin_ia32_cvttps2pi, "V2iV4f", "") -BUILTIN(__builtin_ia32_loadups, "V4ffC*", "") BUILTIN(__builtin_ia32_storeups, "vf*V4f", "") BUILTIN(__builtin_ia32_storehps, "vV2i*V4f", "") BUILTIN(__builtin_ia32_storelps, "vV2i*V4f", "") @@ -223,7 +253,6 @@ BUILTIN(__builtin_ia32_rsqrtss, "V4fV4f", "") BUILTIN(__builtin_ia32_sqrtps, "V4fV4f", "") BUILTIN(__builtin_ia32_sqrtss, "V4fV4f", "") BUILTIN(__builtin_ia32_maskmovdqu, "vV16cV16cc*", "") -BUILTIN(__builtin_ia32_loadupd, "V2ddC*", "") BUILTIN(__builtin_ia32_storeupd, "vd*V2d", "") BUILTIN(__builtin_ia32_movmskpd, "iV2d", "") BUILTIN(__builtin_ia32_pmovmskb128, "iV16c", "") @@ -342,10 +371,10 @@ BUILTIN(__builtin_ia32_pcmpestriz128, "iV16ciV16cic","") BUILTIN(__builtin_ia32_pcmpgtq, "V2LLiV2LLiV2LLi", "") -BUILTIN(__builtin_ia32_crc32qi, "iic", "") -BUILTIN(__builtin_ia32_crc32hi, "iis", "") -BUILTIN(__builtin_ia32_crc32si, "iii", "") -BUILTIN(__builtin_ia32_crc32di, "LLiLLiLLi", "") +BUILTIN(__builtin_ia32_crc32qi, "UiUiUc", "") +BUILTIN(__builtin_ia32_crc32hi, "UiUiUs", "") +BUILTIN(__builtin_ia32_crc32si, "UiUiUi", "") +BUILTIN(__builtin_ia32_crc32di, "ULLiULLiULLi", "") // AES BUILTIN(__builtin_ia32_aesenc128, "V2LLiV2LLiV2LLi", "") diff --git a/include/clang/Basic/CMakeLists.txt b/include/clang/Basic/CMakeLists.txt index 19066e4..df49dc6 100644 --- a/include/clang/Basic/CMakeLists.txt +++ b/include/clang/Basic/CMakeLists.txt @@ -17,6 +17,10 @@ clang_tablegen(DiagnosticGroups.inc -gen-clang-diag-groups SOURCE Diagnostic.td TARGET ClangDiagnosticGroups) +clang_tablegen(DiagnosticIndexName.inc -gen-clang-diags-index-name + SOURCE Diagnostic.td + TARGET ClangDiagnosticIndexName) + clang_tablegen(AttrList.inc -gen-clang-attr-list -I ${CMAKE_CURRENT_SOURCE_DIR}/../../ SOURCE Attr.td diff --git a/include/clang/Basic/ConvertUTF.h b/include/clang/Basic/ConvertUTF.h index 4da2ad75..d928f9d 100644 --- a/include/clang/Basic/ConvertUTF.h +++ b/include/clang/Basic/ConvertUTF.h @@ -87,6 +87,9 @@ ------------------------------------------------------------------------ */ +#ifndef CLANG_BASIC_CONVERTUTF_H +#define CLANG_BASIC_CONVERTUTF_H + /* --------------------------------------------------------------------- The following 4 definitions are compiler-specific. The C standard does not guarantee that wchar_t has at least @@ -156,4 +159,6 @@ Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd); } #endif +#endif + /* --------------------------------------------------------------------- */ diff --git a/include/clang/Basic/DeclNodes.td b/include/clang/Basic/DeclNodes.td index 2ec7427..9e69492 100644 --- a/include/clang/Basic/DeclNodes.td +++ b/include/clang/Basic/DeclNodes.td @@ -17,7 +17,9 @@ def Named : Decl<1>; def NamespaceAlias : DDecl<Named>; def Label : DDecl<Named>; def Type : DDecl<Named, 1>; - def Typedef : DDecl<Type>; + def TypedefName : DDecl<Type, 1>; + def Typedef : DDecl<TypedefName>; + def TypeAlias : DDecl<TypedefName>; def UnresolvedUsingTypename : DDecl<Type>; def Tag : DDecl<Type, 1>, DeclContext; def Enum : DDecl<Tag>; diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 3fc60d1..7fc400f 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -585,7 +585,7 @@ private: /// DiagArgumentsVal - The values for the various substitution positions. This /// is used when the argument is not an std::string. The specific value is - /// mangled into an intptr_t and the intepretation depends on exactly what + /// mangled into an intptr_t and the interpretation depends on exactly what /// sort of argument kind it is. intptr_t DiagArgumentsVal[MaxArguments]; @@ -741,9 +741,6 @@ public: } void AddFixItHint(const FixItHint &Hint) const { - if (Hint.isNull()) - return; - assert(NumFixItHints < Diagnostic::MaxFixItHints && "Too many fix-it hints!"); if (DiagObj) diff --git a/include/clang/Basic/Diagnostic.td b/include/clang/Basic/Diagnostic.td index be510ed..50a22c4 100644 --- a/include/clang/Basic/Diagnostic.td +++ b/include/clang/Basic/Diagnostic.td @@ -18,6 +18,8 @@ def MAP_IGNORE : DiagMapping; def MAP_WARNING : DiagMapping; def MAP_ERROR : DiagMapping; def MAP_FATAL : DiagMapping; +def MAP_WARNING_NO_WERROR : DiagMapping; +def MAP_WARNING_SHOW_IN_SYSTEM_HEADER : DiagMapping; // Define the diagnostic classes. class DiagClass; @@ -60,6 +62,8 @@ class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> { DiagMapping DefaultMapping = defaultmapping; DiagGroup Group; string CategoryName = ""; + string Brief = ""; + string Explanation = ""; } class Error<string str> : Diagnostic<str, CLASS_ERROR, MAP_ERROR>; @@ -73,10 +77,20 @@ class DefaultIgnore { DiagMapping DefaultMapping = MAP_IGNORE; } class DefaultWarn { DiagMapping DefaultMapping = MAP_WARNING; } class DefaultError { DiagMapping DefaultMapping = MAP_ERROR; } class DefaultFatal { DiagMapping DefaultMapping = MAP_FATAL; } +class DefaultWarnNoWerror { DiagMapping DefaultMapping= MAP_WARNING_NO_WERROR; } +class DefaultWarnShowInSystemHeader { + DiagMapping DefaultMapping = MAP_WARNING_SHOW_IN_SYSTEM_HEADER; +} class NoSFINAE { bit SFINAE = 0; } class AccessControl { bit AccessControl = 1; } +class Brief<string str> { string Brief = str; } +class FullExplanation<string brief, string full> { + string Brief = brief; + string Explanation = full; +} + // Definitions for Diagnostics. include "DiagnosticASTKinds.td" include "DiagnosticAnalysisKinds.td" diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td index 85c64c5..0b0bca0 100644 --- a/include/clang/Basic/DiagnosticCommonKinds.td +++ b/include/clang/Basic/DiagnosticCommonKinds.td @@ -45,6 +45,8 @@ 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 warn_method_param_declaration : Warning<"redeclaration of method parameter %0">, + InGroup<DuplicateArgDecl>, DefaultIgnore; 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">; diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index ef1c9e7..908a69b 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -39,8 +39,10 @@ def err_drv_invalid_darwin_version : Error< "invalid Darwin version number: %0">; def err_drv_missing_argument : Error< "argument to '%0' is missing (expected %1 %plural{1:value|:values}1)">; -def err_drv_invalid_Xarch_argument : Error< - "invalid Xarch argument: '%0'">; +def err_drv_invalid_Xarch_argument_with_args : Error< + "invalid Xarch argument: '%0', options requiring arguments are unsupported">; +def err_drv_invalid_Xarch_argument_isdriver : Error< + "invalid Xarch argument: '%0', cannot change driver behavior inside Xarch argument">; def err_drv_argument_only_allowed_with : Error< "invalid argument '%0' only allowed with '%1'">; def err_drv_argument_not_allowed_with : Error< @@ -76,6 +78,10 @@ def err_drv_cc_print_options_failure : Error< "unable to open CC_PRINT_OPTIONS file: %0">; def err_drv_preamble_format : Error< "incorrect format for -preamble-bytes=N,END">; +def err_drv_conflicting_deployment_targets : Error< + "conflicting deployment targets, both '%0' and '%1' are present in environment">; +def err_drv_invalid_arch_for_deployment_target : Error< + "invalid architecture '%0' for deployment target '%1'">; def warn_c_kext : Warning< "ignoring -fapple-kext which is valid for c++ and objective-c++ only">; diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index 3070676..67fc22e 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -79,6 +79,8 @@ 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 warn_fe_cc_log_diagnostics_failure : Warning< + "unable to open CC_LOG_DIAGNOSTICS file: %0 (using stderr)">; def err_verify_missing_start : Error< "cannot find start ('{{') of expected %0">; @@ -113,6 +115,9 @@ def warn_pch_target_triple : Error< def warn_pch_c99 : Error< "C99 support was %select{disabled|enabled}0 in PCH file but is " "currently %select{disabled|enabled}1">; +def warn_pch_c1x : Error< + "C1X support was %select{disabled|enabled}0 in PCH file but is " + "currently %select{disabled|enabled}1">; def warn_pch_cplusplus : Error< "C++ support was %select{disabled|enabled}0 in PCH file but is " "currently %select{disabled|enabled}1">; @@ -230,6 +235,9 @@ def warn_pch_gnu_inline : Error< def warn_pch_no_inline : Error< "the macro '__NO_INLINE__' was %select{not defined|defined}0 in " "the PCH file but is currently %select{undefined|defined}1">; +def warn_pch_deprecated : Error< + "the macro '__DEPRECATED' was %select{not defined|defined}0 in " + "the PCH file but is currently %select{undefined|defined}1">; def warn_pch_gc_mode : Error< "the PCH file was built with %select{no||hybrid}0 garbage collection but " "the current translation unit will compiled with %select{no||hybrid}1 " diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 412fb58..c85acc5 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -24,6 +24,7 @@ def : DiagGroup<"aggregate-return">; def AmbigMemberTemplate : DiagGroup<"ambiguous-member-template">; def : DiagGroup<"attributes">; def : DiagGroup<"bad-function-cast">; +def Availability : DiagGroup<"availability">; def BoolConversions : DiagGroup<"bool-conversions">; def CXXCompat: DiagGroup<"c++-compat">; def CastAlign : DiagGroup<"cast-align">; @@ -54,6 +55,7 @@ def CXXHexFloats : DiagGroup<"c++-hex-floats">; def : DiagGroup<"c++0x-compat", [CXXHexFloats]>; def : DiagGroup<"effc++">; +def ExitTimeDestructors : DiagGroup<"exit-time-destructors">; def FourByteMultiChar : DiagGroup<"four-char-constants">; def GlobalConstructors : DiagGroup<"global-constructors">; def : DiagGroup<"idiomatic-parentheses">; @@ -94,6 +96,8 @@ def Padded : DiagGroup<"padded">; def PointerArith : DiagGroup<"pointer-arith">; def PoundWarning : DiagGroup<"#warnings">, DiagCategory<"#warning Directive">; +def PoundPragmaMessage : DiagGroup<"#pragma messages">, + DiagCategory<"#pragma message Directive">; def : DiagGroup<"pointer-to-int-cast">; def : DiagGroup<"redundant-decls">; def ReturnType : DiagGroup<"return-type">; @@ -109,6 +113,7 @@ def : DiagGroup<"stack-protector">; def : DiagGroup<"switch-default">; def : DiagGroup<"synth">; def TautologicalCompare : DiagGroup<"tautological-compare">; +def HeaderHygiene : DiagGroup<"header-hygiene">; // Preprocessor warnings. def : DiagGroup<"builtin-macro-redefined">; @@ -137,13 +142,17 @@ def Trigraphs : DiagGroup<"trigraphs">; def : DiagGroup<"type-limits">; def Uninitialized : DiagGroup<"uninitialized">; +def UninitializedMaybe : DiagGroup<"conditional-uninitialized">; def UnknownPragmas : DiagGroup<"unknown-pragmas">; def UnknownAttributes : DiagGroup<"unknown-attributes">; def UnnamedTypeTemplateArgs : DiagGroup<"unnamed-type-template-args">; def UnusedArgument : DiagGroup<"unused-argument">; def UnusedExceptionParameter : DiagGroup<"unused-exception-parameter">; -def UnusedFunction : DiagGroup<"unused-function">; -def UnusedMemberFunction : DiagGroup<"unused-member-function">; +def UnneededInternalDecl : DiagGroup<"unneeded-internal-declaration">; +def UnneededMemberFunction : DiagGroup<"unneeded-member-function">; +def UnusedFunction : DiagGroup<"unused-function", [UnneededInternalDecl]>; +def UnusedMemberFunction : DiagGroup<"unused-member-function", + [UnneededMemberFunction]>; def UnusedLabel : DiagGroup<"unused-label">; def UnusedParameter : DiagGroup<"unused-parameter">; def UnusedValue : DiagGroup<"unused-value">; @@ -165,17 +174,22 @@ def VariadicMacros : DiagGroup<"variadic-macros">; def VectorConversions : DiagGroup<"vector-conversions">; // clang specific def VLA : DiagGroup<"vla">; def VolatileRegisterVar : DiagGroup<"volatile-register-var">; -def : DiagGroup<"write-strings">; + +// GCC calls -Wdeprecated-writable-strings -Wwrite-strings. +def GCCWriteStrings : DiagGroup<"write-strings" , [DeprecatedWritableStr]>; + def CharSubscript : DiagGroup<"char-subscripts">; def LargeByValueCopy : DiagGroup<"large-by-value-copy">; +def DuplicateArgDecl : DiagGroup<"duplicate-method-arg">; // Aggregation warning settings. // -Widiomatic-parentheses contains warnings about 'idiomatic' -// missing parentheses; it is off by default. +// missing parentheses; it is off by default. We do not include it +// in -Wparentheses because most users who use -Wparentheses explicitly +// do not want these warnings. def Parentheses : DiagGroup<"parentheses", - [LogicalOpParentheses, - DiagGroup<"idiomatic-parentheses">]>; + [LogicalOpParentheses]>; // -Wconversion has its own warnings, but we split a few out for // legacy reasons: @@ -187,6 +201,7 @@ def Conversion : DiagGroup<"conversion", [DiagGroup<"shorten-64-to-32">, DiagGroup<"constant-conversion">, DiagGroup<"literal-conversion">, + DiagGroup<"sign-conversion">, BoolConversions]>, DiagCategory<"Value Conversion Issue">; @@ -253,7 +268,9 @@ def NonGCC : DiagGroup<"non-gcc", // A warning group for warnings about using C++0x features as extensions in // earlier C++ versions. -def CXX0x : DiagGroup<"c++0x-extensions">; +def CXX0xStaticNonIntegralInitializer : + DiagGroup<"c++0x-static-nonintegral-init">; +def CXX0x : DiagGroup<"c++0x-extensions", [CXX0xStaticNonIntegralInitializer]>; // A warning group for warnings about GCC extensions. def GNU : DiagGroup<"gnu", [GNUDesignator, VLA]>; diff --git a/include/clang/Basic/DiagnosticIDs.h b/include/clang/Basic/DiagnosticIDs.h index 2b03cae..0296b96 100644 --- a/include/clang/Basic/DiagnosticIDs.h +++ b/include/clang/Basic/DiagnosticIDs.h @@ -42,7 +42,8 @@ namespace clang { // Get typedefs for common diagnostics. enum { -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,SFINAE,ACCESS,CATEGORY) ENUM, +#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ + SFINAE,ACCESS,CATEGORY,BRIEF,FULL) ENUM, #include "clang/Basic/DiagnosticCommonKinds.inc" NUM_BUILTIN_COMMON_DIAGNOSTICS #undef DIAG @@ -63,9 +64,12 @@ namespace clang { /// 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 "warning", but make it immune to + /// -Wno-system-headers. + MAP_WARNING_SHOW_IN_SYSTEM_HEADER = 6, /// Map this diagnostic to "error", but make it immune to -Wfatal-errors. /// This happens for -Wno-fatal-errors=foo. - MAP_ERROR_NO_WFATAL = 6 + MAP_ERROR_NO_WFATAL = 7 }; } @@ -99,7 +103,7 @@ public: /// issue. const char *getDescription(unsigned DiagID) const; - /// isNoteWarningOrExtension - Return true if the unmapped diagnostic + /// isBuiltinWarningOrExtension - 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. @@ -130,7 +134,7 @@ public: /// the diagnostic, this returns null. static const char *getWarningOptionForDiag(unsigned DiagID); - /// getWarningOptionForDiag - Return the category number that a specified + /// getCategoryNumberForDiag - Return the category number that a specified /// DiagID belongs to, or 0 if no category. static unsigned getCategoryNumberForDiag(unsigned DiagID); @@ -174,6 +178,20 @@ public: /// are not SFINAE errors. static SFINAEResponse getDiagnosticSFINAEResponse(unsigned DiagID); + /// getName - Given a diagnostic ID, return its name + static const char *getName(unsigned DiagID); + + /// getIdFromName - Given a diagnostic name, return its ID, or 0 + static unsigned getIdFromName(char const *Name); + + /// getBriefExplanation - Given a diagnostic ID, return a brief explanation + /// of the issue + static const char *getBriefExplanation(unsigned DiagID); + + /// getFullExplanation - Given a diagnostic ID, return a full explanation + /// of the issue + static const char *getFullExplanation(unsigned DiagID); + private: /// setDiagnosticGroupMapping - Change an entire diagnostic group (e.g. /// "unknown-pragmas" to have the specified mapping. This returns true and diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index 6d1d9b6..3514cca 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -114,7 +114,8 @@ def err_invalid_pth_file : Error< //===----------------------------------------------------------------------===// // Preprocessor Diagnostics //===----------------------------------------------------------------------===// -def pp_hash_warning : Warning<"#warning%0">, InGroup<PoundWarning>; +def pp_hash_warning : Warning<"#warning%0">, + InGroup<PoundWarning>, DefaultWarnShowInSystemHeader; def pp_include_next_in_primary : Warning< "#include_next in primary source file">; def pp_include_macros_out_of_predefines : Error< @@ -239,7 +240,8 @@ def err_pragma_push_pop_macro_malformed : Error< "pragma %0 requires a parenthesized string">; def warn_pragma_pop_macro_no_push : Warning< "pragma pop_macro could not pop '%0', no matching push_macro">; -def warn_pragma_message : Warning<"%0">; +def warn_pragma_message : Warning<"%0">, + InGroup<PoundPragmaMessage>, DefaultWarnNoWerror; def warn_pragma_ignored : Warning<"unknown pragma ignored">, InGroup<UnknownPragmas>, DefaultIgnore; def ext_stdc_pragma_ignored : ExtWarn<"unknown pragma in STDC namespace">, @@ -247,8 +249,8 @@ def ext_stdc_pragma_ignored : ExtWarn<"unknown pragma in STDC namespace">, def ext_on_off_switch_syntax : ExtWarn<"expected 'ON' or 'OFF' or 'DEFAULT' in pragma">, InGroup<UnknownPragmas>; -def ext_pragma_syntax_eom : - ExtWarn<"expected end of macro in pragma">, +def ext_pragma_syntax_eod : + ExtWarn<"expected end of directive 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 9a68af9..c37e510 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -67,6 +67,13 @@ def ext_ms_enum_fixed_underlying_type : Extension< "enumeration types with a fixed underlying type are a Microsoft extension">, InGroup<Microsoft>; +def ext_c1x_generic_selection : Extension< + "generic selections are a C1X-specific feature">; +def err_duplicate_default_assoc : Error< + "duplicate default generic association">; +def note_previous_default_assoc : Note< + "previous default generic association is here">; + def ext_gnu_indirect_goto : Extension< "use of GNU indirect-goto extension">, InGroup<GNU>; def ext_gnu_address_of_label : Extension< @@ -111,7 +118,7 @@ def err_expected_semi_declaration : Error< "expected ';' at end of declaration">; def err_expected_semi_decl_list : Error< "expected ';' at end of declaration list">; -def ext_expected_semi_decl_list : Extension< +def ext_expected_semi_decl_list : ExtWarn< "expected ';' at end of declaration list">; def err_expected_member_name_or_semi : Error< "expected member name or ';' after declaration specifiers">; @@ -119,6 +126,10 @@ def err_function_declared_typedef : Error< "function definition declared 'typedef'">; def err_iboutletcollection_builtintype : Error< "type argument of iboutletcollection attribute cannot be a builtin type">; + +def err_at_defs_cxx : Error<"@defs is not supported in Objective-C++">; +def err_at_in_class : Error<"unexpected '@' in member specification">; + def err_expected_fn_body : Error< "expected function body after function declarator">; def err_expected_method_body : Error<"expected method body">; @@ -130,6 +141,7 @@ 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">; def err_expected_less_after : Error<"expected '<' after '%0'">; +def err_expected_equal_after : Error<"expected '=' after %0">; def err_expected_comma : Error<"expected ','">; def err_expected_lbrace_in_compound_literal : Error< "expected '{' in compound literal">; @@ -178,6 +190,9 @@ 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 ext_generalized_initializer_lists : ExtWarn< + "generalized initializer lists are a C++0x extension unsupported in Clang">, + InGroup<CXX0x>; def err_argument_required_after_attribute : Error< "argument required after attribute">; def err_missing_param : Error<"expected parameter declarator">; @@ -189,6 +204,9 @@ def err_expected_class_name : Error<"expected class name">; def err_unspecified_vla_size_with_static : Error< "'static' may not be used with an unspecified variable length array size">; +def err_expected_case_before_expression: Error< + "expected 'case' keyword before expression">; + // Declarations. def err_typename_requires_specqual : Error< "type name requires a specifier or qualifier">; @@ -226,6 +244,8 @@ def err_unexected_colon_in_nested_name_spec : Error< "unexpected ':' in nested name specifier">; def err_bool_redeclaration : Error< "redeclaration of C++ built-in type 'bool'">; +def ext_c1x_static_assert : Extension< + "_Static_assert is a C1X-specific feature">; /// Objective-C parser diagnostics def err_expected_minus_or_plus : Error< @@ -266,7 +286,7 @@ def err_missing_id_definition : Error<"cannot find definition of 'id'">; def err_missing_proto_definition : Error< "cannot find definition of 'Protocol'">; def err_missing_class_definition : Error<"cannot find definition of 'Class'">; -def warn_expected_implementation : Warning< +def err_expected_implementation : Error< "@end must appear in an @implementation context">; def error_property_ivar_decl : Error< "property synthesize requires specification of an ivar">; @@ -300,6 +320,8 @@ def err_expected_lbrace_after_base_specifiers : Error< "expected '{' after base class list">; def ext_ellipsis_exception_spec : Extension< "exception specification of '...' is a Microsoft extension">; +def err_dynamic_and_noexcept_specification : Error< + "cannot have both throw() and noexcept() clause on the same function">; def err_expected_catch : Error<"expected catch">; def err_expected_lbrace_or_comma : Error<"expected '{' or ','">; def err_using_namespace_in_class : Error< @@ -363,6 +385,8 @@ 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_missing_dependent_template_keyword : ExtWarn< + "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 " @@ -380,6 +404,8 @@ def err_out_of_line_type_names_constructor : Error< def err_expected_qualified_after_typename : Error< "expected a qualified name after 'typename'">; +def warn_expected_qualified_after_typename : ExtWarn< + "expected a qualified name after 'typename'">; def err_expected_semi_after_tagdecl : Error< "expected ';' after %0">; @@ -401,15 +427,23 @@ def err_ctor_init_missing_comma : Error< // C++ declarations def err_friend_decl_defines_class : Error< "cannot define a type in a friend declaration">; +def err_missing_whitespace_digraph : Error< + "found '<::' after a " + "%select{template name|const_cast|dynamic_cast|reinterpret_cast|static_cast}0" + " which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?">; def warn_deleted_function_accepted_as_extension: ExtWarn< "deleted function definition accepted as a C++0x extension">, InGroup<CXX0x>; +// C++0x alias-declaration +def ext_alias_declaration : ExtWarn< + "alias declarations accepted as a C++0x extension">, InGroup<CXX0x>; +def err_alias_declaration_not_identifier : Error< + "name defined in alias declaration must be an identifier">; + // 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'">; @@ -426,6 +460,23 @@ def err_paren_sizeof_parameter_pack : Error< def err_sizeof_parameter_pack : Error< "expected parenthesized parameter pack name in 'sizeof...' expression">; +// Availability attribute +def err_expected_version : Error< + "expected a version of the form 'major[.minor[.subminor]]'">; +def err_zero_version : Error< + "version number must have non-zero major, minor, or sub-minor version">; +def err_availability_expected_platform : Error< + "expected a platform name, e.g., 'macosx'">; +def err_availability_expected_change : Error< + "expected 'introduced', 'deprecated', or 'obsoleted'">; +def err_availability_unknown_change : Error< + "%0 is not an availability stage; use 'introduced', 'deprecated', or " + "'obsoleted'">; +def err_availability_redundant : Error< + "redundant %0 availability change; only the last specified change will " "be used">; +def warn_availability_and_unavailable : Warning< + "'unavailable' availability overrides all other availability information">; + // Language specific pragmas // - Generic warnings def warn_pragma_expected_lparen : Warning< @@ -434,6 +485,8 @@ def warn_pragma_expected_rparen : Warning< "missing ')' after '#pragma %0' - ignoring">; def warn_pragma_expected_identifier : Warning< "expected identifier in '#pragma %0' - ignored">; +def warn_pragma_ms_struct : Warning< + "incorrect use of '#pragma ms_struct on|off' - ignored">; def warn_pragma_extra_tokens_at_eol : Warning< "extra tokens at end of '#pragma %0' - ignored">; // - #pragma options @@ -468,5 +521,17 @@ def warn_pragma_expected_enable_disable : Warning< def warn_pragma_unknown_extension : Warning< "unknown OpenCL extension %0 - ignoring">; +def err_seh_expected_handler : Error< + "expected '__except' or '__finally' block">; + +def err_seh___except_block : Error< + "%0 only allowed in __except block">; + +def err_seh___except_filter : Error< + "%0 only allowed in __except filter expression">; + +def err_seh___finally_block : Error< + "%0 only allowed in __finally block">; + } // end of Parse Issue category. } // end of Parser diagnostics diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index a9fb2da..0a0c91a 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -30,6 +30,8 @@ def warn_float_overflow : Warning< def warn_float_underflow : Warning< "magnitude of floating-point constant too small for type %0; minimum is %1">, InGroup<LiteralRange>; +def warn_double_const_requires_fp64 : Warning< + "double precision constant requires cl_khr_fp64, casting to single precision">; // C99 variable-length arrays def ext_vla : Extension< @@ -57,6 +59,8 @@ def err_variably_modified_new_type : Error< // C99 Designated Initializers def ext_designated_init : Extension< + "designated initializers are a C99 feature">; +def ext_designated_init_cxx : Extension< "designated initializers are a C99 feature, accepted in C++ as an extension">; def err_array_designator_negative : Error< "array designator value '%0' is negative">; @@ -114,6 +118,12 @@ 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_unneeded_internal_decl : Warning< + "%select{function|variable}0 %1 is not needed and will not be emitted">, + InGroup<UnneededInternalDecl>, DefaultIgnore; +def warn_unneeded_member_function : Warning< + "member function %0 is not needed and will not be emitted">, + InGroup<UnneededMemberFunction>, DefaultIgnore; def warn_parameter_size: Warning< "%0 is a large (%1 bytes) pass-by-value argument; " @@ -202,6 +212,9 @@ def warn_global_constructor : Warning< def warn_global_destructor : Warning< "declaration requires a global destructor">, InGroup<GlobalConstructors>, DefaultIgnore; +def warn_exit_time_destructor : Warning< + "declaration requires an exit-time destructor">, + InGroup<ExitTimeDestructors>, DefaultIgnore; def err_invalid_thread : Error< "'__thread' is only allowed on variable declarations">; @@ -248,6 +261,11 @@ def err_builtin_definition : Error<"definition of builtin function %0">; def err_types_compatible_p_in_cplusplus : Error< "__builtin_types_compatible_p is not valid in C++">; def warn_builtin_unknown : Warning<"use of unknown builtin %0">, DefaultError; +def warn_non_pod_memset : Warning< + "destination for this memset call is a pointer to a non-POD type %0">, + InGroup<DiagGroup<"non-pod-memset">>, DefaultIgnore; +def note_non_pod_memset_silence : Note< + "explicitly cast the pointer to silence this warning">; /// main() // static/inline main() are not errors in C, just in C++. @@ -382,7 +400,7 @@ 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">; +def err_missing_atend : Error<"'@end' is missing in implementation context">; def err_objc_var_decl_inclass : Error<"cannot declare variable inside @interface or @protocol">; def error_missing_method_context : Error< @@ -540,7 +558,7 @@ def ext_using_undefined_std : ExtWarn< // C++ exception specifications def err_exception_spec_in_typedef : Error< - "exception specifications are not allowed in typedefs">; + "exception specifications are not allowed in %select{typedefs|type aliases}0">; def err_distant_exception_spec : Error< "exception specifications are not allowed beyond a single level " "of indirection">; @@ -549,6 +567,8 @@ def err_incomplete_in_exception_spec : Error< "in exception specification">; def err_mismatched_exception_spec : Error< "exception specification in declaration does not match previous declaration">; +def warn_mismatched_exception_spec : ExtWarn< + "exception specification in declaration does not match previous declaration">; def err_override_exception_spec : Error< "exception specification of overriding function is more lax than " "base version">; @@ -558,6 +578,8 @@ def err_deep_exception_specs_differ : Error< "exception specifications of %select{return|argument}0 types differ">; def warn_missing_exception_specification : Warning< "%0 is missing exception specification '%1'">; +def err_noexcept_needs_constant_expression : Error< + "argument to noexcept specifier must be a constant expression">; // C++ access checking def err_class_redeclared_with_different_access : Error< @@ -786,20 +808,28 @@ def err_destructor_redeclared : Error<"destructor cannot be redeclared">; def err_destructor_with_params : Error<"destructor cannot have any parameters">; def err_destructor_variadic : Error<"destructor cannot be variadic">; def err_destructor_typedef_name : Error< - "destructor cannot be declared using a typedef %0 of the class name">; + "destructor cannot be declared using a %select{typedef|type alias}1 %0 of the class name">; def err_destructor_name : Error< "expected the class name after '~' to name the enclosing class">; def err_destructor_class_name : Error< "expected the class name after '~' to name a destructor">; -def err_ident_in_pseudo_dtor_not_a_type : Error< - "identifier %0 in pseudo-destructor expression does not name a type">; +def err_ident_in_dtor_not_a_type : Error< + "identifier %0 in object destruction expression does not name a type">; +def err_destructor_expr_type_mismatch : Error< + "destructor type %0 in object destruction expression does not match the " + "type %1 of the object being destroyed">; +def note_destructor_type_here : Note< + "type %0 is declared here">; + +def err_destructor_template : Error< + "destructor cannot be declared as a template">; // C++ initialization def err_init_conversion_failed : Error< "cannot initialize %select{a variable|a parameter|return object|an " "exception object|a member subobject|an array element|a new value|a value|a " - "base class|a vector element}0 of type %1 with an %select{rvalue|lvalue}2 of " - "type %3">; + "base class|a constructor delegation|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 to type %0 cannot bind " "to lvalue of type %1">; @@ -854,13 +884,23 @@ def note_uninit_reference_member : Note< "uninitialized reference member is here">; def warn_field_is_uninit : Warning<"field is uninitialized when used here">, InGroup<Uninitialized>; -def warn_uninit_var : Warning<"variable %0 is possibly uninitialized when used here">, - InGroup<DiagGroup<"uninitialized-experimental">>, DefaultIgnore; +def warn_uninit_self_reference_in_init : Warning< + "variable %0 is uninitialized when used within its own initialization">, + InGroup<Uninitialized>; +def warn_uninit_var : Warning< + "variable %0 is uninitialized when used here">, + InGroup<Uninitialized>, DefaultIgnore; +def warn_maybe_uninit_var : + Warning<"variable %0 may be uninitialized when used here">, + InGroup<UninitializedMaybe>, 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; + "variable %0 is uninitialized when captured by block">, + InGroup<Uninitialized>, DefaultIgnore; +def warn_maybe_uninit_var_captured_by_block : Warning< + "variable %0 may be uninitialized when captured by block">, + InGroup<UninitializedMaybe>, 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">; @@ -905,7 +945,7 @@ def err_auto_not_allowed : Error< "'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" - "|in typedef|in function return type|here}0">; + "|in typedef|in type alias|in function return type|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< @@ -944,9 +984,6 @@ def err_final_function_overridden : Error< 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">; @@ -969,6 +1006,34 @@ 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">; +def err_delegating_initializer_alone : Error< + "an initializer for a delegating constructor must appear alone">; +def err_delegating_ctor_loop : Error< + "constructor %0 delegates to itself (possibly indirectly)">; +def err_delegating_codegen_not_implemented : Error< + "code generation for delegating constructors not implemented">; + +// C++0x range-based for loop +def err_for_range_decl_must_be_var : Error< + "for range declaration must declare a variable">; +def err_for_range_storage_class : Error< + "loop variable %0 may not be declared %select{'extern'|'static'|" + "'__private_extern__'|'auto'|'register'|'constexpr'}1">; +def err_type_defined_in_for_range : Error< + "types may not be defined in a for range declaration">; +def err_for_range_deduction_failure : Error< + "cannot use type %0 as a range">; +def err_for_range_incomplete_type : Error< + "cannot use incomplete type %0 as a range">; +def err_for_range_iter_deduction_failure : Error< + "cannot use type %0 as an iterator">; +def err_for_range_member_begin_end_mismatch : Error< + "range type %0 has '%select{begin|end}1' member but no '%select{end|begin}1' member">; +def err_for_range_begin_end_types_differ : Error< + "'begin' and 'end' must return the same type (got %0 and %1)">; +def note_for_range_type : Note<"range has type %0">; +def note_for_range_begin_end : Note< + "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">; // Objective-C++ def err_objc_decls_may_only_appear_in_global_scope : Error< @@ -982,7 +1047,10 @@ def err_attribute_can_be_applied_only_to_symbol_declaration : Error< def err_attributes_are_not_compatible : Error< "%0 and %1 attributes are not compatible">; def err_attribute_wrong_number_arguments : Error< - "attribute requires %0 argument(s)">; + "attribute %plural{0:takes no arguments|1:takes one argument|" + ":requires exactly %0 arguments}0">; +def err_attribute_too_many_arguments : Error< + "attribute takes no more than %0 argument%s0">; def err_iboutletcollection_type : Error< "invalid type %0 as argument of iboutletcollection attribute">; def err_iboutletcollection_object_type : Error< @@ -1026,6 +1094,7 @@ 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 warn_unknown_method_family : Warning<"unrecognized method family">; def err_attribute_invalid_size : Error< "vector size not an integral multiple of component size">; def err_attribute_zero_size : Error<"zero vector size">; @@ -1101,7 +1170,9 @@ def err_attribute_wrong_decl_type : Error< "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">; + "'%0' only applies to function types; type here is %1">; +def warn_pointer_attribute_wrong_type : Warning< + "'%0' only applies to pointer types; type here is %1">; def warn_gnu_inline_attribute_requires_inline : Warning< "'gnu_inline' attribute requires function to be marked 'inline'," " attribute ignored">; @@ -1119,6 +1190,15 @@ def err_cconv_varargs : Error< def err_regparm_mismatch : Error<"function declared with with regparm(%0) " "attribute was previously declared " "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">; +def err_invalid_pcs : Error<"Invalid PCS type">; + +// Availability attribute +def warn_availability_unknown_platform : Warning< + "unknown platform %0 in availability macro">; +def warn_availability_version_ordering : Warning< + "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version " + "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; " + "attribute ignored">; def warn_impcast_vector_scalar : Warning< "implicit conversion turns vector to scalar: %0 to %1">, @@ -1134,10 +1214,10 @@ def warn_impcast_float_integer : Warning< InGroup<DiagGroup<"conversion">>, DefaultIgnore; def warn_impcast_integer_sign : Warning< "implicit conversion changes signedness: %0 to %1">, - InGroup<DiagGroup<"conversion">>, DefaultIgnore; + InGroup<DiagGroup<"sign-conversion">>, DefaultIgnore; def warn_impcast_integer_sign_conditional : Warning< "operand of ? changes signedness: %0 to %1">, - InGroup<DiagGroup<"conversion">>, DefaultIgnore; + InGroup<DiagGroup<"sign-conversion">>, DefaultIgnore; def warn_impcast_integer_precision : Warning< "implicit conversion loses integer precision: %0 to %1">, InGroup<DiagGroup<"conversion">>, DefaultIgnore; @@ -1154,9 +1234,15 @@ 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 note_fix_integral_float_as_integer : Note< + "this can be rewritten as an integer literal with the exact same value">; def warn_impcast_different_enum_types : Warning< "implicit conversion from enumeration type %0 to different enumeration type " "%1">, InGroup<DiagGroup<"conversion">>; +def warn_impcast_bool_to_null_pointer : Warning< + "initialization of pointer of type %0 to NULL from a constant boolean " + "expression">, InGroup<BoolConversions>; + def warn_cast_align : Warning< "cast from %0 to %1 increases required alignment from %2 to %3">, @@ -1252,11 +1338,13 @@ def err_ident_list_in_fn_declaration : Error< def ext_param_not_declared : Extension< "parameter %0 was not declared, defaulting to type 'int'">; def err_param_typedef_of_void : Error< - "empty parameter list defined with a typedef of 'void' not allowed in C++">; + "empty parameter list defined with a %select{typedef|type alias}0 of 'void' not allowed%select{ in C++|}0">; def err_param_default_argument : Error< "C does not support default arguments">; def err_param_default_argument_redefinition : Error< "redefinition of default argument">; +def warn_param_default_argument_redefinition : ExtWarn< + "redefinition of default argument">; def err_param_default_argument_missing : Error< "missing default argument on parameter">; def err_param_default_argument_missing_name : Error< @@ -1311,11 +1399,11 @@ def err_ovl_no_viable_member_function_in_call : Error< def err_ovl_ambiguous_call : Error< "call to %0 is ambiguous">; def err_ovl_deleted_call : Error< - "call to %select{unavailable|deleted}0 function %1 %2">; + "call to %select{unavailable|deleted}0 function %1%2">; def err_ovl_ambiguous_member_call : Error< "call to member function %0 is ambiguous">; def err_ovl_deleted_member_call : Error< - "call to %select{unavailable|deleted}0 member function %1 %2">; + "call to %select{unavailable|deleted}0 member function %1%2">; def note_ovl_too_many_candidates : Note< "remaining %0 candidate%s0 omitted; " "pass -fshow-overloads=all to show them">; @@ -1327,10 +1415,6 @@ def note_ovl_candidate : Note<"candidate " "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">; @@ -1408,6 +1492,15 @@ def note_ovl_candidate_bad_addrspace : Note<"candidate " "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_gc : 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)|" + "constructor (inherited)}0%1 not viable: " + "%select{%ordinal6|'this'}5 argument (%2) has %select{no|__weak|__strong}3 " + "lifetime, but parameter has %select{no|__weak|__strong}4 lifetime">; def note_ovl_candidate_bad_cvr_this : Note<"candidate " "%select{|function|||function||||" "function (the implicit copy assignment operator)|}0 not viable: " @@ -1467,13 +1560,13 @@ 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' %2">; + "overload resolution selected %select{unavailable|deleted}0 operator '%1'%2">; 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">; + Error<"cannot resolve overloaded function %0 from context">; def err_ovl_no_viable_object_call : Error< @@ -1481,7 +1574,7 @@ def err_ovl_no_viable_object_call : Error< def err_ovl_ambiguous_object_call : Error< "call to object of type %0 is ambiguous">; def err_ovl_deleted_object_call : Error< - "call to %select{unavailable|deleted}0 function call operator in type %1 %2">; + "call to %select{unavailable|deleted}0 function call operator in type %1%2">; def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">; def err_member_call_without_object : Error< "call to non-static member function without an object argument">; @@ -1707,6 +1800,8 @@ def err_template_spec_default_arg : Error< def err_not_class_template_specialization : Error< "cannot specialize a %select{dependent template|template template " "parameter}0">; +def err_function_specialization_in_class : Error< + "cannot specialize a function %0 within class scope">; // C++ class template specializations and out-of-line definitions def err_template_spec_needs_header : Error< @@ -1777,6 +1872,9 @@ def err_template_recursion_depth_exceeded : Error< def note_template_recursion_depth : Note< "use -ftemplate-depth-N to increase recursive template instantiation depth">; +def err_template_instantiate_within_definition : Error< + "%select{implicit|explicit}0 instantiation of template %1 within its" + " own definition">; def err_template_instantiate_undefined : Error< "%select{implicit|explicit}0 instantiation of undefined template %1">; def err_implicit_instantiate_member_undefined : Error< @@ -1900,6 +1998,8 @@ def note_typename_refers_here : Note< "referenced member %0 is declared here">; def err_typename_missing : Error< "missing 'typename' prior to dependent type name '%0%1'">; +def warn_typename_missing : ExtWarn< + "missing 'typename' prior to dependent type name '%0%1'">; def ext_typename_outside_of_template : ExtWarn< "'typename' occurs outside of a template">, InGroup<CXX0x>; def err_typename_refers_to_using_value_decl : Error< @@ -1921,6 +2021,14 @@ def err_template_kw_missing : Error< def ext_template_outside_of_template : ExtWarn< "'template' keyword outside of a template">, InGroup<CXX0x>; +def err_non_type_template_in_nested_name_specifier : Error< + "qualified name refers into a specialization of function template '%0'">; +def err_template_id_not_a_type : Error< + "template name refers to non-type template '%0'">; +def note_template_declared_here : Note< + "%select{function template|class template|template template parameter}0 " + "%1 declared here">; + // C++0x Variadic Templates def err_template_param_pack_default_arg : Error< "template parameter pack cannot have a default argument">; @@ -2039,6 +2147,8 @@ def err_inline_declaration_block_scope : Error< "inline declaration of %0 not allowed in block scope">; def err_static_non_static : Error< "static declaration of %0 follows non-static declaration">; +def warn_static_non_static : ExtWarn< + "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< @@ -2054,17 +2164,17 @@ def err_redefinition_different_type : Error< def err_redefinition_different_kind : Error< "redefinition of %0 as different kind of symbol">; def err_redefinition_different_typedef : Error< - "typedef redefinition with different types (%0 vs %1)">; + "%select{typedef|type alias}0 redefinition with different types (%1 vs %2)">; def err_tag_reference_non_tag : Error< - "elaborated type refers to %select{a non-tag type|a typedef|a template}0">; + "elaborated type refers to %select{a non-tag type|a typedef|a type alias|a template}0">; def err_tag_reference_conflict : Error< "implicit declaration introduced by elaborated type conflicts with " - "%select{a declaration|a typedef|a template}0 of the same name">; + "%select{a declaration|a typedef|a type alias|a template}0 of the same name">; def err_dependent_tag_decl : Error< "%select{declaration|definition}0 of %select{struct|union|class|enum}1 " "in a dependent scope">; def err_tag_definition_of_typedef : Error< - "definition of type %0 conflicts with typedef of the same name">; + "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">; def err_conflicting_types : Error<"conflicting types for %0">; def err_nested_redefinition : Error<"nested redefinition of %0">; def err_use_with_wrong_tag : Error< @@ -2154,6 +2264,8 @@ def err_excess_initializers_in_char_array_initializer : Error< "excess elements in char array initializer">; def warn_excess_initializers_in_char_array_initializer : ExtWarn< "excess elements in char array initializer">; +def err_initializer_string_for_char_array_too_long : Error< + "initializer-string for char array is too long">; def warn_initializer_string_for_char_array_too_long : ExtWarn< "initializer-string for char array is too long">; def warn_missing_field_initializers : Warning< @@ -2180,6 +2292,8 @@ def err_bitfield_width_exceeds_type_size : Error< "size of bit-field %0 (%1 bits) exceeds size of its type (%2 bits)">; def err_anon_bitfield_width_exceeds_type_size : Error< "size of anonymous bit-field (%0 bits) exceeds size of its type (%1 bits)">; +def err_incorrect_number_of_vector_initializers : Error< + "number of elements must be either one or match the size of the vector">; // Used by C++ which allows bit-fields that are wider than the type. def warn_bitfield_width_exceeds_type_size: Warning< @@ -2212,6 +2326,8 @@ def note_protected_by_cleanup : Note< "jump bypasses initialization of variable with __attribute__((cleanup))">; def note_protected_by_vla_typedef : Note< "jump bypasses initialization of VLA typedef">; +def note_protected_by_vla_type_alias : Note< + "jump bypasses initialization of VLA type alias">; def note_protected_by_vla : Note< "jump bypasses initialization of variable length array">; def note_protected_by_objc_try : Note< @@ -2266,12 +2382,17 @@ 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< +def ext_flexible_array_empty_aggregate_ms : Extension< "flexible array member %0 in otherwise empty %select{struct|class}1 " "is a Microsoft extension">, InGroup<Microsoft>; -def ext_flexible_array_union : Extension< +def ext_flexible_array_union_ms : Extension< "flexible array member %0 in a union is a Microsoft extension">, InGroup<Microsoft>; +def ext_flexible_array_empty_aggregate_gnu : Extension< + "flexible array member %0 in otherwise empty %select{struct|class}1 " + "is a GNU extension">, InGroup<GNU>; +def ext_flexible_array_union_gnu : Extension< + "flexible array member %0 in a union is a GNU extension">, InGroup<GNU>; def err_flexible_array_init_needs_braces : Error< "flexible array requires brace-enclosed initializer">; @@ -2314,14 +2435,18 @@ def err_func_def_incomplete_result : Error< def ext_sizeof_function_type : Extension< "invalid application of 'sizeof' to a function type">, InGroup<PointerArith>; def err_sizeof_alignof_overloaded_function_type : Error< - "invalid application of '%select{sizeof|__alignof}0' to an overloaded " - "function">; + "invalid application of '%select{sizeof|__alignof|vec_step}0' to an " + "overloaded function">; def ext_sizeof_void_type : Extension< - "invalid application of '%0' to a void type">, InGroup<PointerArith>; + "invalid application of '%select{sizeof|__alignof|vec_step}0' to a void " + "type">, InGroup<PointerArith>; def err_sizeof_alignof_incomplete_type : Error< - "invalid application of '%select{sizeof|__alignof}0' to an incomplete type %1">; + "invalid application of '%select{sizeof|__alignof|vec_step}0' to an " + "incomplete type %1">; def err_sizeof_alignof_bitfield : Error< "invalid application of '%select{sizeof|__alignof}0' to bit-field">; +def err_vecstep_non_scalar_vector_type : Error< + "'vec_step' requires built-in scalar or vector type, %0 invalid">; def err_offsetof_incomplete_type : Error< "offsetof of incomplete type %0">; def err_offsetof_record_type : Error< @@ -2417,6 +2542,11 @@ def warn_subscript_is_char : Warning<"array subscript is of type 'char'">, 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_not_yet_instantiated : Error< + "no member %0 in %1; it has not yet been instantiated">; +def note_non_instantiated_member_here : Note< + "not-yet-instantiated member is declared here">; + def err_member_redeclared : Error<"class member cannot be redeclared">; def err_member_name_of_class : Error<"member %0 has the same name as its class">; def err_member_def_undefined_record : Error< @@ -2483,6 +2613,7 @@ def err_typecheck_sclass_fscope : Error< "illegal storage class on file-scoped variable">; def err_unsupported_global_register : Error< "global register variables are not supported">; +def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">; def err_typecheck_sclass_func : Error<"illegal storage class on function">; def err_static_block_func : Error< "function declared in block scope cannot have 'static' storage class">; @@ -2618,6 +2749,8 @@ 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_invalid_property_name : Error< + "%0 is not a valid property name (accessing an object of type %1)">; def err_getter_not_found : Error< "expected getter method not found on object of type %0">; def err_property_not_found_forward_class : Error< @@ -2636,6 +2769,8 @@ def ext_gnu_ptr_func_arith : Extension< InGroup<PointerArith>; def error_readonly_property_assignment : Error< "assigning to property with 'readonly' attribute not allowed">; +def error_readonly_message_assignment : Error< + "assigning to 'readonly' return result of an objective-c message not allowed">; def ext_integer_increment_complex : Extension< "ISO C does not support '++'/'--' on complex integer type %0">; def ext_integer_complement_complex : Extension< @@ -2655,9 +2790,11 @@ def err_imaginary_not_supported : Error<"imaginary types are not supported">; def warn_root_inst_method_not_found : Warning< "instance method %0 is being used on 'Class' which is not in the root class">; def warn_class_method_not_found : Warning< - "method %objcclass0 not found (return type defaults to 'id')">; + "class method %objcclass0 not found (return type defaults to 'id')">; +def warn_instance_method_on_class_found : Warning< + "instance method %0 found instead of class method %1">; def warn_inst_method_not_found : Warning< - "method %objcinstance0 not found (return type defaults to 'id')">; + "instance 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_root_class_cannot_use_super : Error< @@ -2735,9 +2872,9 @@ def err_bad_cxx_cast_generic : Error< def err_bad_cxx_cast_rvalue : Error< "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|" "functional-style cast}0 from rvalue to reference type %2">; -def err_bad_cxx_cast_const_away : Error< +def err_bad_cxx_cast_qualifiers_away : Error< "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|" - "functional-style cast}0 from %1 to %2 casts away constness">; + "functional-style cast}0 from %1 to %2 casts away qualifiers">; def err_bad_const_cast_dest : Error< "%select{const_cast||||C-style cast|functional-style cast}0 to %2, " "which is not a reference, pointer-to-object, or pointer-to-data-member">; @@ -2765,6 +2902,8 @@ def err_bad_cxx_cast_member_pointer_size : Error< "cannot %select{||reinterpret_cast||C-style cast|}0 from member pointer " "type %1 to member pointer type %2 of different size">; def err_bad_static_cast_incomplete : Error<"%0 is an incomplete type">; +def err_bad_reinterpret_cast_reference : Error< + "reinterpret_cast of a %0 to %1 needs its address which is not allowed">; // These messages don't adhere to the pattern. // FIXME: Display the path somehow better. @@ -2823,7 +2962,11 @@ 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">, InGroup<CXX0x>; - +def err_address_space_qualified_new : Error< + "'new' cannot allocate objects of type %0 in address space '%1'">; +def err_address_space_qualified_delete : Error< + "'delete' cannot delete objects of type %0 in address space '%1'">; + def err_default_init_const : Error< "default initialization of an object of const type %0" "%select{| requires a user-provided default constructor}1">; @@ -2878,6 +3021,9 @@ def warn_overloaded_virtual : Warning< InGroup<OverloadedVirtual>, DefaultIgnore; def note_hidden_overloaded_virtual_declared_here : Note< "hidden overloaded virtual function %q0 declared here">; +def warn_using_directive_in_header : Warning< + "using namespace directive in global context in header">, + InGroup<HeaderHygiene>, DefaultIgnore; def err_conditional_void_nonvoid : Error< "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand " @@ -3067,11 +3213,6 @@ def err_typecheck_incompatible_address_space : Error< " 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< - "cannot initialize a value of type %0 with an %select{rvalue|lvalue}1 " - "of type %2">; -def err_cannot_initialize_decl : Error< - "cannot initialize %0 with an %select{rvalue|lvalue}1 of type %2">; def err_typecheck_comparison_of_distinct_blocks : Error< "comparison of distinct block types (%0 and %1)">; @@ -3109,6 +3250,8 @@ def err_typecheck_call_too_few_args_at_least : Error< def err_typecheck_call_too_many_args : Error< "too many arguments to %select{function|block|method}0 call, " "expected %1, have %2">; +def note_typecheck_call_too_many_args : Note< + "%0 declared here">; def err_typecheck_call_too_many_args_at_most : Error< "too many arguments to %select{function|block|method}0 call, " "expected at most %1, have %2">; @@ -3196,6 +3339,8 @@ def warn_unused_call : Warning< def err_incomplete_type_used_in_type_trait_expr : Error< "incomplete type %0 used in type trait expression">; +def err_dimension_expr_not_constant_integer : Error< + "dimension expression does not evaluate to a constant unsigned int">; def err_expected_ident_or_lparen : Error<"expected identifier or '('">; def err_typecheck_cond_incompatible_operands_null : Error< @@ -3278,7 +3423,7 @@ 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>; + "is a C++0x extension">, InGroup<CXX0xStaticNonIntegralInitializer>; def err_in_class_initializer_non_constant : Error< "in-class initializer is not a constant expression">; @@ -3544,6 +3689,21 @@ def warn_stringcompare : Warning< "result of comparison against %select{a string literal|@encode}0 is " "unspecified (use strncmp instead)">; +// Generic selections. +def err_assoc_type_incomplete : Error< + "type %0 in generic association incomplete">; +def err_assoc_type_nonobject : Error< + "type %0 in generic association not an object type">; +def err_assoc_type_variably_modified : Error< + "type %0 in generic association is a variably modified type">; +def err_assoc_compatible_types : Error< + "type %0 in generic association compatible with previously specified type %1">; +def note_compat_assoc : Note< + "compatible type %0 specified here">; +def err_generic_sel_no_match : Error< + "controlling expression type %0 not compatible with any generic association type">; +def err_generic_sel_multi_match : Error< + "controlling expression type %0 compatible with %1 generic association types">; // Blocks @@ -3559,8 +3719,6 @@ def err_block_returning_array_function : Error< // CFString checking 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">; @@ -3722,6 +3880,8 @@ def warn_ivar_use_hidden : Warning< "local declaration of %0 hides instance variable">; def error_ivar_use_in_class_method : Error< "instance variable %0 accessed in class method">; +def error_implicit_ivar_access : Error< + "instance variable %0 cannot be accessed because 'self' has been redeclared">; def error_private_ivar_access : Error<"instance variable %0 is private">, AccessControl; def error_protected_ivar_access : Error<"instance variable %0 is protected">, @@ -3776,6 +3936,26 @@ 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">; +def err_uncasted_use_of_unknown_any : Error< + "%0 has unknown type; cast it to its declared type to use it">; +def err_uncasted_call_of_unknown_any : Error< + "%0 has unknown return type; cast the call to its declared return type">; +def err_unsupported_unknown_any_decl : Error< + "%0 has unknown type, which is unsupported for this kind of declaration">; +def err_unsupported_unknown_any_expr : Error< + "unsupported expression with unknown type">; +def err_unsupported_unknown_any_call : Error< + "call to unsupported expression with unknown type">; +def err_unknown_any_addrof : Error< + "the address of a declaration with unknown type " + "can only be cast to a pointer type">; +def err_unknown_any_var_function_type : Error< + "variable %0 with unknown type cannot be given a function type">; + +def err_filter_expression_integral : Error< + "filter expression type should be an integral value not %0">; + } // end of sema category + } // end of sema component. diff --git a/include/clang/Basic/ExceptionSpecificationType.h b/include/clang/Basic/ExceptionSpecificationType.h new file mode 100644 index 0000000..aecf6eb --- /dev/null +++ b/include/clang/Basic/ExceptionSpecificationType.h @@ -0,0 +1,39 @@ +//===--- ExceptionSpecificationType.h ---------------------------*- 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 ExceptionSpecificationType enumeration and various +// utility functions. +// +//===----------------------------------------------------------------------===// +#ifndef LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H +#define LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H + +namespace clang { + +/// \brief The various types of exception specifications that exist in C++0x. +enum ExceptionSpecificationType { + EST_None, ///< no exception specification + EST_DynamicNone, ///< throw() + EST_Dynamic, ///< throw(T1, T2) + EST_MSAny, ///< Microsoft throw(...) extension + EST_BasicNoexcept, ///< noexcept + EST_ComputedNoexcept ///< noexcept(expression) +}; + +inline bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType) { + return ESpecType >= EST_DynamicNone && ESpecType <= EST_MSAny; +} + +inline bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType) { + return ESpecType == EST_BasicNoexcept || ESpecType == EST_ComputedNoexcept; +} + +} // end namespace clang + +#endif // LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H diff --git a/include/clang/Basic/ExpressionTraits.h b/include/clang/Basic/ExpressionTraits.h new file mode 100644 index 0000000..403a59a --- /dev/null +++ b/include/clang/Basic/ExpressionTraits.h @@ -0,0 +1,25 @@ +//===--- ExpressionTraits.h - C++ Expression Traits Support Enumerations ----*- 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 enumerations for expression traits intrinsics. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_EXPRESSIONTRAITS_H +#define LLVM_CLANG_EXPRESSIONTRAITS_H + +namespace clang { + + enum ExpressionTrait { + ET_IsLValueExpr, + ET_IsRValueExpr + }; +} + +#endif diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h index 563157f..2ca344d 100644 --- a/include/clang/Basic/FileManager.h +++ b/include/clang/Basic/FileManager.h @@ -15,6 +15,7 @@ #define LLVM_CLANG_FILEMANAGER_H #include "clang/Basic/FileSystemOptions.h" +#include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" @@ -105,7 +106,7 @@ public: /// properties, such as uniquing files based on "inode", so that a file with two /// names (e.g. symlinked) will be treated as a single file. /// -class FileManager { +class FileManager : public llvm::RefCountedBase<FileManager> { FileSystemOptions FileSystemOpts; class UniqueDirContainer; @@ -176,10 +177,11 @@ public: /// const DirectoryEntry *getDirectory(llvm::StringRef DirName); - /// getFile - Lookup, cache, and verify the specified file (real or + /// \brief 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); + /// \param openFile if true and the file exists, it will be opened. + const FileEntry *getFile(llvm::StringRef Filename, bool openFile = false); /// \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 @@ -194,13 +196,16 @@ public: llvm::MemoryBuffer *getBufferForFile(llvm::StringRef Filename, std::string *ErrorStr = 0); + // getNoncachedStatValue - Will get the 'stat' information for the given path. + // If the path is relative, it will be resolved against the WorkingDir of the + // FileManager's FileSystemOptions. + bool getNoncachedStatValue(llvm::StringRef Path, struct stat &StatBuf); + /// \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); + void FixupRelativePath(llvm::SmallVectorImpl<char> &path) const; - /// \brief Produce an array mapping from the unique IDs assigned to each /// file to the corresponding FileEntry pointer. void GetUniqueIDMapping( diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index d576643..683ec83 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -255,6 +255,25 @@ private: } }; +/// \brief an RAII object for [un]poisoning an identifier +/// within a certain scope. II is allowed to be null, in +/// which case, objects of this type have no effect. +class PoisonIdentifierRAIIObject { + IdentifierInfo *const II; + const bool OldValue; +public: + PoisonIdentifierRAIIObject(IdentifierInfo *II, bool NewValue) + : II(II), OldValue(II ? II->isPoisoned() : false) { + if(II) + II->setIsPoisoned(NewValue); + } + + ~PoisonIdentifierRAIIObject() { + if(II) + II->setIsPoisoned(OldValue); + } +}; + /// \brief An iterator that walks over all of the known identifiers /// in the lookup table. /// @@ -325,7 +344,7 @@ public: /// IdentifierTable - This table implements an efficient mapping from strings to /// IdentifierInfo nodes. It has no other purpose, but this is an -/// extremely performance-critical piece of the code, as each occurrance of +/// extremely performance-critical piece of the code, as each occurrence of /// every identifier goes through here when lexed. class IdentifierTable { // Shark shows that using MallocAllocator is *much* slower than using this @@ -443,6 +462,52 @@ public: void AddKeywords(const LangOptions &LangOpts); }; +/// ObjCMethodFamily - A family of Objective-C methods. These +/// families have no inherent meaning in the language, but are +/// nonetheless central enough in the existing implementations to +/// merit direct AST support. While, in theory, arbitrary methods can +/// be considered to form families, we focus here on the methods +/// involving allocation and retain-count management, as these are the +/// most "core" and the most likely to be useful to diverse clients +/// without extra information. +/// +/// Both selectors and actual method declarations may be classified +/// into families. Method families may impose additional restrictions +/// beyond their selector name; for example, a method called '_init' +/// that returns void is not considered to be in the 'init' family +/// (but would be if it returned 'id'). It is also possible to +/// explicitly change or remove a method's family. Therefore the +/// method's family should be considered the single source of truth. +enum ObjCMethodFamily { + /// \brief No particular method family. + OMF_None, + + // Selectors in these families may have arbitrary arity, may be + // written with arbitrary leading underscores, and may have + // additional CamelCase "words" in their first selector chunk + // following the family name. + OMF_alloc, + OMF_copy, + OMF_init, + OMF_mutableCopy, + OMF_new, + + // These families are singletons consisting only of the nullary + // selector with the given name. + OMF_autorelease, + OMF_dealloc, + OMF_release, + OMF_retain, + OMF_retainCount +}; + +/// Enough bits to store any enumerator in ObjCMethodFamily or +/// InvalidObjCMethodFamily. +enum { ObjCMethodFamilyBitWidth = 4 }; + +/// An invalid value of ObjCMethodFamily. +enum { InvalidObjCMethodFamily = (1 << ObjCMethodFamilyBitWidth) - 1 }; + /// Selector - This smart pointer class efficiently represents Objective-C /// method names. This class will either point to an IdentifierInfo or a /// MultiKeywordSelector (which is private). This enables us to optimize @@ -479,6 +544,8 @@ class Selector { return InfoPtr & ArgFlags; } + static ObjCMethodFamily getMethodFamilyImpl(Selector sel); + public: friend class SelectorTable; // only the SelectorTable can create these friend class DeclarationName; // and the AST's DeclarationName. @@ -541,6 +608,11 @@ public: /// it as an std::string. std::string getAsString() const; + /// getMethodFamily - Derive the conventional family of this method. + ObjCMethodFamily getMethodFamily() const { + return getMethodFamilyImpl(*this); + } + static Selector getEmptyMarker() { return Selector(uintptr_t(-1)); } @@ -571,6 +643,9 @@ public: return Selector(ID, 0); } + /// Return the total amount of memory allocated for managing selectors. + size_t getTotalMemory() const; + /// constructSetterName - Return the setter name for the given /// identifier, i.e. "set" + Name where the initial character of Name /// has been capitalized. diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h index 0bd983e..a5f6789 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -34,6 +34,7 @@ public: unsigned Digraphs : 1; // C94, C99 and C++ unsigned HexFloats : 1; // C99 Hexadecimal float constants. unsigned C99 : 1; // C99 Support + unsigned C1X : 1; // C1X Support unsigned Microsoft : 1; // Microsoft extensions. unsigned Borland : 1; // Borland extensions. unsigned CPlusPlus : 1; // C++ Support @@ -56,6 +57,7 @@ public: unsigned ObjCExceptions : 1; // Support Objective-C exceptions. unsigned CXXExceptions : 1; // Support C++ exceptions. unsigned SjLjExceptions : 1; // Use setjmp-longjump exception handling. + unsigned TraditionalCPP : 1; /// Enable some traditional CPP emulation. unsigned RTTI : 1; // Support RTTI information. unsigned MSBitfields : 1; // MS-compatible structure layout @@ -87,6 +89,8 @@ public: // used (instead of C99 semantics). unsigned NoInline : 1; // Should __NO_INLINE__ be defined. + unsigned Deprecated : 1; // Should __DEPRECATED be defined. + unsigned ObjCGCBitmapPrint : 1; // Enable printing of gc's bitmap layout // for __weak/__strong ivars. @@ -112,6 +116,7 @@ public: unsigned NoConstantCFStrings : 1; // Do not do CF strings unsigned InlineVisibilityHidden : 1; // Whether inline C++ methods have // hidden visibility by default. + unsigned ParseUnknownAnytype: 1; /// Let the user write __unknown_anytype. unsigned SpellChecking : 1; // Whether to perform spell-checking for error // recovery. @@ -123,6 +128,11 @@ public: unsigned DefaultFPContract : 1; // Default setting for FP_CONTRACT // FIXME: This is just a temporary option, for testing purposes. unsigned NoBitFieldTypeAlign : 1; + unsigned FakeAddressSpaceMap : 1; // Use a fake address space map, for + // testing languages such as OpenCL. + + unsigned MRTD : 1; // -mrtd calling convention + unsigned DelayedTemplateParsing : 1; // Delayed template parsing private: // We declare multibit enums as unsigned because MSVC insists on making enums @@ -164,10 +174,10 @@ public: AppleKext = 0; ObjCDefaultSynthProperties = 0; NoConstantCFStrings = 0; InlineVisibilityHidden = 0; - C99 = Microsoft = Borland = CPlusPlus = CPlusPlus0x = 0; + C99 = C1X = Microsoft = Borland = CPlusPlus = CPlusPlus0x = 0; CXXOperatorNames = PascalStrings = WritableStrings = ConstStrings = 0; Exceptions = ObjCExceptions = CXXExceptions = SjLjExceptions = 0; - Freestanding = NoBuiltin = 0; + TraditionalCPP = Freestanding = NoBuiltin = 0; MSBitfields = 0; NeXTRuntime = 1; RTTI = 1; @@ -205,6 +215,8 @@ public: GNUInline = 0; NoInline = 0; + Deprecated = 0; + CharIsSigned = 1; ShortWChar = 0; ShortEnums = 0; @@ -216,6 +228,10 @@ public: FastRelaxedMath = 0; DefaultFPContract = 0; NoBitFieldTypeAlign = 0; + FakeAddressSpaceMap = 0; + MRTD = 0; + DelayedTemplateParsing = 0; + ParseUnknownAnytype = 0; } GCMode getGCMode() const { return (GCMode) GC; } @@ -240,8 +256,8 @@ public: SignedOverflowBehavior = (unsigned)V; } - bool areExceptionsEnabled() const { - return Exceptions; + bool isSignedOverflowDefined() const { + return getSignedOverflowBehavior() == SOB_Defined; } }; diff --git a/include/clang/Basic/Makefile b/include/clang/Basic/Makefile index bc64f6aa..1338464 100644 --- a/include/clang/Basic/Makefile +++ b/include/clang/Basic/Makefile @@ -4,7 +4,7 @@ BUILT_SOURCES = \ DiagnosticCommonKinds.inc DiagnosticDriverKinds.inc \ DiagnosticFrontendKinds.inc DiagnosticLexKinds.inc \ DiagnosticParseKinds.inc DiagnosticSemaKinds.inc \ - DiagnosticGroups.inc AttrList.inc arm_neon.inc \ + DiagnosticIndexName.inc DiagnosticGroups.inc AttrList.inc arm_neon.inc \ Version.inc TABLEGEN_INC_FILES_COMMON = 1 @@ -33,6 +33,10 @@ $(ObjDir)/Diagnostic%Kinds.inc.tmp : Diagnostic.td Diagnostic%Kinds.td $(TBLGEN) $(Echo) "Building Clang $(patsubst Diagnostic%Kinds.inc.tmp,%,$(@F)) diagnostic tables with tblgen" $(Verb) $(TableGen) -gen-clang-diags-defs -clang-component=$(patsubst Diagnostic%Kinds.inc.tmp,%,$(@F)) -o $(call SYSPATH, $@) $< +$(ObjDir)/DiagnosticIndexName.inc.tmp : Diagnostic.td $(INPUT_TDS) $(TBLGEN) $(ObjDir)/.dir + $(Echo) "Building Clang diagnostic name index with tblgen" + $(Verb) $(TableGen) -gen-clang-diags-index-name -o $(call SYSPATH, $@) $< + $(ObjDir)/DiagnosticGroups.inc.tmp : Diagnostic.td DiagnosticGroups.td $(INPUT_TDS) $(TBLGEN) $(ObjDir)/.dir $(Echo) "Building Clang diagnostic groups with tblgen" $(Verb) $(TableGen) -gen-clang-diag-groups -o $(call SYSPATH, $@) $< diff --git a/include/clang/Basic/OpenCL.h b/include/clang/Basic/OpenCL.h new file mode 100644 index 0000000..6f9785f --- /dev/null +++ b/include/clang/Basic/OpenCL.h @@ -0,0 +1,28 @@ +//===--- OpenCL.h - OpenCL enums --------------------------------*- 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 some OpenCL-specific enums. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_BASIC_OPENCL_H +#define LLVM_CLANG_BASIC_OPENCL_H + +namespace clang { + +/// Names for the OpenCL image access qualifiers (OpenCL 1.1 6.6). +enum OpenCLImageAccess { + CLIA_read_only = 1, + CLIA_write_only = 2, + CLIA_read_write = 3 +}; + +} + +#endif diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h index c636194..7d7c089 100644 --- a/include/clang/Basic/PartialDiagnostic.h +++ b/include/clang/Basic/PartialDiagnostic.h @@ -53,7 +53,7 @@ public: /// DiagArgumentsVal - The values for the various substitution positions. /// This is used when the argument is not an std::string. The specific value - /// is mangled into an intptr_t and the intepretation depends on exactly + /// is mangled into an intptr_t and the interpretation depends on exactly /// what sort of argument kind it is. intptr_t DiagArgumentsVal[MaxArguments]; diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index 605c4bb..14bb2b7 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -16,6 +16,7 @@ #include "llvm/Support/PointerLikeTypeTraits.h" #include <utility> +#include <functional> #include <cassert> namespace llvm { @@ -295,6 +296,14 @@ public: return isBeforeInTranslationUnitThan((SourceLocation)Loc); } + /// \brief Comparison function class, useful for sorting FullSourceLocs. + struct BeforeThanCompare : public std::binary_function<FullSourceLoc, + FullSourceLoc, bool> { + bool operator()(const FullSourceLoc& lhs, const FullSourceLoc& rhs) const { + return lhs.isBeforeInTranslationUnitThan(rhs); + } + }; + /// Prints information about this FullSourceLoc to stderr. Useful for /// debugging. void dump() const { SourceLocation::dump(*SrcMgr); } diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index b1443da..c121bbb 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -19,12 +19,13 @@ #include "llvm/Support/DataTypes.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/PointerUnion.h" +#include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/Support/MemoryBuffer.h" #include <vector> #include <cassert> namespace llvm { -class MemoryBuffer; class StringRef; } @@ -66,10 +67,16 @@ namespace SrcMgr { mutable llvm::PointerIntPair<const llvm::MemoryBuffer *, 2> Buffer; public: - /// Reference to the file entry. This reference does not own - /// the FileEntry object. It is possible for this to be NULL if + /// Reference to the file entry representing this ContentCache. + /// This reference does not own the FileEntry object. + /// It is possible for this to be NULL if /// the ContentCache encapsulates an imaginary text buffer. - const FileEntry *Entry; + const FileEntry *OrigEntry; + + /// \brief References the file which the contents were actually loaded from. + /// Can be different from 'Entry' if we overridden the contents of one file + /// with the contents of another file. + const FileEntry *ContentsEntry; /// SourceLineCache - A bump pointer allocated array of offsets for each /// source line. This is lazily computed. This is owned by the @@ -104,6 +111,10 @@ namespace SrcMgr { /// this ContentCache. This can be 0 if the MemBuffer was not actually /// instantiated. unsigned getSizeBytesMapped() const; + + /// Returns the kind of memory used to back the memory buffer for + /// this content cache. This is used for performance analysis. + llvm::MemoryBuffer::BufferKind getMemoryBufferKind() const; void setBuffer(const llvm::MemoryBuffer *B) { assert(!Buffer.getPointer() && "MemoryBuffer already set."); @@ -132,17 +143,23 @@ namespace SrcMgr { } ContentCache(const FileEntry *Ent = 0) - : Buffer(0, false), Entry(Ent), SourceLineCache(0), NumLines(0) {} + : Buffer(0, false), OrigEntry(Ent), ContentsEntry(Ent), + SourceLineCache(0), NumLines(0) {} + + ContentCache(const FileEntry *Ent, const FileEntry *contentEnt) + : Buffer(0, false), OrigEntry(Ent), ContentsEntry(contentEnt), + SourceLineCache(0), NumLines(0) {} ~ContentCache(); /// The copy ctor does not allow copies where source object has either /// a non-NULL Buffer or SourceLineCache. Ownership of allocated memory - /// is not transfered, so this is a logical error. + /// is not transferred, so this is a logical error. ContentCache(const ContentCache &RHS) : Buffer(0, false), SourceLineCache(0) { - Entry = RHS.Entry; + OrigEntry = RHS.OrigEntry; + ContentsEntry = RHS.ContentsEntry; assert (RHS.Buffer.getPointer() == 0 && RHS.SourceLineCache == 0 && "Passed ContentCache object cannot own a buffer."); @@ -301,7 +318,10 @@ public: virtual ~ExternalSLocEntrySource(); /// \brief Read the source location entry with index ID. - virtual void ReadSLocEntry(unsigned ID) = 0; + /// + /// \returns true if an error occurred that prevented the source-location + /// entry from being loaded. + virtual bool ReadSLocEntry(unsigned ID) = 0; }; @@ -364,9 +384,9 @@ public: /// Spelling locations represent where the bytes corresponding to a token came /// from and instantiation locations represent where the location is in the /// user's view. In the case of a macro expansion, for example, the spelling -/// location indicates where the expanded token came from and the instantiation +/// location indicates where the expanded token came from and the instantiation /// location specifies where it was expanded. -class SourceManager { +class SourceManager : public llvm::RefCountedBase<SourceManager> { /// \brief Diagnostic object. Diagnostic &Diag; @@ -380,6 +400,13 @@ class SourceManager { /// non-null, FileEntry pointers. llvm::DenseMap<const FileEntry*, SrcMgr::ContentCache*> FileInfos; + /// \brief True if the ContentCache for files that are overriden by other + /// files, should report the original file name. Defaults to true. + bool OverridenFilesKeepOriginalName; + + /// \brief Files that have been overriden with the contents from another file. + llvm::DenseMap<const FileEntry *, const FileEntry *> OverriddenFiles; + /// MemBufferInfos - Information about various memory buffers that we have /// read in. All FileEntry* within the stored ContentCache objects are NULL, /// as they do not refer to a file. @@ -425,6 +452,9 @@ class SourceManager { // Cache results for the isBeforeInTranslationUnit method. mutable IsBeforeInTranslationUnitCache IsBeforeInTUCache; + // Cache for the "fake" buffer used for error-recovery purposes. + mutable llvm::MemoryBuffer *FakeBufferForRecovery; + // SourceManager doesn't support copy construction. explicit SourceManager(const SourceManager&); void operator=(const SourceManager&); @@ -438,6 +468,12 @@ public: FileManager &getFileManager() const { return FileMgr; } + /// \brief Set true if the SourceManager should report the original file name + /// for contents of files that were overriden by other files.Defaults to true. + void setOverridenFilesKeepOriginalName(bool value) { + OverridenFilesKeepOriginalName = value; + } + //===--------------------------------------------------------------------===// // MainFileID creation and querying methods. //===--------------------------------------------------------------------===// @@ -527,6 +563,15 @@ public: const llvm::MemoryBuffer *Buffer, bool DoNotFree = false); + /// \brief Override the the given source file with another one. + /// + /// \param SourceFile the source file which will be overriden. + /// + /// \param NewFile the file whose contents will be used as the + /// data instead of the contents of the given source file. + void overrideFileContents(const FileEntry *SourceFile, + const FileEntry *NewFile); + //===--------------------------------------------------------------------===// // FileID manipulation methods. //===--------------------------------------------------------------------===// @@ -536,18 +581,48 @@ public: /// buffer and returns a non-empty error string. const llvm::MemoryBuffer *getBuffer(FileID FID, SourceLocation Loc, bool *Invalid = 0) const { - return getSLocEntry(FID).getFile().getContentCache() - ->getBuffer(Diag, *this, Loc, Invalid); + bool MyInvalid = false; + const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &MyInvalid); + if (MyInvalid || !Entry.isFile()) { + if (Invalid) + *Invalid = true; + + return getFakeBufferForRecovery(); + } + + return Entry.getFile().getContentCache()->getBuffer(Diag, *this, Loc, + Invalid); } const llvm::MemoryBuffer *getBuffer(FileID FID, bool *Invalid = 0) const { - return getSLocEntry(FID).getFile().getContentCache() - ->getBuffer(Diag, *this, SourceLocation(), Invalid); + bool MyInvalid = false; + const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &MyInvalid); + if (MyInvalid || !Entry.isFile()) { + if (Invalid) + *Invalid = true; + + return getFakeBufferForRecovery(); + } + + return Entry.getFile().getContentCache()->getBuffer(Diag, *this, + SourceLocation(), + Invalid); } /// getFileEntryForID - Returns the FileEntry record for the provided FileID. const FileEntry *getFileEntryForID(FileID FID) const { - return getSLocEntry(FID).getFile().getContentCache()->Entry; + bool MyInvalid = false; + const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &MyInvalid); + if (MyInvalid || !Entry.isFile()) + return 0; + + return Entry.getFile().getContentCache()->OrigEntry; + } + + /// Returns the FileEntry record for the provided SLocEntry. + const FileEntry *getFileEntryForSLocEntry(const SrcMgr::SLocEntry &sloc) const + { + return sloc.getFile().getContentCache()->OrigEntry; } /// getBufferData - Return a StringRef to the source buffer data for the @@ -581,8 +656,12 @@ public: /// first byte of the specified file. SourceLocation getLocForStartOfFile(FileID FID) const { assert(FID.ID < SLocEntryTable.size() && "FileID out of range"); - assert(getSLocEntry(FID).isFile() && "FileID is not a file"); - unsigned FileOffset = getSLocEntry(FID).getOffset(); + bool Invalid = false; + const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid); + if (Invalid || !Entry.isFile()) + return SourceLocation(); + + unsigned FileOffset = Entry.getOffset(); return SourceLocation::getFileLoc(FileOffset); } @@ -775,6 +854,28 @@ public: LineTableInfo &getLineTable(); //===--------------------------------------------------------------------===// + // Queries for performance analysis. + //===--------------------------------------------------------------------===// + + /// Return the total amount of physical memory allocated by the + /// ContentCache allocator. + size_t getContentCacheSize() const { + return ContentCacheAlloc.getTotalMemory(); + } + + struct MemoryBufferSizes { + const size_t malloc_bytes; + const size_t mmap_bytes; + + MemoryBufferSizes(size_t malloc_bytes, size_t mmap_bytes) + : malloc_bytes(malloc_bytes), mmap_bytes(mmap_bytes) {} + }; + + /// Return the amount of memory used by memory buffers, breaking down + /// by heap-backed versus mmap'ed memory. + MemoryBufferSizes getMemoryBufferSizes() const; + + //===--------------------------------------------------------------------===// // Other miscellaneous methods. //===--------------------------------------------------------------------===// @@ -810,17 +911,22 @@ public: // any other external source). unsigned sloc_loaded_entry_size() const { return SLocEntryLoaded.size(); } - const SrcMgr::SLocEntry &getSLocEntry(unsigned ID) const { + const SrcMgr::SLocEntry &getSLocEntry(unsigned ID, bool *Invalid = 0) const { assert(ID < SLocEntryTable.size() && "Invalid id"); + // If we haven't loaded this source-location entry from the external source + // yet, do so now. if (ExternalSLocEntries && ID < SLocEntryLoaded.size() && - !SLocEntryLoaded[ID]) - ExternalSLocEntries->ReadSLocEntry(ID); + !SLocEntryLoaded[ID] && + ExternalSLocEntries->ReadSLocEntry(ID) && + Invalid) + *Invalid = true; + return SLocEntryTable[ID]; } - const SrcMgr::SLocEntry &getSLocEntry(FileID FID) const { - return getSLocEntry(FID.ID); + const SrcMgr::SLocEntry &getSLocEntry(FileID FID, bool *Invalid = 0) const { + return getSLocEntry(FID.ID, Invalid); } unsigned getNextOffset() const { return NextOffset; } @@ -836,6 +942,8 @@ public: void ClearPreallocatedSLocEntries(); private: + const llvm::MemoryBuffer *getFakeBufferForRecovery() const; + /// isOffsetInFileID - Return true if the specified FileID contains the /// specified SourceLocation offset. This is a very hot method. inline bool isOffsetInFileID(FileID FID, unsigned SLocOffset) const { diff --git a/include/clang/Basic/Specifiers.h b/include/clang/Basic/Specifiers.h index e6b6218..2f0ad9f 100644 --- a/include/clang/Basic/Specifiers.h +++ b/include/clang/Basic/Specifiers.h @@ -55,6 +55,7 @@ namespace clang { TST_typeofExpr, TST_decltype, // C++0x decltype TST_auto, // C++0x auto + TST_unknown_anytype, // __unknown_anytype extension TST_error // erroneous type }; diff --git a/include/clang/Basic/StmtNodes.td b/include/clang/Basic/StmtNodes.td index be0d8ff..15ac760 100644 --- a/include/clang/Basic/StmtNodes.td +++ b/include/clang/Basic/StmtNodes.td @@ -41,6 +41,7 @@ def ObjCForCollectionStmt : Stmt; // C++ statments def CXXCatchStmt : Stmt; def CXXTryStmt : Stmt; +def CXXForRangeStmt : Stmt; // Expressions def Expr : Stmt<1>; @@ -54,7 +55,7 @@ def CharacterLiteral : DStmt<Expr>; def ParenExpr : DStmt<Expr>; def UnaryOperator : DStmt<Expr>; def OffsetOfExpr : DStmt<Expr>; -def SizeOfAlignOfExpr : DStmt<Expr>; +def UnaryExprOrTypeTraitExpr : DStmt<Expr>; def ArraySubscriptExpr : DStmt<Expr>; def CallExpr : DStmt<Expr>; def MemberExpr : DStmt<Expr>; @@ -74,6 +75,7 @@ def DesignatedInitExpr : DStmt<Expr>; def ImplicitValueInitExpr : DStmt<Expr>; def ParenListExpr : DStmt<Expr>; def VAArgExpr : DStmt<Expr>; +def GenericSelectionExpr : DStmt<Expr>; // GNU Extensions. def AddrLabelExpr : DStmt<Expr>; @@ -102,6 +104,8 @@ def CXXDeleteExpr : DStmt<Expr>; def CXXPseudoDestructorExpr : DStmt<Expr>; def UnaryTypeTraitExpr : DStmt<Expr>; def BinaryTypeTraitExpr : DStmt<Expr>; +def ArrayTypeTraitExpr : DStmt<Expr>; +def ExpressionTraitExpr : DStmt<Expr>; def DependentScopeDeclRefExpr : DStmt<Expr>; def CXXConstructExpr : DStmt<Expr>; def CXXBindTemporaryExpr : DStmt<Expr>; @@ -138,4 +142,7 @@ def OpaqueValueExpr : DStmt<Expr>; // Microsoft Extensions. def CXXUuidofExpr : DStmt<Expr>; +def SEHTryStmt : Stmt; +def SEHExceptStmt : Stmt; +def SEHFinallyStmt : Stmt; diff --git a/include/clang/Basic/TargetBuiltins.h b/include/clang/Basic/TargetBuiltins.h index f1edd1d..8bc60ff 100644 --- a/include/clang/Basic/TargetBuiltins.h +++ b/include/clang/Basic/TargetBuiltins.h @@ -35,6 +35,17 @@ namespace clang { }; } + /// PTX builtins + namespace PTX { + enum { + LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, +#define BUILTIN(ID, TYPE, ATTRS) BI##ID, +#include "clang/Basic/BuiltinsPTX.def" + LastTSBuiltin + }; + } + + /// X86 builtins namespace X86 { enum { diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index b9087f2..b830bf2 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -14,18 +14,20 @@ #ifndef LLVM_CLANG_BASIC_TARGETINFO_H #define LLVM_CLANG_BASIC_TARGETINFO_H -// FIXME: Daniel isn't smart enough to use a prototype for this. +#include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" #include "llvm/Support/DataTypes.h" +#include "clang/Basic/AddressSpaces.h" +#include "clang/Basic/VersionTuple.h" #include <cassert> #include <vector> #include <string> namespace llvm { struct fltSemantics; -class StringRef; } namespace clang { @@ -56,7 +58,7 @@ enum TargetCXXABI { /// TargetInfo - This class exposes information about the current target. /// -class TargetInfo { +class TargetInfo : public llvm::RefCountedBase<TargetInfo> { llvm::Triple Triple; protected: // Target values set by the ctor of the actual target implementation. Default @@ -78,6 +80,10 @@ protected: const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat; unsigned char RegParmMax, SSERegParmMax; TargetCXXABI CXXABI; + const LangAS::Map *AddrSpaceMap; + + mutable llvm::StringRef PlatformName; + mutable VersionTuple PlatformMinVersion; unsigned HasAlignMac68kSupport : 1; unsigned RealTypeUsesObjCFPRet : 3; @@ -530,6 +536,19 @@ public: virtual const char *getStaticInitSectionSpecifier() const { return 0; } + + const LangAS::Map &getAddressSpaceMap() const { + return *AddrSpaceMap; + } + + /// \brief Retrieve the name of the platform as it is used in the + /// availability attribute. + llvm::StringRef getPlatformName() const { return PlatformName; } + + /// \brief Retrieve the minimum desired version of the platform, to + /// which the program should be compiled. + VersionTuple getPlatformMinVersion() const { return PlatformMinVersion; } + 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 b84b04d..f9d1f4e 100644 --- a/include/clang/Basic/TokenKinds.def +++ b/include/clang/Basic/TokenKinds.def @@ -38,6 +38,9 @@ #ifndef OBJC2_AT_KEYWORD #define OBJC2_AT_KEYWORD(X) #endif +#ifndef TESTING_KEYWORD +#define TESTING_KEYWORD(X, L) KEYWORD(X, L) +#endif #ifndef ANNOTATION #define ANNOTATION(X) TOK(annot_ ## X) #endif @@ -94,7 +97,8 @@ PPKEYWORD(unassert) TOK(unknown) // Not a token. TOK(eof) // End of file. -TOK(eom) // End of macro (end of line inside a macro). +TOK(eod) // End of preprocessing directive (end of line inside a + // directive). TOK(code_completion) // Code completion marker TOK(cxx_defaultarg_end) // C++ default argument end marker @@ -186,6 +190,7 @@ PUNCTUATOR(greatergreatergreater, ">>>") // is a keyword in the implementation namespace that should // always be treated as a keyword // KEYC99 - This is a keyword introduced to C in C99 +// KEYC1X - This is a keyword introduced to C in C1X // 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. @@ -195,6 +200,7 @@ PUNCTUATOR(greatergreatergreater, ">>>") // KEYOPENCL - This is a keyword in OpenCL // KEYALTIVEC - This is a keyword in AltiVec // KEYBORLAND - This is a keyword if Borland extensions are enabled +// BOOLSUPPORT - This is a keyword if 'bool' is a built-in type // KEYWORD(auto , KEYALL) KEYWORD(break , KEYALL) @@ -232,7 +238,9 @@ KEYWORD(volatile , KEYALL) KEYWORD(while , KEYALL) KEYWORD(_Bool , KEYNOCXX) KEYWORD(_Complex , KEYALL) +KEYWORD(_Generic , KEYALL) KEYWORD(_Imaginary , KEYALL) +KEYWORD(_Static_assert , KEYALL) KEYWORD(__func__ , KEYALL) // C++ 2.11p1: Keywords. @@ -251,7 +259,7 @@ KEYWORD(mutable , KEYCXX) KEYWORD(namespace , KEYCXX) KEYWORD(new , KEYCXX) KEYWORD(operator , KEYCXX) -KEYWORD(private , KEYCXX) +KEYWORD(private , KEYCXX|KEYOPENCL) KEYWORD(protected , KEYCXX) KEYWORD(public , KEYCXX) KEYWORD(reinterpret_cast , KEYCXX) @@ -328,11 +336,50 @@ KEYWORD(__is_class , KEYCXX) KEYWORD(__is_convertible_to , KEYCXX) KEYWORD(__is_empty , KEYCXX) KEYWORD(__is_enum , KEYCXX) +// Tentative name - there's no implementation of std::is_literal_type yet. +KEYWORD(__is_literal , KEYCXX) +// Name for GCC 4.6 compatibility - people have already written libraries using +// this name unfortunately. +KEYWORD(__is_literal_type , KEYCXX) KEYWORD(__is_pod , KEYCXX) KEYWORD(__is_polymorphic , KEYCXX) +KEYWORD(__is_trivial , KEYCXX) KEYWORD(__is_union , KEYCXX) -// Tentative name - there's no implementation of std::is_literal_type yet. -KEYWORD(__is_literal , KEYCXX) + +// Embarcadero Expression Traits +KEYWORD(__is_lvalue_expr , KEYCXX) +KEYWORD(__is_rvalue_expr , KEYCXX) + +// Embarcadero Unary Type Traits +KEYWORD(__is_arithmetic , KEYCXX) +KEYWORD(__is_floating_point , KEYCXX) +KEYWORD(__is_integral , KEYCXX) +KEYWORD(__is_complete_type , KEYCXX) +KEYWORD(__is_void , KEYCXX) +KEYWORD(__is_array , KEYCXX) +KEYWORD(__is_function , KEYCXX) +KEYWORD(__is_reference , KEYCXX) +KEYWORD(__is_lvalue_reference , KEYCXX) +KEYWORD(__is_rvalue_reference , KEYCXX) +KEYWORD(__is_fundamental , KEYCXX) +KEYWORD(__is_object , KEYCXX) +KEYWORD(__is_scalar , KEYCXX) +KEYWORD(__is_compound , KEYCXX) +KEYWORD(__is_pointer , KEYCXX) +KEYWORD(__is_member_object_pointer , KEYCXX) +KEYWORD(__is_member_function_pointer, KEYCXX) +KEYWORD(__is_member_pointer , KEYCXX) +KEYWORD(__is_const , KEYCXX) +KEYWORD(__is_volatile , KEYCXX) +KEYWORD(__is_standard_layout , KEYCXX) +KEYWORD(__is_signed , KEYCXX) +KEYWORD(__is_unsigned , KEYCXX) + +// Embarcadero Binary Type Traits +KEYWORD(__is_same , KEYCXX) +KEYWORD(__is_convertible , KEYCXX) +KEYWORD(__array_rank , KEYCXX) +KEYWORD(__array_extent , KEYCXX) // Apple Extension. KEYWORD(__private_extern__ , KEYALL) @@ -345,9 +392,23 @@ KEYWORD(__fastcall , KEYALL) KEYWORD(__thiscall , KEYALL) KEYWORD(__forceinline , KEYALL) -// OpenCL-specific keywords (see OpenCL 1.1 [6.1.9]) +// OpenCL-specific keywords KEYWORD(__kernel , KEYOPENCL) ALIAS("kernel", __kernel , KEYOPENCL) +KEYWORD(vec_step , KEYOPENCL|KEYALTIVEC) +KEYWORD(__private , KEYOPENCL) +KEYWORD(__global , KEYOPENCL) +KEYWORD(__local , KEYOPENCL) +KEYWORD(__constant , KEYOPENCL) +ALIAS("global", __global , KEYOPENCL) +ALIAS("local", __local , KEYOPENCL) +ALIAS("constant", __constant , KEYOPENCL) +KEYWORD(__read_only , KEYOPENCL) +KEYWORD(__write_only , KEYOPENCL) +KEYWORD(__read_write , KEYOPENCL) +ALIAS("read_only", __read_only , KEYOPENCL) +ALIAS("write_only", __write_only , KEYOPENCL) +ALIAS("read_write", __read_write , KEYOPENCL) // Borland Extensions. KEYWORD(__pascal , KEYALL) @@ -358,18 +419,19 @@ KEYWORD(__pixel , KEYALTIVEC) // Alternate spelling for various tokens. There are GCC extensions in all // languages, but should not be disabled in strict conformance mode. -ALIAS("__attribute__", __attribute, KEYALL) -ALIAS("__const" , const , KEYALL) -ALIAS("__const__" , const , KEYALL) ALIAS("__alignof__" , __alignof , KEYALL) ALIAS("__asm" , asm , KEYALL) ALIAS("__asm__" , asm , KEYALL) +ALIAS("__attribute__", __attribute, KEYALL) ALIAS("__complex" , _Complex , KEYALL) ALIAS("__complex__" , _Complex , KEYALL) +ALIAS("__const" , const , KEYALL) +ALIAS("__const__" , const , KEYALL) +ALIAS("__decltype" , decltype , KEYCXX) ALIAS("__imag__" , __imag , KEYALL) ALIAS("__inline" , inline , KEYALL) ALIAS("__inline__" , inline , KEYALL) -ALIAS("__nullptr" , nullptr , KEYCXX) +ALIAS("__nullptr" , nullptr , KEYCXX) ALIAS("__real__" , __real , KEYALL) ALIAS("__restrict" , restrict , KEYALL) ALIAS("__restrict__" , restrict , KEYALL) @@ -384,6 +446,14 @@ ALIAS("__volatile__" , volatile , KEYALL) KEYWORD(__ptr64 , KEYMS) KEYWORD(__w64 , KEYMS) KEYWORD(__uuidof , KEYMS | KEYBORLAND) +KEYWORD(__try , KEYMS | KEYBORLAND) +KEYWORD(__except , KEYMS | KEYBORLAND) +KEYWORD(__finally , KEYMS | KEYBORLAND) +KEYWORD(__leave , KEYMS | KEYBORLAND) +KEYWORD(__int64 , KEYMS) +ALIAS("__int8" , char , KEYMS) +ALIAS("__int16" , short , KEYMS) +ALIAS("__int32" , int , KEYMS) ALIAS("_asm" , asm , KEYMS) ALIAS("_cdecl" , __cdecl , KEYMS | KEYBORLAND) ALIAS("_fastcall" , __fastcall , KEYMS | KEYBORLAND) @@ -391,6 +461,8 @@ ALIAS("_stdcall" , __stdcall , KEYMS | KEYBORLAND) ALIAS("_thiscall" , __thiscall , KEYMS) ALIAS("_uuidof" , __uuidof , KEYMS | KEYBORLAND) ALIAS("_inline" , inline , KEYMS) +ALIAS("_declspec" , __declspec , KEYMS) +ALIAS("__interface" , class , KEYMS) // Borland Extensions which should be disabled in strict conformance mode. ALIAS("_pascal" , __pascal , KEYBORLAND) @@ -399,9 +471,12 @@ ALIAS("_pascal" , __pascal , KEYBORLAND) ALIAS("__char16_t" , char16_t , KEYCXX) ALIAS("__char32_t" , char32_t , KEYCXX) +// Clang-specific keywords enabled only in testing. +TESTING_KEYWORD(__unknown_anytype , KEYALL) + //===----------------------------------------------------------------------===// -// Objective-C @-preceeded keywords. +// Objective-C @-preceded keywords. //===----------------------------------------------------------------------===// // These have meaning after an '@' in Objective-C mode. These define enums in @@ -443,6 +518,7 @@ 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(primary_expr) // annotation for a primary expression // Annotation for #pragma unused(...) // For each argument inside the parentheses the pragma handler will produce @@ -450,6 +526,7 @@ ANNOTATION(template_id) // annotation for a C++ template-id that names a ANNOTATION(pragma_unused) #undef ANNOTATION +#undef TESTING_KEYWORD #undef OBJC2_AT_KEYWORD #undef OBJC1_AT_KEYWORD #undef CXX_KEYWORD_OPERATOR diff --git a/include/clang/Basic/TypeTraits.h b/include/clang/Basic/TypeTraits.h index 00c6e9e..4a2a2c6 100644 --- a/include/clang/Basic/TypeTraits.h +++ b/include/clang/Basic/TypeTraits.h @@ -27,20 +27,59 @@ namespace clang { UTT_HasTrivialDestructor, UTT_HasVirtualDestructor, UTT_IsAbstract, + UTT_IsArithmetic, + UTT_IsArray, UTT_IsClass, + UTT_IsCompleteType, + UTT_IsCompound, + UTT_IsConst, UTT_IsEmpty, UTT_IsEnum, + UTT_IsFloatingPoint, + UTT_IsFunction, + UTT_IsFundamental, + UTT_IsIntegral, + UTT_IsLiteral, + UTT_IsLvalueReference, + UTT_IsMemberFunctionPointer, + UTT_IsMemberObjectPointer, + UTT_IsMemberPointer, + UTT_IsObject, UTT_IsPOD, + UTT_IsPointer, UTT_IsPolymorphic, + UTT_IsReference, + UTT_IsRvalueReference, + UTT_IsScalar, + UTT_IsSigned, + UTT_IsStandardLayout, + UTT_IsTrivial, UTT_IsUnion, - UTT_IsLiteral + UTT_IsUnsigned, + UTT_IsVoid, + UTT_IsVolatile }; /// BinaryTypeTrait - Names for the binary type traits. enum BinaryTypeTrait { BTT_IsBaseOf, - BTT_TypeCompatible, - BTT_IsConvertibleTo + BTT_IsConvertible, + BTT_IsConvertibleTo, + BTT_IsSame, + BTT_TypeCompatible + }; + + /// ArrayTypeTrait - Names for the array type traits. + enum ArrayTypeTrait { + ATT_ArrayRank, + ATT_ArrayExtent + }; + + /// UnaryExprOrTypeTrait - Names for the "expression or type" traits. + enum UnaryExprOrTypeTrait { + UETT_SizeOf, + UETT_AlignOf, + UETT_VecStep }; } diff --git a/include/clang/Basic/Version.h b/include/clang/Basic/Version.h index ede68ed..15cdf1f 100644 --- a/include/clang/Basic/Version.h +++ b/include/clang/Basic/Version.h @@ -58,6 +58,11 @@ namespace clang { /// which includes the clang version number, the repository version, /// and the vendor tag. std::string getClangFullVersion(); + + /// \brief Retrieves a string representing the complete clang version suitable + /// for use in the CPP __VERSION__ macro, which includes the clang version + /// number, the repository version, and the vendor tag. + std::string getClangFullCPPVersion(); } #endif // LLVM_CLANG_BASIC_VERSION_H diff --git a/include/clang/Basic/VersionTuple.h b/include/clang/Basic/VersionTuple.h new file mode 100644 index 0000000..91eb68e --- /dev/null +++ b/include/clang/Basic/VersionTuple.h @@ -0,0 +1,126 @@ +//===- VersionTuple.h - Version Number Handling -----------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This header defines the VersionTuple class, which represents a version in +// the form major[.minor[.subminor]]. +// +//===----------------------------------------------------------------------===// +#ifndef LLVM_CLANG_BASIC_VERSIONTUPLE_H +#define LLVM_CLANG_BASIC_VERSIONTUPLE_H + +#include "llvm/ADT/Optional.h" +#include <string> + +namespace llvm { + class raw_ostream; +} + +namespace clang { + +/// \brief Represents a version number in the form major[.minor[.subminor]]. +class VersionTuple { + unsigned Major; + unsigned Minor : 31; + unsigned Subminor : 31; + unsigned HasMinor : 1; + unsigned HasSubminor : 1; + +public: + VersionTuple() + : Major(0), Minor(0), Subminor(0), HasMinor(false), HasSubminor(false) { } + + explicit VersionTuple(unsigned Major) + : Major(Major), Minor(0), Subminor(0), HasMinor(false), HasSubminor(false) + { } + + explicit VersionTuple(unsigned Major, unsigned Minor) + : Major(Major), Minor(Minor), Subminor(0), HasMinor(true), + HasSubminor(false) + { } + + explicit VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor) + : Major(Major), Minor(Minor), Subminor(Subminor), HasMinor(true), + HasSubminor(true) + { } + + /// \brief Determine whether this version information is empty + /// (e.g., all version components are zero). + bool empty() const { return Major == 0 && Minor == 0 && Subminor == 0; } + + /// \brief Retrieve the major version number. + unsigned getMajor() const { return Major; } + + /// \brief Retrieve the minor version number, if provided. + llvm::Optional<unsigned> getMinor() const { + if (!HasMinor) + return llvm::Optional<unsigned>(); + return Minor; + } + + /// \brief Retrieve the subminor version number, if provided. + llvm::Optional<unsigned> getSubminor() const { + if (!HasSubminor) + return llvm::Optional<unsigned>(); + return Subminor; + } + + /// \brief Determine if two version numbers are equivalent. If not + /// provided, minor and subminor version numbers are considered to be zero. + friend bool operator==(const VersionTuple& X, const VersionTuple &Y) { + return X.Major == Y.Major && X.Minor == Y.Minor && X.Subminor == Y.Subminor; + } + + /// \brief Determine if two version numbers are not equivalent. If + /// not provided, minor and subminor version numbers are considered to be + /// zero. + friend bool operator!=(const VersionTuple &X, const VersionTuple &Y) { + return !(X == Y); + } + + /// \brief Determine whether one version number precedes another. If not + /// provided, minor and subminor version numbers are considered to be zero. + friend bool operator<(const VersionTuple &X, const VersionTuple &Y) { + if (X.Major != Y.Major) + return X.Major < Y.Major; + + if (X.Minor != Y.Minor) + return X.Minor < Y.Minor; + + return X.Subminor < Y.Subminor; + } + + /// \brief Determine whether one version number follows another. If not + /// provided, minor and subminor version numbers are considered to be zero. + friend bool operator>(const VersionTuple &X, const VersionTuple &Y) { + return Y < X; + } + + /// \brief Determine whether one version number precedes or is + /// equivalent to another. If not provided, minor and subminor + /// version numbers are considered to be zero. + friend bool operator<=(const VersionTuple &X, const VersionTuple &Y) { + return !(Y < X); + } + + /// \brief Determine whether one version number follows or is + /// equivalent to another. If not provided, minor and subminor + /// version numbers are considered to be zero. + friend bool operator>=(const VersionTuple &X, const VersionTuple &Y) { + return !(X < Y); + } + + /// \brief Retrieve a string representation of the version number/ + std::string getAsString() const; +}; + +/// \brief Print a version number. +llvm::raw_ostream& operator<<(llvm::raw_ostream &Out, const VersionTuple &V); + +} // end namespace clang +#endif // LLVM_CLANG_BASIC_VERSIONTUPLE_H diff --git a/include/clang/Basic/arm_neon.td b/include/clang/Basic/arm_neon.td index 880a0da..6d6c7c7 100644 --- a/include/clang/Basic/arm_neon.td +++ b/include/clang/Basic/arm_neon.td @@ -22,13 +22,11 @@ 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; @@ -144,8 +142,7 @@ 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 VMULL : SInst<"vmull", "wdd", "csiUcUsUiPc">; def VQDMULL : SInst<"vqdmull", "wdd", "si">; //////////////////////////////////////////////////////////////////////////////// @@ -331,7 +328,7 @@ 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_N : SInst<"vmull_n", "wda", "siUsUi">; 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>; |