]> granicus.if.org Git - clang/commitdiff
Add the beginnings of a CXXTempVarDecl class.
authorAnders Carlsson <andersca@mac.com>
Tue, 21 Apr 2009 01:57:48 +0000 (01:57 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 21 Apr 2009 01:57:48 +0000 (01:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69652 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclCXX.h
include/clang/AST/DeclNodes.def
lib/AST/DeclCXX.cpp

index 4dbfe4db0bd89e5c778cd1bf6699cde6e0263905..f7b5eb5fa1683521b99718bd0f72652b5fb7fdf9 100644 (file)
@@ -1026,6 +1026,7 @@ public:
   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 @@ public:
   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,
index bbe36242b1c3ef47bbaa97567b84f913298fa8f2..3b48b2196e1e7dde32b76299a1a7aec0587f597c 100644 (file)
@@ -102,6 +102,7 @@ ABSTRACT_DECL(Named,  Decl)
       DECL(ParmVar, VarDecl)
         DECL(OriginalParmVar, ParmVarDecl)
       DECL(NonTypeTemplateParm, VarDecl)
+      DECL(CXXTempVar, VarDecl)
   DECL(Template, NamedDecl)
     DECL(FunctionTemplate, TemplateDecl)
     DECL(ClassTemplate, TemplateDecl)
index a5d133c643f45808e43f451d9f8dd0a56152b36e..34d746433e125b4554df1e3a9a7df5356445e91b 100644 (file)
@@ -375,6 +375,13 @@ void StaticAssertDecl::Destroy(ASTContext& C) {
 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: