diff options
Diffstat (limited to 'include/clang/Basic')
-rw-r--r-- | include/clang/Basic/Builtins.def | 90 | ||||
-rw-r--r-- | include/clang/Basic/BuiltinsX86.def | 2 | ||||
-rw-r--r-- | include/clang/Basic/Diagnostic.h | 3 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticCommonKinds.td | 4 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticDriverKinds.td | 4 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticFrontendKinds.td | 36 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticGroups.td | 1 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticLexKinds.td | 17 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticParseKinds.td | 2 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 107 | ||||
-rw-r--r-- | include/clang/Basic/FileManager.h | 9 | ||||
-rw-r--r-- | include/clang/Basic/IdentifierTable.h | 6 | ||||
-rw-r--r-- | include/clang/Basic/LangOptions.h | 6 | ||||
-rw-r--r-- | include/clang/Basic/PartialDiagnostic.h | 33 | ||||
-rw-r--r-- | include/clang/Basic/SourceLocation.h | 8 | ||||
-rw-r--r-- | include/clang/Basic/SourceManager.h | 75 | ||||
-rw-r--r-- | include/clang/Basic/TokenKinds.def | 2 | ||||
-rw-r--r-- | include/clang/Basic/TypeTraits.h | 3 |
18 files changed, 267 insertions, 141 deletions
diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index 98c703d..e700cde 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -118,51 +118,51 @@ BUILTIN(__builtin_powf, "fff" , "nc") BUILTIN(__builtin_powl, "LdLdLd", "nc") // Standard unary libc/libm functions with double/float/long double variants: -BUILTIN(__builtin_acos , "dd" , "nc") -BUILTIN(__builtin_acosf, "ff" , "nc") -BUILTIN(__builtin_acosl, "LdLd", "nc") -BUILTIN(__builtin_asin , "dd" , "nc") -BUILTIN(__builtin_asinf, "ff" , "nc") -BUILTIN(__builtin_asinl, "LdLd", "nc") -BUILTIN(__builtin_atan , "dd" , "nc") -BUILTIN(__builtin_atanf, "ff" , "nc") -BUILTIN(__builtin_atanl, "LdLd", "nc") -BUILTIN(__builtin_ceil , "dd" , "nc") -BUILTIN(__builtin_ceilf, "ff" , "nc") -BUILTIN(__builtin_ceill, "LdLd", "nc") -BUILTIN(__builtin_cos , "dd" , "nc") -BUILTIN(__builtin_cosf, "ff" , "nc") -BUILTIN(__builtin_cosh , "dd" , "nc") -BUILTIN(__builtin_coshf, "ff" , "nc") -BUILTIN(__builtin_coshl, "LdLd", "nc") -BUILTIN(__builtin_cosl, "LdLd", "nc") -BUILTIN(__builtin_exp , "dd" , "nc") -BUILTIN(__builtin_expf, "ff" , "nc") -BUILTIN(__builtin_expl, "LdLd", "nc") -BUILTIN(__builtin_floor , "dd" , "nc") -BUILTIN(__builtin_floorf, "ff" , "nc") -BUILTIN(__builtin_floorl, "LdLd", "nc") -BUILTIN(__builtin_log , "dd" , "nc") -BUILTIN(__builtin_log10 , "dd" , "nc") -BUILTIN(__builtin_log10f, "ff" , "nc") -BUILTIN(__builtin_log10l, "LdLd", "nc") -BUILTIN(__builtin_logf, "ff" , "nc") -BUILTIN(__builtin_logl, "LdLd", "nc") -BUILTIN(__builtin_sin , "dd" , "nc") -BUILTIN(__builtin_sinf, "ff" , "nc") -BUILTIN(__builtin_sinh , "dd" , "nc") -BUILTIN(__builtin_sinhf, "ff" , "nc") -BUILTIN(__builtin_sinhl, "LdLd", "nc") -BUILTIN(__builtin_sinl, "LdLd", "nc") -BUILTIN(__builtin_sqrt , "dd" , "nc") -BUILTIN(__builtin_sqrtf, "ff" , "nc") -BUILTIN(__builtin_sqrtl, "LdLd", "nc") -BUILTIN(__builtin_tan , "dd" , "nc") -BUILTIN(__builtin_tanf, "ff" , "nc") -BUILTIN(__builtin_tanh , "dd" , "nc") -BUILTIN(__builtin_tanhf, "ff" , "nc") -BUILTIN(__builtin_tanhl, "LdLd", "nc") -BUILTIN(__builtin_tanl, "LdLd", "nc") +BUILTIN(__builtin_acos , "dd" , "Fnc") +BUILTIN(__builtin_acosf, "ff" , "Fnc") +BUILTIN(__builtin_acosl, "LdLd", "Fnc") +BUILTIN(__builtin_asin , "dd" , "Fnc") +BUILTIN(__builtin_asinf, "ff" , "Fnc") +BUILTIN(__builtin_asinl, "LdLd", "Fnc") +BUILTIN(__builtin_atan , "dd" , "Fnc") +BUILTIN(__builtin_atanf, "ff" , "Fnc") +BUILTIN(__builtin_atanl, "LdLd", "Fnc") +BUILTIN(__builtin_ceil , "dd" , "Fnc") +BUILTIN(__builtin_ceilf, "ff" , "Fnc") +BUILTIN(__builtin_ceill, "LdLd", "Fnc") +BUILTIN(__builtin_cos , "dd" , "Fnc") +BUILTIN(__builtin_cosf, "ff" , "Fnc") +BUILTIN(__builtin_cosh , "dd" , "Fnc") +BUILTIN(__builtin_coshf, "ff" , "Fnc") +BUILTIN(__builtin_coshl, "LdLd", "Fnc") +BUILTIN(__builtin_cosl, "LdLd", "Fnc") +BUILTIN(__builtin_exp , "dd" , "Fnc") +BUILTIN(__builtin_expf, "ff" , "Fnc") +BUILTIN(__builtin_expl, "LdLd", "Fnc") +BUILTIN(__builtin_floor , "dd" , "Fnc") +BUILTIN(__builtin_floorf, "ff" , "Fnc") +BUILTIN(__builtin_floorl, "LdLd", "Fnc") +BUILTIN(__builtin_log , "dd" , "Fnc") +BUILTIN(__builtin_log10 , "dd" , "Fnc") +BUILTIN(__builtin_log10f, "ff" , "Fnc") +BUILTIN(__builtin_log10l, "LdLd", "Fnc") +BUILTIN(__builtin_logf, "ff" , "Fnc") +BUILTIN(__builtin_logl, "LdLd", "Fnc") +BUILTIN(__builtin_sin , "dd" , "Fnc") +BUILTIN(__builtin_sinf, "ff" , "Fnc") +BUILTIN(__builtin_sinh , "dd" , "Fnc") +BUILTIN(__builtin_sinhf, "ff" , "Fnc") +BUILTIN(__builtin_sinhl, "LdLd", "Fnc") +BUILTIN(__builtin_sinl, "LdLd", "Fnc") +BUILTIN(__builtin_sqrt , "dd" , "Fnc") +BUILTIN(__builtin_sqrtf, "ff" , "Fnc") +BUILTIN(__builtin_sqrtl, "LdLd", "Fnc") +BUILTIN(__builtin_tan , "dd" , "Fnc") +BUILTIN(__builtin_tanf, "ff" , "Fnc") +BUILTIN(__builtin_tanh , "dd" , "Fnc") +BUILTIN(__builtin_tanhf, "ff" , "Fnc") +BUILTIN(__builtin_tanhl, "LdLd", "Fnc") +BUILTIN(__builtin_tanl, "LdLd", "Fnc") // C99 complex builtins BUILTIN(__builtin_cabs, "dXd", "Fnc") diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index bbf42ee..6315c16 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -250,7 +250,7 @@ BUILTIN(__builtin_ia32_pmaddwd128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_monitor, "vv*UiUi", "") BUILTIN(__builtin_ia32_mwait, "vUiUi", "") BUILTIN(__builtin_ia32_lddqu, "V16ccC*", "") -BUILTIN(__builtin_ia32_palignr128, "V2LLiV2LLiV2LLic", "") +BUILTIN(__builtin_ia32_palignr128, "V16cV16cV16cc", "") BUILTIN(__builtin_ia32_palignr, "V1LLiV1LLiV1LLic", "") BUILTIN(__builtin_ia32_insertps128, "V4fV4fV4fi", "") diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 00a5bc6..b2523f2 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -238,7 +238,6 @@ public: DiagnosticClient *getClient() { return Client; } const DiagnosticClient *getClient() const { return Client; } - /// pushMappings - Copies the current DiagMappings and pushes the new copy /// onto the top of the stack. void pushMappings(); @@ -319,7 +318,7 @@ public: /// getCustomDiagID - Return an ID for a diagnostic with the specified message /// and level. If this is the first request for this diagnosic, it is /// registered and created, otherwise the existing ID is returned. - unsigned getCustomDiagID(Level L, const char *Message); + unsigned getCustomDiagID(Level L, llvm::StringRef Message); /// ConvertArgToString - This method converts a diagnostic argument (as an diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td index 9a342b5..f319cf2 100644 --- a/include/clang/Basic/DiagnosticCommonKinds.td +++ b/include/clang/Basic/DiagnosticCommonKinds.td @@ -26,8 +26,8 @@ def note_type_being_defined : Note< /// e.g. to specify the '(' when we expected a ')'. def note_matching : Note<"to match this '%0'">; -def note_using_decl : Note<"using">; -def note_also_found_decl : Note<"also found">; +def note_using : Note<"using">; +def note_also_found : Note<"also found">; // Parse && Lex def err_expected_colon : Error<"expected ':'">; diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index 3f7d114..efbc787 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -60,6 +60,8 @@ def err_drv_I_dash_not_supported : Error< def err_drv_unknown_argument : Error<"unknown argument: '%0'">; def err_drv_invalid_value : Error<"invalid value '%1' in '%0'">; def err_drv_invalid_int_value : Error<"invalid integral value '%1' in '%0'">; +def err_drv_invalid_remap_file : Error< + "invalid option '%0' not of the form <from-file>;<to-file>">; def warn_drv_input_file_unused : Warning< "%0: '%1' input unused when '%2' is present">; @@ -70,7 +72,7 @@ def warn_drv_unused_argument : Warning< def warn_drv_pipe_ignored_with_save_temps : Warning< "-pipe ignored because -save-temps specified">; def warn_drv_not_using_clang_cpp : Warning< - "not using the clang prepreprocessor due to user override">; + "not using the clang preprocessor due to user override">; def warn_drv_not_using_clang_cxx : Warning< "not using the clang compiler for C++ inputs">; def warn_drv_not_using_clang_arch : Warning< diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index cbc287c..252900d 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -15,8 +15,8 @@ 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_code_complete_file - : Error<"cannot locate code-completion file %0">, DefaultFatal; +def err_fe_invalid_code_complete_file : Error< + "cannot locate code-completion file %0">, DefaultFatal; def err_fe_stdout_binary : Error<"unable to change standard output to binary">, DefaultFatal; def err_fe_dependency_file_requires_MT : Error< @@ -29,6 +29,36 @@ def err_fe_unable_to_find_fixit_file : Error< "FIX-IT could not find file '%0'">; def err_fe_invalid_plugin_name : Error< "unable to find plugin '%0'">; +def err_fe_expected_compiler_job : Error< + "unable to handle compilation, expected exactly one compiler job in '%0'">; +def err_fe_expected_clang_command : Error< + "expected a clang compiler command">; +def err_fe_remap_missing_to_file : Error< + "could not remap file '%0' to the contents of file '%1'">, DefaultFatal; +def err_fe_remap_missing_from_file : Error< + "could not remap from missing file '%0'">, DefaultFatal; +def err_fe_unable_to_load_pch : Error< + "unable to load PCH file">; +def err_fe_unable_to_load_plugin : Error< + "unable to load plugin '%0': '%1'">; +def err_fe_unable_to_create_target : Error< + "unable to create target: '%0'">; +def err_fe_unable_to_interface_with_target : Error< + "unable to interface with target machine">; +def err_fe_unable_to_read_pch_file : Error< + "unable to read PCH file: '%0'">; +def err_fe_not_a_pch_file : Error< + "input is not a PCH file: '%0'">; +def err_fe_pch_malformed_block : Error< + "malformed block record in PCH file: '%0'">; +def err_fe_pch_error_at_end_block : Error< + "error at end of module block in PCH file: '%0'">; +def err_fe_unable_to_open_output : Error< + "unable to open output file '%0': '%1'">; +def err_fe_pth_file_has_no_source_header : Error< + "PTH file '%0' does not designate an original source header file for -include-pth">; +def warn_fe_macro_contains_embedded_newline : Warning< + "macro '%0' contains embedded newline, text after the newline is ignored.">; def err_verify_bogus_characters : Error< "bogus characters before '{{' in expected string">; @@ -45,6 +75,8 @@ def note_fixit_in_macro : Note< def note_fixit_failed : Note< "FIX-IT unable to apply suggested code changes">; def note_fixit_unfixed_error : Note<"FIX-IT detected an error it cannot fix">; +def note_fixit_main_file_unchanged : Note< + "main file unchanged">; def warn_fixit_no_changes : Note< "FIX-IT detected errors it could not fix; no output will be generated">; diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index c1c833c..761478a 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -113,6 +113,7 @@ def Reorder : DiagGroup<"reorder">; def UndeclaredSelector : DiagGroup<"undeclared-selector">; def SuperSubClassMismatch : DiagGroup<"super-class-method-mismatch">; def : DiagGroup<"variadic-macros">; +def VariadicMacros : DiagGroup<"variadic-macros">; def VectorConversions : DiagGroup<"vector-conversions">; // clang specific def VolatileRegisterVar : DiagGroup<"volatile-register-var">; def : DiagGroup<"write-strings">; diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index 39123d9..d8b5f2d 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -51,6 +51,9 @@ def err_empty_character : Error<"empty character constant">; def err_unterminated_block_comment : Error<"unterminated /* comment">; def err_invalid_character_to_charify : Error< "invalid argument to convert to character">; + +def err_conflict_marker : Error<"version control conflict marker in file">; + def ext_multichar_character_literal : ExtWarn< "multi-character character constant">, InGroup<MultiChar>; def ext_four_char_character_literal : Extension< @@ -150,9 +153,10 @@ def ext_pp_comma_expr : Extension<"comma operator in operand of #if">; def ext_pp_bad_vaargs_use : Extension< "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro">; def ext_pp_macro_redef : ExtWarn<"%0 macro redefined">; -def ext_variadic_macro : Extension<"variadic macros were introduced in C99">; +def ext_variadic_macro : Extension<"variadic macros were introduced in C99">, + InGroup<VariadicMacros>; def ext_named_variadic_macro : Extension< - "named variadic macros are a GNU extension">; + "named variadic macros are a GNU extension">, InGroup<VariadicMacros>; def ext_embedded_directive : Extension< "embedding a directive within macro arguments is not portable">; def ext_missing_varargs_arg : Extension< @@ -160,18 +164,11 @@ def ext_missing_varargs_arg : Extension< def ext_empty_fnmacro_arg : Extension< "empty macro arguments were standardized in C99">; -def ext_pp_base_file : Extension<"__BASE_FILE__ is a language extension">; -def ext_pp_include_level : Extension< - "__INCLUDE_LEVEL__ is a language extension">; -def ext_pp_timestamp : Extension<"__TIMESTAMP__ is a language extension">; -def ext_pp_counter : Extension< - "__COUNTER__ is a language extension">; - def err_pp_invalid_directive : Error<"invalid preprocessing directive">; def err_pp_hash_error : Error<"#error%0">; def err_pp_file_not_found : Error<"'%0' file not found">, DefaultFatal; def err_pp_error_opening_file : Error< - "error opening file '%0'">, DefaultFatal; + "error opening file '%0': %1">, DefaultFatal; def err_pp_empty_filename : Error<"empty filename">; def err_pp_include_too_deep : Error<"#include nested too deeply">; def err_pp_expects_filename : Error<"expected \"FILENAME\" or <FILENAME>">; diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 4310704..bf188cf 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -166,6 +166,8 @@ def err_use_of_tag_name_without_tag : Error< "use of tagged type %0 without '%1' tag">; def err_expected_ident_in_using : Error< "expected an identifier in using directive">; +def err_unexected_colon_in_nested_name_spec : Error< + "unexpected ':' in nested name specifier">; /// Objective-C parser diagnostics def err_objc_no_attributes_on_category : Error< diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index a0e03fe..a890323 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -105,7 +105,11 @@ def err_using_typename_non_type : Error< "'typename' keyword used on a non-type">; def err_using_dependent_value_is_type : Error< "dependent using declaration resolved to type without 'typename'">; -def err_using_decl_nested_name_specifier_is_not_a_base_class : Error< +def err_using_decl_nested_name_specifier_is_not_class : Error< + "using declaration in class refers into '%0', which is not a class">; +def err_using_decl_nested_name_specifier_is_current_class : Error< + "using declaration refers to its own class">; +def err_using_decl_nested_name_specifier_is_not_base_class : Error< "using declaration refers into '%0', which is not a base class of %1">; def err_using_decl_can_not_refer_to_class_member : Error< "using declaration can not refer to class member">; @@ -117,8 +121,17 @@ def err_using_decl_destructor : Error< "using declaration can not refer to a destructor">; def err_using_decl_template_id : Error< "using declaration can not refer to a template specialization">; -def note_using_decl_target : Note< - "target of using declaration">; +def note_using_decl_target : Note<"target of using declaration">; +def note_using_decl_conflict : Note<"conflicting declaration">; +def err_using_decl_redeclaration : Error<"redeclaration of using decl">; +def err_using_decl_conflict : Error< + "target of using declaration conflicts with declaration already in scope">; +def err_using_decl_conflict_reverse : Error< + "declaration conflicts with target of using declaration already in scope">; +def note_using_decl : Note<"%select{|previous }0using declaration">; + +def warn_access_decl_deprecated : Warning< + "access declarations are deprecated; use using declarations instead">; def err_invalid_thread : Error< "'__thread' is only allowed on variable declarations">; @@ -186,7 +199,6 @@ def warn_pragma_pack_invalid_alignment : Warning< "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">; // Follow the MSVC implementation. def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">; -// FIXME: Dehardcode. def warn_pragma_pack_pop_identifer_and_alignment : Warning< "specifying both a name and alignment to 'pop' is undefined">; def warn_pragma_pack_pop_failed : Warning<"#pragma pack(pop, ...) failed: %0">; @@ -441,7 +453,8 @@ def err_implicit_object_parameter_init : Error< "of type %1">; def note_field_decl : Note<"member is declared here">; -def note_previous_class_decl : Note< +def note_bitfield_decl : Note<"bit-field is declared here">; +def note_previous_decl : Note< "%0 declared here">; def note_member_synthesized_at : Note< "implicit default %select{constructor|copy constructor|" @@ -521,14 +534,35 @@ def err_lvalue_to_rvalue_ambig_ref : Error<"rvalue reference cannot bind to lval def err_not_reference_to_const_init : Error< "non-const lvalue reference to type %0 cannot be initialized " "with a %1 of type %2">; +def err_lvalue_reference_bind_to_temporary : Error< + "non-const lvalue reference to type %0 cannot bind to a temporary of type " + "%1">; +def err_lvalue_reference_bind_to_unrelated : Error< + "non-const lvalue reference to type %0 cannot bind to a value of unrelated " + "type %1">; +def err_reference_bind_drops_quals : Error< + "binding of reference to type %0 to a value of type %1 drops qualifiers">; +def err_reference_bind_failed : Error< + "reference to type %0 could not bind to an %select{rvalue|lvalue}1 of type " + "%2">; +def err_reference_bind_init_list : Error< + "reference to type %0 cannot bind to an initializer list">; +def err_init_list_bad_dest_type : Error< + "%select{|non-aggregate }0type %1 cannot be initialized with an initializer " + "list">; + // FIXME: passing in an English string as %1! def err_reference_init_drops_quals : Error< "initialization of reference to type %0 with a %1 of type %2 drops " "qualifiers">; +def err_reference_bind_to_bitfield : Error< + "%select{non-const|volatile}0 reference cannot bind to bit-field %1">; def err_reference_var_requires_init : Error< "declaration of reference variable %0 requires an initializer">; def err_const_var_requires_init : Error< "declaration of const variable '%0' requires an initializer">; +def err_reference_has_multiple_inits : Error< + "reference cannot be initialized with multiple values">; def err_init_non_aggr_init_list : Error< "initialization of non-aggregate type %0 with an initializer list">; def err_init_reference_member_uninitialized : Error< @@ -934,6 +968,11 @@ def err_template_variable_noparams : Error< "extraneous 'template<>' in declaration of variable %0">; def err_template_tag_noparams : Error< "extraneous 'template<>' in declaration of %0 %1">; +def err_template_decl_ref : Error< + "cannot refer to class template %0 without a template argument list">; + +def err_typedef_in_def_scope : Error< + "cannot use typedef %0 in scope specifier for out-of-line declaration">; // C++ Template Argument Lists def err_template_arg_list_different_arity : Error< @@ -1261,7 +1300,10 @@ def warn_missing_prototype : Warning< "no previous prototype for function %0">, InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore; def err_redefinition : Error<"redefinition of %0">; - +def err_definition_of_implicitly_declared_member : Error< + "definition of implicitly declared %select{constructor|copy constructor|" + "copy assignment operator|destructor}1">; + def warn_redefinition_of_typedef : Warning< "redefinition of typedef %0 is invalid in C">, InGroup<DiagGroup<"typedef-redefinition"> >, DefaultError; @@ -1515,6 +1557,8 @@ def err_typecheck_member_reference_ivar : Error< "%0 does not have a member named %1">; def err_typecheck_member_reference_arrow : Error< "member reference type %0 is not a pointer">; +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'">; def err_typecheck_member_reference_unknown : Error< @@ -1564,6 +1608,9 @@ def warn_tentative_incomplete_array : Warning< def err_typecheck_incomplete_array_needs_initializer : Error< "definition of variable with array type needs an explicit size " "or an initializer">; +def err_array_init_not_init_list : Error< + "array initializater must be an initializer " + "list%select{| or string literal}0">; def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">; def err_typecheck_sclass_fscope : Error< @@ -1649,6 +1696,7 @@ def warn_printf_nonliteral : Warning< def err_unexpected_interface : Error< "unexpected interface name %0: expected expression">; +def err_ref_non_value : Error<"%0 does not refer to a value">; def err_property_not_found : Error< "property %0 not found on object of type %1">; def ext_gnu_void_ptr : Extension< @@ -1849,7 +1897,10 @@ def err_typecheck_bool_condition : Error< def err_typecheck_ambiguous_condition : Error< "conversion from %0 to %1 is ambiguous">; def err_typecheck_nonviable_condition : Error< - "no viable conversion from %0 to %1 is possible">; + "no viable conversion from %0 to %1">; +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_invalid_declarator_scope : Error< "definition or redeclaration of %0 not in a namespace enclosing %1">; @@ -1963,7 +2014,8 @@ def err_cannot_pass_objc_interface_to_vararg : Error< def warn_cannot_pass_non_pod_arg_to_vararg : Warning< "cannot pass object of non-POD type %0 through variadic " - "%select{function|block|method|constructor}1; call will abort at runtime">; + "%select{function|block|method|constructor}1; call will abort at runtime">, + InGroup<DiagGroup<"non-pod-varargs">>, DefaultError; def err_typecheck_call_invalid_ordered_compare : Error< "ordered compare requires two args of floating point type (%0 and %1)">; @@ -2047,12 +2099,6 @@ def err_overload_expr_requires_non_zero_constant : Error< def err_overload_incorrect_fntype : Error< "argument is not a function, or has wrong number of parameters">; -// FIXME: PASSING TYPES AS STRING. -def err_overload_no_match : Error< - "no matching overload found for arguments of type '%0'">; -def err_overload_multiple_match : Error< - "more than one matching function found in __builtin_overload">; - // C++ member initializers. def err_only_constructors_take_base_inits : Error< "only constructors take base initializers">; @@ -2176,10 +2222,6 @@ def err_operator_overload_needs_class_or_enum : Error< def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">; def err_operator_overload_static : Error< "overloaded %0 cannot be a static member function">; -def err_operator_new_param_type : Error< - "%0 takes type size_t (%1) as first parameter">; -def err_operator_new_result_type : Error< - "%0 must return type %1">; def err_operator_overload_default_arg : Error< "parameter of overloaded %0 cannot have a default argument">; def err_operator_overload_must_be : Error< @@ -2192,6 +2234,31 @@ def err_operator_overload_post_incdec_must_be_int : Error< "parameter of overloaded post-%select{increment|decrement}1 operator must " "have type 'int' (not %0)">; +// C++ allocation and deallocation functions. +def err_operator_new_delete_declared_in_namespace : Error< + "%0 cannot be declared inside a namespace">; +def err_operator_new_delete_declared_static : Error< + "%0 cannot be declared static in global scope">; +def err_operator_new_delete_invalid_result_type : Error< + "%0 must return type %1">; +def err_operator_new_delete_dependent_result_type : Error< + "%0 cannot have a dependent return type; use %1 instead">; +def err_operator_new_delete_too_few_parameters : Error< + "%0 must have at least one parameter.">; +def err_operator_new_delete_template_too_few_parameters : Error< + "%0 template must have at least two parameters.">; + +def err_operator_new_dependent_param_type : Error< + "%0 cannot take a dependent type as first parameter; " + "use size_t (%1) instead">; +def err_operator_new_param_type : Error< + "%0 takes type size_t (%1) as first parameter">; +def err_operator_new_default_arg: Error< + "parameter of %0 cannot have a default argument">; +def err_operator_delete_dependent_param_type : Error< + "%0 cannot take a dependent type as first parameter; use %1 instead">; +def err_operator_delete_param_type : Error< + "%0 takes type %1 as first parameter">; // C++ conversion functions def err_conv_function_not_member : Error< @@ -2371,7 +2438,9 @@ 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_argument : Error< +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">; diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h index 5e7ac4f..d0e0118 100644 --- a/include/clang/Basic/FileManager.h +++ b/include/clang/Basic/FileManager.h @@ -14,6 +14,7 @@ #ifndef LLVM_CLANG_FILEMANAGER_H #define LLVM_CLANG_FILEMANAGER_H +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/OwningPtr.h" @@ -151,6 +152,9 @@ class FileManager { /// unsigned NextFileUID; + /// \brief The virtual files that we have allocated. + llvm::SmallVector<FileEntry *, 4> VirtualFileEntries; + // Statistics. unsigned NumDirLookups, NumFileLookups; unsigned NumDirCacheMisses, NumFileCacheMisses; @@ -199,6 +203,11 @@ public: const FileEntry *getFile(const char *FilenameStart, const char *FilenameEnd); + /// \brief Retrieve a file entry for a "virtual" file that acts as + /// if there were a file with the given name on disk. The file + /// itself is not accessed. + const FileEntry *getVirtualFile(const llvm::StringRef &Filename, + off_t Size, time_t ModificationTime); void PrintStats() const; }; diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index 5393950..75a7b81 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -532,9 +532,11 @@ struct DenseMapInfo<clang::Selector> { static bool isEqual(clang::Selector LHS, clang::Selector RHS) { return LHS == RHS; } - - static bool isPod() { return true; } }; + +template <> +struct isPodLike<clang::Selector> { static const bool value = true; }; + // Provide PointerLikeTypeTraits for IdentifierInfo pointers, which // are not guaranteed to be 8-byte aligned. diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h index a16a271..e17279e 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -46,7 +46,7 @@ public: unsigned LaxVectorConversions : 1; unsigned AltiVec : 1; // Support AltiVec-style vector initializers. unsigned Exceptions : 1; // Support exception handling. - unsigned Rtti : 1; // Support rtti information. + unsigned RTTI : 1; // Support RTTI information. unsigned NeXTRuntime : 1; // Use NeXT runtime. unsigned Freestanding : 1; // Freestanding implementation @@ -92,6 +92,7 @@ public: unsigned ElideConstructors : 1; // Whether C++ copy constructors should be // elided if possible. + unsigned CatchUndefined :1; // Generate code to check for undefined ops. private: unsigned GC : 2; // Objective-C Garbage Collection modes. We // declare this enum as unsigned because MSVC @@ -125,7 +126,7 @@ public: CXXOperatorNames = PascalStrings = WritableStrings = 0; Exceptions = Freestanding = NoBuiltin = 0; NeXTRuntime = 1; - Rtti = 1; + RTTI = 1; LaxVectorConversions = 1; HeinousExtensions = 0; AltiVec = OpenCL = StackProtector = 0; @@ -160,6 +161,7 @@ public: CharIsSigned = 1; ShortWChar = 0; + CatchUndefined = 0; } GCMode getGCMode() const { return (GCMode) GC; } diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h index 9960d5b..ae11a75 100644 --- a/include/clang/Basic/PartialDiagnostic.h +++ b/include/clang/Basic/PartialDiagnostic.h @@ -51,11 +51,11 @@ class PartialDiagnostic { /// 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 sort of argument kind it is. - mutable intptr_t DiagArgumentsVal[MaxArguments]; + intptr_t DiagArgumentsVal[MaxArguments]; /// DiagRanges - The list of ranges added to this diagnostic. It currently /// only support 10 ranges, could easily be extended if needed. - mutable const SourceRange *DiagRanges[10]; + SourceRange DiagRanges[10]; }; /// DiagID - The diagnostic ID. @@ -81,25 +81,40 @@ class PartialDiagnostic { assert(DiagStorage->NumDiagRanges < llvm::array_lengthof(DiagStorage->DiagRanges) && "Too many arguments to diagnostic!"); - DiagStorage->DiagRanges[DiagStorage->NumDiagRanges++] = &R; + DiagStorage->DiagRanges[DiagStorage->NumDiagRanges++] = R; } - void operator=(const PartialDiagnostic &); // DO NOT IMPLEMENT - public: PartialDiagnostic(unsigned DiagID) : DiagID(DiagID), DiagStorage(0) { } PartialDiagnostic(const PartialDiagnostic &Other) - : DiagID(Other.DiagID), DiagStorage(Other.DiagStorage) { - Other.DiagID = 0; - Other.DiagStorage = 0; + : DiagID(Other.DiagID), DiagStorage(0) + { + if (Other.DiagStorage) + DiagStorage = new Storage(*Other.DiagStorage); + } + + PartialDiagnostic &operator=(const PartialDiagnostic &Other) { + DiagID = Other.DiagID; + if (Other.DiagStorage) { + if (DiagStorage) + *DiagStorage = *Other.DiagStorage; + else + DiagStorage = new Storage(*Other.DiagStorage); + } else { + delete DiagStorage; + DiagStorage = 0; + } + + return *this; } ~PartialDiagnostic() { delete DiagStorage; } + unsigned getDiagID() const { return DiagID; } void Emit(const DiagnosticBuilder &DB) const { @@ -114,7 +129,7 @@ public: // Add all ranges. for (unsigned i = 0, e = DiagStorage->NumDiagRanges; i != e; ++i) - DB.AddSourceRange(*DiagStorage->DiagRanges[i]); + DB.AddSourceRange(DiagStorage->DiagRanges[i]); } friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index 28cf2db..36baf5f 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -21,6 +21,7 @@ namespace llvm { class MemoryBuffer; class raw_ostream; template <typename T> struct DenseMapInfo; + template <typename T> struct isPodLike; } namespace clang { @@ -296,9 +297,12 @@ namespace llvm { static bool isEqual(clang::FileID LHS, clang::FileID RHS) { return LHS == RHS; } - - static bool isPod() { return true; } }; + + template <> + struct isPodLike<clang::SourceLocation> { static const bool value = true; }; + template <> + struct isPodLike<clang::FileID> { static const bool value = true; }; } // end namespace llvm diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 7e9ac53..b4cf959 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -54,9 +54,6 @@ namespace SrcMgr { /// file. This is owned by the ContentCache object. mutable const llvm::MemoryBuffer *Buffer; - /// The line and column at which we should truncate the file. - unsigned TruncateAtLine, TruncateAtColumn; - public: /// Reference to the file entry. This reference does not own /// the FileEntry object. It is possible for this to be NULL if @@ -72,13 +69,10 @@ namespace SrcMgr { /// if SourceLineCache is non-null. unsigned NumLines; - /// FirstFID - First FileID that was created for this ContentCache. - /// Represents the first source inclusion of the file associated with this - /// ContentCache. - mutable FileID FirstFID; - - /// getBuffer - Returns the memory buffer for the associated content. - const llvm::MemoryBuffer *getBuffer() const; + /// getBuffer - Returns the memory buffer for the associated content. 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(std::string *ErrorStr = 0) const; /// getSize - Returns the size of the content encapsulated by this /// ContentCache. This can be the size of the source file or the size of an @@ -96,28 +90,19 @@ namespace SrcMgr { Buffer = B; } - /// \brief Truncate this file at the given line and column. - /// - /// \param Line the line on which to truncate the current file (1-based). - /// \param Column the column at which to truncate the current file. - /// (1-based). - void truncateAt(unsigned Line, unsigned Column); - - /// \brief Determines whether the file was artificially truncated with - /// truncateAt(). - bool isTruncated() const { return TruncateAtLine && TruncateAtColumn; } - + /// \brief Replace the existing buffer (which will be deleted) + /// with the given buffer. + void replaceBuffer(const llvm::MemoryBuffer *B); + ContentCache(const FileEntry *Ent = 0) - : Buffer(0), TruncateAtLine(0), TruncateAtColumn(0), Entry(Ent), - SourceLineCache(0), NumLines(0) {} + : Buffer(0), Entry(Ent), 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. - ContentCache(const ContentCache &RHS) - : Buffer(0), TruncateAtLine(0), TruncateAtColumn(0), SourceLineCache(0) { + ContentCache(const ContentCache &RHS) : Buffer(0), SourceLineCache(0) { Entry = RHS.Entry; assert (RHS.Buffer == 0 && RHS.SourceLineCache == 0 @@ -347,19 +332,13 @@ class SourceManager { mutable FileID LastRFIDForBeforeTUCheck; mutable bool LastResForBeforeTUCheck; - // Keep track of the file/line/column that we should truncate. - const FileEntry *TruncateFile; - unsigned TruncateAtLine; - unsigned TruncateAtColumn; - // SourceManager doesn't support copy construction. explicit SourceManager(const SourceManager&); void operator=(const SourceManager&); public: SourceManager() - : ExternalSLocEntries(0), LineTable(0), NumLinearScans(0), - NumBinaryProbes(0), TruncateFile(0), TruncateAtLine(0), - TruncateAtColumn(0) { + : ExternalSLocEntries(0), LineTable(0), NumLinearScans(0), + NumBinaryProbes(0) { clearIDTables(); } ~SourceManager(); @@ -428,14 +407,30 @@ public: unsigned PreallocatedID = 0, unsigned Offset = 0); + /// \brief Retrieve the memory buffer associated with the given file. + const llvm::MemoryBuffer *getMemoryBufferForFile(const FileEntry *File); + + /// \brief Override the contents of the given source file by providing an + /// already-allocated buffer. + /// + /// \param SourceFile the source file whose contents will be override. + /// + /// \param Buffer the memory buffer whose contents will be used as the + /// data in the given source file. + /// + /// \returns true if an error occurred, false otherwise. + bool overrideFileContents(const FileEntry *SourceFile, + const llvm::MemoryBuffer *Buffer); + //===--------------------------------------------------------------------===// // FileID manipulation methods. //===--------------------------------------------------------------------===// - /// getBuffer - Return the buffer for the specified FileID. - /// - const llvm::MemoryBuffer *getBuffer(FileID FID) const { - return getSLocEntry(FID).getFile().getContentCache()->getBuffer(); + /// 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, std::string *Error = 0) const{ + return getSLocEntry(FID).getFile().getContentCache()->getBuffer(Error); } /// getFileEntryForID - Returns the FileEntry record for the provided FileID. @@ -669,12 +664,6 @@ public: /// \returns true if LHS source location comes before RHS, false otherwise. bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const; - /// \brief Truncate the given file at the specified line/column. - void truncateFileAt(const FileEntry *Entry, unsigned Line, unsigned Column); - - /// \brief Determine whether this file was truncated. - bool isTruncatedFile(FileID FID) const; - // Iterators over FileInfos. typedef llvm::DenseMap<const FileEntry*, SrcMgr::ContentCache*> ::const_iterator fileinfo_iterator; diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def index 9942233..bb022f1 100644 --- a/include/clang/Basic/TokenKinds.def +++ b/include/clang/Basic/TokenKinds.def @@ -324,6 +324,8 @@ KEYWORD(__is_enum , KEYCXX) KEYWORD(__is_pod , KEYCXX) KEYWORD(__is_polymorphic , KEYCXX) KEYWORD(__is_union , KEYCXX) +// Tentative name - there's no implementation of std::is_literal_type yet. +KEYWORD(__is_literal , KEYCXX) // FIXME: Add MS's traits, too. // Apple Extension. diff --git a/include/clang/Basic/TypeTraits.h b/include/clang/Basic/TypeTraits.h index 2a2eacc..36b8300 100644 --- a/include/clang/Basic/TypeTraits.h +++ b/include/clang/Basic/TypeTraits.h @@ -32,7 +32,8 @@ namespace clang { UTT_IsEnum, UTT_IsPOD, UTT_IsPolymorphic, - UTT_IsUnion + UTT_IsUnion, + UTT_IsLiteral }; } |