diff options
author | Joao Matos <ripzonetriton@gmail.com> | 2012-08-31 22:18:20 +0000 |
---|---|---|
committer | Joao Matos <ripzonetriton@gmail.com> | 2012-08-31 22:18:20 +0000 |
commit | 17d35c36fbae764fcd68fa8b31624078a033aabc (patch) | |
tree | c7f4eba284b64b1ad1bb5bcf269d7354efdae818 | |
parent | 7aaa167abba495ecb0e99eb4f2fa155cf28c798d (diff) |
Normalize line endings of r163013 (part 2).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163032 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang-c/Index.h | 16 | ||||
-rw-r--r-- | include/clang/AST/DeclCXX.h | 18 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticASTKinds.td | 14 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticParseKinds.td | 14 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 248 | ||||
-rw-r--r-- | include/clang/Basic/Specifiers.h | 14 | ||||
-rw-r--r-- | lib/AST/DeclCXX.cpp | 32 | ||||
-rw-r--r-- | lib/AST/MicrosoftMangle.cpp | 14 | ||||
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 14 | ||||
-rw-r--r-- | lib/Parse/ParseDeclCXX.cpp | 74 | ||||
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 60 | ||||
-rw-r--r-- | lib/Serialization/ASTReaderDecl.cpp | 20 | ||||
-rw-r--r-- | test/Parser/MicrosoftExtensions.cpp | 88 | ||||
-rw-r--r-- | tools/libclang/CIndexCXX.cpp | 18 | ||||
-rw-r--r-- | tools/libclang/IndexingContext.cpp | 20 |
15 files changed, 332 insertions, 332 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index 9ed0570cf6..cf21d23668 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -4962,14 +4962,14 @@ typedef enum { CXIdxEntity_CXXStaticVariable = 19, CXIdxEntity_CXXStaticMethod = 20, CXIdxEntity_CXXInstanceMethod = 21, - CXIdxEntity_CXXConstructor = 22,
- CXIdxEntity_CXXDestructor = 23,
- CXIdxEntity_CXXConversionFunction = 24,
- CXIdxEntity_CXXTypeAlias = 25,
- CXIdxEntity_CXXInterface = 26
-
-} CXIdxEntityKind;
-
+ CXIdxEntity_CXXConstructor = 22, + CXIdxEntity_CXXDestructor = 23, + CXIdxEntity_CXXConversionFunction = 24, + CXIdxEntity_CXXTypeAlias = 25, + CXIdxEntity_CXXInterface = 26 + +} CXIdxEntityKind; + typedef enum { CXIdxEntityLang_None = 0, CXIdxEntityLang_C = 1, diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index 676d0f9e9e..8d963c80a5 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -1553,15 +1553,15 @@ public: bool isVolatile() { return getType()->castAs<FunctionType>()->isVolatile(); } bool isVirtual() const { - CXXMethodDecl *CD =
- cast<CXXMethodDecl>(const_cast<CXXMethodDecl*>(this)->getCanonicalDecl());
-
- // Methods declared in interfaces are automatically (pure) virtual
- if (CD->isVirtualAsWritten() ||
- CD->getParent()->getTagKind() == TTK_Interface)
- return true;
-
- return (CD->begin_overridden_methods() != CD->end_overridden_methods());
+ CXXMethodDecl *CD = + cast<CXXMethodDecl>(const_cast<CXXMethodDecl*>(this)->getCanonicalDecl()); + + // Methods declared in interfaces are automatically (pure) virtual + if (CD->isVirtualAsWritten() || + CD->getParent()->getTagKind() == TTK_Interface) + return true; + + return (CD->begin_overridden_methods() != CD->end_overridden_methods()); } /// \brief Determine whether this is a usual deallocation function diff --git a/include/clang/Basic/DiagnosticASTKinds.td b/include/clang/Basic/DiagnosticASTKinds.td index c64060081f..d869c9983b 100644 --- a/include/clang/Basic/DiagnosticASTKinds.td +++ b/include/clang/Basic/DiagnosticASTKinds.td @@ -134,13 +134,13 @@ def note_odr_defined_here : Note<"also defined here">; def err_odr_function_type_inconsistent : Error< "external function %0 declared with incompatible types in different " "translation units (%1 vs. %2)">; -def warn_odr_tag_type_inconsistent : Warning<
- "type %0 has incompatible definitions in different translation units">;
-def note_odr_tag_kind_here: Note<
- "%0 is a %select{struct|interface|union|class|enum}1 here">;
-def note_odr_field : Note<"field %0 has type %1 here">;
-def note_odr_missing_field : Note<"no corresponding field here">;
-def note_odr_bit_field : Note<"bit-field %0 with type %1 and length %2 here">;
+def warn_odr_tag_type_inconsistent : Warning< + "type %0 has incompatible definitions in different translation units">; +def note_odr_tag_kind_here: Note< + "%0 is a %select{struct|interface|union|class|enum}1 here">; +def note_odr_field : Note<"field %0 has type %1 here">; +def note_odr_missing_field : Note<"no corresponding field here">; +def note_odr_bit_field : Note<"bit-field %0 with type %1 and length %2 here">; def note_odr_not_bit_field : Note<"field %0 is not a bit-field">; def note_odr_base : Note<"class has base type %0">; def note_odr_virtual_base : Note< diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 53d58c085c..e4e339aefc 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -573,13 +573,13 @@ def err_expected_semi_after_tagdecl : Error< def err_typename_refers_to_non_type_template : Error< "typename specifier refers to a non-template">; def err_expected_type_name_after_typename : Error< - "expected an identifier or template-id after '::'">;
-def err_explicit_spec_non_template : Error<
- "explicit %select{specialization|instantiation}0 of non-template "
- "%select{class|struct|union|interface}1 %2">;
-
-def err_default_template_template_parameter_not_template : Error<
- "default template argument for a template template parameter must be a class "
+ "expected an identifier or template-id after '::'">; +def err_explicit_spec_non_template : Error< + "explicit %select{specialization|instantiation}0 of non-template " + "%select{class|struct|union|interface}1 %2">; + +def err_default_template_template_parameter_not_template : Error< + "default template argument for a template template parameter must be a class " "template">; def err_ctor_init_missing_comma : Error< diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index df3586307b..e0dac62403 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -793,17 +793,17 @@ def err_friend_is_member : Error< "friends cannot be members of the declaring class">; def warn_cxx98_compat_friend_is_member : Warning< "friend declaration naming a member of the declaring class is incompatible " - "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
-def ext_unelaborated_friend_type : ExtWarn<
- "unelaborated friend declaration is a C++11 extension; specify "
- "'%select{struct|interface|union|class|enum}0' to befriend %1">,
- InGroup<CXX11>;
-def warn_cxx98_compat_unelaborated_friend_type : Warning<
- "befriending %1 without '%select{struct|interface|union|class|enum}0' "
- "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
-def err_qualified_friend_not_found : Error<
- "no function named %0 with type %1 was found in the specified scope">;
-def err_introducing_special_friend : Error<
+ "with C++98">, InGroup<CXX98Compat>, DefaultIgnore; +def ext_unelaborated_friend_type : ExtWarn< + "unelaborated friend declaration is a C++11 extension; specify " + "'%select{struct|interface|union|class|enum}0' to befriend %1">, + InGroup<CXX11>; +def warn_cxx98_compat_unelaborated_friend_type : Warning< + "befriending %1 without '%select{struct|interface|union|class|enum}0' " + "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; +def err_qualified_friend_not_found : Error< + "no function named %0 with type %1 was found in the specified scope">; +def err_introducing_special_friend : Error< "must use a qualified name when declaring a %select{constructor|" "destructor|conversion operator}0 as a friend">; def err_tagless_friend_type_template : Error< @@ -1115,14 +1115,14 @@ def err_ref_qualifier_constructor : Error< def err_constructor_return_type : Error< "constructor cannot have a return type">; 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|interface|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">;
-def ext_ms_explicit_constructor_call : ExtWarn<
+def err_constructor_byvalue_arg : Error< + "copy constructor must pass its first argument by reference">; +def warn_no_constructor_for_refconst : Warning< + "%select{struct|interface|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">; +def ext_ms_explicit_constructor_call : ExtWarn< "explicit constructor calls are a Microsoft extension">, InGroup<Microsoft>; // C++ destructors @@ -1309,16 +1309,16 @@ def err_auto_variable_cannot_appear_in_own_initializer : Error< def err_illegal_decl_array_of_auto : Error< "'%0' declared as array of %1">; def err_new_array_of_auto : Error< - "cannot allocate array of 'auto'">;
-def err_auto_not_allowed : Error<
- "'auto' not allowed %select{in function prototype|in non-static struct member"
- "|in non-static union member|in non-static class member|in interface member"
- "|in exception declaration|in template parameter|in block literal"
- "|in template argument|in typedef|in type alias|in function return type"
- "|here}0">;
-def err_auto_var_requires_init : Error<
- "declaration of variable %0 with type %1 requires an initializer">;
-def err_auto_new_requires_ctor_arg : Error<
+ "cannot allocate array of 'auto'">; +def err_auto_not_allowed : Error< + "'auto' not allowed %select{in function prototype|in non-static struct member" + "|in non-static union member|in non-static class member|in interface member" + "|in exception declaration|in template parameter|in block literal" + "|in template argument|in typedef|in type alias|in function return type" + "|here}0">; +def err_auto_var_requires_init : Error< + "declaration of variable %0 with type %1 requires an initializer">; +def err_auto_new_requires_ctor_arg : Error< "new expression for type %0 requires a constructor argument">; def err_auto_new_requires_parens : Error< "new expression for type %0 cannot use list-initialization">; @@ -1438,13 +1438,13 @@ def warn_cxx98_compat_constexpr : Warning< "'constexpr' specifier is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; def err_invalid_constexpr : Error< - "%select{function parameter|typedef|non-static data member}0 "
- "cannot be constexpr">;
-def err_constexpr_tag : Error<
- "%select{class|struct|interface|union|enum}0 cannot be marked constexpr">;
-def err_constexpr_dtor : Error<"destructor cannot be marked constexpr">;
-def err_constexpr_no_declarators : Error<
- "constexpr can only be used in variable and function declarations">;
+ "%select{function parameter|typedef|non-static data member}0 " + "cannot be constexpr">; +def err_constexpr_tag : Error< + "%select{class|struct|interface|union|enum}0 cannot be marked constexpr">; +def err_constexpr_dtor : Error<"destructor cannot be marked constexpr">; +def err_constexpr_no_declarators : Error< + "constexpr can only be used in variable and function declarations">; def err_invalid_constexpr_var_decl : Error< "constexpr variable declaration must be a definition">; def err_constexpr_static_mem_var_requires_init : Error< @@ -1456,18 +1456,18 @@ def err_constexpr_var_requires_const_init : Error< def err_constexpr_redecl_mismatch : Error< "%select{non-constexpr declaration of %0 follows constexpr declaration" "|constexpr declaration of %0 follows non-constexpr declaration}1">; -def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
-def err_constexpr_virtual_base : Error<
- "constexpr %select{member function|constructor}0 not allowed in "
- "%select{struct|interface|class}1 with virtual base "
- "%plural{1:class|:classes}2">;
-def note_non_literal_incomplete : Note<
- "incomplete type %0 is not a literal type">;
-def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
- "with virtual base %plural{1:class|:classes}1 is not a literal type">;
-def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
-def err_constexpr_non_literal_return : Error<
- "constexpr function's return type %0 is not a literal type">;
+def err_constexpr_virtual : Error<"virtual function cannot be constexpr">; +def err_constexpr_virtual_base : Error< + "constexpr %select{member function|constructor}0 not allowed in " + "%select{struct|interface|class}1 with virtual base " + "%plural{1:class|:classes}2">; +def note_non_literal_incomplete : Note< + "incomplete type %0 is not a literal type">; +def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 " + "with virtual base %plural{1:class|:classes}1 is not a literal type">; +def note_constexpr_virtual_base_here : Note<"virtual base class declared here">; +def err_constexpr_non_literal_return : Error< + "constexpr function's return type %0 is not a literal type">; def err_constexpr_non_literal_param : Error< "constexpr %select{function|constructor}1's %ordinal0 parameter type %2 is " "not a literal type">; @@ -1700,15 +1700,15 @@ def warn_unhandled_ms_attribute_ignored : Warning< "__declspec attribute %0 is not supported">, InGroup<IgnoredAttributes>; def warn_attribute_invalid_on_stmt : Warning< - "attribute %0 cannot be specified on a statement">,
- InGroup<IgnoredAttributes>;
-def warn_declspec_attribute_ignored : Warning<
- "attribute %0 is ignored, place it after "
- "\"%select{class|struct|union|interface|enum}1\" to apply attribute to "
- "type declaration">, InGroup<IgnoredAttributes>;
-def warn_attribute_precede_definition : Warning<
- "attribute declaration must precede definition">,
- InGroup<IgnoredAttributes>;
+ "attribute %0 cannot be specified on a statement">, + InGroup<IgnoredAttributes>; +def warn_declspec_attribute_ignored : Warning< + "attribute %0 is ignored, place it after " + "\"%select{class|struct|union|interface|enum}1\" to apply attribute to " + "type declaration">, InGroup<IgnoredAttributes>; +def warn_attribute_precede_definition : Warning< + "attribute declaration must precede definition">, + InGroup<IgnoredAttributes>; def warn_attribute_void_function_method : Warning< "attribute %0 cannot be applied to " "%select{functions|Objective-C method}1 without return value">, @@ -3183,31 +3183,31 @@ def err_redefinition_different_typedef : Error< def err_tag_reference_non_tag : Error< "elaborated type refers to %select{a non-tag type|a typedef|a type alias|a template|a type alias template}0">; def err_tag_reference_conflict : Error< - "implicit declaration introduced by elaborated type conflicts with "
- "%select{a declaration|a typedef|a type alias|a template}0 of the same name">;
-def err_dependent_tag_decl : Error<
- "%select{declaration|definition}0 of "
- "%select{struct|interface|union|class|enum}1 in a dependent scope">;
-def err_tag_definition_of_typedef : Error<
- "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
-def err_conflicting_types : Error<"conflicting types for %0">;
+ "implicit declaration introduced by elaborated type conflicts with " + "%select{a declaration|a typedef|a type alias|a template}0 of the same name">; +def err_dependent_tag_decl : Error< + "%select{declaration|definition}0 of " + "%select{struct|interface|union|class|enum}1 in a dependent scope">; +def err_tag_definition_of_typedef : Error< + "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">; +def err_conflicting_types : Error<"conflicting types for %0">; def err_nested_redefinition : Error<"nested redefinition of %0">; -def err_use_with_wrong_tag : Error<
- "use of %0 with tag type that does not match previous declaration">;
-def warn_struct_class_tag_mismatch : Warning<
- "%select{struct|interface|class}0%select{| template}1 %2 was previously "
- "declared as a %select{struct|interface|class}3%select{| template}1">,
- InGroup<MismatchedTags>, DefaultIgnore;
-def warn_struct_class_previous_tag_mismatch : Warning<
- "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
- "here but previously declared as "
- "%select{a struct|an interface|a class}3%select{| template}1">,
- InGroup<MismatchedTags>, DefaultIgnore;
-def note_struct_class_suggestion : Note<
- "did you mean %select{struct|interface|class}0 here?">;
-def ext_forward_ref_enum : Extension<
- "ISO C forbids forward references to 'enum' types">;
-def err_forward_ref_enum : Error<
+def err_use_with_wrong_tag : Error< + "use of %0 with tag type that does not match previous declaration">; +def warn_struct_class_tag_mismatch : Warning< + "%select{struct|interface|class}0%select{| template}1 %2 was previously " + "declared as a %select{struct|interface|class}3%select{| template}1">, + InGroup<MismatchedTags>, DefaultIgnore; +def warn_struct_class_previous_tag_mismatch : Warning< + "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 " + "here but previously declared as " + "%select{a struct|an interface|a class}3%select{| template}1">, + InGroup<MismatchedTags>, DefaultIgnore; +def note_struct_class_suggestion : Note< + "did you mean %select{struct|interface|class}0 here?">; +def ext_forward_ref_enum : Extension< + "ISO C forbids forward references to 'enum' types">; +def err_forward_ref_enum : Error< "ISO C++ forbids forward references to 'enum' types">; def ext_ms_forward_ref_enum : Extension< "forward references to 'enum' types are a Microsoft extension">, InGroup<Microsoft>; @@ -3245,19 +3245,19 @@ def err_array_too_large : Error< def warn_array_new_too_large : Warning<"array is too large (%0 elements)">, // FIXME PR11644: ", will throw std::bad_array_new_length at runtime" InGroup<DiagGroup<"bad-array-new-length">>; -
-// -Wpadded, -Wpacked
-def warn_padded_struct_field : Warning<
- "padding %select{struct|interface|class}0 %1 with %2 "
- "%select{byte|bit}3%select{|s}4 to align %5">,
- InGroup<Padded>, DefaultIgnore;
-def warn_padded_struct_anon_field : Warning<
- "padding %select{struct|interface|class}0 %1 with %2 "
- "%select{byte|bit}3%select{|s}4 to align anonymous bit-field">,
- InGroup<Padded>, DefaultIgnore;
-def warn_padded_struct_size : Warning<
- "padding size of %0 with %1 %select{byte|bit}2%select{|s}3 "
- "to alignment boundary">, InGroup<Padded>, DefaultIgnore;
+ +// -Wpadded, -Wpacked +def warn_padded_struct_field : Warning< + "padding %select{struct|interface|class}0 %1 with %2 " + "%select{byte|bit}3%select{|s}4 to align %5">, + InGroup<Padded>, DefaultIgnore; +def warn_padded_struct_anon_field : Warning< + "padding %select{struct|interface|class}0 %1 with %2 " + "%select{byte|bit}3%select{|s}4 to align anonymous bit-field">, + InGroup<Padded>, DefaultIgnore; +def warn_padded_struct_size : Warning< + "padding size of %0 with %1 %select{byte|bit}2%select{|s}3 " + "to alignment boundary">, InGroup<Padded>, DefaultIgnore; def warn_unnecessary_packed : Warning< "packed attribute is unnecessary for %0">, InGroup<Packed>, DefaultIgnore; @@ -3499,22 +3499,22 @@ def ext_flexible_array_in_struct : Extension< def ext_flexible_array_in_array : Extension< "%0 may not be used as an array element due to flexible array member">, InGroup<FlexibleArrayExtensions>; -def err_flexible_array_init : Error<
- "initialization of flexible array member is not allowed">;
-def ext_flexible_array_empty_aggregate_ms : Extension<
- "flexible array member %0 in otherwise empty "
- "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
- InGroup<Microsoft>;
-def ext_flexible_array_union_ms : Extension<
- "flexible array member %0 in a union is a Microsoft extension">,
- InGroup<Microsoft>;
-def ext_flexible_array_empty_aggregate_gnu : Extension<
- "flexible array member %0 in otherwise empty "
- "%select{struct|interface|union|class|enum}1 is a GNU extension">,
- InGroup<GNU>;
-def ext_flexible_array_union_gnu : Extension<
- "flexible array member %0 in a union is a GNU extension">, InGroup<GNU>;
-
+def err_flexible_array_init : Error< + "initialization of flexible array member is not allowed">; +def ext_flexible_array_empty_aggregate_ms : Extension< + "flexible array member %0 in otherwise empty " + "%select{struct|interface|union|class|enum}1 is a Microsoft extension">, + InGroup<Microsoft>; +def ext_flexible_array_union_ms : Extension< + "flexible array member %0 in a union is a Microsoft extension">, + InGroup<Microsoft>; +def ext_flexible_array_empty_aggregate_gnu : Extension< + "flexible array member %0 in otherwise empty " + "%select{struct|interface|union|class|enum}1 is a GNU extension">, + InGroup<GNU>; +def ext_flexible_array_union_gnu : Extension< + "flexible array member %0 in a union is a GNU extension">, InGroup<GNU>; + let CategoryName = "ARC Semantic Issue" in { // ARC-mode diagnostics. @@ -4594,13 +4594,13 @@ def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here " "because namespace %1 does not enclose namespace %2">; def err_invalid_declarator_global_scope : Error< "definition or redeclaration of %0 cannot name the global scope">; -def err_invalid_declarator_in_function : Error<
- "definition or redeclaration of %0 not allowed inside a function">;
-def err_not_tag_in_scope : Error<
- "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
-
-def err_no_typeid_with_fno_rtti : Error<
- "cannot use typeid with -fno-rtti">;
+def err_invalid_declarator_in_function : Error< + "definition or redeclaration of %0 not allowed inside a function">; +def err_not_tag_in_scope : Error< + "no %select{struct|interface|union|class|enum}0 named %1 in %2">; + +def err_no_typeid_with_fno_rtti : Error< + "cannot use typeid with -fno-rtti">; def err_cannot_form_pointer_to_member_of_reference_type : Error< "cannot form a pointer-to-member to member %0 of reference type %1">; @@ -5945,13 +5945,13 @@ def err_module_private_specialization : Error< "%select{template|partial|member}0 specialization cannot be " "declared __module_private__">; def err_module_private_local : Error< - "%select{local variable|parameter|typedef}0 %1 cannot be declared "
- "__module_private__">;
-def err_module_private_local_class : Error<
- "local %select{struct|interface|union|class|enum}0 cannot be declared "
- "__module_private__">;
-def err_module_private_definition : Error<
- "definition of %0 must be imported before it is required">;
+ "%select{local variable|parameter|typedef}0 %1 cannot be declared " + "__module_private__">; +def err_module_private_local_class : Error< + "local %select{struct|interface|union|class|enum}0 cannot be declared " + "__module_private__">; +def err_module_private_definition : Error< + "definition of %0 must be imported before it is required">; } let CategoryName = "Documentation Issue" in { diff --git a/include/clang/Basic/Specifiers.h b/include/clang/Basic/Specifiers.h index 1d39c4bdcf..31b38d9ad9 100644 --- a/include/clang/Basic/Specifiers.h +++ b/include/clang/Basic/Specifiers.h @@ -50,13 +50,13 @@ namespace clang { TST_decimal64, // _Decimal64 TST_decimal128, // _Decimal128 TST_enum, - TST_union,
- TST_struct,
- TST_class, // C++ class type
- TST_interface, // C++ (Microsoft-specific) __interface type
- TST_typename, // Typedef, C++ class-name or enum name, etc.
- TST_typeofType,
- TST_typeofExpr,
+ TST_union, + TST_struct, + TST_class, // C++ class type + TST_interface, // C++ (Microsoft-specific) __interface type + TST_typename, // Typedef, C++ class-name or enum name, etc. + TST_typeofType, + TST_typeofExpr, TST_decltype, // C++0x decltype TST_underlyingType, // __underlying_type for C++0x TST_auto, // C++0x auto diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index c68a16bdae..d2549eedd5 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -463,14 +463,14 @@ void CXXRecordDecl::markedConstructorConstexpr(CXXConstructorDecl *CD) { } void CXXRecordDecl::addedMember(Decl *D) { - if (!D->isImplicit() &&
- !isa<FieldDecl>(D) &&
- !isa<IndirectFieldDecl>(D) &&
- (!isa<TagDecl>(D) || cast<TagDecl>(D)->getTagKind() == TTK_Class ||
- cast<TagDecl>(D)->getTagKind() == TTK_Interface))
- data().HasOnlyCMembers = false;
-
- // Ignore friends and invalid declarations.
+ if (!D->isImplicit() && + !isa<FieldDecl>(D) && + !isa<IndirectFieldDecl>(D) && + (!isa<TagDecl>(D) || cast<TagDecl>(D)->getTagKind() == TTK_Class || + cast<TagDecl>(D)->getTagKind() == TTK_Interface)) + data().HasOnlyCMembers = false; + + // Ignore friends and invalid declarations. if (D->getFriendObjectKind() || D->isInvalidDecl()) return; @@ -934,14 +934,14 @@ NotASpecialMember:; if (Shadow->getDeclName().getNameKind() == DeclarationName::CXXConversionFunctionName) data().Conversions.addDecl(Shadow, Shadow->getAccess()); -}
-
-bool CXXRecordDecl::isCLike() const {
- if (getTagKind() == TTK_Class || getTagKind() == TTK_Interface ||
- !TemplateOrInstantiation.isNull())
- return false;
- if (!hasDefinition())
- return true;
+} + +bool CXXRecordDecl::isCLike() const { + if (getTagKind() == TTK_Class || getTagKind() == TTK_Interface || + !TemplateOrInstantiation.isNull()) + return false; + if (!hasDefinition()) + return true; return isPOD() && data().HasOnlyCMembers; } diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index f0041b2422..bf72b506b6 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -1270,13 +1270,13 @@ void MicrosoftCXXNameMangler::mangleType(const RecordType *T, SourceRange) { void MicrosoftCXXNameMangler::mangleType(const TagType *T) { switch (T->getDecl()->getTagKind()) { case TTK_Union: - Out << 'T';
- break;
- case TTK_Struct:
- case TTK_Interface:
- Out << 'U';
- break;
- case TTK_Class:
+ Out << 'T'; + break; + case TTK_Struct: + case TTK_Interface: + Out << 'U'; + break; + case TTK_Class: Out << 'V'; break; case TTK_Enum: diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 212923421b..d6c39c610f 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -520,13 +520,13 @@ llvm::DIType CGDebugInfo::createRecordFwdDecl(const RecordDecl *RD, const CXXRecordDecl *CXXDecl = dyn_cast<CXXRecordDecl>(RD); unsigned Tag = 0; if (CXXDecl) { - RDName = getClassName(RD);
- Tag = llvm::dwarf::DW_TAG_class_type;
- }
- else if (RD->isStruct() || RD->isInterface())
- Tag = llvm::dwarf::DW_TAG_structure_type;
- else if (RD->isUnion())
- Tag = llvm::dwarf::DW_TAG_union_type;
+ RDName = getClassName(RD); + Tag = llvm::dwarf::DW_TAG_class_type; + } + else if (RD->isStruct() || RD->isInterface()) + Tag = llvm::dwarf::DW_TAG_structure_type; + else if (RD->isUnion()) + Tag = llvm::dwarf::DW_TAG_union_type; else llvm_unreachable("Unknown RecordDecl type!"); diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index e5740112bb..3bce8a87be 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -1031,14 +1031,14 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, const ParsedTemplateInfo &TemplateInfo, AccessSpecifier AS, bool EnteringContext, DeclSpecContext DSC) { - DeclSpec::TST TagType;
- if (TagTokKind == tok::kw_struct)
- TagType = DeclSpec::TST_struct;
- else if (TagTokKind == tok::kw___interface)
- TagType = DeclSpec::TST_interface;
- else if (TagTokKind == tok::kw_class)
- TagType = DeclSpec::TST_class;
- else {
+ DeclSpec::TST TagType; + if (TagTokKind == tok::kw_struct) + TagType = DeclSpec::TST_struct; + else if (TagTokKind == tok::kw___interface) + TagType = DeclSpec::TST_interface; + else if (TagTokKind == tok::kw_class) + TagType = DeclSpec::TST_class; + else { assert(TagTokKind == tok::kw_union && "Not a class specifier"); TagType = DeclSpec::TST_union; } @@ -1150,14 +1150,14 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, } Diag(NameLoc, diag::err_explicit_spec_non_template) - << (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation)
- << (TagType == DeclSpec::TST_class? 0
- : TagType == DeclSpec::TST_struct? 1
- : TagType == DeclSpec::TST_interface? 2
- : 3)
- << Name
- << SourceRange(LAngleLoc, RAngleLoc);
-
+ << (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation) + << (TagType == DeclSpec::TST_class? 0 + : TagType == DeclSpec::TST_struct? 1 + : TagType == DeclSpec::TST_interface? 2 + : 3) + << Name + << SourceRange(LAngleLoc, RAngleLoc); + // Strip off the last template parameter list if it was empty, since // we've removed its template argument list. if (TemplateParams && TemplateInfo.LastParameterListWasEmpty) { @@ -1243,13 +1243,13 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, (Tok.is(tok::semi) || (Tok.isAtStartOfLine() && !isValidAfterTypeSpecifier(false)))) { TUK = DS.isFriendSpecified() ? Sema::TUK_Friend : Sema::TUK_Declaration; - if (Tok.isNot(tok::semi)) {
- // A semicolon was missing after this declaration. Diagnose and recover.
- ExpectAndConsume(tok::semi, diag::err_expected_semi_after_tagdecl,
- DeclSpec::getSpecifierName(TagType));
- PP.EnterToken(Tok);
- Tok.setKind(tok::semi);
- }
+ if (Tok.isNot(tok::semi)) { + // A semicolon was missing after this declaration. Diagnose and recover. + ExpectAndConsume(tok::semi, diag::err_expected_semi_after_tagdecl, + DeclSpec::getSpecifierName(TagType)); + PP.EnterToken(Tok); + Tok.setKind(tok::semi); + } } else TUK = Sema::TUK_Reference; @@ -1468,13 +1468,13 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, // Also enforce C++ [temp]p3: // In a template-declaration which defines a class, no declarator // is permitted. - if (TUK == Sema::TUK_Definition &&
- (TemplateInfo.Kind || !isValidAfterTypeSpecifier(false))) {
- ExpectAndConsume(tok::semi, diag::err_expected_semi_after_tagdecl,
- DeclSpec::getSpecifierName(TagType));
- // Push this token back into the preprocessor and change our current token
- // to ';' so that the rest of the code recovers as though there were an
- // ';' after the definition.
+ if (TUK == Sema::TUK_Definition && + (TemplateInfo.Kind || !isValidAfterTypeSpecifier(false))) { + ExpectAndConsume(tok::semi, diag::err_expected_semi_after_tagdecl, + DeclSpec::getSpecifierName(TagType)); + // Push this token back into the preprocessor and change our current token + // to ';' so that the rest of the code recovers as though there were an + // ';' after the definition. PP.EnterToken(Tok); Tok.setKind(tok::semi); } @@ -2237,13 +2237,13 @@ ExprResult Parser::ParseCXXMemberInitializer(Decl *D, bool IsFunction, /// member-declaration member-specification[opt] /// access-specifier ':' member-specification[opt] /// -void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
- unsigned TagType, Decl *TagDecl) {
- assert((TagType == DeclSpec::TST_struct ||
- TagType == DeclSpec::TST_interface ||
- TagType == DeclSpec::TST_union ||
- TagType == DeclSpec::TST_class) && "Invalid TagType!");
-
+void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, + unsigned TagType, Decl *TagDecl) { + assert((TagType == DeclSpec::TST_struct || + TagType == DeclSpec::TST_interface || + TagType == DeclSpec::TST_union || + TagType == DeclSpec::TST_class) && "Invalid TagType!"); + PrettyDeclStackTraceEntry CrashInfo(Actions, TagDecl, RecordLoc, "parsing struct/union/class body"); diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index bae03f25af..ff1cbd14b6 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -672,28 +672,28 @@ static bool CheckConstexprParameterTypes(Sema &SemaRef, isa<CXXConstructorDecl>(FD))) return false; } - return true;
-}
-
-/// \brief Get diagnostic %select index for tag kind for
-/// record diagnostic message.
-/// WARNING: Indexes apply to particular diagnostics only!
-///
-/// \returns diagnostic %select index.
-static unsigned getRecordDiagFromTagKind(TagTypeKind Tag)
-{
- switch (Tag) {
- case TTK_Struct: return 0;
- case TTK_Interface: return 1;
- case TTK_Class: return 2;
- default: assert("Invalid tag kind for record diagnostic!");
- }
- return -1;
-}
-
-// CheckConstexprFunctionDecl - Check whether a function declaration satisfies
-// the requirements of a constexpr function definition or a constexpr
-// constructor definition. If so, return true. If not, produce appropriate
+ return true; +} + +/// \brief Get diagnostic %select index for tag kind for +/// record diagnostic message. +/// WARNING: Indexes apply to particular diagnostics only! +/// +/// \returns diagnostic %select index. +static unsigned getRecordDiagFromTagKind(TagTypeKind Tag) +{ + switch (Tag) { + case TTK_Struct: return 0; + case TTK_Interface: return 1; + case TTK_Class: return 2; + default: assert("Invalid tag kind for record diagnostic!"); + } + return -1; +} + +// CheckConstexprFunctionDecl - Check whether a function declaration satisfies +// the requirements of a constexpr function definition or a constexpr +// constructor definition. If so, return true. If not, produce appropriate // diagnostics and return false. // // This implements C++11 [dcl.constexpr]p3,4, as amended by DR1360. |