Author: rjmccall
Date: Fri Oct 23 16:14:09 2009
New Revision: 84970
URL: http://llvm.org/viewvc/llvm-project?rev=84970&view=rev
Log:
Add ASTContext::getTrivialDeclaratorInfo, which initializes a new
source info block with a single location.
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/lib/AST/ASTContext.cpp
Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=84970&r1=84969&r2=84970&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Fri Oct 23 16:14:09 2009
@@ -1085,6 +1085,12 @@
/// 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
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=84970&r1=84969&r2=84970&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Oct 23 16:14:09 2009
@@ -955,6 +955,13 @@
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.
///
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits