mirror of
https://github.com/intel/llvm.git
synced 2026-01-27 14:50:42 +08:00
remember referenced decls in our AST's
llvm-svn: 39193
This commit is contained in:
@@ -253,8 +253,7 @@ Sema::ExprResult Sema::ParseIdentifierExpr(SourceLocation Loc,
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return new DeclRefExpr(*(Decl*)0);
|
||||
return new DeclRefExpr(D);
|
||||
}
|
||||
|
||||
Sema::ExprResult Sema::ParseSimplePrimaryExpr(SourceLocation Loc,
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/AST/StmtVisitor.h"
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/Expr.h"
|
||||
#include "clang/Lex/IdentifierTable.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
@@ -211,8 +212,7 @@ void StmtPrinter::VisitExpr(Expr *Node) {
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
|
||||
// FIXME: print name.
|
||||
OS << "x";
|
||||
OS << Node->getDecl()->getName();
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitIntegerConstant(IntegerConstant *Node) {
|
||||
|
||||
@@ -253,8 +253,7 @@ Sema::ExprResult Sema::ParseIdentifierExpr(SourceLocation Loc,
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return new DeclRefExpr(*(Decl*)0);
|
||||
return new DeclRefExpr(D);
|
||||
}
|
||||
|
||||
Sema::ExprResult Sema::ParseSimplePrimaryExpr(SourceLocation Loc,
|
||||
|
||||
@@ -42,10 +42,12 @@ public:
|
||||
/// DeclRefExpr - [C99 6.5.1p2] - A reference to a declared variable, function,
|
||||
/// enum, etc.
|
||||
class DeclRefExpr : public Expr {
|
||||
// TODO: Union with the decl when resolved.
|
||||
Decl &D;
|
||||
Decl *D;
|
||||
public:
|
||||
DeclRefExpr(Decl &d) : D(d) {}
|
||||
DeclRefExpr(Decl *d) : D(d) {}
|
||||
|
||||
Decl *getDecl() const { return D; }
|
||||
|
||||
virtual void visit(StmtVisitor &Visitor);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user