diff options
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/AST/Expr.h | 9 | ||||
-rw-r--r-- | include/clang/AST/ExprCXX.h | 27 | ||||
-rw-r--r-- | include/clang/AST/StmtNodes.def | 1 | ||||
-rw-r--r-- | include/clang/Basic/SourceManager.h | 1 |
4 files changed, 37 insertions, 1 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 62a93b51e8..0490aab200 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -273,9 +273,15 @@ class DeclRefExpr : public Expr { SourceLocation Loc; protected: + // FIXME: Eventually, this constructor will go away and all subclasses + // will have to provide the type- and value-dependent flags. DeclRefExpr(StmtClass SC, NamedDecl *d, QualType t, SourceLocation l) : Expr(SC, t), D(d), Loc(l) {} + DeclRefExpr(StmtClass SC, NamedDecl *d, QualType t, SourceLocation l, bool TD, + bool VD) : + Expr(SC, t, TD, VD), D(d), Loc(l) {} + public: // FIXME: Eventually, this constructor will go away and all clients // will have to provide the type- and value-dependent flags. @@ -294,7 +300,8 @@ public: static bool classof(const Stmt *T) { return T->getStmtClass() == DeclRefExprClass || - T->getStmtClass() == CXXConditionDeclExprClass; + T->getStmtClass() == CXXConditionDeclExprClass || + T->getStmtClass() == QualifiedDeclRefExprClass; } static bool classof(const DeclRefExpr *) { return true; } diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h index 37436575a2..a9ff1546e9 100644 --- a/include/clang/AST/ExprCXX.h +++ b/include/clang/AST/ExprCXX.h @@ -747,6 +747,33 @@ public: static UnaryTypeTraitExpr *CreateImpl(llvm::Deserializer& D, ASTContext& C); }; +/// QualifiedDeclRefExpr - A reference to a declared variable, +/// function, enum, etc., that includes a qualification, e.g., +/// "N::foo". +class QualifiedDeclRefExpr : public DeclRefExpr { + /// NestedNameLoc - The location of the beginning of the + /// nested-name-specifier that qualifies this declaration. + SourceLocation NestedNameLoc; + +public: + QualifiedDeclRefExpr(NamedDecl *d, QualType t, SourceLocation l, bool TD, + bool VD, SourceLocation nnl) + : DeclRefExpr(QualifiedDeclRefExprClass, d, t, l, TD, VD), + NestedNameLoc(nnl) { } + + virtual SourceRange getSourceRange() const { + return SourceRange(NestedNameLoc, getLocation()); + } + + static bool classof(const Stmt *T) { + return T->getStmtClass() == QualifiedDeclRefExprClass; + } + static bool classof(const QualifiedDeclRefExpr *) { return true; } + + virtual void EmitImpl(llvm::Serializer& S) const; + static QualifiedDeclRefExpr* CreateImpl(llvm::Deserializer& D, ASTContext& C); +}; + } // end namespace clang #endif diff --git a/include/clang/AST/StmtNodes.def b/include/clang/AST/StmtNodes.def index 7bd378220b..26d1e89637 100644 --- a/include/clang/AST/StmtNodes.def +++ b/include/clang/AST/StmtNodes.def @@ -114,6 +114,7 @@ STMT(CXXNewExpr , Expr) STMT(CXXDeleteExpr , Expr) STMT(CXXDependentNameExpr , Expr) STMT(UnaryTypeTraitExpr , Expr) +STMT(QualifiedDeclRefExpr , DeclRefExpr) // Obj-C Expressions. STMT(ObjCStringLiteral , Expr) diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 175c40488c..5185aa1655 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -49,6 +49,7 @@ namespace SrcMgr { /// ContentCache - Once instance of this struct is kept for every file /// loaded or used. This object owns the MemoryBuffer object. class ContentCache { + public: /// Buffer - The actual buffer containing the characters from the input /// file. This is owned by the ContentCache object. const llvm::MemoryBuffer* Buffer; |