From: Anders Carlsson Date: Tue, 21 Apr 2009 01:57:48 +0000 (+0000) Subject: Add the beginnings of a CXXTempVarDecl class. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86fa7502706b993ebbe5b5be147604c3bed0fcad;p=clang Add the beginnings of a CXXTempVarDecl class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69652 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index 4dbfe4db0b..f7b5eb5fa1 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -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, diff --git a/include/clang/AST/DeclNodes.def b/include/clang/AST/DeclNodes.def index bbe36242b1..3b48b2196e 100644 --- a/include/clang/AST/DeclNodes.def +++ b/include/clang/AST/DeclNodes.def @@ -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) diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index a5d133c643..34d746433e 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -375,6 +375,13 @@ void StaticAssertDecl::Destroy(ASTContext& C) { StaticAssertDecl::~StaticAssertDecl() { } +CXXTempVarDecl *CXXTempVarDecl::Create(ASTContext &C, DeclContext *DC, + QualType T) { + assert(isa(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: