diff options
author | Haojian Wu <hokein.wu@gmail.com> | 2023-01-26 10:46:51 +0100 |
---|---|---|
committer | Haojian Wu <hokein.wu@gmail.com> | 2023-01-26 11:37:41 +0100 |
commit | e400c63cc39680538a3726a7736baf6b7844c3a8 (patch) | |
tree | 6d2eea0856ac5a9c15c66be7696c8e3a262423f7 /clang/lib/Parse/ParseDecl.cpp | |
parent | eaea793d5eb68d121dc773f6c31ebc2214bf1371 (diff) | |
download | llvm-e400c63cc39680538a3726a7736baf6b7844c3a8.zip llvm-e400c63cc39680538a3726a7736baf6b7844c3a8.tar.gz llvm-e400c63cc39680538a3726a7736baf6b7844c3a8.tar.bz2 |
Revert "[clang] Build UsingType for elaborated type specifiers."
This reverts commit e70ca7b35319a3621f9d9c6475926428f8c5c000 and the
followup patch "[clang] Fix the location of UsingTypeLoc"
(ebbeb164c25a40cb6ba9c6b18dce5dcd06c0bb07).
The patch causes an incorrect lookup result:
```
namespace ns { struct Foo { };}
using ns::Foo;
void test() {
struct Foo {
} k; // the type of k refers to ns::Foo, rather than the local Foo!
}
```
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index c7fd115..e6812ac 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -4965,7 +4965,6 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, bool IsDependent = false; const char *PrevSpec = nullptr; unsigned DiagID; - UsingShadowDecl* FoundUsing = nullptr; Decl *TagDecl = Actions.ActOnTag(getCurScope(), DeclSpec::TST_enum, TUK, StartLoc, SS, Name, NameLoc, attrs, AS, DS.getModulePrivateSpecLoc(), @@ -4974,7 +4973,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, BaseType, DSC == DeclSpecContext::DSC_type_specifier, DSC == DeclSpecContext::DSC_template_param || DSC == DeclSpecContext::DSC_template_type_arg, - OffsetOfState, FoundUsing, &SkipBody).get(); + OffsetOfState, &SkipBody).get(); if (SkipBody.ShouldSkip) { assert(TUK == Sema::TUK_Definition && "can only skip a definition"); @@ -4984,8 +4983,8 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, T.skipToEnd(); if (DS.SetTypeSpecType(DeclSpec::TST_enum, StartLoc, - NameLoc.isValid() ? NameLoc : StartLoc, PrevSpec, - DiagID, FoundUsing ? FoundUsing : TagDecl, Owned, + NameLoc.isValid() ? NameLoc : StartLoc, + PrevSpec, DiagID, TagDecl, Owned, Actions.getASTContext().getPrintingPolicy())) Diag(StartLoc, DiagID) << PrevSpec; return; @@ -5039,8 +5038,8 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, } if (DS.SetTypeSpecType(DeclSpec::TST_enum, StartLoc, - NameLoc.isValid() ? NameLoc : StartLoc, PrevSpec, - DiagID, FoundUsing ? FoundUsing : TagDecl, Owned, + NameLoc.isValid() ? NameLoc : StartLoc, + PrevSpec, DiagID, TagDecl, Owned, Actions.getASTContext().getPrintingPolicy())) Diag(StartLoc, DiagID) << PrevSpec; } |