diff options
Diffstat (limited to 'include/clang/Basic')
| -rw-r--r-- | include/clang/Basic/Builtins.def | 5 | ||||
| -rw-r--r-- | include/clang/Basic/Builtins.h | 5 | ||||
| -rw-r--r-- | include/clang/Basic/CMakeLists.txt | 32 | ||||
| -rw-r--r-- | include/clang/Basic/Diagnostic.h | 5 | ||||
| -rw-r--r-- | include/clang/Basic/DiagnosticFrontendKinds.td | 9 | ||||
| -rw-r--r-- | include/clang/Basic/DiagnosticGroups.td | 6 | ||||
| -rw-r--r-- | include/clang/Basic/DiagnosticIDs.h | 6 | ||||
| -rw-r--r-- | include/clang/Basic/DiagnosticParseKinds.td | 9 | ||||
| -rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 55 | ||||
| -rw-r--r-- | include/clang/Basic/LangOptions.h | 7 | ||||
| -rw-r--r-- | include/clang/Basic/PartialDiagnostic.h | 2 | ||||
| -rw-r--r-- | include/clang/Basic/SourceManager.h | 8 | 
12 files changed, 96 insertions, 53 deletions
| diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index 7d270ad7fb89..b73ac1f4dd45 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -60,6 +60,7 @@  //  n -> nothrow  //  r -> noreturn  //  c -> const +//  t -> signature is meaningless, use custom typechecking  //  F -> this is a libc/libm function with a '__builtin_' prefix added.  //  f -> this is a libc/libm function without the '__builtin_' prefix. It can  //       be followed by ':headername:' to state which header this function @@ -383,8 +384,8 @@ BUILTIN(__builtin_bswap32, "UiUi", "nc")  BUILTIN(__builtin_bswap64, "ULLiULLi", "nc")  // Random GCC builtins -BUILTIN(__builtin_constant_p, "i.", "nc") -BUILTIN(__builtin_classify_type, "i.", "nc") +BUILTIN(__builtin_constant_p, "i.", "nct") +BUILTIN(__builtin_classify_type, "i.", "nct")  BUILTIN(__builtin___CFStringMakeConstantString, "FC*cC*", "nc")  BUILTIN(__builtin___NSStringMakeConstantString, "FC*cC*", "nc")  BUILTIN(__builtin_va_start, "vA.", "n") diff --git a/include/clang/Basic/Builtins.h b/include/clang/Basic/Builtins.h index 4df4c8f95374..0d17e03d8a52 100644 --- a/include/clang/Basic/Builtins.h +++ b/include/clang/Basic/Builtins.h @@ -117,6 +117,11 @@ public:      return strchr(GetRecord(ID).Attributes, 'f') != 0;    } +  /// \brief Determines whether this builtin has custom typechecking. +  bool hasCustomTypechecking(unsigned ID) const { +    return strchr(GetRecord(ID).Attributes, 't') != 0; +  } +    /// \brief Completely forget that the given ID was ever considered a builtin,    /// e.g., because the user provided a conflicting signature.    void ForgetBuiltin(unsigned ID, IdentifierTable &Table); diff --git a/include/clang/Basic/CMakeLists.txt b/include/clang/Basic/CMakeLists.txt index c5952365d593..19066e4c0eef 100644 --- a/include/clang/Basic/CMakeLists.txt +++ b/include/clang/Basic/CMakeLists.txt @@ -1,11 +1,10 @@  macro(clang_diag_gen component) -  tablegen(Diagnostic${component}Kinds.inc -        -gen-clang-diags-defs -clang-component=${component}) -  add_custom_target(ClangDiagnostic${component} -    DEPENDS Diagnostic${component}Kinds.inc) +  clang_tablegen(Diagnostic${component}Kinds.inc +    -gen-clang-diags-defs -clang-component=${component} +    SOURCE Diagnostic.td +    TARGET ClangDiagnostic${component})  endmacro(clang_diag_gen) -set(LLVM_TARGET_DEFINITIONS Diagnostic.td)  clang_diag_gen(Analysis)  clang_diag_gen(AST)  clang_diag_gen(Common) @@ -14,19 +13,16 @@ clang_diag_gen(Frontend)  clang_diag_gen(Lex)  clang_diag_gen(Parse)  clang_diag_gen(Sema) -tablegen(DiagnosticGroups.inc -         -gen-clang-diag-groups) -add_custom_target(ClangDiagnosticGroups -  DEPENDS DiagnosticGroups.inc) +clang_tablegen(DiagnosticGroups.inc -gen-clang-diag-groups +  SOURCE Diagnostic.td +  TARGET ClangDiagnosticGroups) -set(LLVM_TARGET_DEFINITIONS Attr.td) -tablegen(AttrList.inc -         -gen-clang-attr-list -         -I ${CMAKE_CURRENT_SOURCE_DIR}/../../) -add_custom_target(ClangAttrList -  DEPENDS AttrList.inc) +clang_tablegen(AttrList.inc -gen-clang-attr-list +  -I ${CMAKE_CURRENT_SOURCE_DIR}/../../ +  SOURCE Attr.td +  TARGET ClangAttrList)  # ARM NEON -set(LLVM_TARGET_DEFINITIONS arm_neon.td) -tablegen(arm_neon.inc -gen-arm-neon-sema) -add_custom_target(ClangARMNeon DEPENDS arm_neon.inc) +clang_tablegen(arm_neon.inc -gen-arm-neon-sema +  SOURCE arm_neon.td +  TARGET ClangARMNeon) diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 19e7c91f5324..3fc60d136b5c 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -474,8 +474,9 @@ public:    ///    /// \param Loc The source location we are interested in finding out the    /// diagnostic state. Can be null in order to query the latest state. -  Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc) const { -    return (Level)Diags->getDiagnosticLevel(DiagID, Loc, *this); +  Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc, +                           diag::Mapping *mapping = 0) const { +    return (Level)Diags->getDiagnosticLevel(DiagID, Loc, *this, mapping);    }    /// Report - Issue the message to the client.  @c DiagID is a member of the diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index 5f9f4a7f3927..30706769d45e 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -177,12 +177,15 @@ def warn_pch_elide_constructors : Error<  def warn_pch_exceptions : Error<      "exceptions were %select{disabled|enabled}0 in PCH file but "      "are currently %select{disabled|enabled}1">; -def warn_pch_sjlj_exceptions : Error< -    "sjlj-exceptions were %select{disabled|enabled}0 in PCH file but " -    "are currently %select{disabled|enabled}1">;  def warn_pch_objc_exceptions : Error<      "Objective-C exceptions were %select{disabled|enabled}0 in PCH file but "      "are currently %select{disabled|enabled}1">; +def warn_pch_cxx_exceptions : Error< +    "C++ exceptions were %select{disabled|enabled}0 in PCH file but " +    "are currently %select{disabled|enabled}1">; +def warn_pch_sjlj_exceptions : Error< +    "sjlj-exceptions were %select{disabled|enabled}0 in PCH file but " +    "are currently %select{disabled|enabled}1">;  def warn_pch_objc_runtime : Error<      "PCH file was compiled with the %select{NeXT|GNU}0 runtime but the "      "%select{NeXT|GNU}1 runtime is selected">; diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index d4377c9a0b07..412fb587108e 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -198,9 +198,11 @@ def Unused : DiagGroup<"unused",                          DiagCategory<"Unused Entity Issue">;  // Format settings. -def Format : DiagGroup<"format", [FormatExtraArgs, FormatZeroLength, NonNull]>, +def FormatSecurity : DiagGroup<"format-security">; +def Format : DiagGroup<"format", +                       [FormatExtraArgs, FormatZeroLength, NonNull, +                        FormatSecurity]>,               DiagCategory<"Format String Issue">; -def FormatSecurity : DiagGroup<"format-security", [Format]>;  def FormatNonLiteral : DiagGroup<"format-nonliteral", [FormatSecurity]>;  def FormatY2K : DiagGroup<"format-y2k", [Format]>;  def Format2 : DiagGroup<"format=2", diff --git a/include/clang/Basic/DiagnosticIDs.h b/include/clang/Basic/DiagnosticIDs.h index b46380569851..2b03cae565c8 100644 --- a/include/clang/Basic/DiagnosticIDs.h +++ b/include/clang/Basic/DiagnosticIDs.h @@ -188,14 +188,16 @@ private:    /// \param Loc The source location we are interested in finding out the    /// diagnostic state. Can be null in order to query the latest state.    DiagnosticIDs::Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc, -                                          const Diagnostic &Diag) const; +                                          const Diagnostic &Diag, +                                          diag::Mapping *mapping = 0) const;    /// getDiagnosticLevel - This is an internal implementation helper used when    /// DiagClass is already known.    DiagnosticIDs::Level getDiagnosticLevel(unsigned DiagID,                                            unsigned DiagClass,                                            SourceLocation Loc, -                                          const Diagnostic &Diag) const; +                                          const Diagnostic &Diag, +                                          diag::Mapping *mapping = 0) const;    /// ProcessDiag - This is the method used to report a diagnostic that is    /// finally fully formed. diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 9d7ec9d45447..9a68af9c45ca 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -28,6 +28,10 @@ def ext_extra_struct_semi : Extension<  def ext_extra_ivar_semi : Extension<    "extra ';' inside instance variable list">; +def auto_storage_class : ExtWarn< +  "'auto' storage class specifier is redundant and will be " +  "removed in future releases">; +  def ext_duplicate_declspec : Extension<"duplicate '%0' declaration specifier">;  def ext_plain_complex : ExtWarn<    "plain '_Complex' requires a type specifier; assuming '_Complex double'">; @@ -57,6 +61,11 @@ def ext_enumerator_list_comma : Extension<    "feature">;  def err_enumerator_list_missing_comma : Error<    "missing ',' between enumerators">; +def err_enumerator_unnamed_no_def : Error< +  "unnamed enumeration must be a definition">; +def ext_ms_enum_fixed_underlying_type : Extension< +  "enumeration types with a fixed underlying type are a Microsoft extension">,  +  InGroup<Microsoft>;  def ext_gnu_indirect_goto : Extension<    "use of GNU indirect-goto extension">, InGroup<GNU>; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 2e7f274b8ed5..a9fb2da00176 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -351,12 +351,18 @@ def note_required_for_protocol_at :  def warn_conflicting_ret_types : Warning<    "conflicting return type in implementation of %0: %1 vs %2">; +def warn_conflicting_ret_type_modifiers : Warning< +  "conflicting distributed object modifiers on return type " +  "in implementation of %0">;  def warn_non_covariant_ret_types : Warning<    "conflicting return type in implementation of %0: %1 vs %2">,    InGroup<DiagGroup<"method-signatures">>, DefaultIgnore;  def warn_conflicting_param_types : Warning<    "conflicting parameter types in implementation of %0: %1 vs %2">; +def warn_conflicting_param_modifiers : Warning< +  "conflicting distributed object modifiers on parameter type " +  "in implementation of %0">;  def warn_non_contravariant_param_types : Warning<    "conflicting parameter types in implementation of %0: %1 vs %2">,    InGroup<DiagGroup<"method-signatures">>, DefaultIgnore; @@ -898,7 +904,8 @@ def err_new_array_of_auto : Error<  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|here}0">; +  "|in template parameter|in block literal|in template argument" +  "|in typedef|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< @@ -911,6 +918,8 @@ def err_auto_missing_trailing_return : Error<    "'auto' return without trailing return type">;  def err_trailing_return_without_auto : Error<    "function with trailing return type must specify return type 'auto', not %0">; +def err_trailing_return_in_parens : Error< +  "trailing return type may not be nested within parentheses">;  def err_auto_var_deduction_failure : Error<    "variable %0 with type %1 has incompatible initializer of type %2">;  def err_auto_new_deduction_failure : Error< @@ -1145,6 +1154,9 @@ def warn_impcast_literal_float_to_integer : Warning<    "implicit conversion turns literal floating-point number into integer: "    "%0 to %1">,    InGroup<DiagGroup<"literal-conversion">>, DefaultIgnore; +def warn_impcast_different_enum_types : Warning< +  "implicit conversion from enumeration type %0 to different enumeration type " +  "%1">, InGroup<DiagGroup<"conversion">>;  def warn_cast_align : Warning<    "cast from %0 to %1 increases required alignment from %2 to %3">, @@ -1299,11 +1311,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">; +  "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">; +  "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">; @@ -1455,7 +1467,7 @@ 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'">; +  "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 : @@ -1469,7 +1481,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">; +  "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">; @@ -2015,9 +2027,10 @@ def err_redefinition_extern_inline : Error<  // This should eventually be an error.  def warn_undefined_internal : Warning< -  "%select{function|variable}0 %q1 has internal linkage but is not defined">; +  "%select{function|variable}0 %q1 has internal linkage but is not defined">, +  DiagGroup<"undefined-internal">;  def note_used_here : Note<"used here">; -   +  def warn_redefinition_of_typedef : Warning<    "redefinition of typedef %0 is invalid in C">,    InGroup<DiagGroup<"typedef-redefinition"> >, DefaultError; @@ -2328,6 +2341,13 @@ def warn_division_by_zero : Warning<"division by zero is undefined">;  def warn_remainder_by_zero : Warning<"remainder by zero is undefined">;  def warn_shift_negative : Warning<"shift count is negative">;  def warn_shift_gt_typewidth : Warning<"shift count >= width of type">; +def warn_shift_result_gt_typewidth : Warning< +  "shift result (%0) requires %1 bits to represent, but %2 only has %3 bits">, +   InGroup<DiagGroup<"shift-overflow">>; +def warn_shift_result_overrides_sign_bit : Warning< +  "shift result (%0) overrides the sign bit of the shift expression's type " +  "(%1) and becomes negative">, +  InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;  def warn_precedence_bitwise_rel : Warning<    "%0 has lower precedence than %1; %1 will be evaluated first">, @@ -2387,13 +2407,10 @@ def err_typecheck_member_reference_type : Error<  def err_typecheck_member_reference_unknown : Error<    "cannot refer to member %0 in %1 with '%select{.|->}2'">;  def err_member_reference_needs_call : Error< -  "base of member reference is an overloaded function; perhaps you meant " -  "to call %select{it|the 0-argument overload}0?">; +  "base of member reference is %select{a function|an overloaded function}0; " +  "perhaps you meant to call it%select{| with no arguments}1?">;  def note_member_ref_possible_intended_overload : Note<    "possibly valid overload here">; -def err_member_reference_needs_call_zero_arg : Error< -  "base of member reference has function type %0; perhaps you meant to call " -  "this function with '()'?">;  def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,    InGroup<CharSubscript>, DefaultIgnore; @@ -2452,6 +2469,13 @@ def err_typecheck_incomplete_array_needs_initializer : Error<  def err_array_init_not_init_list : Error<    "array initializer must be an initializer "    "list%select{| or string literal}0">; +def err_array_init_different_type : Error< +  "cannot initialize array of type %0 with array of type %1">; +def err_array_init_non_constant_array : Error< +  "cannot initialize array of type %0 with non-constant array of type %1">; +def ext_array_init_copy : Extension< +  "initialization of an array of type %0 from a compound literal of type %1 is " +  "a GNU extension">;  def warn_deprecated_string_literal_conversion : Warning<    "conversion from string literal to %0 is deprecated">, InGroup<DeprecatedWritableStr>;  def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">; @@ -2950,10 +2974,7 @@ def note_equality_comparison_silence : Note<  def warn_synthesized_ivar_access : Warning<    "direct access of synthesized ivar by using property access %0">,    InGroup<NonfragileAbi2>, DefaultIgnore; -def warn_ivar_variable_conflict : Warning< -  "when default property synthesis is on, " -  "%0 lookup will access property ivar instead of global variable">,  -  InGroup<NonfragileAbi2>; +  def note_global_declared_at : Note<"global variable declared here">;  // assignment related diagnostics (also for argument passing, returning, etc). @@ -3108,6 +3129,8 @@ def err_kern_type_not_void_return : Error<    "kernel function type %0 must have void return type">;  def err_config_scalar_return : Error<    "CUDA special function 'cudaConfigureCall' must have scalar return type">; +def err_kern_call_not_global_function : Error< +  "kernel call to non-global function %0">;  def err_cannot_pass_objc_interface_to_vararg : Error< diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h index f4db55ae0626..0bd983e8e6c6 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -53,8 +53,9 @@ public:    unsigned LaxVectorConversions : 1;    unsigned AltiVec           : 1;  // Support AltiVec-style vector initializers.    unsigned Exceptions        : 1;  // Support exception handling. -  unsigned SjLjExceptions    : 1;  // Use setjmp-longjump exception handling.    unsigned ObjCExceptions    : 1;  // Support Objective-C exceptions. +  unsigned CXXExceptions     : 1;  // Support C++ exceptions. +  unsigned SjLjExceptions    : 1;  // Use setjmp-longjump exception handling.    unsigned RTTI              : 1;  // Support RTTI information.    unsigned MSBitfields       : 1; // MS-compatible structure layout @@ -165,8 +166,8 @@ public:      NoConstantCFStrings = 0; InlineVisibilityHidden = 0;      C99 = Microsoft = Borland = CPlusPlus = CPlusPlus0x = 0;      CXXOperatorNames = PascalStrings = WritableStrings = ConstStrings = 0; -    Exceptions = SjLjExceptions = Freestanding = NoBuiltin = 0; -    ObjCExceptions = 1; +    Exceptions = ObjCExceptions = CXXExceptions = SjLjExceptions = 0; +    Freestanding = NoBuiltin = 0;      MSBitfields = 0;      NeXTRuntime = 1;      RTTI = 1; diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h index d00195b32674..c63619440551 100644 --- a/include/clang/Basic/PartialDiagnostic.h +++ b/include/clang/Basic/PartialDiagnostic.h @@ -75,7 +75,7 @@ public:    /// \brief An allocator for Storage objects, which uses a small cache to     /// objects, used to reduce malloc()/free() traffic for partial diagnostics.    class StorageAllocator { -    static const unsigned NumCached = 4; +    static const unsigned NumCached = 16;      Storage Cached[NumCached];      Storage *FreeList[NumCached];      unsigned NumFreeListEntries; diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index c0fbd089e760..b1443dad09fd 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -684,10 +684,10 @@ public:    /// before calling this method.    unsigned getColumnNumber(FileID FID, unsigned FilePos,                              bool *Invalid = 0) const; -  unsigned getSpellingColumnNumber(SourceLocation Loc, -                                   bool *Invalid = 0) const; +  unsigned getSpellingColumnNumber(SourceLocation Loc, bool *Invalid = 0) const;    unsigned getInstantiationColumnNumber(SourceLocation Loc,                                          bool *Invalid = 0) const; +  unsigned getPresumedColumnNumber(SourceLocation Loc, bool *Invalid = 0) const;    /// getLineNumber - Given a SourceLocation, return the spelling line number @@ -695,10 +695,10 @@ public:    /// line offsets for the MemoryBuffer, so this is not cheap: use only when    /// about to emit a diagnostic.    unsigned getLineNumber(FileID FID, unsigned FilePos, bool *Invalid = 0) const; - +  unsigned getSpellingLineNumber(SourceLocation Loc, bool *Invalid = 0) const;    unsigned getInstantiationLineNumber(SourceLocation Loc,                                         bool *Invalid = 0) const; -  unsigned getSpellingLineNumber(SourceLocation Loc, bool *Invalid = 0) const; +  unsigned getPresumedLineNumber(SourceLocation Loc, bool *Invalid = 0) const;    /// Return the filename or buffer identifier of the buffer the location is in.    /// Note that this name does not respect #line directives.  Use getPresumedLoc | 
