aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Parse/Action.h
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-28 23:31:59 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-28 23:31:59 +0000
commit402abb55fc2e0cdda5fb1ac90009b1f5f6774906 (patch)
tree3c379d93e527baaa9a8cc7184a92f80b8f9762da /include/clang/Parse/Action.h
parent2dce5f8a99b5c48f1287ff3941288ca6f7fde2de (diff)
When we parse a tag specifier, keep track of whether that tag
specifier resulted in the creation of a new TagDecl node, which happens either when the tag specifier was a definition or when the tag specifier was the first declaration of that tag type. This information has several uses, the first of which is implemented in this commit: 1) In C++, one is not allowed to define tag types within a type specifier (e.g., static_cast<struct S { int x; } *>(0) is ill-formed) or within the result or parameter types of a function. We now diagnose this. 2) We can extend DeclGroups to contain information about any tags that are declared/defined within the declaration specifiers of a variable, e.g., struct Point { int x, y, z; } p; This will help improve AST printing and template instantiation, among other things. 3) For C99, we can keep track of whether a tag type is defined within the type of a parameter, to properly cope with cases like, e.g., int bar(struct T2 { int x; } y) { struct T2 z; } We can also do similar things wherever there is a type specifier, e.g., to keep track of where the definition of S occurs in this legal C99 code: (struct S { int x, y; } *)0 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72555 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Parse/Action.h')
-rw-r--r--include/clang/Parse/Action.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h
index 8fa9f8cc49..86e3194836 100644
--- a/include/clang/Parse/Action.h
+++ b/include/clang/Parse/Action.h
@@ -397,7 +397,8 @@ public:
virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagSpec, TagKind TK,
SourceLocation KWLoc, const CXXScopeSpec &SS,
IdentifierInfo *Name, SourceLocation NameLoc,
- AttributeList *Attr, AccessSpecifier AS) {
+ AttributeList *Attr, AccessSpecifier AS,
+ bool &OwnedDecl) {
// TagType is an instance of DeclSpec::TST, indicating what kind of tag this
// is (struct/union/enum/class).
return DeclPtrTy();