CXIdxEntity_CXXStaticVariable = 19,
CXIdxEntity_CXXStaticMethod = 20,
CXIdxEntity_CXXInstanceMethod = 21,
- CXIdxEntity_CXXConstructor = 22,\r
- CXIdxEntity_CXXDestructor = 23,\r
- CXIdxEntity_CXXConversionFunction = 24,\r
- CXIdxEntity_CXXTypeAlias = 25,\r
- CXIdxEntity_CXXInterface = 26\r
-\r
-} CXIdxEntityKind;\r
-\r
+ CXIdxEntity_CXXConstructor = 22,
+ CXIdxEntity_CXXDestructor = 23,
+ CXIdxEntity_CXXConversionFunction = 24,
+ CXIdxEntity_CXXTypeAlias = 25,
+ CXIdxEntity_CXXInterface = 26
+
+} CXIdxEntityKind;
+
typedef enum {
CXIdxEntityLang_None = 0,
CXIdxEntityLang_C = 1,
bool isVolatile() { return getType()->castAs<FunctionType>()->isVolatile(); }
bool isVirtual() const {
- CXXMethodDecl *CD =\r
- cast<CXXMethodDecl>(const_cast<CXXMethodDecl*>(this)->getCanonicalDecl());\r
-\r
- // Methods declared in interfaces are automatically (pure) virtual\r
- if (CD->isVirtualAsWritten() ||\r
- CD->getParent()->getTagKind() == TTK_Interface)\r
- return true;\r
-\r
- return (CD->begin_overridden_methods() != CD->end_overridden_methods());\r
+ 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
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<\r
- "type %0 has incompatible definitions in different translation units">;\r
-def note_odr_tag_kind_here: Note<\r
- "%0 is a %select{struct|interface|union|class|enum}1 here">;\r
-def note_odr_field : Note<"field %0 has type %1 here">;\r
-def note_odr_missing_field : Note<"no corresponding field here">;\r
-def note_odr_bit_field : Note<"bit-field %0 with type %1 and length %2 here">;\r
+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<
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 '::'">;\r
-def err_explicit_spec_non_template : Error<\r
- "explicit %select{specialization|instantiation}0 of non-template "\r
- "%select{class|struct|union|interface}1 %2">;\r
- \r
-def err_default_template_template_parameter_not_template : Error<\r
- "default template argument for a template template parameter must be a class "\r
+ "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<
"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;\r
-def ext_unelaborated_friend_type : ExtWarn<\r
- "unelaborated friend declaration is a C++11 extension; specify "\r
- "'%select{struct|interface|union|class|enum}0' to befriend %1">,\r
- InGroup<CXX11>;\r
-def warn_cxx98_compat_unelaborated_friend_type : Warning<\r
- "befriending %1 without '%select{struct|interface|union|class|enum}0' "\r
- "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;\r
-def err_qualified_friend_not_found : Error<\r
- "no function named %0 with type %1 was found in the specified scope">;\r
-def err_introducing_special_friend : Error<\r
+ "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<
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<\r
- "copy constructor must pass its first argument by reference">;\r
-def warn_no_constructor_for_refconst : Warning<\r
- "%select{struct|interface|union|class|enum}0 %1 does not declare any "\r
- "constructor to initialize its non-modifiable members">;\r
-def note_refconst_member_not_initialized : Note<\r
- "%select{const|reference}0 member %1 will never be initialized">;\r
-def ext_ms_explicit_constructor_call : ExtWarn<\r
+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
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'">;\r
-def err_auto_not_allowed : Error<\r
- "'auto' not allowed %select{in function prototype|in non-static struct member"\r
- "|in non-static union member|in non-static class member|in interface member"\r
- "|in exception declaration|in template parameter|in block literal"\r
- "|in template argument|in typedef|in type alias|in function return type"\r
- "|here}0">;\r
-def err_auto_var_requires_init : Error<\r
- "declaration of variable %0 with type %1 requires an initializer">;\r
-def err_auto_new_requires_ctor_arg : Error<\r
+ "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">;
"'constexpr' specifier is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def err_invalid_constexpr : Error<
- "%select{function parameter|typedef|non-static data member}0 "\r
- "cannot be constexpr">;\r
-def err_constexpr_tag : Error<\r
- "%select{class|struct|interface|union|enum}0 cannot be marked constexpr">;\r
-def err_constexpr_dtor : Error<"destructor cannot be marked constexpr">;\r
-def err_constexpr_no_declarators : Error<\r
- "constexpr can only be used in variable and function declarations">;\r
+ "%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<
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">;\r
-def err_constexpr_virtual_base : Error<\r
- "constexpr %select{member function|constructor}0 not allowed in "\r
- "%select{struct|interface|class}1 with virtual base "\r
- "%plural{1:class|:classes}2">;\r
-def note_non_literal_incomplete : Note<\r
- "incomplete type %0 is not a literal type">;\r
-def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "\r
- "with virtual base %plural{1:class|:classes}1 is not a literal type">;\r
-def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;\r
-def err_constexpr_non_literal_return : Error<\r
- "constexpr function's return type %0 is not a literal type">;\r
+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">;
"__declspec attribute %0 is not supported">,
InGroup<IgnoredAttributes>;
def warn_attribute_invalid_on_stmt : Warning<
- "attribute %0 cannot be specified on a statement">,\r
- InGroup<IgnoredAttributes>;\r
-def warn_declspec_attribute_ignored : Warning<\r
- "attribute %0 is ignored, place it after "\r
- "\"%select{class|struct|union|interface|enum}1\" to apply attribute to "\r
- "type declaration">, InGroup<IgnoredAttributes>;\r
-def warn_attribute_precede_definition : Warning<\r
- "attribute declaration must precede definition">,\r
- InGroup<IgnoredAttributes>;\r
+ "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">,
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 "\r
- "%select{a declaration|a typedef|a type alias|a template}0 of the same name">;\r
-def err_dependent_tag_decl : Error<\r
- "%select{declaration|definition}0 of "\r
- "%select{struct|interface|union|class|enum}1 in a dependent scope">;\r
-def err_tag_definition_of_typedef : Error<\r
- "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;\r
-def err_conflicting_types : Error<"conflicting types for %0">;\r
+ "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<\r
- "use of %0 with tag type that does not match previous declaration">;\r
-def warn_struct_class_tag_mismatch : Warning<\r
- "%select{struct|interface|class}0%select{| template}1 %2 was previously "\r
- "declared as a %select{struct|interface|class}3%select{| template}1">,\r
- InGroup<MismatchedTags>, DefaultIgnore;\r
-def warn_struct_class_previous_tag_mismatch : Warning<\r
- "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "\r
- "here but previously declared as "\r
- "%select{a struct|an interface|a class}3%select{| template}1">,\r
- InGroup<MismatchedTags>, DefaultIgnore;\r
-def note_struct_class_suggestion : Note<\r
- "did you mean %select{struct|interface|class}0 here?">;\r
-def ext_forward_ref_enum : Extension<\r
- "ISO C forbids forward references to 'enum' types">;\r
-def err_forward_ref_enum : Error<\r
+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>;
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">>;
-\r
-// -Wpadded, -Wpacked\r
-def warn_padded_struct_field : Warning<\r
- "padding %select{struct|interface|class}0 %1 with %2 "\r
- "%select{byte|bit}3%select{|s}4 to align %5">,\r
- InGroup<Padded>, DefaultIgnore;\r
-def warn_padded_struct_anon_field : Warning<\r
- "padding %select{struct|interface|class}0 %1 with %2 "\r
- "%select{byte|bit}3%select{|s}4 to align anonymous bit-field">,\r
- InGroup<Padded>, DefaultIgnore;\r
-def warn_padded_struct_size : Warning<\r
- "padding size of %0 with %1 %select{byte|bit}2%select{|s}3 "\r
- "to alignment boundary">, InGroup<Padded>, DefaultIgnore;\r
+
+// -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;
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<\r
- "initialization of flexible array member is not allowed">;\r
-def ext_flexible_array_empty_aggregate_ms : Extension<\r
- "flexible array member %0 in otherwise empty "\r
- "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,\r
- InGroup<Microsoft>;\r
-def ext_flexible_array_union_ms : Extension<\r
- "flexible array member %0 in a union is a Microsoft extension">,\r
- InGroup<Microsoft>;\r
-def ext_flexible_array_empty_aggregate_gnu : Extension<\r
- "flexible array member %0 in otherwise empty "\r
- "%select{struct|interface|union|class|enum}1 is a GNU extension">,\r
- InGroup<GNU>;\r
-def ext_flexible_array_union_gnu : Extension<\r
- "flexible array member %0 in a union is a GNU extension">, InGroup<GNU>;\r
-\r
+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.
"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<\r
- "definition or redeclaration of %0 not allowed inside a function">;\r
-def err_not_tag_in_scope : Error<\r
- "no %select{struct|interface|union|class|enum}0 named %1 in %2">;\r
-\r
-def err_no_typeid_with_fno_rtti : Error<\r
- "cannot use typeid with -fno-rtti">;\r
+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">;
"%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 "\r
- "__module_private__">;\r
-def err_module_private_local_class : Error<\r
- "local %select{struct|interface|union|class|enum}0 cannot be declared "\r
- "__module_private__">;\r
-def err_module_private_definition : Error<\r
- "definition of %0 must be imported before it is required">;\r
+ "%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 {
TST_decimal64, // _Decimal64
TST_decimal128, // _Decimal128
TST_enum,
- TST_union,\r
- TST_struct,\r
- TST_class, // C++ class type\r
- TST_interface, // C++ (Microsoft-specific) __interface type\r
- TST_typename, // Typedef, C++ class-name or enum name, etc.\r
- TST_typeofType,\r
- TST_typeofExpr,\r
+ 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
}
void CXXRecordDecl::addedMember(Decl *D) {
- if (!D->isImplicit() &&\r
- !isa<FieldDecl>(D) &&\r
- !isa<IndirectFieldDecl>(D) &&\r
- (!isa<TagDecl>(D) || cast<TagDecl>(D)->getTagKind() == TTK_Class ||\r
- cast<TagDecl>(D)->getTagKind() == TTK_Interface))\r
- data().HasOnlyCMembers = false;\r
-\r
- // Ignore friends and invalid declarations.\r
+ 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;
if (Shadow->getDeclName().getNameKind()
== DeclarationName::CXXConversionFunctionName)
data().Conversions.addDecl(Shadow, Shadow->getAccess());
-}\r
-\r
-bool CXXRecordDecl::isCLike() const {\r
- if (getTagKind() == TTK_Class || getTagKind() == TTK_Interface ||\r
- !TemplateOrInstantiation.isNull())\r
- return false;\r
- if (!hasDefinition())\r
- return true;\r
+}
+
+bool CXXRecordDecl::isCLike() const {
+ if (getTagKind() == TTK_Class || getTagKind() == TTK_Interface ||
+ !TemplateOrInstantiation.isNull())
+ return false;
+ if (!hasDefinition())
+ return true;
return isPOD() && data().HasOnlyCMembers;
}
void MicrosoftCXXNameMangler::mangleType(const TagType *T) {
switch (T->getDecl()->getTagKind()) {
case TTK_Union:
- Out << 'T';\r
- break;\r
- case TTK_Struct:\r
- case TTK_Interface:\r
- Out << 'U';\r
- break;\r
- case TTK_Class:\r
+ Out << 'T';
+ break;
+ case TTK_Struct:
+ case TTK_Interface:
+ Out << 'U';
+ break;
+ case TTK_Class:
Out << 'V';
break;
case TTK_Enum:
const CXXRecordDecl *CXXDecl = dyn_cast<CXXRecordDecl>(RD);
unsigned Tag = 0;
if (CXXDecl) {
- RDName = getClassName(RD);\r
- Tag = llvm::dwarf::DW_TAG_class_type;\r
- }\r
- else if (RD->isStruct() || RD->isInterface())\r
- Tag = llvm::dwarf::DW_TAG_structure_type;\r
- else if (RD->isUnion())\r
- Tag = llvm::dwarf::DW_TAG_union_type;\r
+ 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!");
const ParsedTemplateInfo &TemplateInfo,
AccessSpecifier AS,
bool EnteringContext, DeclSpecContext DSC) {
- DeclSpec::TST TagType;\r
- if (TagTokKind == tok::kw_struct)\r
- TagType = DeclSpec::TST_struct;\r
- else if (TagTokKind == tok::kw___interface)\r
- TagType = DeclSpec::TST_interface;\r
- else if (TagTokKind == tok::kw_class)\r
- TagType = DeclSpec::TST_class;\r
- else {\r
+ 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;
}
}
Diag(NameLoc, diag::err_explicit_spec_non_template)
- << (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation)\r
- << (TagType == DeclSpec::TST_class? 0\r
- : TagType == DeclSpec::TST_struct? 1\r
- : TagType == DeclSpec::TST_interface? 2\r
- : 3)\r
- << Name\r
- << SourceRange(LAngleLoc, RAngleLoc);\r
-\r
+ << (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) {
(Tok.is(tok::semi) ||
(Tok.isAtStartOfLine() && !isValidAfterTypeSpecifier(false)))) {
TUK = DS.isFriendSpecified() ? Sema::TUK_Friend : Sema::TUK_Declaration;
- if (Tok.isNot(tok::semi)) {\r
- // A semicolon was missing after this declaration. Diagnose and recover.\r
- ExpectAndConsume(tok::semi, diag::err_expected_semi_after_tagdecl,\r
- DeclSpec::getSpecifierName(TagType));\r
- PP.EnterToken(Tok);\r
- Tok.setKind(tok::semi);\r
- }\r
+ 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;
// Also enforce C++ [temp]p3:
// In a template-declaration which defines a class, no declarator
// is permitted.
- if (TUK == Sema::TUK_Definition &&\r
- (TemplateInfo.Kind || !isValidAfterTypeSpecifier(false))) {\r
- ExpectAndConsume(tok::semi, diag::err_expected_semi_after_tagdecl,\r
- DeclSpec::getSpecifierName(TagType));\r
- // Push this token back into the preprocessor and change our current token\r
- // to ';' so that the rest of the code recovers as though there were an\r
- // ';' after the definition.\r
+ 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);
}
/// member-declaration member-specification[opt]
/// access-specifier ':' member-specification[opt]
///
-void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,\r
- unsigned TagType, Decl *TagDecl) {\r
- assert((TagType == DeclSpec::TST_struct ||\r
- TagType == DeclSpec::TST_interface ||\r
- TagType == DeclSpec::TST_union ||\r
- TagType == DeclSpec::TST_class) && "Invalid TagType!");\r
-\r
+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");
isa<CXXConstructorDecl>(FD)))
return false;
}
- return true;\r
-}\r
-\r
-/// \brief Get diagnostic %select index for tag kind for\r
-/// record diagnostic message.\r
-/// WARNING: Indexes apply to particular diagnostics only!\r
-///\r
-/// \returns diagnostic %select index.\r
-static unsigned getRecordDiagFromTagKind(TagTypeKind Tag)\r
-{\r
- switch (Tag) {\r
- case TTK_Struct: return 0;\r
- case TTK_Interface: return 1;\r
- case TTK_Class: return 2;\r
- default: assert("Invalid tag kind for record diagnostic!");\r
- }\r
- return -1;\r
-}\r
-\r
-// CheckConstexprFunctionDecl - Check whether a function declaration satisfies\r
-// the requirements of a constexpr function definition or a constexpr\r
-// constructor definition. If so, return true. If not, produce appropriate\r
+ 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.
// The definition of a constexpr constructor shall satisfy the following
// constraints:
// - the class shall not have any virtual base classes;
- const CXXRecordDecl *RD = MD->getParent();\r
- if (RD->getNumVBases()) {\r
- Diag(NewFD->getLocation(), diag::err_constexpr_virtual_base)\r
- << isa<CXXConstructorDecl>(NewFD)\r
- << getRecordDiagFromTagKind(RD->getTagKind()) << RD->getNumVBases();\r
- for (CXXRecordDecl::base_class_const_iterator I = RD->vbases_begin(),\r
- E = RD->vbases_end(); I != E; ++I)\r
- Diag(I->getLocStart(),\r
+ const CXXRecordDecl *RD = MD->getParent();
+ if (RD->getNumVBases()) {
+ Diag(NewFD->getLocation(), diag::err_constexpr_virtual_base)
+ << isa<CXXConstructorDecl>(NewFD)
+ << getRecordDiagFromTagKind(RD->getTagKind()) << RD->getNumVBases();
+ for (CXXRecordDecl::base_class_const_iterator I = RD->vbases_begin(),
+ E = RD->vbases_end(); I != E; ++I)
+ Diag(I->getLocStart(),
diag::note_constexpr_virtual_base_here) << I->getSourceRange();
return false;
}
return true;
// Compatible tags match.
- if (TagDecl *TagX = dyn_cast<TagDecl>(X)) {\r
- TagDecl *TagY = cast<TagDecl>(Y);\r
- return (TagX->getTagKind() == TagY->getTagKind()) ||\r
- ((TagX->getTagKind() == TTK_Struct || TagX->getTagKind() == TTK_Class ||\r
- TagX->getTagKind() == TTK_Interface) &&\r
- (TagY->getTagKind() == TTK_Struct || TagY->getTagKind() == TTK_Class ||\r
- TagY->getTagKind() == TTK_Interface));\r
- }\r
- \r
- // Functions with the same type and linkage match.\r
+ if (TagDecl *TagX = dyn_cast<TagDecl>(X)) {
+ TagDecl *TagY = cast<TagDecl>(Y);
+ return (TagX->getTagKind() == TagY->getTagKind()) ||
+ ((TagX->getTagKind() == TTK_Struct || TagX->getTagKind() == TTK_Class ||
+ TagX->getTagKind() == TTK_Interface) &&
+ (TagY->getTagKind() == TTK_Struct || TagY->getTagKind() == TTK_Class ||
+ TagY->getTagKind() == TTK_Interface));
+ }
+
+ // Functions with the same type and linkage match.
// FIXME: This needs to cope with function templates, merging of
//prototyped/non-prototyped functions, etc.
if (FunctionDecl *FuncX = dyn_cast<FunctionDecl>(X)) {
int k = typename var;// expected-error {{expected a qualified name after 'typename'}}
}
-\r
-__interface MicrosoftInterface;\r
-__interface MicrosoftInterface {\r
- void foo1() = 0;\r
- virtual void foo2() = 0;\r
-};\r
-\r
-__interface MicrosoftDerivedInterface : public MicrosoftInterface {\r
- void foo1();\r
- void foo2() override;\r
- void foo3();\r
-};\r
-\r
-void interface_test() {\r
- MicrosoftInterface* a;\r
- a->foo1();\r
- MicrosoftDerivedInterface* b;\r
- b->foo2();\r
-}\r
-\r
-__int64 x7 = __int64(0);\r
+
+__interface MicrosoftInterface;
+__interface MicrosoftInterface {
+ void foo1() = 0;
+ virtual void foo2() = 0;
+};
+
+__interface MicrosoftDerivedInterface : public MicrosoftInterface {
+ void foo1();
+ void foo2() override;
+ void foo3();
+};
+
+void interface_test() {
+ MicrosoftInterface* a;
+ a->foo1();
+ MicrosoftDerivedInterface* b;
+ b->foo2();
+}
+
+__int64 x7 = __int64(0);
namespace If_exists_test {
int __if_exists_init_list() {
- int array1[] = {\r
- 0, \r
- __if_exists(IF_EXISTS::Type) {2, }\r
- 3\r
- };\r
-
- int array2[] = {\r
- 0, \r
- __if_exists(IF_EXISTS::Type_not) { this wont compile }\r
- 3\r
- };\r
-\r
- int array3[] = {\r
- 0, \r
- __if_not_exists(IF_EXISTS::Type_not) {2, }\r
- 3\r
- };\r
-
- int array4[] = {\r
- 0, \r
- __if_not_exists(IF_EXISTS::Type) { this wont compile }\r
- 3\r
- };\r
+ int array1[] = {
+ 0,
+ __if_exists(IF_EXISTS::Type) {2, }
+ 3
+ };
+
+ int array2[] = {
+ 0,
+ __if_exists(IF_EXISTS::Type_not) { this wont compile }
+ 3
+ };
+
+ int array3[] = {
+ 0,
+ __if_not_exists(IF_EXISTS::Type_not) {2, }
+ 3
+ };
+
+ int array4[] = {
+ 0,
+ __if_not_exists(IF_EXISTS::Type) { this wont compile }
+ 3
+ };
}
case CXCursor_ClassTemplatePartialSpecialization:
if (ClassTemplateSpecializationDecl *PartialSpec
- = dyn_cast_or_null<ClassTemplatePartialSpecializationDecl>(\r
- getCursorDecl(C))) {\r
- switch (PartialSpec->getTagKind()) {\r
- case TTK_Interface:\r
- case TTK_Struct: return CXCursor_StructDecl;\r
- case TTK_Class: return CXCursor_ClassDecl;\r
- case TTK_Union: return CXCursor_UnionDecl;\r
- case TTK_Enum: return CXCursor_NoDeclFound;\r
- }\r
+ = dyn_cast_or_null<ClassTemplatePartialSpecializationDecl>(
+ getCursorDecl(C))) {
+ switch (PartialSpec->getTagKind()) {
+ case TTK_Interface:
+ case TTK_Struct: return CXCursor_StructDecl;
+ case TTK_Class: return CXCursor_ClassDecl;
+ case TTK_Union: return CXCursor_UnionDecl;
+ case TTK_Enum: return CXCursor_NoDeclFound;
+ }
}
break;
case TTK_Union:
EntityInfo.kind = CXIdxEntity_Union; break;
case TTK_Class:
- EntityInfo.kind = CXIdxEntity_CXXClass;\r
- EntityInfo.lang = CXIdxEntityLang_CXX;\r
- break;\r
- case TTK_Interface:\r
- EntityInfo.kind = CXIdxEntity_CXXInterface;\r
- EntityInfo.lang = CXIdxEntityLang_CXX;\r
- break;\r
- case TTK_Enum:\r
- EntityInfo.kind = CXIdxEntity_Enum; break;\r
- }\r
+ EntityInfo.kind = CXIdxEntity_CXXClass;
+ EntityInfo.lang = CXIdxEntityLang_CXX;
+ break;
+ case TTK_Interface:
+ EntityInfo.kind = CXIdxEntity_CXXInterface;
+ EntityInfo.lang = CXIdxEntityLang_CXX;
+ break;
+ case TTK_Enum:
+ EntityInfo.kind = CXIdxEntity_Enum; break;
+ }
if (const CXXRecordDecl *CXXRec = dyn_cast<CXXRecordDecl>(D))
if (!CXXRec->isCLike())