summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-09-21 18:33:56 +0000
committerTed Kremenek <kremenek@apple.com>2012-09-21 18:33:56 +0000
commite7ad535e66e8d53249d52b32edd0d320b21575c9 (patch)
treed47ee4002b3f4dfd14c32ae4dfe9231232f58b57
parentf465dc1553056066d4adbb38b57935eaf16c2c77 (diff)
downloadbcm5719-llvm-e7ad535e66e8d53249d52b32edd0d320b21575c9.tar.gz
bcm5719-llvm-e7ad535e66e8d53249d52b32edd0d320b21575c9.zip
Experiment in BodyFarm of structuring AST creation calls in a hierarchy,
so that they visually look like an AST dump. llvm-svn: 164401
-rw-r--r--clang/lib/Analysis/BodyFarm.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/clang/lib/Analysis/BodyFarm.cpp b/clang/lib/Analysis/BodyFarm.cpp
index 54c8ab44300..be998581d75 100644
--- a/clang/lib/Analysis/BodyFarm.cpp
+++ b/clang/lib/Analysis/BodyFarm.cpp
@@ -151,12 +151,15 @@ static Stmt *create_dispatch_once(ASTContext &C, const FunctionDecl *D) {
IntegerLiteral *IL =
IntegerLiteral::Create(C, llvm::APInt(C.getTypeSize(C.IntTy), (uint64_t) 1),
C.IntTy, SourceLocation());
- ICE = M.makeIntegralCast(IL, PredicateTy);
- DR = M.makeDeclRefExpr(Predicate);
- ImplicitCastExpr *LValToRval = M.makeLvalueToRvalue(DR, PredicateQPtrTy);
- UnaryOperator *UO = M.makeDereference(LValToRval, PredicateTy);
- BinaryOperator * B = M.makeAssignment(UO, ICE, PredicateTy);
-
+ BinaryOperator *B =
+ M.makeAssignment(
+ M.makeDereference(
+ M.makeLvalueToRvalue(
+ M.makeDeclRefExpr(Predicate), PredicateQPtrTy),
+ PredicateTy),
+ M.makeIntegralCast(IL, PredicateTy),
+ PredicateTy);
+
// (3) Create the compound statement.
Stmt *Stmts[2];
Stmts[0] = B;
@@ -165,12 +168,18 @@ static Stmt *create_dispatch_once(ASTContext &C, const FunctionDecl *D) {
SourceLocation());
// (4) Create the 'if' condition.
- DR = M.makeDeclRefExpr(Predicate);
- LValToRval = M.makeLvalueToRvalue(DR, PredicateQPtrTy);
- UO = M.makeDereference(LValToRval, PredicateTy);
- LValToRval = M.makeLvalueToRvalue(UO, PredicateTy);
- UO = new (C) UnaryOperator(LValToRval, UO_LNot, C.IntTy,
- VK_RValue, OK_Ordinary, SourceLocation());
+ ImplicitCastExpr *LValToRval =
+ M.makeLvalueToRvalue(
+ M.makeDereference(
+ M.makeLvalueToRvalue(
+ M.makeDeclRefExpr(Predicate),
+ PredicateQPtrTy),
+ PredicateTy),
+ PredicateTy);
+
+ UnaryOperator *UO = new (C) UnaryOperator(LValToRval, UO_LNot, C.IntTy,
+ VK_RValue, OK_Ordinary,
+ SourceLocation());
// (5) Create the 'if' statement.
IfStmt *If = new (C) IfStmt(C, SourceLocation(), 0, UO, CS);
OpenPOWER on IntegriCloud