summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorJoel E. Denny <jdenny.ornl@gmail.com>2018-05-30 18:33:53 +0000
committerJoel E. Denny <jdenny.ornl@gmail.com>2018-05-30 18:33:53 +0000
commit857613bc6ded429c9a4bb9e4a01839fc62a3e36a (patch)
tree6324996b9425660da92f9c9aa2e4145ce6182d83 /clang/lib
parent2fbbffa4bf66efa3715fa9c80ef6c43e61bcedfb (diff)
downloadbcm5719-llvm-857613bc6ded429c9a4bb9e4a01839fc62a3e36a.tar.gz
bcm5719-llvm-857613bc6ded429c9a4bb9e4a01839fc62a3e36a.zip
[AST] Fix loss of enum forward decl from decl context
For example, given: enum __attribute__((deprecated)) T *p; -ast-print produced: enum T *p; The attribute was lost because the enum forward decl was lost. Another example is the loss of enum forward decls from C++ namespaces (in MS compatibility mode). The trouble was that the EnumDecl node was suppressed, as revealed by -ast-dump. The suppression of the EnumDecl was intentional in r116122, but I don't understand why. The suppression isn't needed for the test suite to behave. Reviewed by: rsmith Differential Revision: https://reviews.llvm.org/D46846 llvm-svn: 333574
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index c422a85d84e..862da621491 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -14287,7 +14287,6 @@ CreateNewDecl:
// PrevDecl.
TagDecl *New;
- bool IsForwardReference = false;
if (Kind == TTK_Enum) {
// FIXME: Tag decls should be chained to any simultaneous vardecls, e.g.:
// enum X { A, B, C } D; D should chain to X.
@@ -14317,12 +14316,6 @@ CreateNewDecl:
else if (getLangOpts().CPlusPlus)
DiagID = diag::err_forward_ref_enum;
Diag(Loc, DiagID);
-
- // If this is a forward-declared reference to an enumeration, make a
- // note of it; we won't actually be introducing the declaration into
- // the declaration context.
- if (TUK == TUK_Reference)
- IsForwardReference = true;
}
}
@@ -14480,9 +14473,7 @@ CreateNewDecl:
PushOnScopeChains(New, EnclosingScope, /* AddToContext = */ false);
} else if (Name) {
S = getNonFieldDeclScope(S);
- PushOnScopeChains(New, S, !IsForwardReference);
- if (IsForwardReference)
- SearchDC->makeDeclVisibleInContext(New);
+ PushOnScopeChains(New, S, true);
} else {
CurContext->addDecl(New);
}
OpenPOWER on IntegriCloud