[cfe-commits] r166130 - in /cfe/trunk: bindings/xml/comment-xml-schema.rng include/clang/AST/Comment.h include/clang/AST/PrettyPrinter.h lib/AST/Comment.cpp lib/AST/DeclPrinter.cpp test/Index/annotate-comments-availability-attrs.cpp test/Index/annotate-comments.cpp test/Index/overriding-ftemplate-comments.cpp test/Index/overriding-method-comments.mm tools/libclang/CXComment.cpp
jahanian
fjahanian at apple.com
Thu Oct 18 10:25:11 PDT 2012
On Oct 18, 2012, at 10:21 AM, Douglas Gregor <dgregor at apple.com> wrote:
>
> On Oct 17, 2012, at 2:58 PM, Fariborz Jahanian <fjahanian at apple.com> 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
>
>
More information about the cfe-commits
mailing list