diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/AST/StmtDumper.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/AST/StmtDumper.cpp | 69 |
1 files changed, 61 insertions, 8 deletions
diff --git a/contrib/llvm/tools/clang/lib/AST/StmtDumper.cpp b/contrib/llvm/tools/clang/lib/AST/StmtDumper.cpp index 2968739..b5e298c 100644 --- a/contrib/llvm/tools/clang/lib/AST/StmtDumper.cpp +++ b/contrib/llvm/tools/clang/lib/AST/StmtDumper.cpp @@ -112,6 +112,7 @@ namespace { case OK_Ordinary: break; case OK_BitField: OS << " bitfield"; break; case OK_ObjCProperty: OS << " objcproperty"; break; + case OK_ObjCSubscript: OS << " objcsubscript"; break; case OK_VectorComponent: OS << " vectorcomponent"; break; } } @@ -148,6 +149,7 @@ namespace { void VisitCompoundAssignOperator(CompoundAssignOperator *Node); void VisitAddrLabelExpr(AddrLabelExpr *Node); void VisitBlockExpr(BlockExpr *Node); + void VisitOpaqueValueExpr(OpaqueValueExpr *Node); // C++ void VisitCXXNamedCastExpr(CXXNamedCastExpr *Node); @@ -167,7 +169,9 @@ namespace { void VisitObjCSelectorExpr(ObjCSelectorExpr *Node); void VisitObjCProtocolExpr(ObjCProtocolExpr *Node); void VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node); + void VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *Node); void VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node); + void VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *Node); }; } @@ -250,7 +254,7 @@ void StmtDumper::DumpDeclarator(Decl *D) { std::string Name = VD->getNameAsString(); VD->getType().getAsStringInternal(Name, - PrintingPolicy(VD->getASTContext().getLangOptions())); + PrintingPolicy(VD->getASTContext().getLangOpts())); OS << Name; // If this is a vardecl with an initializer, emit it. @@ -283,10 +287,10 @@ void StmtDumper::DumpDeclarator(Decl *D) { const char *tn = UD->isTypeName() ? "typename " : ""; OS << '"' << UD->getDeclKindName() << tn; UD->getQualifier()->print(OS, - PrintingPolicy(UD->getASTContext().getLangOptions())); + PrintingPolicy(UD->getASTContext().getLangOpts())); OS << ";\""; } else if (LabelDecl *LD = dyn_cast<LabelDecl>(D)) { - OS << "label " << LD->getNameAsString(); + OS << "label " << *LD; } else if (StaticAssertDecl *SAD = dyn_cast<StaticAssertDecl>(D)) { OS << "\"static_assert(\n"; DumpSubTree(SAD->getAssertExpr()); @@ -425,7 +429,7 @@ void StmtDumper::VisitPredefinedExpr(PredefinedExpr *Node) { void StmtDumper::VisitCharacterLiteral(CharacterLiteral *Node) { DumpExpr(Node); - OS << Node->getValue(); + OS << " " << Node->getValue(); } void StmtDumper::VisitIntegerLiteral(IntegerLiteral *Node) { @@ -503,8 +507,10 @@ void StmtDumper::VisitCompoundAssignOperator(CompoundAssignOperator *Node) { void StmtDumper::VisitBlockExpr(BlockExpr *Node) { DumpExpr(Node); - IndentLevel++; BlockDecl *block = Node->getBlockDecl(); + OS << " decl=" << block; + + IndentLevel++; if (block->capturesCXXThis()) { OS << '\n'; Indent(); OS << "(capture this)"; } @@ -515,15 +521,26 @@ void StmtDumper::VisitBlockExpr(BlockExpr *Node) { OS << "(capture "; if (i->isByRef()) OS << "byref "; if (i->isNested()) OS << "nested "; - DumpDeclRef(i->getVariable()); + if (i->getVariable()) + DumpDeclRef(i->getVariable()); if (i->hasCopyExpr()) DumpSubTree(i->getCopyExpr()); OS << ")"; } IndentLevel--; + OS << '\n'; DumpSubTree(block->getBody()); } +void StmtDumper::VisitOpaqueValueExpr(OpaqueValueExpr *Node) { + DumpExpr(Node); + + if (Expr *Source = Node->getSourceExpr()) { + OS << '\n'; + DumpSubTree(Source); + } +} + // GNU extensions. void StmtDumper::VisitAddrLabelExpr(AddrLabelExpr *Node) { @@ -580,10 +597,12 @@ void StmtDumper::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node) { void StmtDumper::VisitExprWithCleanups(ExprWithCleanups *Node) { DumpExpr(Node); ++IndentLevel; - for (unsigned i = 0, e = Node->getNumTemporaries(); i != e; ++i) { + for (unsigned i = 0, e = Node->getNumObjects(); i != e; ++i) { OS << "\n"; Indent(); - DumpCXXTemporary(Node->getTemporary(i)); + OS << "(cleanup "; + DumpDeclRef(Node->getObject(i)); + OS << ")"; } --IndentLevel; } @@ -667,6 +686,40 @@ void StmtDumper::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) { if (Node->isSuperReceiver()) OS << " super"; + + OS << " Messaging="; + if (Node->isMessagingGetter() && Node->isMessagingSetter()) + OS << "Getter&Setter"; + else if (Node->isMessagingGetter()) + OS << "Getter"; + else if (Node->isMessagingSetter()) + OS << "Setter"; +} + +void StmtDumper::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *Node) { + DumpExpr(Node); + if (Node->isArraySubscriptRefExpr()) + OS << " Kind=ArraySubscript GetterForArray=\""; + else + OS << " Kind=DictionarySubscript GetterForDictionary=\""; + if (Node->getAtIndexMethodDecl()) + OS << Node->getAtIndexMethodDecl()->getSelector().getAsString(); + else + OS << "(null)"; + + if (Node->isArraySubscriptRefExpr()) + OS << "\" SetterForArray=\""; + else + OS << "\" SetterForDictionary=\""; + if (Node->setAtIndexMethodDecl()) + OS << Node->setAtIndexMethodDecl()->getSelector().getAsString(); + else + OS << "(null)"; +} + +void StmtDumper::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *Node) { + DumpExpr(Node); + OS << " " << (Node->getValue() ? "__objc_yes" : "__objc_no"); } //===----------------------------------------------------------------------===// |