[cfe-commits] r69652 - in /cfe/trunk: include/clang/AST/DeclCXX.h include/clang/AST/DeclNodes.def lib/AST/DeclCXX.cpp

Anders Carlsson andersca at mac.com
Mon Apr 20 18:57:48 PDT 2009


Author: andersca
Date: Mon Apr 20 20:57:48 2009
New Revision: 69652

URL: http://llvm.org/viewvc/llvm-project?rev=69652&view=rev
Log:
Add the beginnings of a CXXTempVarDecl class.

Modified:
    cfe/trunk/include/clang/AST/DeclCXX.h
    cfe/trunk/include/clang/AST/DeclNodes.def
    cfe/trunk/lib/AST/DeclCXX.cpp

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=69652&r1=69651&r2=69652&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Mon Apr 20 20:57:48 2009
@@ -1026,6 +1026,7 @@
   static bool classof(const NamespaceAliasDecl *D) { return true; }
 };
   
+/// StaticAssertDecl - Represents a C++0x static_assert declaration.
 class StaticAssertDecl : public Decl {
   Expr *AssertExpr;
   StringLiteral *Message;
@@ -1054,6 +1055,17 @@
   static bool classof(StaticAssertDecl *D) { return true; }
 };
 
+/// CXXTempVarDecl - Represents an implicit C++ temporary variable declaration.
+class CXXTempVarDecl : public VarDecl {
+protected:
+  CXXTempVarDecl(DeclContext *DC, QualType T) 
+    : VarDecl(CXXTempVar, DC, SourceLocation(), 0, T, None) {}
+
+public:
+  static CXXTempVarDecl *Create(ASTContext &C, DeclContext *DC,
+                                QualType T);
+};
+
 /// Insertion operator for diagnostics.  This allows sending AccessSpecifier's
 /// into a diagnostic with <<.
 const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,

Modified: cfe/trunk/include/clang/AST/DeclNodes.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclNodes.def?rev=69652&r1=69651&r2=69652&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclNodes.def (original)
+++ cfe/trunk/include/clang/AST/DeclNodes.def Mon Apr 20 20:57:48 2009
@@ -102,6 +102,7 @@
       DECL(ParmVar, VarDecl)
         DECL(OriginalParmVar, ParmVarDecl)
       DECL(NonTypeTemplateParm, VarDecl)
+      DECL(CXXTempVar, VarDecl)
   DECL(Template, NamedDecl)
     DECL(FunctionTemplate, TemplateDecl)
     DECL(ClassTemplate, TemplateDecl)

Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=69652&r1=69651&r2=69652&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Mon Apr 20 20:57:48 2009
@@ -375,6 +375,13 @@
 StaticAssertDecl::~StaticAssertDecl() {
 }
 
+CXXTempVarDecl *CXXTempVarDecl::Create(ASTContext &C, DeclContext *DC,
+                                       QualType T) {
+  assert(isa<CXXRecordDecl>(T->getAsRecordType()->getDecl()) &&
+         "CXXTempVarDecl must have a C++ record type!");
+  return new (C) CXXTempVarDecl(DC, T);
+}
+
 static const char *getAccessName(AccessSpecifier AS) {
   switch (AS) {
     default:





More information about the cfe-commits mailing list