diff options
Diffstat (limited to 'clang/lib/AST/ExprCXX.cpp')
-rw-r--r-- | clang/lib/AST/ExprCXX.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp index 1d4a3ba3a63..f18a2888470 100644 --- a/clang/lib/AST/ExprCXX.cpp +++ b/clang/lib/AST/ExprCXX.cpp @@ -24,6 +24,31 @@ void CXXConditionDeclExpr::Destroy(ASTContext& C) { C.Deallocate(this); } +QualifiedDeclRefExpr::QualifiedDeclRefExpr(NamedDecl *d, QualType t, + SourceLocation l, bool TD, + bool VD, SourceRange R, + const NestedNameSpecifier *Components, + unsigned NumComponents) + : DeclRefExpr(QualifiedDeclRefExprClass, d, t, l, TD, VD), + QualifierRange(R), NumComponents(NumComponents) { + NestedNameSpecifier *Data + = reinterpret_cast<NestedNameSpecifier *>(this + 1); + for (unsigned I = 0; I < NumComponents; ++I) + Data[I] = Components[I]; +} + +QualifiedDeclRefExpr * +QualifiedDeclRefExpr::Create(ASTContext &Context, NamedDecl *d, QualType t, + SourceLocation l, bool TD, + bool VD, SourceRange R, + const NestedNameSpecifier *Components, + unsigned NumComponents) { + void *Mem = Context.Allocate((sizeof(QualifiedDeclRefExpr) + + sizeof(NestedNameSpecifier) * NumComponents)); + return new (Mem) QualifiedDeclRefExpr(d, t, l, TD, VD, R, Components, + NumComponents); +} + //===----------------------------------------------------------------------===// // Child Iterators for iterating over subexpressions/substatements //===----------------------------------------------------------------------===// |