diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-03-10 17:45:58 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-03-10 17:45:58 +0000 |
commit | 27c39af73c0d7d0b97e57b3a905040d4cefc9708 (patch) | |
tree | 56c1dd85a159948815817b5a90bedb39cf9ad105 /lib/Frontend/DeclXML.cpp | |
parent | d2e6cf1d1c6468396ec057119c32aa58b1ee5ac9 (diff) | |
download | FreeBSD-src-27c39af73c0d7d0b97e57b3a905040d4cefc9708.zip FreeBSD-src-27c39af73c0d7d0b97e57b3a905040d4cefc9708.tar.gz |
Update clang to r98164.
Diffstat (limited to 'lib/Frontend/DeclXML.cpp')
-rw-r--r-- | lib/Frontend/DeclXML.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/lib/Frontend/DeclXML.cpp b/lib/Frontend/DeclXML.cpp index d7470d9..8750b1e 100644 --- a/lib/Frontend/DeclXML.cpp +++ b/lib/Frontend/DeclXML.cpp @@ -29,6 +29,14 @@ class DocumentXML::DeclPrinter : public DeclVisitor<DocumentXML::DeclPrinter> { } } + void addFunctionBody(FunctionDecl* FD) { + if (FD->isThisDeclarationADefinition()) { + Doc.addSubNode("Body"); + Doc.PrintStmt(FD->getBody()); + Doc.toParent(); + } + } + void addSubNodes(RecordDecl* RD) { for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end(); i != e; ++i) { @@ -37,6 +45,15 @@ class DocumentXML::DeclPrinter : public DeclVisitor<DocumentXML::DeclPrinter> { } } + void addSubNodes(CXXRecordDecl* RD) { + addSubNodes(cast<RecordDecl>(RD)); + for (CXXRecordDecl::method_iterator i = RD->method_begin(), + e = RD->method_end(); i != e; ++i) { + Visit(*i); + Doc.toParent(); + } + } + void addSubNodes(EnumDecl* ED) { for (EnumDecl::enumerator_iterator i = ED->enumerator_begin(), e = ED->enumerator_end(); i != e; ++i) { @@ -115,6 +132,8 @@ public: #define SUB_NODE_SEQUENCE_XML( CLASS ) addSubNodes(T); #define SUB_NODE_OPT_XML( CLASS ) addSubNodes(T); +#define SUB_NODE_FN_BODY_XML addFunctionBody(T); + #include "clang/Frontend/DeclXML.def" }; @@ -122,13 +141,6 @@ public: //--------------------------------------------------------- void DocumentXML::writeDeclToXML(Decl *D) { DeclPrinter(*this).Visit(D); - if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { - if (Stmt *Body = FD->getBody()) { - addSubNode("Body"); - PrintStmt(Body); - toParent(); - } - } toParent(); } |