summaryrefslogtreecommitdiffstats
path: root/clang/include
diff options
context:
space:
mode:
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/Basic/DiagnosticParseKinds.td2
-rw-r--r--clang/include/clang/Parse/Action.h9
-rw-r--r--clang/include/clang/Parse/Parser.h6
3 files changed, 15 insertions, 2 deletions
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 66a48cffb02..5e97faa96da 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -145,6 +145,8 @@ def err_invalid_decl_spec_combination : Error<
"cannot combine with previous '%0' declaration specifier">;
def err_unknown_typename : Error<
"unknown type name %0">;
+def err_use_of_tag_name_without_tag : Error<
+ "use of tagged type %0 without '%1' tag">;
/// Objective-C parser diagnostics
diff --git a/clang/include/clang/Parse/Action.h b/clang/include/clang/Parse/Action.h
index 699d5711466..df54da46f6c 100644
--- a/clang/include/clang/Parse/Action.h
+++ b/clang/include/clang/Parse/Action.h
@@ -139,6 +139,15 @@ public:
virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
Scope *S, const CXXScopeSpec *SS = 0) = 0;
+ /// isTagName() - This method is called *for error recovery purposes only*
+ /// to determine if the specified name is a valid tag name ("struct foo"). If
+ /// so, this returns the TST for the tag corresponding to it (TST_enum,
+ /// TST_union, TST_struct, TST_class). This is used to diagnose cases in C
+ /// where the user forgot to specify the tag.
+ virtual DeclSpec::TST isTagName(IdentifierInfo &II, Scope *S) {
+ return DeclSpec::TST_unspecified;
+ }
+
/// isCurrentClassName - Return true if the specified name is the
/// name of the innermost C++ class type currently being defined.
virtual bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index 3e09a2cc535..f5a00065df1 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -825,7 +825,8 @@ private:
void ParseObjCTypeQualifierList(ObjCDeclSpec &DS);
- void ParseEnumSpecifier(DeclSpec &DS, AccessSpecifier AS = AS_none);
+ void ParseEnumSpecifier(SourceLocation TagLoc, DeclSpec &DS,
+ AccessSpecifier AS = AS_none);
void ParseEnumBody(SourceLocation StartLoc, DeclPtrTy TagDecl);
void ParseStructUnionBody(SourceLocation StartLoc, unsigned TagType,
DeclPtrTy TagDecl);
@@ -1012,7 +1013,8 @@ private:
// C++ 9: classes [class] and C structs/unions.
TypeResult ParseClassName(SourceLocation &EndLocation,
const CXXScopeSpec *SS = 0);
- void ParseClassSpecifier(DeclSpec &DS,
+ void ParseClassSpecifier(tok::TokenKind TagTokKind, SourceLocation TagLoc,
+ DeclSpec &DS,
TemplateParameterLists *TemplateParams = 0,
AccessSpecifier AS = AS_none);
void ParseCXXMemberSpecification(SourceLocation StartLoc, unsigned TagType,
OpenPOWER on IntegriCloud