On Oct 18, 2012, at 10:21 AM, Douglas Gregor <[email protected]> wrote:
> > On Oct 17, 2012, at 2:58 PM, Fariborz Jahanian <[email protected]> wrote: > >> Author: fjahanian >> Date: Wed Oct 17 16:58:03 2012 >> New Revision: 166130 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=166130&view=rev >> Log: >> [Doc parsing]: This patch adds <Declaration> tag to >> XML comment for declarations which pretty-prints >> declaration. I had to XFAIL one test annotate-comments.cpp. >> This test is currently unmaintainable as written. >> Dmitri G., can you see what we can do about this test. >> We should change this test such that adding a new tag does not wreck >> havoc to the test. >> >> Modified: >> cfe/trunk/bindings/xml/comment-xml-schema.rng >> cfe/trunk/include/clang/AST/Comment.h >> cfe/trunk/include/clang/AST/PrettyPrinter.h >> cfe/trunk/lib/AST/Comment.cpp >> cfe/trunk/lib/AST/DeclPrinter.cpp >> cfe/trunk/test/Index/annotate-comments-availability-attrs.cpp >> cfe/trunk/test/Index/annotate-comments.cpp >> cfe/trunk/test/Index/overriding-ftemplate-comments.cpp >> cfe/trunk/test/Index/overriding-method-comments.mm >> cfe/trunk/tools/libclang/CXComment.cpp >> >> Modified: cfe/trunk/tools/libclang/CXComment.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXComment.cpp?rev=166130&r1=166129&r2=166130&view=diff >> ============================================================================== >> --- cfe/trunk/tools/libclang/CXComment.cpp (original) >> +++ cfe/trunk/tools/libclang/CXComment.cpp Wed Oct 17 16:58:03 2012 >> @@ -16,6 +16,7 @@ >> #include "CXComment.h" >> #include "CXCursor.h" >> >> +#include "clang/AST/PrettyPrinter.h" >> #include "clang/AST/CommentVisitor.h" >> #include "clang/AST/CommentCommandTraits.h" >> #include "clang/AST/Decl.h" >> @@ -1027,6 +1028,20 @@ >> Result << "</Verbatim>"; >> } >> >> +static StringRef getSourceTextOfDeclaration(const DeclInfo *ThisDecl) { >> + >> + ASTContext &Context = ThisDecl->CurrentDecl->getASTContext(); >> + const LangOptions &LangOpts = Context.getLangOpts(); >> + std::string SStr; >> + llvm::raw_string_ostream S(SStr); >> + PrintingPolicy PPolicy(LangOpts); >> + PPolicy.SuppressAttributes = true; >> + PPolicy.TerseOutput = true; >> + ThisDecl->CurrentDecl->print(S, PPolicy, >> + /*Indentation*/0, >> /*PrintInstantiation*/true); >> + return S.str(); >> +} > > The declaration printer is going to need a lot of work. We'll need to have > tests for essentially every kind of AST node. Yes, this is wip. Test annotate-comments.cpp already has many of them. I need to start writing unit tests. - Fariborz > > - Doug > > _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
