diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-05-04 16:12:48 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-05-04 16:12:48 +0000 |
commit | 8aaf5818a64e9f7687798852af5945b053c68a54 (patch) | |
tree | d6a70c3518b8dea8be7062438d7e8676820ed17f /include/clang/Basic | |
parent | 71438373cd57f0d5d8c93bb5cf690844a0fbc9d0 (diff) | |
download | FreeBSD-src-8aaf5818a64e9f7687798852af5945b053c68a54.zip FreeBSD-src-8aaf5818a64e9f7687798852af5945b053c68a54.tar.gz |
Update clang to r103004.
Diffstat (limited to 'include/clang/Basic')
-rw-r--r-- | include/clang/Basic/Builtins.def | 12 | ||||
-rw-r--r-- | include/clang/Basic/BuiltinsPPC.def | 92 | ||||
-rw-r--r-- | include/clang/Basic/BuiltinsX86.def | 2 | ||||
-rw-r--r-- | include/clang/Basic/Diagnostic.h | 49 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticCommonKinds.td | 10 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticDriverKinds.td | 2 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticFrontendKinds.td | 19 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticGroups.td | 13 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticParseKinds.td | 4 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 319 | ||||
-rw-r--r-- | include/clang/Basic/LangOptions.h | 19 | ||||
-rw-r--r-- | include/clang/Basic/SourceLocation.h | 11 | ||||
-rw-r--r-- | include/clang/Basic/SourceManager.h | 19 | ||||
-rw-r--r-- | include/clang/Basic/TargetInfo.h | 34 | ||||
-rw-r--r-- | include/clang/Basic/Version.h | 4 |
15 files changed, 469 insertions, 140 deletions
diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index 453f660..b306954 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -314,6 +314,7 @@ BUILTIN(__builtin_setjmp, "iv**", "") BUILTIN(__builtin_longjmp, "vv**i", "r") BUILTIN(__builtin_unwind_init, "v", "") BUILTIN(__builtin_eh_return_data_regno, "ii", "nc") +BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:") BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:") // GCC exception builtins @@ -335,6 +336,7 @@ BUILTIN(__builtin___strcat_chk, "c*c*cC*z", "nF") BUILTIN(__builtin___strcpy_chk, "c*c*cC*z", "nF") BUILTIN(__builtin___strncat_chk, "c*c*cC*zz", "nF") BUILTIN(__builtin___strncpy_chk, "c*c*cC*zz", "nF") +BUILTIN(__builtin___stpncpy_chk, "c*c*cC*zz", "nF") BUILTIN(__builtin___snprintf_chk, "ic*zizcC*.", "Fp:4:") BUILTIN(__builtin___sprintf_chk, "ic*izcC*.", "Fp:3:") BUILTIN(__builtin___vsnprintf_chk, "ic*zizcC*a", "FP:4:") @@ -346,12 +348,9 @@ BUILTIN(__builtin___vprintf_chk, "iicC*a", "FP:1:") BUILTIN(__builtin_expect, "LiLiLi" , "nc") BUILTIN(__builtin_prefetch, "vvC*.", "nc") -BUILTIN(__builtin_abort, "v", "Fnr") BUILTIN(__builtin_trap, "v", "nr") BUILTIN(__builtin_unreachable, "v", "nr") - BUILTIN(__builtin_shufflevector, "v." , "nc") - BUILTIN(__builtin_alloca, "v*z" , "n") // "Overloaded" Atomic operator builtins. These are overloaded to support data @@ -473,6 +472,13 @@ BUILTIN(__sync_fetch_and_max, "ii*i", "n") BUILTIN(__sync_fetch_and_umin, "UiUi*Ui", "n") BUILTIN(__sync_fetch_and_umax, "UiUi*Ui", "n") +// Random libc builtins. +BUILTIN(__builtin_abort, "v", "Fnr") +BUILTIN(__builtin_index, "c*cC*i", "Fn") +BUILTIN(__builtin_rindex, "c*cC*i", "Fn") + + + // C99 library functions // C99 stdlib.h LIBBUILTIN(abort, "v", "fr", "stdlib.h") diff --git a/include/clang/Basic/BuiltinsPPC.def b/include/clang/Basic/BuiltinsPPC.def index 817a032..287bba9 100644 --- a/include/clang/Basic/BuiltinsPPC.def +++ b/include/clang/Basic/BuiltinsPPC.def @@ -18,7 +18,97 @@ // The format of this database matches clang/Basic/Builtins.def. // This is just a placeholder, the types and attributes are wrong. -BUILTIN(__builtin_altivec_abs_v4sf , "ii" , "nc") +BUILTIN(__builtin_altivec_abs_v16qi, "V16UcV16Sc", "") +BUILTIN(__builtin_altivec_abs_v8hi, "V8UsV8Ss", "") +BUILTIN(__builtin_altivec_abs_v4si, "V4UiV4Si", "") + +BUILTIN(__builtin_altivec_abss_v16qi, "V16UcV16Sc", "") +BUILTIN(__builtin_altivec_abss_v8hi, "V8UsV8Ss", "") +BUILTIN(__builtin_altivec_abss_v4si, "V4UiV4Si", "") + +BUILTIN(__builtin_altivec_vaddcuw, "V4UiV4UiV4Ui", "") + +BUILTIN(__builtin_altivec_vaddsbs, "V16ScV16ScV16Sc", "") +BUILTIN(__builtin_altivec_vaddubs, "V16UcV16UcV16Uc", "") +BUILTIN(__builtin_altivec_vaddshs, "V8SsV8SsV8Ss", "") +BUILTIN(__builtin_altivec_vadduhs, "V8UsV8UsV8Us", "") +BUILTIN(__builtin_altivec_vaddsws, "V4SiV4SiV4Si", "") +BUILTIN(__builtin_altivec_vadduws, "V4UiV4UiV4Ui", "") + +BUILTIN(__builtin_altivec_vsubsbs, "V16ScV16ScV16Sc", "") +BUILTIN(__builtin_altivec_vsububs, "V16UcV16UcV16Uc", "") +BUILTIN(__builtin_altivec_vsubshs, "V8SsV8SsV8Ss", "") +BUILTIN(__builtin_altivec_vsubuhs, "V8UsV8UsV8Us", "") +BUILTIN(__builtin_altivec_vsubsws, "V4SiV4SiV4Si", "") +BUILTIN(__builtin_altivec_vsubuws, "V4UiV4UiV4Ui", "") + +BUILTIN(__builtin_altivec_vavgsb, "V16ScV16ScV16Sc", "") +BUILTIN(__builtin_altivec_vavgub, "V16UcV16UcV16Uc", "") +BUILTIN(__builtin_altivec_vavgsh, "V8SsV8SsV8Ss", "") +BUILTIN(__builtin_altivec_vavguh, "V8UsV8UsV8Us", "") +BUILTIN(__builtin_altivec_vavgsw, "V4SiV4SiV4Si", "") +BUILTIN(__builtin_altivec_vavguw, "V4UiV4UiV4Ui", "") + +BUILTIN(__builtin_altivec_stvx, "vV4iiv*", "") +BUILTIN(__builtin_altivec_stvxl, "vV4iiv*", "") +BUILTIN(__builtin_altivec_stvebx, "vV16civ*", "") +BUILTIN(__builtin_altivec_stvehx, "vV8siv*", "") +BUILTIN(__builtin_altivec_stvewx, "vV4iiv*", "") + +BUILTIN(__builtin_altivec_vcmpbfp, "V4iV4fV4f", "") + +BUILTIN(__builtin_altivec_vcmpgefp, "V4iV4fV4f", "") + +BUILTIN(__builtin_altivec_vcmpequb, "V16cV16cV16c", "") +BUILTIN(__builtin_altivec_vcmpequh, "V8sV8sV8s", "") +BUILTIN(__builtin_altivec_vcmpequw, "V4iV4iV4i", "") +BUILTIN(__builtin_altivec_vcmpeqfp, "V4iV4fV4f", "") + +BUILTIN(__builtin_altivec_vcmpgtsb, "V16cV16ScV16Sc", "") +BUILTIN(__builtin_altivec_vcmpgtub, "V16cV16UcV16Uc", "") +BUILTIN(__builtin_altivec_vcmpgtsh, "V8sV8SsV8Ss", "") +BUILTIN(__builtin_altivec_vcmpgtuh, "V8sV8UsV8Us", "") +BUILTIN(__builtin_altivec_vcmpgtsw, "V4iV4SiV4Si", "") +BUILTIN(__builtin_altivec_vcmpgtuw, "V4iV4UiV4Ui", "") +BUILTIN(__builtin_altivec_vcmpgtfp, "V4iV4fV4f", "") + +BUILTIN(__builtin_altivec_vmaxsb, "V16ScV16ScV16Sc", "") +BUILTIN(__builtin_altivec_vmaxub, "V16UcV16UcV16Uc", "") +BUILTIN(__builtin_altivec_vmaxsh, "V8SsV8SsV8Ss", "") +BUILTIN(__builtin_altivec_vmaxuh, "V8UsV8UsV8Us", "") +BUILTIN(__builtin_altivec_vmaxsw, "V4SiV4SiV4Si", "") +BUILTIN(__builtin_altivec_vmaxuw, "V4UiV4UiV4Ui", "") +BUILTIN(__builtin_altivec_vmaxfp, "V4fV4fV4f", "") + +BUILTIN(__builtin_altivec_mfvscr, "V8Us", "") + +BUILTIN(__builtin_altivec_vminsb, "V16ScV16ScV16Sc", "") +BUILTIN(__builtin_altivec_vminub, "V16UcV16UcV16Uc", "") +BUILTIN(__builtin_altivec_vminsh, "V8SsV8SsV8Ss", "") +BUILTIN(__builtin_altivec_vminuh, "V8UsV8UsV8Us", "") +BUILTIN(__builtin_altivec_vminsw, "V4SiV4SiV4Si", "") +BUILTIN(__builtin_altivec_vminuw, "V4UiV4UiV4Ui", "") +BUILTIN(__builtin_altivec_vminfp, "V4fV4fV4f", "") + +BUILTIN(__builtin_altivec_mtvscr, "vV4i", "") + +BUILTIN(__builtin_altivec_vcmpbfp_p, "iiV4fV4f", "") + +BUILTIN(__builtin_altivec_vcmpgefp_p, "iiV4fV4f", "") + +BUILTIN(__builtin_altivec_vcmpequb_p, "iiV16cV16c", "") +BUILTIN(__builtin_altivec_vcmpequh_p, "iiV8sV8s", "") +BUILTIN(__builtin_altivec_vcmpequw_p, "iiV4iV4i", "") +BUILTIN(__builtin_altivec_vcmpeqfp_p, "iiV4fV4f", "") + +BUILTIN(__builtin_altivec_vcmpgtsb_p, "iiV16ScV16Sc", "") +BUILTIN(__builtin_altivec_vcmpgtub_p, "iiV16UcV16Uc", "") +BUILTIN(__builtin_altivec_vcmpgtsh_p, "iiV8SsV8Ss", "") +BUILTIN(__builtin_altivec_vcmpgtuh_p, "iiV8UsV8Us", "") +BUILTIN(__builtin_altivec_vcmpgtsw_p, "iiV4SiV4Si", "") +BUILTIN(__builtin_altivec_vcmpgtuw_p, "iiV4UiV4Ui", "") +BUILTIN(__builtin_altivec_vcmpgtfp_p, "iiV4fV4f", "") + // FIXME: Obviously incomplete. #undef BUILTIN diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index 5c75d37..a878dd1 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -245,7 +245,7 @@ BUILTIN(__builtin_ia32_monitor, "vv*UiUi", "") BUILTIN(__builtin_ia32_mwait, "vUiUi", "") BUILTIN(__builtin_ia32_lddqu, "V16ccC*", "") BUILTIN(__builtin_ia32_palignr128, "V16cV16cV16cc", "") -BUILTIN(__builtin_ia32_palignr, "V1LLiV1LLiV1LLic", "") +BUILTIN(__builtin_ia32_palignr, "V8cV8cV8cc", "") BUILTIN(__builtin_ia32_insertps128, "V4fV4fV4fi", "") BUILTIN(__builtin_ia32_storelv4si, "vV2i*V2LLi", "") diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 57dd696..bf94af6 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -188,6 +188,9 @@ private: bool ErrorsAsFatal; // Treat errors like fatal errors. bool SuppressSystemWarnings; // Suppress warnings in system headers. bool SuppressAllDiagnostics; // Suppress all diagnostics. + unsigned ErrorLimit; // Cap of # errors emitted, 0 -> no limit. + unsigned TemplateBacktraceLimit; // Cap on depth of template backtrace stack, + // 0 -> no limit. ExtensionHandling ExtBehavior; // Map extensions onto warnings or errors? DiagnosticClient *Client; @@ -211,9 +214,10 @@ private: /// diagnostic that they follow. Diagnostic::Level LastDiagLevel; - unsigned NumDiagnostics; // Number of diagnostics reported - unsigned NumErrors; // Number of diagnostics that are errors - + unsigned NumWarnings; // Number of warnings reported + unsigned NumErrors; // Number of errors reported + unsigned NumErrorsSuppressed; // Number of errors suppressed + /// CustomDiagInfo - Information for uniquing and looking up custom diags. diag::CustomDiagInfo *CustomDiagInfo; @@ -270,6 +274,22 @@ public: void setClient(DiagnosticClient* client) { Client = client; } + /// setErrorLimit - Specify a limit for the number of errors we should + /// emit before giving up. Zero disables the limit. + void setErrorLimit(unsigned Limit) { ErrorLimit = Limit; } + + /// \brief Specify the maximum number of template instantiation + /// notes to emit along with a given diagnostic. + void setTemplateBacktraceLimit(unsigned Limit) { + TemplateBacktraceLimit = Limit; + } + + /// \brief Retrieve the maximum number of template instantiation + /// nodes to emit along with a given diagnostic. + unsigned getTemplateBacktraceLimit() const { + return TemplateBacktraceLimit; + } + /// setIgnoreAllWarnings - When set to true, any unmapped warnings are /// ignored. If this and WarningsAsErrors are both set, then this one wins. void setIgnoreAllWarnings(bool Val) { IgnoreAllWarnings = Val; } @@ -324,8 +344,9 @@ public: void setDiagnosticMapping(diag::kind Diag, diag::Mapping Map) { assert(Diag < diag::DIAG_UPPER_LIMIT && "Can only map builtin diagnostics"); - assert((isBuiltinWarningOrExtension(Diag) || Map == diag::MAP_FATAL) && - "Cannot map errors!"); + assert((isBuiltinWarningOrExtension(Diag) || + (Map == diag::MAP_FATAL || Map == diag::MAP_ERROR)) && + "Cannot map errors into warnings!"); setDiagnosticMappingInternal(Diag, Map, true); } @@ -338,7 +359,8 @@ public: bool hasFatalErrorOccurred() const { return FatalErrorOccurred; } unsigned getNumErrors() const { return NumErrors; } - unsigned getNumDiagnostics() const { return NumDiagnostics; } + unsigned getNumErrorsSuppressed() const { return NumErrorsSuppressed; } + unsigned getNumWarnings() const { return NumWarnings; } /// getCustomDiagID - Return an ID for a diagnostic with the specified message /// and level. If this is the first request for this diagnosic, it is @@ -383,7 +405,18 @@ public: /// isBuiltinExtensionDiag - Determine whether the given built-in diagnostic /// ID is for an extension of some sort. /// - static bool isBuiltinExtensionDiag(unsigned DiagID); + static bool isBuiltinExtensionDiag(unsigned DiagID) { + bool ignored; + return isBuiltinExtensionDiag(DiagID, ignored); + } + + /// isBuiltinExtensionDiag - Determine whether the given built-in diagnostic + /// ID is for an extension of some sort. This also returns EnabledByDefault, + /// which is set to indicate whether the diagnostic is ignored by default (in + /// which case -pedantic enables it) or treated as a warning/error by default. + /// + static bool isBuiltinExtensionDiag(unsigned DiagID, bool &EnabledByDefault); + /// getWarningOptionForDiag - Return the lowest-level warning option that /// enables the specified diagnostic. If there is no -Wfoo flag that controls @@ -473,7 +506,7 @@ private: /// getDiagnosticMappingInfo - Return the mapping info currently set for the /// specified builtin diagnostic. This returns the high bit encoding, or zero /// if the field is completely uninitialized. - unsigned getDiagnosticMappingInfo(diag::kind Diag) const { + diag::Mapping getDiagnosticMappingInfo(diag::kind Diag) const { const DiagMappings ¤tMappings = DiagMappingsStack.back(); return (diag::Mapping)((currentMappings[Diag/2] >> (Diag & 1)*4) & 15); } diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td index 8e791c3..88e7dc1 100644 --- a/include/clang/Basic/DiagnosticCommonKinds.td +++ b/include/clang/Basic/DiagnosticCommonKinds.td @@ -13,6 +13,11 @@ let Component = "Common" in { +// Basic. + +def fatal_too_many_errors + : Error<"too many errors emitted, stopping now">, DefaultFatal; + def note_previous_definition : Note<"previous definition is here">; def note_previous_declaration : Note<"previous declaration is here">; def note_previous_implicit_declaration : Note< @@ -36,7 +41,7 @@ def err_expected_colon_after_setter_name : Error< "must end with ':'">; // Parse && Sema -def err_no_declarators : Error<"declaration does not declare anything">; +def ext_no_declarators : ExtWarn<"declaration does not declare anything">; def err_param_redefinition : Error<"redefinition of parameter %0">; def err_invalid_storage_class_in_func_decl : Error< "invalid storage class specifier in function declarator">; @@ -67,5 +72,6 @@ def err_target_invalid_feature : Error<"invalid target feature '%0'">; def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal; def err_file_modified : Error< "file '%0' modified since it was first processed">, DefaultFatal; - +def err_unsupported_bom : Error<"%0 byte order mark detected in '%1', but " + "encoding is not supported">, DefaultFatal; } diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index 3dbe47f..3b7272e 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -94,5 +94,7 @@ def warn_drv_conflicting_deployment_targets : Warning< def warn_drv_treating_input_as_cxx : Warning< "treating '%0' input as '%1' when in C++ mode, this behavior is deprecated">, InGroup<Deprecated>; +def warn_drv_objc_gc_unsupported : Warning< + "Objective-C garbage collection is not supported on this platform, ignoring '%0'">; } diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index 2e0b4ba..b731030 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -14,7 +14,10 @@ def err_fe_error_reading : Error<"error reading '%0'">; def err_fe_error_reading_stdin : Error<"error reading stdin">; def err_fe_error_backend : Error<"error in backend: %0">, DefaultFatal; def err_fe_invalid_ast_file : Error<"invalid AST file: '%0'">, DefaultFatal; -def err_fe_invalid_ast_action : Error<"invalid action for AST input">, DefaultFatal; +def err_fe_invalid_ast_action : Error<"invalid action for AST input">, + DefaultFatal; +def err_fe_inline_asm : Error<"%0">; // Error generated by the backend. +def note_fe_inline_asm_here : Note<"generated from here">; def err_fe_invalid_code_complete_file : Error< "cannot locate code-completion file %0">, DefaultFatal; def err_fe_stdout_binary : Error<"unable to change standard output to binary">, @@ -69,12 +72,12 @@ def err_fe_pth_file_has_no_source_header : Error< def warn_fe_macro_contains_embedded_newline : Warning< "macro '%0' contains embedded newline, text after the newline is ignored.">; -def err_verify_bogus_characters : Error< - "bogus characters before '{{' in expected string">; def err_verify_missing_start : Error< - "cannot find start ('{{') of expected string">; + "cannot find start ('{{') of expected %0">; def err_verify_missing_end : Error< - "cannot find end ('}}') of expected string">; + "cannot find end ('}}') of expected %0">; +def err_verify_invalid_content : Error< + "invalid expected %0: %1">; def err_verify_inconsistent_diags : Error< "'%0' diagnostics %select{expected|seen}1 but not %select{seen|expected}1: %2">; @@ -120,12 +123,18 @@ def warn_pch_nonfragile_abi2 : Error< "PCH file was compiled with the %select{32-bit|enhanced non-fragile}0 " "Objective-C ABI but the %select{32-bit|enhanced non-fragile}1 " "Objective-C ABI is selected">; +def warn_pch_no_constant_cfstrings : Error< + "Objctive-C NSstring generation support was %select{disabled|enabled}0 " + "in PCH file but currently %select{disabled|enabled}1">; def warn_pch_extensions : Error< "extensions were %select{enabled|disabled}0 in PCH file but are " "currently %select{enabled|disabled}1">; def warn_pch_gnu_extensions : Error< "GNU extensions were %select{disabled|enabled}0 in PCH file but are " "currently %select{disabled|enabled}1">; +def warn_pch_gnu_keywords : Error< + "GNU keywords were %select{disabled|enabled}0 in PCH file but are " + "currently %select{disabled|enabled}1">; def warn_pch_microsoft_extensions : Error< "Microsoft extensions were %select{disabled|enabled}0 in PCH file but are " "currently %select{disabled|enabled}1">; diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index b0c016b..c74a48c 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -108,6 +108,7 @@ def : DiagGroup<"type-limits">; def Uninitialized : DiagGroup<"uninitialized">; def UnknownPragmas : DiagGroup<"unknown-pragmas">; def UnusedArgument : DiagGroup<"unused-argument">; +def UnusedExceptionParameter : DiagGroup<"unused-exception-parameter">; def UnusedFunction : DiagGroup<"unused-function">; def UnusedLabel : DiagGroup<"unused-label">; def UnusedParameter : DiagGroup<"unused-parameter">; @@ -138,7 +139,8 @@ def Conversion : DiagGroup<"conversion", def Unused : DiagGroup<"unused", [UnusedArgument, UnusedFunction, UnusedLabel, - UnusedParameter, UnusedValue, UnusedVariable]>; + // UnusedParameter, (matches GCC's behavior) + UnusedValue, UnusedVariable]>; // Format settings. def Format : DiagGroup<"format", [FormatExtraArgs, FormatZeroLength, NonNull]>; @@ -156,23 +158,22 @@ def Extra : DiagGroup<"extra", [ ]>; def Most : DiagGroup<"most", [ + CharSubscript, Comment, Format, Implicit, MismatchedTags, MissingBraces, MultiChar, + Reorder, ReturnType, Switch, Trigraphs, Uninitialized, UnknownPragmas, - UnusedValue, - UnusedVariable, + Unused, VectorConversions, - VolatileRegisterVar, - Reorder, - CharSubscript + VolatileRegisterVar ]>; // -Wall is -Wmost -Wparentheses diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 3e0956f..2795851 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -190,7 +190,9 @@ def err_objc_missing_end : Error<"missing @end">; def warn_objc_protocol_qualifier_missing_id : Warning< "protocol qualifiers without 'id' is archaic">; def err_objc_unknown_at : Error<"expected an Objective-C directive after '@'">; - +def err_illegal_super_cast : Error< + "cannot cast 'super' (it isn't an expression)">; + def err_objc_illegal_visibility_spec : Error< "illegal visibility specification">; def err_objc_illegal_interface_qual : Error<"illegal interface qualifier">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index b66d6cc..93ab858 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -85,6 +85,8 @@ def warn_unused_parameter : Warning<"unused parameter %0">, InGroup<UnusedParameter>, DefaultIgnore; def warn_unused_variable : Warning<"unused variable %0">, InGroup<UnusedVariable>, DefaultIgnore; +def warn_unused_exception_param : Warning<"unused exception parameter %0">, + InGroup<UnusedExceptionParameter>, DefaultIgnore; def warn_decl_in_param_list : Warning< "declaration of %0 will not be visible outside of this function">; def err_array_star_in_function_definition : Error< @@ -215,7 +217,8 @@ def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">; def err_statically_allocated_object : Error< "interface type cannot be statically allocated">; def err_object_cannot_be_passed_returned_by_value : Error< - "interface type %1 cannot be %select{returned|passed}0 by value">; + "interface type %1 cannot be %select{returned|passed}0 by value" + "; did you forget * in %1">; def warn_enum_value_overflow : Warning<"overflow in enumeration value">; def warn_pragma_pack_invalid_alignment : Warning< "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">; @@ -237,6 +240,8 @@ def err_duplicate_class_def : Error< "duplicate interface definition for class %0">; def err_undef_superclass : Error< "cannot find interface declaration for %0, superclass of %1">; +def err_no_nsconstant_string_class : Error< + "cannot find interface declaration for %0">; def err_recursive_superclass : Error< "trying to recursively use %0 as superclass of %1">; def warn_previous_alias_decl : Warning<"previously declared alias is ignored">; @@ -296,7 +301,7 @@ def warn_implements_nscopying : Warning< def warn_multiple_method_decl : Warning<"multiple methods named %0 found">; def warn_accessor_property_type_mismatch : Warning< "type of property %0 does not match type of accessor %1">; -def note_declared_at : Note<"declared at">; +def note_declared_at : Note<"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">; @@ -322,8 +327,8 @@ def warn_atomic_property_rule : Warning< "writable atomic property %0 cannot pair a synthesized setter/getter " "with a user defined setter/getter">; def err_use_continuation_class : Error< - "property declaration in continuation class of %0 is to change a 'readonly' " - "property to 'readwrite'">; + "illegal declaration of property in continuation class %0" + ": attribute must be readwrite, while its primary must be readonly">; def err_continuation_class : Error<"continuation class has no primary class">; def err_property_type : Error<"property cannot have array or function type %0">; def error_missing_property_context : Error< @@ -381,11 +386,13 @@ def err_static_assert_failed : Error<"static_assert failed \"%0\"">; def err_unexpected_friend : Error< "friends can only be classes or functions">; -def err_enum_friend : Error< - "enum types cannot be friends">; +def ext_enum_friend : ExtWarn< + "enumeration type %0 cannot be a friend">; +def ext_nonclass_type_friend : ExtWarn< + "non-class type %0 cannot be a friend">; def err_friend_is_member : Error< "friends cannot be members of the declaring class">; -def err_unelaborated_friend_type : Error< +def ext_unelaborated_friend_type : ExtWarn< "must specify '%select{struct|union|class|enum}0' to befriend %1">; def err_qualified_friend_not_found : Error< "no function named %0 with type %1 was found in the specified scope">; @@ -399,6 +406,9 @@ def err_abstract_type_in_decl : Error< "%select{return|parameter|variable|field}0 type %1 is an abstract class">; def err_allocation_of_abstract_type : Error< "allocation of an object of abstract type %0">; +def err_throw_abstract_type : Error< + "cannot throw an object of abstract type %0">; +def err_array_of_abstract_type : Error<"array of abstract class type %0">; def err_multiple_final_overriders : Error< "virtual function %q0 has more than one final overrider in %1">; @@ -448,11 +458,20 @@ def warn_missing_exception_specification : Warning< // C++ access checking def err_class_redeclared_with_different_access : Error< "%0 redeclared with '%1' access">; -def err_access : - Error<"%1 is a %select{private|protected}0 member of %3">, - NoSFINAE; -def err_access_ctor : - Error<"calling a %select{private|protected}0 constructor of class %2">, +def err_access : Error< + "%1 is a %select{private|protected}0 member of %3">, NoSFINAE; +def err_access_ctor : Error< + "calling a %select{private|protected}0 constructor of class %2">, NoSFINAE; +def err_access_base : Error< + "%select{base class|inherited virtual base class}0 %1 has %select{private|" + "protected}3 %select{constructor|copy constructor|copy assignment operator|" + "destructor}2">, NoSFINAE; +def err_access_field: Error< + "field of type %0 has %select{private|protected}2 %select{constructor|copy " + "constructor|copy assignment operator|destructor}1">, NoSFINAE; + +def err_access_ctor_field : + Error<"field of type %1 has %select{private|protected}2 constructor">, NoSFINAE; def err_access_dtor_base : Error<"base class %0 has %select{private|protected}1 destructor">, @@ -461,6 +480,9 @@ def err_access_dtor_vbase : Error<"inherited virtual base class %0 has " "%select{private|protected}1 destructor">, NoSFINAE; +def err_access_dtor_temp : + Error<"temporary of type %0 has %select{private|protected}1 destructor">, + NoSFINAE; def err_access_dtor_field : Error<"field of type %1 has %select{private|protected}2 destructor">, NoSFINAE; @@ -494,6 +516,9 @@ def note_access_constrained_by_path : Note< // C++ name lookup def err_incomplete_nested_name_spec : Error< "incomplete type %0 named in nested name specifier">; +def err_dependent_nested_name_spec : Error< + "nested name specifier for a declaration cannot depend on a template " + "parameter">; def err_nested_name_member_ref_lookup_ambiguous : Error< "lookup of %0 in member access expression is ambiguous">; def note_ambig_member_ref_object_type : Note< @@ -542,6 +567,8 @@ def err_non_virtual_pure : Error< def err_implicit_object_parameter_init : Error< "cannot initialize object parameter of type %0 with an expression " "of type %1">; +def err_qualified_member_of_unrelated : Error< + "%q0 is not a member of class %1">; def note_field_decl : Note<"member is declared here">; def note_ivar_decl : Note<"ivar is declared here">; @@ -592,6 +619,7 @@ def err_covariant_return_type_class_type_more_qualified : Error< "return type of virtual function %0 is not covariant with the return type of " "the function it overrides (class type %1 is more qualified than class " "type %2">; + // C++ constructors def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">; def err_invalid_qualified_constructor : Error< @@ -601,6 +629,11 @@ def err_constructor_return_type : Error< def err_constructor_redeclared : Error<"constructor cannot be redeclared">; def err_constructor_byvalue_arg : Error< "copy constructor must pass its first argument by reference">; +def warn_no_constructor_for_refconst : Warning< + "%select{struct|union|class|enum}0 %1 does not declare any constructor to " + "initialize its non-modifiable members">; +def note_refconst_member_not_initialized : Note< + "%select{const|reference}0 member %1 will never be initialized">; // C++ destructors def err_destructor_not_member : Error< @@ -678,18 +711,23 @@ def warn_field_is_uninit : Warning<"field is uninitialized when used here">, InGroup<DiagGroup<"uninitialized">>; def err_temp_copy_no_viable : Error< - "no viable copy constructor %select{copying variable|copying parameter|" + "no viable constructor %select{copying variable|copying parameter|" "returning object|throwing object|copying member subobject|copying array " - "element}0 of type %1">; + "element|allocating object|copying temporary|initializing base subobject|" + "initializing vector element}0 of type %1">; def err_temp_copy_ambiguous : Error< - "ambiguous copy constructor call when %select{copying variable|copying " + "ambiguous constructor call when %select{copying variable|copying " "parameter|returning object|throwing object|copying member subobject|copying " - "array element}0 of type %1">; + "array element|allocating object|copying temporary|initializing base subobject|" + "initializing vector element}0 of type %1">; def err_temp_copy_deleted : Error< "%select{copying variable|copying parameter|returning object|throwing " - "object|copying member subobject|copying array element}0 of type %1 invokes " - "deleted copy constructor">; - + "object|copying member subobject|copying array element|allocating object|" + "copying temporary|initializing base subobject|initializing vector element}0 " + "of type %1 invokes deleted constructor">; +def err_temp_copy_incomplete : Error< + "copying a temporary object of incomplete type %0">; + // C++0x decltype def err_cannot_determine_declared_type_of_overloaded_function : Error< "cannot determine the %select{type|declared type}0 of an overloaded " @@ -1116,9 +1154,13 @@ def err_member_call_without_object : Error< "call to non-static member function without an object argument">; // C++ Address of Overloaded Function +def err_addr_ovl_no_viable : Error< + "address of overloaded function %0 does not match required type %1">; def err_addr_ovl_ambiguous : Error< "address of overloaded function %0 is ambiguous">; - +def err_addr_ovl_not_func_ptrref : Error< + "address of overloaded function %0 cannot be converted to type %1">; + // C++ Template Declarations def err_template_param_shadow : Error< "declaration of %0 shadows template parameter">; @@ -1178,6 +1220,8 @@ def err_template_decl_ref : Error< "cannot refer to class template %0 without a template argument list">; // C++ Template Argument Lists +def err_template_missing_args : Error< + "use of class template %0 requires template arguments">; def err_template_arg_list_different_arity : Error< "%select{too few|too many}0 template arguments for " "%select{class template|function template|template template parameter" @@ -1231,9 +1275,6 @@ def err_template_arg_no_ref_bind : Error< def err_template_arg_ref_bind_ignores_quals : Error< "reference binding of non-type template parameter of type %0 to template " "argument of type %1 ignores qualifiers">; -def err_template_arg_unresolved_overloaded_function : Error< - "overloaded function cannot be resolved to a non-type template parameter of " - "type %0">; def err_template_arg_not_decl_ref : Error< "non-type template argument does not refer to any declaration">; def err_template_arg_not_object_or_func_form : Error< @@ -1414,7 +1455,10 @@ def note_prior_template_arg_substitution : Note< " template parameter%1 %2">; def note_template_default_arg_checking : Note< "while checking a default template argument used here">; - +def note_instantiation_contexts_suppressed : Note< + "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to " + "see all)">; + def err_field_instantiates_to_function : Error< "data member instantiated with function type %0">; def err_nested_name_spec_non_tag : Error< @@ -1551,6 +1595,14 @@ 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)">; +def err_tag_reference_non_tag : Error< + "elaborated type refers to %select{a non-tag type|a typedef|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">; +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">; def err_conflicting_types : Error<"conflicting types for %0">; @@ -1641,6 +1693,8 @@ def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">; def err_illegal_initializer : Error< "illegal initializer (only variables can be initialized)">; def err_illegal_initializer_type : Error<"illegal initializer type %0">; +def err_init_objc_class : Error< + "cannot initialize Objective-C class type %0">; def err_implicit_empty_initializer : Error< "initializer for aggregate with no elements requires explicit braces">; def err_bitfield_has_negative_width : Error< @@ -1649,9 +1703,18 @@ def err_anon_bitfield_has_negative_width : Error< "anonymous bit-field has negative width (%0)">; def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">; def err_bitfield_width_exceeds_type_size : Error< - "size of bit-field %0 exceeds size of its type (%1 bits)">; + "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 exceeds size of its type (%0 bits)">; + "size of anonymous bit-field (%0 bits) exceeds size of its type (%1 bits)">; + +// Used by C++ which allows bit-fields that are wider than the type. +def warn_bitfield_width_exceeds_type_size: Warning< + "size of bit-field %0 (%1 bits) exceeds the size of its type; value will be " + "truncated to %2 bits">; +def warn_anon_bitfield_width_exceeds_type_size : Warning< + "size of anonymous bit-field (%0 bits) exceeds size of its type; value will " + "be truncated to %1 bits">; + def warn_missing_braces : Warning< "suggest braces around initialization of subobject">, InGroup<DiagGroup<"missing-braces">>, DefaultIgnore; @@ -1758,6 +1821,7 @@ def ext_offsetof_extended_field_designator : Extension< "using extended field designator is an extension">; def warn_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">, InGroup<InvalidOffsetof>; +def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">; def warn_floatingpoint_eq : Warning< "comparing floating point with == or != is unsafe">, @@ -1773,6 +1837,8 @@ def warn_precedence_bitwise_rel : Warning< InGroup<Parentheses>; def note_precedence_bitwise_first : Note< "place parentheses around the %0 expression to evaluate it first">; +def note_precedence_bitwise_silence : Note< + "place parentheses around the %0 expression to silence this warning">; def err_sizeof_nonfragile_interface : Error< "invalid application of '%select{alignof|sizeof}1' to interface %0 in " @@ -1807,9 +1873,9 @@ def err_typecheck_member_reference_arrow : Error< def err_typecheck_member_reference_suggestion : Error< "member reference type %0 is %select{a|not a}1 pointer; maybe you meant to use '%select{->|.}1'?">; def err_typecheck_member_reference_type : Error< - "cannot refer to type member %0 with '%select{.|->}1'">; + "cannot refer to type member %0 in %1 with '%select{.|->}2'">; def err_typecheck_member_reference_unknown : Error< - "cannot refer to member %0 with '%select{.|->}1'">; + "cannot refer to member %0 in %1 with '%select{.|->}2'">; def err_member_reference_needs_call : Error< "base of member reference has function type %0; perhaps you meant to call " "this function with '()'?">; @@ -1835,6 +1901,8 @@ def err_out_of_line_declaration : Error< def note_member_def_close_match : Note<"member declaration nearly matches">; def err_typecheck_ivar_variable_size : Error< "instance variables must have a constant size">; +def err_ivar_reference_type : Error< + "instance variables cannot be of reference type">; def err_typecheck_illegal_increment_decrement : Error< "cannot %select{decrement|increment}1 value of type %0">; def err_typecheck_arithmetic_incomplete_type : Error< @@ -2003,10 +2071,16 @@ def error_no_super_class : Error< "no super class declared in @interface for %0">; def err_invalid_receiver_to_message : Error< "invalid receiver to message expression">; +def err_invalid_receiver_to_message_super : Error< + "'super' is only valid in a method body">; +def err_invalid_receiver_class_message : Error< + "receiver type %0 is not an Objective-C class">; def warn_bad_receiver_type : Warning< "receiver type %0 is not 'id' or interface pointer, consider " "casting it to 'id'">; def err_bad_receiver_type : Error<"bad receiver type %0">; +def err_unknown_receiver_suggest : Error< + "unknown receiver %0; did you mean %1?">; def error_objc_throw_expects_object : Error< "@throw requires an Objective-C object type (%0 invalid)">; def error_objc_synchronized_expects_object : Error< @@ -2019,8 +2093,15 @@ def err_catch_param_not_objc_type : Error< "@catch parameter is not a pointer to an interface type">; def err_illegal_qualifiers_on_catch_parm : Error< "illegal qualifiers on @catch parameter">; -def err_illegal_super_cast : Error< - "cannot cast 'super' (it isn't an expression)">; +def err_storage_spec_on_catch_parm : Error< + "@catch parameter cannot have storage specifier %select{|'typedef'|'extern'|" + "'static'|'auto'|'register'|'__private_extern__'|'mutable'}0">; +def warn_register_objc_catch_parm : Warning< + "'register' storage specifier on @catch parameter will be ignored">; +def err_qualified_objc_catch_parm : Error< + "@catch parameter declarator cannot be qualified">; + + def warn_setter_getter_impl_required : Warning< "property %0 requires method %1 to be defined - " "use @synthesize, @dynamic or provide a method implementation">; @@ -2029,7 +2110,10 @@ def warn_setter_getter_impl_required_in_category : Warning< "use @dynamic or provide a method implementation in category">; def note_property_impl_required : Note< "implementation is here">; - +def note_parameter_named_here : Note< + "passing argument to parameter %0 here">; +def note_parameter_here : Note< + "passing argument to parameter here">; // C++ casts // These messages adhere to the TryCast pattern: %0 is an int specifying the @@ -2099,6 +2183,8 @@ def err_new_incomplete_type : Error< "allocation of incomplete type %0">; def err_new_array_nonconst : Error< "only the first dimension of an allocated array may have dynamic size">; +def err_new_array_init_args : Error< + "array 'new' cannot have initialization arguments">; def err_new_paren_array_nonconst : Error< "when type is in parentheses, array cannot have dynamic size">; def err_placement_new_non_placement_delete : Error< @@ -2116,8 +2202,8 @@ def warn_delete_incomplete : Warning< "deleting pointer to incomplete type %0 may cause undefined behaviour">; def err_no_suitable_delete_member_function_found : Error< "no suitable member %0 in %1">; -def note_delete_member_function_declared_here : Note< - "%0 declared here">; +def note_member_declared_here : Note< + "member %0 declared here">; def err_decrement_bool : Error<"cannot decrement expression of type bool">; def warn_increment_bool : Warning< "incrementing expression of type bool is deprecated">, InGroup<Deprecated>; @@ -2132,6 +2218,8 @@ def err_qualified_catch_declarator : Error< def err_early_catch_all : Error<"catch-all handler must come last">; def err_bad_memptr_rhs : Error< "right hand operand to %0 has non pointer-to-member type %1">; +def err_memptr_rhs_to_incomplete : Error< + "cannot dereference pointer into incomplete class type %0">; def err_bad_memptr_lhs : Error< "left hand operand to %0 must be a %select{|pointer to }1class " "compatible with the right hand operand, but is %2">; @@ -2190,6 +2278,8 @@ def err_typecheck_deleted_function : Error< "conversion function from %0 to %1 invokes a deleted function">; def err_expected_class_or_namespace : Error<"expected a class or namespace">; +def err_missing_qualified_for_redecl : Error< + "must qualify the name %0 to declare %q1 in this scope">; def err_invalid_declarator_scope : Error< "definition or redeclaration of %0 not in a namespace enclosing %1">; def err_invalid_declarator_global_scope : Error< @@ -2213,6 +2303,8 @@ def warn_condition_is_idiomatic_assignment : Warning<"using the result " InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore; def note_condition_assign_to_comparison : Note< "use '==' to turn this assignment into an equality comparison">; +def note_condition_assign_silence : Note< + "place parentheses around the assignment to silence this warning">; def warn_value_always_zero : Warning< "%0 is always %select{zero|false|NULL}1 in this context">; @@ -2221,53 +2313,91 @@ def warn_value_always_zero : Warning< // In most of these diagnostics the %2 is a value from the // Sema::AssignmentAction enumeration def err_typecheck_convert_incompatible : Error< - "incompatible type %select{assigning|passing|returning|converting|initializing|sending|casting}2" - " %1, expected %0">; -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">; + "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" + " %0 " + "%select{from incompatible type|to parameter of incompatible type|" + "from a function with incompatible result type|to incompatible type|" + "with an expression of incompatible type|to parameter of incompatible type|" + "to incompatible type}2 %1">; def warn_incompatible_qualified_id : Warning< - "incompatible type %select{assigning|passing|returning|converting|initializing|sending|casting}2" - " %1, expected %0">; + "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" + " %0 " + "%select{from incompatible type|to parameter of incompatible type|" + "from a function with incompatible result type|to incompatible type|" + "with an expression of incompatible type|to parameter of incompatible type|" + "to incompatible type}2 %1">; def ext_typecheck_convert_pointer_int : ExtWarn< "incompatible pointer to integer conversion " - "%select{assigning|passing|returning|converting|initializing|sending|casting}2 %1, expected %0">; + "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" + " %0 " + "%select{from|to parameter of type|from a function with result type|to type|" + "with an expression of type|to parameter of type|to type}2 %1">; def ext_typecheck_convert_int_pointer : ExtWarn< "incompatible integer to pointer conversion " - "%select{assigning|passing|returning|converting|initializing|sending|casting}2 %1, expected %0">; + "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" + " %0 " + "%select{from|to parameter of type|from a function with result type|to type|" + "with an expression of type|to parameter of type|to type}2 %1">; def ext_typecheck_convert_pointer_void_func : Extension< - "%select{assigning|passing|returning|converting|initializing|sending|casting}2" - " %1 converts between void* and function pointer, expected %0">; + "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" + " %0 " + "%select{from|to parameter of type|from a function with result type|to type|" + "with an expression of type|to parameter of type|to type}2 %1 " + "converts between void pointer and function pointer">; def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn< - "pointer types point to integer types with different sign " - "%select{assigning|passing|returning|converting|initializing|sending|casting}2 %1, expected %0">, + "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" + " %0 " + "%select{from|to parameter of type|from a function with result type|to type|" + "with an expression of type|to parameter of type|to type}2 %1 " + "converts between pointers to integer types with different sign">, InGroup<DiagGroup<"pointer-sign">>; def ext_typecheck_convert_incompatible_pointer : ExtWarn< "incompatible pointer types " - "%select{assigning|passing|returning|converting|initializing|sending|casting}2 %1, expected %0">; + "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" + " %0 " + "%select{from|to parameter of type|from a function with result type|to type|" + "with an expression of type|to parameter of type|to type}2 %1">; def ext_typecheck_convert_discards_qualifiers : ExtWarn< - "%select{assigning|passing|returning|converting|initializing|sending|casting}2" - " %1 discards qualifiers, expected %0">; + "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" + " %0 " + "%select{from|to parameter of type|from a function with result type|to type|" + "with an expression of type|to parameter of type|to type}2 %1 discards " + "qualifiers">; def ext_nested_pointer_qualifier_mismatch : ExtWarn< - "%select{assigning|passing|returning|converting|initializing|sending|casting}2," - " %0 and %1 have different qualifiers in nested pointer types">; + "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" + " %0 " + "%select{from|to parameter of type|from a function with result type|to type|" + "with an expression of type|to parameter of type|to type}2 %1 discards " + "qualifiers in nested pointer types">; def warn_incompatible_vectors : Warning< - "incompatible vector types %select{assigning|passing|returning|converting|initializing|sending|casting}2" - " %1, expected %0">, + "incompatible vector types " + "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" + " %0 " + "%select{from|to parameter of type|from a function with result type|to type|" + "with an expression of type|to parameter of type|to type}2 %1">, InGroup<VectorConversions>, DefaultIgnore; def err_int_to_block_pointer : Error< - "invalid conversion " - "%select{assigning|passing|returning|converting|initializing|sending|casting}2" - " integer %1, expected block pointer %0">; -def err_typecheck_comparison_of_distinct_blocks : Error< - "comparison of distinct block types (%0 and %1)">; + "invalid block pointer conversion " + "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" + " %0 " + "%select{from|to parameter of type|from a function with result type|to type|" + "with an expression of type|to parameter of type|to type}2 %1">; def err_typecheck_convert_incompatible_block_pointer : Error< "incompatible block pointer types " - "%select{assigning|passing|returning|converting|initializing|sending|casting}2 %1, expected %0">; + "%select{assigning to|passing|returning|converting|initializing|sending|casting}2" + " %0 " + "%select{from|to parameter of type|from a function with result type|to type|" + "with an expression of type|to parameter of type|to type}2 %1">; + +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)">; def err_typecheck_array_not_modifiable_lvalue : Error< "array type %0 is not assignable">; @@ -2295,9 +2425,17 @@ def note_function_with_incomplete_return_type_declared_here : Note< def err_call_incomplete_argument : Error< "argument type %0 is incomplete">; def err_typecheck_call_too_few_args : Error< - "too few arguments to %select{function|block|method}0 call">; + "too few arguments to %select{function|block|method}0 call, " + "expected %1, have %2">; +def err_typecheck_call_too_few_args_at_least : Error< + "too few arguments to %select{function|block|method}0 call, " + "expected at least %1, have %2">; def err_typecheck_call_too_many_args : Error< - "too many arguments to %select{function|block|method}0 call">; + "too many arguments to %select{function|block|method}0 call, " + "expected %1, have %2">; +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">; def warn_call_wrong_number_of_arguments : Warning< "too %select{few|many}0 arguments in call to %1">; def err_atomic_builtin_must_be_pointer : Error< @@ -2359,8 +2497,11 @@ def ext_typecheck_expression_not_constant_but_accepted : Extension< InGroup<GNU>; def warn_unused_expr : Warning<"expression result unused">, InGroup<UnusedValue>; +def warn_unused_voidptr : Warning< + "expression result unused; should this cast be to 'void'?">, + InGroup<UnusedValue>; def warn_unused_property_expr : Warning< - "property access result unused - getters should not have side effects">, + "property access result unused - getters should not be used for side effects">, InGroup<UnusedValue>; def warn_unused_call : Warning< "ignoring return value of function declared with %0 attribute">, @@ -2412,24 +2553,21 @@ def err_overload_incorrect_fntype : Error< def err_only_constructors_take_base_inits : Error< "only constructors take base initializers">; -def error_multiple_mem_initialization : Error < - "multiple initializations given for non-static member '%0'">; - -def error_multiple_base_initialization : Error < +def err_multiple_mem_initialization : Error < + "multiple initializations given for non-static member %0">; +def err_multiple_mem_union_initialization : Error < + "initializing multiple members of anonymous union">; +def err_multiple_base_initialization : Error < "multiple initializations given for base %0">; def err_mem_init_not_member_or_class : Error< "member initializer %0 does not name a non-static data member or base " "class">; -def warn_field_initialized : Warning< - "member '%0' will be initialized after">, - InGroup<Reorder>, DefaultIgnore; -def warn_base_initialized : Warning< - "base class %0 will be initialized after">, +def warn_initializer_out_of_order : Warning< + "%select{field|base class}0 %1 will be initialized after " + "%select{field|base}2 %3">, InGroup<Reorder>, DefaultIgnore; -def note_fieldorbase_initialized_here : Note< - "%select{field|base}0 %1">; def err_base_init_does_not_name_class : Error< "constructor initializer %0 does not name a class">; @@ -2437,9 +2575,7 @@ def err_base_init_direct_and_virtual : Error< "base class initializer %0 names both a direct base class and an " "inherited virtual base class">; def err_not_direct_base_or_virtual : Error< - "type %0 is not a direct or virtual base of '%1'">; -def err_not_direct_base_or_virtual_multi : Error< - "type %0 is not a direct or virtual base of '%1'">; + "type %0 is not a direct or virtual base of %1">; def err_in_class_initializer_non_integral_type : Error< "in-class initializer has non-integral, non-enumeration type %0">; @@ -2587,6 +2723,8 @@ def err_conv_function_to_array : Error< "conversion function cannot convert to an array type">; def err_conv_function_to_function : Error< "conversion function cannot convert to a function type">; +def err_conv_function_with_complex_decl : Error< + "must use a typedef to declare a conversion to %0">; def err_conv_function_redeclared : Error< "conversion function cannot be redeclared">; def warn_conv_to_self_not_used : Warning< @@ -2669,7 +2807,7 @@ def warn_selfcomparison : Warning< "self-comparison always results in a constant value">; def warn_stringcompare : Warning< "result of comparison against %select{a string literal|@encode}0 is " - "unspecified (use strcmp instead)">; + "unspecified (use strncmp instead)">; @@ -2698,7 +2836,7 @@ def err_default_not_in_switch : Error< "'default' statement not in switch statement">; def err_case_not_in_switch : Error<"'case' statement not in switch statement">; def warn_bool_switch_condition : Warning< - "switch condition is a bool">; + "switch condition has boolean value">; def warn_case_value_overflow : Warning< "overflow converting case value to switch condition type (%0 to %1)">, InGroup<DiagGroup<"switch">>; @@ -2770,22 +2908,15 @@ def err_vector_incorrect_num_initializers : Error< "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">; def err_altivec_empty_initializer : Error<"expected initializer">; -def err_stack_const_level : Error< - "level argument for a stack address builtin must be constant">; - -def err_prefetch_invalid_arg_type : Error< - "argument to __builtin_prefetch must be of integer type">; -def err_prefetch_invalid_arg_ice : Error< - "argument to __builtin_prefetch must be a constant integer">; def err_argument_invalid_range : Error< "argument should be a value from %0 to %1">; -def err_object_size_invalid_argument : Error< - "argument to __builtin_object_size must be a constant integer">; - def err_builtin_longjmp_invalid_val : Error< "argument to __builtin_longjmp must be a constant 1">; +def err_constant_integer_arg_type : Error< + "argument to %0 must be a constant integer">; + def ext_mixed_decls_code : Extension< "ISO C90 forbids mixing declarations and code">; def err_non_variable_decl_in_for : Error< @@ -2834,9 +2965,9 @@ def warn_ivar_use_hidden : Warning< def error_ivar_use_in_class_method : Error< "instance variable %0 accessed in class method">; def error_private_ivar_access : Error<"instance variable %0 is private">, - NoSFINAE; + NoSFINAE; def error_protected_ivar_access : Error<"instance variable %0 is protected">, - NoSFINAE; + NoSFINAE; def warn_maynot_respond : Warning<"%0 may not respond to %1">; def warn_attribute_method_def : Warning< "method attribute can only be specified on method declarations">; diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h index fdf69d0..1ed86f1 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -28,6 +28,7 @@ public: unsigned DollarIdents : 1; // '$' allowed in identifiers. unsigned AsmPreprocessor : 1; // Preprocessor in asm mode. unsigned GNUMode : 1; // True in gnu99 mode false in c99 mode (etc) + unsigned GNUKeywords : 1; // True if GNU-only keywords are allowed unsigned ImplicitInt : 1; // C89 implicit 'int'. unsigned Digraphs : 1; // C94, C99 and C++ unsigned HexFloats : 1; // C99 Hexadecimal float constants. @@ -98,8 +99,13 @@ public: unsigned ElideConstructors : 1; // Whether C++ copy constructors should be // elided if possible. unsigned CatchUndefined : 1; // Generate code to check for undefined ops. - unsigned DumpVtableLayouts : 1; // Dump the layouts of all the emitted - // vtables. + unsigned DumpRecordLayouts : 1; /// Dump the layout of IRgen'd records. + unsigned DumpVTableLayouts : 1; /// Dump the layouts of emitted vtables. + unsigned NoConstantCFStrings : 1; // Do not do CF strings + + // FIXME: This is just a temporary option, for testing purposes. + unsigned NoBitFieldTypeAlign : 1; + private: unsigned GC : 2; // Objective-C Garbage Collection modes. We // declare this enum as unsigned because MSVC @@ -126,9 +132,10 @@ public: LangOptions() { Trigraphs = BCPLComment = Bool = DollarIdents = AsmPreprocessor = 0; - GNUMode = ImplicitInt = Digraphs = 0; + GNUMode = GNUKeywords = ImplicitInt = Digraphs = 0; HexFloats = 0; GC = ObjC1 = ObjC2 = ObjCNonFragileABI = ObjCNonFragileABI2 = 0; + NoConstantCFStrings = 0; C99 = Microsoft = CPlusPlus = CPlusPlus0x = 0; CXXOperatorNames = PascalStrings = WritableStrings = ConstStrings = 0; Exceptions = SjLjExceptions = Freestanding = NoBuiltin = 0; @@ -155,7 +162,7 @@ public: OverflowChecking = 0; ObjCGCBitmapPrint = 0; - InstantiationDepth = 500; + InstantiationDepth = 1024; Optimize = 0; OptimizeSize = 0; @@ -169,7 +176,9 @@ public: CharIsSigned = 1; ShortWChar = 0; CatchUndefined = 0; - DumpVtableLayouts = 0; + DumpRecordLayouts = 0; + DumpVTableLayouts = 0; + NoBitFieldTypeAlign = 0; } GCMode getGCMode() const { return (GCMode) GC; } diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index 555e6f5..0bbeffe 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -176,19 +176,14 @@ public: /// FullSourceLoc - A SourceLocation and its associated SourceManager. Useful /// for argument passing to functions that expect both objects. class FullSourceLoc : public SourceLocation { - SourceManager* SrcMgr; + const SourceManager *SrcMgr; public: /// Creates a FullSourceLoc where isValid() returns false. - explicit FullSourceLoc() : SrcMgr((SourceManager*) 0) {} + explicit FullSourceLoc() : SrcMgr(0) {} - explicit FullSourceLoc(SourceLocation Loc, SourceManager &SM) + explicit FullSourceLoc(SourceLocation Loc, const SourceManager &SM) : SourceLocation(Loc), SrcMgr(&SM) {} - SourceManager &getManager() { - assert(SrcMgr && "SourceManager is NULL."); - return *SrcMgr; - } - const SourceManager &getManager() const { assert(SrcMgr && "SourceManager is NULL."); return *SrcMgr; diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index d123969..930fb52 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -78,8 +78,13 @@ namespace SrcMgr { /// \param Diag Object through which diagnostics will be emitted it the /// buffer cannot be retrieved. /// + /// \param Loc If specified, is the location that invalid file diagnostics + /// will be emitted at. + /// /// \param Invalid If non-NULL, will be set \c true if an error occurred. - const llvm::MemoryBuffer *getBuffer(Diagnostic &Diag, + const llvm::MemoryBuffer *getBuffer(Diagnostic &Diag, + const SourceManager &SM, + SourceLocation Loc = SourceLocation(), bool *Invalid = 0) const; /// getSize - Returns the size of the content encapsulated by this @@ -447,11 +452,17 @@ public: /// getBuffer - Return the buffer for the specified FileID. If there is an /// error opening this buffer the first time, this manufactures a temporary /// buffer and returns a non-empty error string. - const llvm::MemoryBuffer *getBuffer(FileID FID, bool *Invalid = 0) const { - return getSLocEntry(FID).getFile().getContentCache()->getBuffer(Diag, - Invalid); + const llvm::MemoryBuffer *getBuffer(FileID FID, SourceLocation Loc, + bool *Invalid = 0) const { + return getSLocEntry(FID).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); + } + /// getFileEntryForID - Returns the FileEntry record for the provided FileID. const FileEntry *getFileEntryForID(FileID FID) const { return getSLocEntry(FID).getFile().getContentCache()->Entry; diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index bc2cf19..1998750 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -45,6 +45,7 @@ protected: // Target values set by the ctor of the actual target implementation. Default // values are specified by the TargetInfo constructor. bool TLSSupported; + bool NoAsmVariants; // True if {|} are normal characters. unsigned char PointerWidth, PointerAlign; unsigned char IntWidth, IntAlign; unsigned char FloatWidth, FloatAlign; @@ -85,6 +86,14 @@ public: protected: IntType SizeType, IntMaxType, UIntMaxType, PtrDiffType, IntPtrType, WCharType, WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType; + + /// Control whether the alignment of bit-field types is respected when laying + /// out structures. If true, then the alignment of the bit-field type will be + /// used to (a) impact the alignment of the containing structure, and (b) + /// ensure that the individual bit-field will not straddle an alignment + /// boundary. + unsigned UseBitFieldTypeAlignment : 1; + public: IntType getSizeType() const { return SizeType; } IntType getIntMaxType() const { return IntMaxType; } @@ -197,6 +206,10 @@ public: return UserLabelPrefix; } + bool useBitFieldTypeAlignment() const { + return UseBitFieldTypeAlignment; + } + /// getTypeName - Return the user string for the specified integer type enum. /// For example, SignedShort -> "short". static const char *getTypeName(IntType T); @@ -326,6 +339,18 @@ public: return "__DATA,__cfstring"; } + /// getNSStringSection - Return the section to use for NSString + /// literals, or 0 if no special section is used. + virtual const char *getNSStringSection() const { + return "__OBJC,__cstring_object,regular,no_dead_strip"; + } + + /// getNSStringNonFragileABISection - Return the section to use for + /// NSString literals, or 0 if no special section is used (NonFragile ABI). + virtual const char *getNSStringNonFragileABISection() const { + return "__DATA, __objc_stringobj, regular, no_dead_strip"; + } + /// isValidSectionSpecifier - This is an optional hook that targets can /// implement to perform semantic checking on attribute((section("foo"))) /// specifiers. In this case, "foo" is passed in to be checked. If the @@ -402,6 +427,15 @@ public: return TLSSupported; } + /// hasNoAsmVariants - Return true if {|} are normal characters in the + /// asm string. If this returns false (the default), then {abc|xyz} is syntax + /// that says that when compiling for asm variant #0, "abc" should be + /// generated, but when compiling for asm variant #1, "xyz" should be + /// generated. + bool hasNoAsmVariants() const { + return NoAsmVariants; + } + /// getEHDataRegisterNumber - Return the register number that /// __builtin_eh_return_regno would return with the specified argument. virtual int getEHDataRegisterNumber(unsigned RegNo) const { diff --git a/include/clang/Basic/Version.h b/include/clang/Basic/Version.h index 2e0993a..b3b6184 100644 --- a/include/clang/Basic/Version.h +++ b/include/clang/Basic/Version.h @@ -18,11 +18,11 @@ #include "llvm/ADT/StringRef.h" /// \brief Clang major version -#define CLANG_VERSION_MAJOR 1 +#define CLANG_VERSION_MAJOR 2 // FIXME: Updates to this file must also update CMakeLists.txt and VER. /// \brief Clang minor version -#define CLANG_VERSION_MINOR 5 +#define CLANG_VERSION_MINOR 0 /// \brief Clang patchlevel version // #define CLANG_VERSION_PATCHLEVEL 1 |