diff options
author | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-08-11 22:01:17 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-08-11 22:01:17 +0000 |
commit | 2577743c5650c646fb705df01403707e94f2df04 (patch) | |
tree | 02c673a648345cb0d695e28c244ea719ca5cd789 /lib/AST/ASTContext.cpp | |
parent | e6b1bb6e7fe906d164637ca33503b8fafdbc99e5 (diff) |
Added locations and type source info for DeclarationName.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110860 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 7d159269c1..8051dca5a6 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -2534,21 +2534,31 @@ bool ASTContext::UnwrapSimilarPointerTypes(QualType &T1, QualType &T2) { return false; } -DeclarationName ASTContext::getNameForTemplate(TemplateName Name) { +DeclarationNameInfo ASTContext::getNameForTemplate(TemplateName Name, + SourceLocation NameLoc) { if (TemplateDecl *TD = Name.getAsTemplateDecl()) - return TD->getDeclName(); - + // DNInfo work in progress: CHECKME: what about DNLoc? + return DeclarationNameInfo(TD->getDeclName(), NameLoc); + if (DependentTemplateName *DTN = Name.getAsDependentTemplateName()) { + DeclarationName DName; if (DTN->isIdentifier()) { - return DeclarationNames.getIdentifier(DTN->getIdentifier()); + DName = DeclarationNames.getIdentifier(DTN->getIdentifier()); + return DeclarationNameInfo(DName, NameLoc); } else { - return DeclarationNames.getCXXOperatorName(DTN->getOperator()); + DName = DeclarationNames.getCXXOperatorName(DTN->getOperator()); + // DNInfo work in progress: FIXME: source locations? + DeclarationNameLoc DNLoc; + DNLoc.CXXOperatorName.BeginOpNameLoc = SourceLocation().getRawEncoding(); + DNLoc.CXXOperatorName.EndOpNameLoc = SourceLocation().getRawEncoding(); + return DeclarationNameInfo(DName, NameLoc, DNLoc); } } OverloadedTemplateStorage *Storage = Name.getAsOverloadedTemplate(); assert(Storage); - return (*Storage->begin())->getDeclName(); + // DNInfo work in progress: CHECKME: what about DNLoc? + return DeclarationNameInfo((*Storage->begin())->getDeclName(), NameLoc); } TemplateName ASTContext::getCanonicalTemplateName(TemplateName Name) { |