diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-03-19 03:51:16 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-03-19 03:51:16 +0000 |
commit | 183539102563b85e9421d0fc5c3a650a20887840 (patch) | |
tree | 7a18d1af87575a34033cebf9778c66508d13eec9 /clang/lib/AST/ExprCXX.cpp | |
parent | 3b7b301a2462c9982192c41de7e11cbd804792a3 (diff) | |
download | bcm5719-llvm-183539102563b85e9421d0fc5c3a650a20887840.tar.gz bcm5719-llvm-183539102563b85e9421d0fc5c3a650a20887840.zip |
Generalize printing of nested-name-specifier sequences for use in both
QualifiedNameType and QualifiedDeclRefExpr. We now keep track of the
exact nested-name-specifier spelling for a QualifiedDeclRefExpr, and
use that spelling when printing ASTs. This fixes PR3493.
llvm-svn: 67283
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 //===----------------------------------------------------------------------===// |