diff options
author | John McCall <rjmccall@apple.com> | 2009-10-23 21:14:09 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-10-23 21:14:09 +0000 |
commit | a4eb74d4dfe126c686dc708fec444c85ffb73b47 (patch) | |
tree | 4a60545d74bab13cb37c39a78fa158c644d8d698 | |
parent | f071e9b173dbaf97b00849c309a97c5aa3c49ae9 (diff) |
Add ASTContext::getTrivialDeclaratorInfo, which initializes a new
source info block with a single location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84970 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/ASTContext.h | 6 | ||||
-rw-r--r-- | lib/AST/ASTContext.cpp | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 30896c91a1..66e69995c6 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -1085,6 +1085,12 @@ public: /// should be calculated based on the type. DeclaratorInfo *CreateDeclaratorInfo(QualType T, unsigned Size = 0); + /// \brief Allocate a DeclaratorInfo where all locations have been + /// initialized to a given location, which defaults to the empty + /// location. + DeclaratorInfo * + getTrivialDeclaratorInfo(QualType T, SourceLocation Loc = SourceLocation()); + private: ASTContext(const ASTContext&); // DO NOT IMPLEMENT void operator=(const ASTContext&); // DO NOT IMPLEMENT diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 7f5fa35842..3ece8c95a2 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -955,6 +955,13 @@ DeclaratorInfo *ASTContext::CreateDeclaratorInfo(QualType T, return DInfo; } +DeclaratorInfo *ASTContext::getTrivialDeclaratorInfo(QualType T, + SourceLocation L) { + DeclaratorInfo *DI = CreateDeclaratorInfo(T); + DI->getTypeLoc().initialize(L); + return DI; +} + /// getInterfaceLayoutImpl - Get or compute information about the /// layout of the given interface. /// |