]> granicus.if.org Git - clang/commitdiff
Add ASTContext::getTrivialDeclaratorInfo, which initializes a new
authorJohn McCall <rjmccall@apple.com>
Fri, 23 Oct 2009 21:14:09 +0000 (21:14 +0000)
committerJohn McCall <rjmccall@apple.com>
Fri, 23 Oct 2009 21:14:09 +0000 (21:14 +0000)
source info block with a single location.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84970 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/ASTContext.h
lib/AST/ASTContext.cpp

index 30896c91a14326d3b4297bcabeae7e9c8b81c1f3..66e69995c698e12cfcab1cd9bd747ca54f0ab349 100644 (file)
@@ -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
index 7f5fa35842af279f368e24c728e989c588dc005c..3ece8c95a27a70f2427f6f358456d5d5a38bdf5b 100644 (file)
@@ -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.
 ///