diff options
author | Abramo Bagnara <abramo.bagnara@gmail.com> | 2012-01-27 08:46:19 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo.bagnara@gmail.com> | 2012-01-27 08:46:19 +0000 |
commit | 4244b43b606a01a9795eece32ede4483c35bda37 (patch) | |
tree | efb8f7b5952154241c8c9caf7b4ba7dce40808bd /clang/lib/Sema/SemaDecl.cpp | |
parent | 8823d12a53f46619f3f7ceb464fa35c7c5e18bef (diff) | |
download | bcm5719-llvm-4244b43b606a01a9795eece32ede4483c35bda37.tar.gz bcm5719-llvm-4244b43b606a01a9795eece32ede4483c35bda37.zip |
Avoid redundant NNS qualification in constructor/destructor names.
llvm-svn: 149124
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index e7ff5c5400a..a6e1e401b3a 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -94,6 +94,7 @@ ParsedType Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS, bool isClassName, bool HasTrailingDot, ParsedType ObjectTypePtr, + bool IsCtorOrDtorName, bool WantNontrivialTypeSourceInfo, IdentifierInfo **CorrectedII) { // Determine where we will perform name lookup. @@ -194,6 +195,7 @@ ParsedType Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc, false, Template, MemberOfUnknownSpecialization))) { ParsedType Ty = getTypeName(*NewII, NameLoc, S, NewSSPtr, isClassName, HasTrailingDot, ObjectTypePtr, + IsCtorOrDtorName, WantNontrivialTypeSourceInfo); if (Ty) { std::string CorrectedStr(Correction.getAsString(getLangOptions())); @@ -272,8 +274,11 @@ ParsedType Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc, if (T.isNull()) T = Context.getTypeDeclType(TD); - - if (SS && SS->isNotEmpty()) { + + // NOTE: avoid constructing an ElaboratedType(Loc) if this is a + // constructor or destructor name (in such a case, the scope specifier + // will be attached to the enclosing Expr or Decl node). + if (SS && SS->isNotEmpty() && !IsCtorOrDtorName) { if (WantNontrivialTypeSourceInfo) { // Construct a type with type-source information. TypeLocBuilder Builder; @@ -394,6 +399,7 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, SuggestedType = getTypeName(*Result->getIdentifier(), IILoc, S, SS, false, false, ParsedType(), + /*IsCtorOrDtorName=*/false, /*NonTrivialTypeSourceInfo=*/true); } return true; |