[PATCH] D48395: Added PublicOnly flag
This revision was automatically updated to reflect the committed changes. Closed by commit rCTE337602: [clang-doc] Adding PublicOnly flag (authored by juliehockett, committed by ). Herald added a subscriber: arphaman. Changed prior to commit: https://reviews.llvm.org/D48395?vs=154470=156562#toc Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48395 Files: clang-doc/ClangDoc.cpp clang-doc/ClangDoc.h clang-doc/Mapper.cpp clang-doc/Mapper.h clang-doc/Representation.cpp clang-doc/Representation.h clang-doc/Serialize.cpp clang-doc/Serialize.h clang-doc/tool/ClangDocMain.cpp test/clang-doc/module.cpp test/clang-doc/public-module.cpp test/clang-doc/public-records.cpp Index: clang-doc/Representation.cpp === --- clang-doc/Representation.cpp +++ clang-doc/Representation.cpp @@ -42,7 +42,7 @@ mergeInfos(std::vector> ) { if (Values.empty()) return llvm::make_error("No info values to merge.\n", - llvm::inconvertibleErrorCode()); + llvm::inconvertibleErrorCode()); switch (Values[0]->IT) { case InfoType::IT_namespace: Index: clang-doc/Serialize.h === --- clang-doc/Serialize.h +++ clang-doc/Serialize.h @@ -29,15 +29,15 @@ namespace serialize { std::string emitInfo(const NamespaceDecl *D, const FullComment *FC, - int LineNumber, StringRef File); + int LineNumber, StringRef File, bool PublicOnly); std::string emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber, - StringRef File); + StringRef File, bool PublicOnly); std::string emitInfo(const EnumDecl *D, const FullComment *FC, int LineNumber, - StringRef File); + StringRef File, bool PublicOnly); std::string emitInfo(const FunctionDecl *D, const FullComment *FC, - int LineNumber, StringRef File); + int LineNumber, StringRef File, bool PublicOnly); std::string emitInfo(const CXXMethodDecl *D, const FullComment *FC, - int LineNumber, StringRef File); + int LineNumber, StringRef File, bool PublicOnly); // Function to hash a given USR value for storage. // As USRs (Unified Symbol Resolution) could be large, especially for functions Index: clang-doc/tool/ClangDocMain.cpp === --- clang-doc/tool/ClangDocMain.cpp +++ clang-doc/tool/ClangDocMain.cpp @@ -64,6 +64,10 @@ llvm::cl::desc("Dump intermediate results to bitcode file."), llvm::cl::init(false), llvm::cl::cat(ClangDocCategory)); +static llvm::cl::opt +PublicOnly("public", llvm::cl::desc("Document only public declarations."), + llvm::cl::init(false), llvm::cl::cat(ClangDocCategory)); + enum OutputFormatTy { yaml, }; @@ -171,9 +175,10 @@ // Mapping phase llvm::outs() << "Mapping decls...\n"; - auto Err = Exec->get()->execute( - doc::newMapperActionFactory(Exec->get()->getExecutionContext()), - ArgAdjuster); + clang::doc::ClangDocContext CDCtx = {Exec->get()->getExecutionContext(), + PublicOnly}; + auto Err = + Exec->get()->execute(doc::newMapperActionFactory(CDCtx), ArgAdjuster); if (Err) { llvm::errs() << toString(std::move(Err)) << "\n"; return 1; Index: clang-doc/Mapper.h === --- clang-doc/Mapper.h +++ clang-doc/Mapper.h @@ -18,6 +18,7 @@ #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_MAPPER_H #define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_MAPPER_H +#include "Representation.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/Tooling/Execution.h" @@ -30,8 +31,8 @@ class MapASTVisitor : public clang::RecursiveASTVisitor, public ASTConsumer { public: - explicit MapASTVisitor(ASTContext *Ctx, ExecutionContext *ECtx) - : ECtx(ECtx) {} + explicit MapASTVisitor(ASTContext *Ctx, ClangDocContext CDCtx) + : CDCtx(CDCtx) {} void HandleTranslationUnit(ASTContext ) override; bool VisitNamespaceDecl(const NamespaceDecl *D); @@ -48,7 +49,7 @@ comments::FullComment *getComment(const NamedDecl *D, const ASTContext ) const; - ExecutionContext *ECtx; + ClangDocContext CDCtx; }; } // namespace doc Index: clang-doc/Serialize.cpp === --- clang-doc/Serialize.cpp +++ clang-doc/Serialize.cpp @@ -171,8 +171,20 @@ return Ty->getDecl()->getDefinition(); } -static void parseFields(RecordInfo , const RecordDecl *D) { +static bool isPublic(const clang::AccessSpecifier AS, + const clang::Linkage Link) { + if (AS ==
[PATCH] D48395: Added PublicOnly flag
juliehockett added inline comments. Comment at: clang-tools-extra/test/clang-doc/yaml-module.cpp:14 +// CHECK-A: --- +// CHECK-A-NEXT: USR: '{{[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]}}' +// CHECK-A-NEXT: Name:'moduleFunction' ioeric wrote: > This could be `[0-9A-Z]{N}` where N = length(USR), right? The `{n}` syntax doesn't work with FileCheck. https://reviews.llvm.org/D48395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48395: Added PublicOnly flag
ioeric added a comment. In https://reviews.llvm.org/D48395#1158869, @juliehockett wrote: > Remember to mark comments as done when they are. Otherwise, LGTM unless > @ioeric has any concerns. No concern if this looks good to Julie. Comment at: clang-tools-extra/test/clang-doc/yaml-module.cpp:14 +// CHECK-A: --- +// CHECK-A-NEXT: USR: '{{[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]}}' +// CHECK-A-NEXT: Name:'moduleFunction' This could be `[0-9A-Z]{N}` where N = length(USR), right? https://reviews.llvm.org/D48395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48395: Added PublicOnly flag
juliehockett accepted this revision. juliehockett added a comment. This revision is now accepted and ready to land. Remember to mark comments as done when they are. Otherwise, LGTM unless @ioeric has any concerns. https://reviews.llvm.org/D48395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48395: Added PublicOnly flag
anniecherk updated this revision to Diff 154470. anniecherk added a comment. Updated according to Julie's suggestions, mostly adjusted formatting. https://reviews.llvm.org/D48395 Files: clang-tools-extra/clang-doc/ClangDoc.cpp clang-tools-extra/clang-doc/ClangDoc.h clang-tools-extra/clang-doc/Mapper.cpp clang-tools-extra/clang-doc/Mapper.h clang-tools-extra/clang-doc/Representation.cpp clang-tools-extra/clang-doc/Representation.h clang-tools-extra/clang-doc/Serialize.cpp clang-tools-extra/clang-doc/Serialize.h clang-tools-extra/clang-doc/tool/ClangDocMain.cpp clang-tools-extra/test/clang-doc/yaml-module.cpp clang-tools-extra/test/clang-doc/yaml-public-module.cpp clang-tools-extra/test/clang-doc/yaml-public-records.cpp Index: clang-tools-extra/test/clang-doc/yaml-public-records.cpp === --- /dev/null +++ clang-tools-extra/test/clang-doc/yaml-public-records.cpp @@ -0,0 +1,339 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" +// RUN: clang-doc --public --doxygen -p %t %t/test.cpp -output=%t/docs +// RUN: clang-doc --doxygen -p %t %t/test.cpp -output=%t/docs-without-flag +// RUN: cat %t/docs/function.yaml | FileCheck %s --check-prefix=CHECK-A +// RUN: cat %t/docs/inlinedFunction.yaml | FileCheck %s --check-prefix=CHECK-B +// RUN: cat %t/docs/functionWithInnerClass.yaml | FileCheck %s --check-prefix=CHECK-C +// RUN: cat %t/docs/inlinedFunctionWithInnerClass.yaml | FileCheck %s --check-prefix=CHECK-D +// RUN: cat %t/docs/Class/publicMethod.yaml| FileCheck %s --check-prefix=CHECK-E +// RUN: cat %t/docs/Class.yaml| FileCheck %s --check-prefix=CHECK-F +// RUN: cat %t/docs/Class/protectedMethod.yaml| FileCheck %s --check-prefix=CHECK-G +// RUN: cat %t/docs/named.yaml| FileCheck %s --check-prefix=CHECK-H +// RUN: cat %t/docs/named/NamedClass.yaml| FileCheck %s --check-prefix=CHECK-I +// RUN: cat %t/docs/named/namedFunction.yaml| FileCheck %s --check-prefix=CHECK-J +// RUN: cat %t/docs/named/namedInlineFunction.yaml| FileCheck %s --check-prefix=CHECK-K +// RUN: cat %t/docs/named/NamedClass/namedPublicMethod.yaml| FileCheck %s --check-prefix=CHECK-L +// RUN: cat %t/docs/named/NamedClass/namedProtectedMethod.yaml| FileCheck %s --check-prefix=CHECK-M +// RUN: (diff -qry %t/docs-without-flag %t/docs | sed 's:.*/::' > %t/public.diff) || true +// RUN: cat %t/public.diff | FileCheck %s --check-prefix=CHECK-N + +void function(int x); + +// CHECK-A: --- +// CHECK-A-NEXT: USR: '{{[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]}}' +// CHECK-A-NEXT: Name:'function' +// CHECK-A-NEXT: Location: +// CHECK-A-NEXT: - LineNumber: 23 +// CHECK-A-NEXT: Filename:{{.*}} +// CHECK-A-NEXT: Params: +// CHECK-A-NEXT: - Type: +// CHECK-A-NEXT: Name:'int' +// CHECK-A-NEXT: Name:'x' +// CHECK-A-NEXT: ReturnType: +// CHECK-A-NEXT: Type: +// CHECK-A-NEXT: Name:'void' +// CHECK-A-NEXT: ... + +inline int inlinedFunction(int x); + +// CHECK-B: --- +// CHECK-B-NEXT: USR: '{{[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]}}' +// CHECK-B-NEXT: Name:'inlinedFunction' +// CHECK-B-NEXT: Location: +// CHECK-B-NEXT: - LineNumber: 40 +// CHECK-B-NEXT: Filename:{{.*}} +// CHECK-B-NEXT: Params: +// CHECK-B-NEXT: - Type: +// CHECK-B-NEXT: Name:'int' +// CHECK-B-NEXT: Name:'x' +// CHECK-B-NEXT: ReturnType: +// CHECK-B-NEXT: Type: +// CHECK-B-NEXT: Name:'int' +// CHECK-B-NEXT: ... + +int functionWithInnerClass(int x){ +class InnerClass { //NoLinkage + public: +int innerPublicMethod() { return 2; }; +}; //end class +InnerClass temp; +return temp.innerPublicMethod(); +}; + +// CHECK-C: --- +// CHECK-C-NEXT: USR: '{{[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]}}' +// CHECK-C-NEXT: Name:'functionWithInnerClass' +// CHECK-C-NEXT: DefLocation: +// CHECK-C-NEXT: LineNumber: 57 +// CHECK-C-NEXT: Filename:{{.*}} +// CHECK-C-NEXT: Params: +// CHECK-C-NEXT:
[PATCH] D48395: Added PublicOnly flag
juliehockett added inline comments. Comment at: clang-tools-extra/clang-doc/Serialize.cpp:322-324 + if(PublicOnly && ! isPublic(D->getAccess(), D->getLinkageInternal())){ +return ""; + } anniecherk wrote: > juliehockett wrote: > > Since this is the same for Record/Function/Enum, can we move this to > > `populateSymbolInfo()`? > > > > Also, elide braces on single-line ifs. > I don't see a good way to put it into populateSymbolInfo because if the > condition passes then the emitInfo method needs to bail out and I don't see a > clean way to do that if the check is in populateSymbolInfo. A clunky way to > do this would be to either have populateSymbolInfo set a flag that emitInfo > checks or emitInfo can assume that populateSymbolInfo bailed if all the info > is unpopulated, but that seems like a worse way to do it. Am I missing > something? > > I can refactor the condition into a function if that would be better for > understandability / maintainability. Hmm I suppose this is fine then. Still elide braces on single-line ifs. https://reviews.llvm.org/D48395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48395: Added PublicOnly flag
anniecherk marked 11 inline comments as done. anniecherk added inline comments. Comment at: clang-tools-extra/clang-doc/Serialize.cpp:322-324 + if(PublicOnly && ! isPublic(D->getAccess(), D->getLinkageInternal())){ +return ""; + } juliehockett wrote: > Since this is the same for Record/Function/Enum, can we move this to > `populateSymbolInfo()`? > > Also, elide braces on single-line ifs. I don't see a good way to put it into populateSymbolInfo because if the condition passes then the emitInfo method needs to bail out and I don't see a clean way to do that if the check is in populateSymbolInfo. A clunky way to do this would be to either have populateSymbolInfo set a flag that emitInfo checks or emitInfo can assume that populateSymbolInfo bailed if all the info is unpopulated, but that seems like a worse way to do it. Am I missing something? I can refactor the condition into a function if that would be better for understandability / maintainability. https://reviews.llvm.org/D48395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48395: Added PublicOnly flag
juliehockett added a comment. Please run clang-format and clang-tidy on the patch. Comment at: clang-tools-extra/clang-doc/ClangDoc.cpp:25 #include "clang/Frontend/FrontendActions.h" +#include "Representation.h" Sort includes (this should be at the top) Comment at: clang-tools-extra/clang-doc/Mapper.cpp:13 #include "Serialize.h" +#include "Representation.h" #include "clang/AST/Comment.h" Sort includes alphabetically, but you shouldn't need this here? Comment at: clang-tools-extra/clang-doc/Mapper.h:23 #include "clang/Tooling/Execution.h" +#include "Representation.h" Sort includes (this should be at the top) Comment at: clang-tools-extra/clang-doc/Serialize.cpp:174 -static void parseFields(RecordInfo , const RecordDecl *D) { +static bool isPublic(const clang::AccessSpecifier as, const clang::Linkage link){ +if(as == clang::AccessSpecifier::AS_private) clang-tidy will tell you to capitalize these in llvm world (as -> AS, link -> Link) Comment at: clang-tools-extra/clang-doc/Serialize.cpp:322-324 + if(PublicOnly && ! isPublic(D->getAccess(), D->getLinkageInternal())){ +return ""; + } Since this is the same for Record/Function/Enum, can we move this to `populateSymbolInfo()`? Also, elide braces on single-line ifs. https://reviews.llvm.org/D48395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48395: Added PublicOnly flag
anniecherk updated this revision to Diff 153825. anniecherk marked 4 inline comments as done. anniecherk added a comment. Addressed Julie's comments https://reviews.llvm.org/D48395 Files: clang-tools-extra/clang-doc/ClangDoc.cpp clang-tools-extra/clang-doc/ClangDoc.h clang-tools-extra/clang-doc/Mapper.cpp clang-tools-extra/clang-doc/Mapper.h clang-tools-extra/clang-doc/Representation.h clang-tools-extra/clang-doc/Serialize.cpp clang-tools-extra/clang-doc/Serialize.h clang-tools-extra/clang-doc/tool/ClangDocMain.cpp clang-tools-extra/test/clang-doc/yaml-module.cpp clang-tools-extra/test/clang-doc/yaml-public-module.cpp clang-tools-extra/test/clang-doc/yaml-public-records.cpp Index: clang-tools-extra/test/clang-doc/yaml-public-records.cpp === --- /dev/null +++ clang-tools-extra/test/clang-doc/yaml-public-records.cpp @@ -0,0 +1,339 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" +// RUN: clang-doc --public --doxygen -p %t %t/test.cpp -output=%t/docs +// RUN: clang-doc --doxygen -p %t %t/test.cpp -output=%t/docs-without-flag +// RUN: cat %t/docs/function.yaml | FileCheck %s --check-prefix=CHECK-A +// RUN: cat %t/docs/inlinedFunction.yaml | FileCheck %s --check-prefix=CHECK-B +// RUN: cat %t/docs/functionWithInnerClass.yaml | FileCheck %s --check-prefix=CHECK-C +// RUN: cat %t/docs/inlinedFunctionWithInnerClass.yaml | FileCheck %s --check-prefix=CHECK-D +// RUN: cat %t/docs/Class/publicMethod.yaml| FileCheck %s --check-prefix=CHECK-E +// RUN: cat %t/docs/Class.yaml| FileCheck %s --check-prefix=CHECK-F +// RUN: cat %t/docs/Class/protectedMethod.yaml| FileCheck %s --check-prefix=CHECK-G +// RUN: cat %t/docs/named.yaml| FileCheck %s --check-prefix=CHECK-H +// RUN: cat %t/docs/named/NamedClass.yaml| FileCheck %s --check-prefix=CHECK-I +// RUN: cat %t/docs/named/namedFunction.yaml| FileCheck %s --check-prefix=CHECK-J +// RUN: cat %t/docs/named/namedInlineFunction.yaml| FileCheck %s --check-prefix=CHECK-K +// RUN: cat %t/docs/named/NamedClass/namedPublicMethod.yaml| FileCheck %s --check-prefix=CHECK-L +// RUN: cat %t/docs/named/NamedClass/namedProtectedMethod.yaml| FileCheck %s --check-prefix=CHECK-M +// RUN: (diff -qry %t/docs-without-flag %t/docs | sed 's:.*/::' > %t/public.diff) || true +// RUN: cat %t/public.diff | FileCheck %s --check-prefix=CHECK-N + +void function(int x); + +// CHECK-A: --- +// CHECK-A-NEXT: USR: '{{[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]}}' +// CHECK-A-NEXT: Name:'function' +// CHECK-A-NEXT: Location: +// CHECK-A-NEXT: - LineNumber: 23 +// CHECK-A-NEXT: Filename:{{.*}} +// CHECK-A-NEXT: Params: +// CHECK-A-NEXT: - Type: +// CHECK-A-NEXT: Name:'int' +// CHECK-A-NEXT: Name:'x' +// CHECK-A-NEXT: ReturnType: +// CHECK-A-NEXT: Type: +// CHECK-A-NEXT: Name:'void' +// CHECK-A-NEXT: ... + +inline int inlinedFunction(int x); + +// CHECK-B: --- +// CHECK-B-NEXT: USR: '{{[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]}}' +// CHECK-B-NEXT: Name:'inlinedFunction' +// CHECK-B-NEXT: Location: +// CHECK-B-NEXT: - LineNumber: 40 +// CHECK-B-NEXT: Filename:{{.*}} +// CHECK-B-NEXT: Params: +// CHECK-B-NEXT: - Type: +// CHECK-B-NEXT: Name:'int' +// CHECK-B-NEXT: Name:'x' +// CHECK-B-NEXT: ReturnType: +// CHECK-B-NEXT: Type: +// CHECK-B-NEXT: Name:'int' +// CHECK-B-NEXT: ... + +int functionWithInnerClass(int x){ +class InnerClass { //NoLinkage + public: +int innerPublicMethod() { return 2; }; +}; //end class +InnerClass temp; +return temp.innerPublicMethod(); +}; + +// CHECK-C: --- +// CHECK-C-NEXT: USR: '{{[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]}}' +// CHECK-C-NEXT: Name:'functionWithInnerClass' +// CHECK-C-NEXT: DefLocation: +// CHECK-C-NEXT: LineNumber: 57 +// CHECK-C-NEXT: Filename:{{.*}} +// CHECK-C-NEXT: Params: +// CHECK-C-NEXT: - Type: +// CHECK-C-NEXT: Name:
[PATCH] D48395: Added PublicOnly flag
juliehockett added a reviewer: ioeric. juliehockett added inline comments. Comment at: clang-tools-extra/clang-doc/ClangDoc.h:27 +struct ClangDocContext { +tooling::ExecutionContext *ECtx; Can we put this in `Representation.h`? Here, you have a potential circular include with `Mapper.h`. Comment at: clang-tools-extra/clang-doc/Mapper.cpp:37-40 serialize::emitInfo(D, getComment(D, D->getASTContext()), getLine(D, D->getASTContext()), - getFile(D, D->getASTContext(; + getFile(D, D->getASTContext()), + CDCtx.PublicOnly)); Since the emitInfos are returning `""` if they're being passed over, the results container is still storing them -- move the emission outside of this call, and only report if it returns a non-empty string. Comment at: clang-tools-extra/clang-doc/Mapper.h:23 #include "clang/Tooling/Execution.h" +#include "ClangDoc.h" See above, I don't love the potential for circular includes (since `Mapper.h` is included in the implementation file for `ClangDoc` Comment at: clang-tools-extra/clang-doc/Serialize.cpp:174 -static void parseFields(RecordInfo , const RecordDecl *D) { +static bool shouldNotBePublic(const clang::AccessSpecifier as, const clang::Linkage link){ +if(as == clang::AccessSpecifier::AS_private) For readability, it's usually better to use positives (i.e. `isPublic`). Then, if we ever want to check for internal only, `isPublic()` is much more readable than `!shouldNotBePublic()`. Comment at: clang-tools-extra/clang-doc/Serialize.cpp:311-313 + bool nonPublicNamespace = (D->isAnonymousNamespace()) || +shouldNotBePublic(D->getAccess(), D->getLinkageInternal()); + if(PublicOnly && nonPublicNamespace){ You can inline this. Comment at: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp:69 +"public", +llvm::cl::desc("Document only public structures."), +llvm::cl::init(false), llvm::cl::cat(ClangDocCategory)); s/structures/declarations Comment at: clang-tools-extra/test/clang-doc/yaml-module.cpp:14 +// CHECK-A: --- +// CHECK-A-NEXT: USR: '4429AA8706EF483A44B1DCE2D956BF0FEF82A9B7' +// CHECK-A-NEXT: Name:'moduleFunction' I'm working on making these less brittle (so changing the USR schema doesn't require changing all these tests and just check the length with a regex, so let's just do that here (see D48341's tests for an example). Comment at: clang-tools-extra/test/clang-doc/yaml-module.cpp:18 +// CHECK-A-NEXT: - LineNumber: 12 +// CHECK-A-NEXT: Filename:'test' +// CHECK-A-NEXT: Params: To be system-agnostic, make this `{{.*}}` to match regardless of from where the test is run. Comment at: clang-tools-extra/test/clang-doc/yaml-public-module.cpp:11-15 + + + + + Unnecessary whitespace https://reviews.llvm.org/D48395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48395: Added PublicOnly flag
anniecherk updated this revision to Diff 153790. anniecherk added a comment. Updated the tests to more accurately check that the files that we expect to not be generated by clang-doc with the public flag are in fact not being created. The tests now run clang-doc over the test files with and without the public flag, outputting yaml files into two different directories. File-check then diffs those directories and verifies that the files we expect to be absent in the directory created from running clang-doc with the public flag are in fact absent. https://reviews.llvm.org/D48395 Files: clang-tools-extra/clang-doc/ClangDoc.cpp clang-tools-extra/clang-doc/ClangDoc.h clang-tools-extra/clang-doc/Mapper.cpp clang-tools-extra/clang-doc/Mapper.h clang-tools-extra/clang-doc/Serialize.cpp clang-tools-extra/clang-doc/Serialize.h clang-tools-extra/clang-doc/tool/ClangDocMain.cpp clang-tools-extra/test/clang-doc/yaml-module.cpp clang-tools-extra/test/clang-doc/yaml-public-module.cpp clang-tools-extra/test/clang-doc/yaml-public-records.cpp Index: clang-tools-extra/test/clang-doc/yaml-public-records.cpp === --- /dev/null +++ clang-tools-extra/test/clang-doc/yaml-public-records.cpp @@ -0,0 +1,361 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" +// RUN: clang-doc --public --doxygen -p %t %t/test.cpp -output=%t/docs +// RUN: clang-doc --doxygen -p %t %t/test.cpp -output=%t/docs-without-flag +// RUN: cat %t/docs/function.yaml | FileCheck %s --check-prefix=CHECK-A +// RUN: cat %t/docs/inlinedFunction.yaml | FileCheck %s --check-prefix=CHECK-B +// RUN: cat %t/docs/functionWithInnerClass.yaml | FileCheck %s --check-prefix=CHECK-C +// RUN: cat %t/docs/inlinedFunctionWithInnerClass.yaml | FileCheck %s --check-prefix=CHECK-D +// RUN: cat %t/docs/Class/publicMethod.yaml| FileCheck %s --check-prefix=CHECK-E +// RUN: cat %t/docs/Class.yaml| FileCheck %s --check-prefix=CHECK-F +// RUN: cat %t/docs/Class/protectedMethod.yaml| FileCheck %s --check-prefix=CHECK-G +// RUN: cat %t/docs/named.yaml| FileCheck %s --check-prefix=CHECK-H +// RUN: cat %t/docs/named/NamedClass.yaml| FileCheck %s --check-prefix=CHECK-I +// RUN: cat %t/docs/named/namedFunction.yaml| FileCheck %s --check-prefix=CHECK-J +// RUN: cat %t/docs/named/namedInlineFunction.yaml| FileCheck %s --check-prefix=CHECK-K +// RUN: cat %t/docs/named/NamedClass/namedPublicMethod.yaml| FileCheck %s --check-prefix=CHECK-L +// RUN: cat %t/docs/named/NamedClass/namedProtectedMethod.yaml| FileCheck %s --check-prefix=CHECK-M +// RUN: (diff -qry %t/docs-without-flag %t/docs | sed 's:.*/::' > %t/public.diff) || true +// RUN: cat %t/public.diff | FileCheck %s --check-prefix=CHECK-N + + +void function(int x); + +// CHECK-A: --- +// CHECK-A-NEXT: USR: 'E789672E987C6FCE95B1BB760CB9A6998C4584A9' +// CHECK-A-NEXT: Name:'function' +// CHECK-A-NEXT: Location: +// CHECK-A-NEXT: - LineNumber: 24 +// CHECK-A-NEXT: Filename:'test' +// CHECK-A-NEXT: Params: +// CHECK-A-NEXT: - Type: +// CHECK-A-NEXT: Name:'int' +// CHECK-A-NEXT: Name:'x' +// CHECK-A-NEXT: ReturnType: +// CHECK-A-NEXT: Type: +// CHECK-A-NEXT: Name:'void' +// CHECK-A-NEXT: ... + + +inline int inlinedFunction(int x); + +// CHECK-B: --- +// CHECK-B-NEXT: USR: '9BDA332A65B254CC1F5FF736E8815A1CD3668A87' +// CHECK-B-NEXT: Name:'inlinedFunction' +// CHECK-B-NEXT: Location: +// CHECK-B-NEXT: - LineNumber: 42 +// CHECK-B-NEXT: Filename:'test' +// CHECK-B-NEXT: Params: +// CHECK-B-NEXT: - Type: +// CHECK-B-NEXT: Name:'int' +// CHECK-B-NEXT: Name:'x' +// CHECK-B-NEXT: ReturnType: +// CHECK-B-NEXT: Type: +// CHECK-B-NEXT: Name:'int' +// CHECK-B-NEXT: ... + + + +int functionWithInnerClass(int x){ +class InnerClass { //NoLinkage + public: +int innerPublicMethod() { return 2; }; +}; //end class +InnerClass temp; +return temp.innerPublicMethod(); +}; + +// CHECK-C: --- +// CHECK-C-NEXT: USR: 'D7C0B43D134C4D904A64AB58AD050312E0F52B42' +// CHECK-C-NEXT: Name:'functionWithInnerClass' +// CHECK-C-NEXT: DefLocation: +// CHECK-C-NEXT: LineNumber: 61 +// CHECK-C-NEXT: Filename:'test' +// CHECK-C-NEXT: Params: +// CHECK-C-NEXT: - Type: +// CHECK-C-NEXT: Name:'int' +// CHECK-C-NEXT: Name:'x' +// CHECK-C-NEXT: ReturnType: +// CHECK-C-NEXT: Type: +// CHECK-C-NEXT: Name:'int' +// CHECK-C-NEXT: ... + + + + +inline int inlinedFunctionWithInnerClass(int x){ +class InnerClass { //VisibleNoLinkage + public: +int innerPublicMethod() { return 2; }; +}; //end class +InnerClass temp; +return temp.innerPublicMethod(); +}; + +// CHECK-D: --- +// CHECK-D-NEXT: USR:
[PATCH] D48395: Added PublicOnly flag
anniecherk updated this revision to Diff 153597. anniecherk added a comment. Herald added a subscriber: eraman. - addressed Julie's comments - updated logic to consider both access specifier & linkage - added tests for each type of linkage https://reviews.llvm.org/D48395 Files: clang-tools-extra/clang-doc/ClangDoc.cpp clang-tools-extra/clang-doc/ClangDoc.h clang-tools-extra/clang-doc/Mapper.cpp clang-tools-extra/clang-doc/Mapper.h clang-tools-extra/clang-doc/Serialize.cpp clang-tools-extra/clang-doc/Serialize.h clang-tools-extra/clang-doc/tool/ClangDocMain.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-module-excluded.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-module-included.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-anonInlineFunction.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-anonStaticFunction.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-anonclass.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-anonfunction.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-classPrivate.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-functionInnerClass.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-namespace-private.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-excluded-static.cpp clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-included.cpp clang-tools-extra/test/clang-doc/yaml-module.cpp Index: clang-tools-extra/test/clang-doc/yaml-module.cpp === --- /dev/null +++ clang-tools-extra/test/clang-doc/yaml-module.cpp @@ -0,0 +1,63 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" +// RUN: clang-doc --extra-arg=-fmodules-ts --doxygen -p %t %t/test.cpp -output=%t/docs +// RUN: cat %t/docs/moduleFunction.yaml | FileCheck %s --check-prefix=CHECK-A +// RUN: cat %t/docs/staticModuleFunction.yaml | FileCheck %s --check-prefix=CHECK-B +// RUN: cat %t/docs/exportedModuleFunction.yaml | FileCheck %s --check-prefix=CHECK-C + +export module M; + +int moduleFunction(int x); //ModuleLinkage +// CHECK-A: --- +// CHECK-A-NEXT: USR: '4429AA8706EF483A44B1DCE2D956BF0FEF82A9B7' +// CHECK-A-NEXT: Name:'moduleFunction' +// CHECK-A-NEXT: Location: +// CHECK-A-NEXT: - LineNumber: 12 +// CHECK-A-NEXT: Filename:'test' +// CHECK-A-NEXT: Params: +// CHECK-A-NEXT: - Type: +// CHECK-A-NEXT: Name:'int' +// CHECK-A-NEXT: Name:'x' +// CHECK-A-NEXT: ReturnType: +// CHECK-A-NEXT: Type: +// CHECK-A-NEXT: Name:'int' +// CHECK-A-NEXT: ... + + +static int staticModuleFunction(int x); //ModuleInternalLinkage +// CHECK-B: --- +// CHECK-B-NEXT: USR: '2E49675BF9D3FCCF51D5AA5EA02C280D894C1E4C' +// CHECK-B-NEXT: Name:'staticModuleFunction' +// CHECK-B-NEXT: Location: +// CHECK-B-NEXT: - LineNumber: 29 +// CHECK-B-NEXT: Filename:'test' +// CHECK-B-NEXT: Params: +// CHECK-B-NEXT: - Type: +// CHECK-B-NEXT: Name:'int' +// CHECK-B-NEXT: Name:'x' +// CHECK-B-NEXT: ReturnType: +// CHECK-B-NEXT: Type: +// CHECK-B-NEXT: Name:'int' +// CHECK-B-NEXT: ... + + +export double exportedModuleFunction(double y, int z); //ExternalLinkage +// CHECK-C: --- +// CHECK-C-NEXT: USR: '325C328D4EB158CCBA4DF2B5321F63EB39C2B17C' +// CHECK-C-NEXT: Name:'exportedModuleFunction' +// CHECK-C-NEXT: Location: +// CHECK-C-NEXT: - LineNumber: 46 +// CHECK-C-NEXT: Filename:'test' +// CHECK-C-NEXT: Params: +// CHECK-C-NEXT: - Type: +// CHECK-C-NEXT: Name:'double' +// CHECK-C-NEXT: Name:'y' +// CHECK-C-NEXT: - Type: +// CHECK-C-NEXT: Name:'int' +// CHECK-C-NEXT: Name:'z' +// CHECK-C-NEXT: ReturnType: +// CHECK-C-NEXT: Type: +// CHECK-C-NEXT: Name:'double' +// CHECK-C-NEXT: ... Index: clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-included.cpp === --- /dev/null +++ clang-tools-extra/test/clang-doc/public-flag/yaml-public-record-included.cpp @@ -0,0 +1,311 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" +// RUN: clang-doc --public --doxygen -p %t %t/test.cpp -output=%t/docs +// RUN: cat %t/docs/function.yaml | FileCheck %s --check-prefix=CHECK-A +// RUN: cat %t/docs/inlinedFunction.yaml | FileCheck %s --check-prefix=CHECK-B +// RUN: cat %t/docs/functionWithInnerClass.yaml | FileCheck %s --check-prefix=CHECK-C +// RUN: cat %t/docs/inlinedFunctionWithInnerClass.yaml | FileCheck %s
[PATCH] D48395: Added PublicOnly flag
juliehockett added a comment. So on seeing this, all of the plumbing needed to get that particular value where you need it is a bit ugly. I'm inclined to suggest wrapping it in a `ClangDocContext`, containing it and the `ExecutionContext` in the `ClangDoc.h` file: struct ClangDocContext { ExecutionContext bool PublicOnly; } and then basically just replace everywhere the `ECtx` is plumbed through with the new context object. Comment at: clang-tools-extra/clang-doc/Serialize.cpp:307 std::string emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber, + llvm::StringRef File, bool PublicOnly) { You also want to check access here (records can be private to a class). Comment at: clang-tools-extra/clang-doc/Serialize.cpp:334 I.Access = D->getAccess(); + if(PublicOnly && (I.Access != clang::AccessSpecifier::AS_public)){ +return ""; Move this to the top of the function and do the check before you set the value on `I` -- if we're not going to return anything, you should exit quickly before you do all of the allocation. Comment at: clang-tools-extra/clang-doc/Serialize.cpp:340 std::string emitInfo(const EnumDecl *D, const FullComment *FC, int LineNumber, + llvm::StringRef File, bool PublicOnly) { Also check here Comment at: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp:68 +static llvm::cl::opt PublicOnly( +"public-only", +llvm::cl::desc("Only document public methods & public fields."), Can we make the flag just `--public`? Comment at: clang-tools-extra/test/clang-doc/yaml-record-public-only.cpp:10 +// RUN: cat %t/docs/Class/publicMethod.yaml | FileCheck %s --check-prefix=CHECK-D + +struct Struct { Add a test case for a function. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48395: Added PublicOnly flag
juliehockett added a comment. Can you re-upload the patch with context? (i.e. use -U99 or similar) Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48395: Added PublicOnly flag
anniecherk created this revision. anniecherk added reviewers: juliehockett, jakehehrlich, mcgrathr, phosek. Herald added a subscriber: cfe-commits. Added a flag which, when enabled, documents only those methods and fields which have a Public attribute. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D48395 Files: clang-tools-extra/clang-doc/ClangDoc.cpp clang-tools-extra/clang-doc/ClangDoc.h clang-tools-extra/clang-doc/Mapper.cpp clang-tools-extra/clang-doc/Mapper.h clang-tools-extra/clang-doc/Serialize.cpp clang-tools-extra/clang-doc/Serialize.h clang-tools-extra/clang-doc/tool/ClangDocMain.cpp clang-tools-extra/test/clang-doc/yaml-record-public-only.cpp Index: clang-tools-extra/test/clang-doc/yaml-record-public-only.cpp === --- /dev/null +++ clang-tools-extra/test/clang-doc/yaml-record-public-only.cpp @@ -0,0 +1,103 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" +// RUN: clang-doc --public-only --doxygen -p %t %t/test.cpp -output=%t/docs +// RUN: cat %t/docs/Struct.yaml | FileCheck %s --check-prefix=CHECK-A +// RUN: cat %t/docs/Struct/publicMethod.yaml | FileCheck %s --check-prefix=CHECK-B +// RUN: cat %t/docs/Class.yaml | FileCheck %s --check-prefix=CHECK-C +// RUN: cat %t/docs/Class/publicMethod.yaml | FileCheck %s --check-prefix=CHECK-D + +struct Struct { + public: +void publicMethod(); +int publicField; + protected: +void protectedMethod(); +int protectedField; + private: +void privateMethod(); +int privateField; +}; + + +// CHECK-A: --- +// CHECK-A-NEXT: USR: '0E0522198A2C7D141073719DA0815FCD6DC95610' +// CHECK-A-NEXT: Name:'Struct' +// CHECK-A-NEXT: DefLocation: +// CHECK-A-NEXT: LineNumber: 11 +// CHECK-A-NEXT: Filename:'test' +// CHECK-A-NEXT: Members: +// CHECK-A-NEXT: - Type: +// CHECK-A-NEXT: Name:'int' +// CHECK-A-NEXT: Name:'publicField' +// CHECK-A-NEXT: ... + + +// CHECK-B: --- +// CHECK-B-NEXT: USR: 'DC71C1FF683E2DE57395B0029458ADC4BDDE46CA' +// CHECK-B-NEXT: Name:'publicMethod' +// CHECK-B-NEXT: Namespace: +// CHECK-B-NEXT: - Type:Record +// CHECK-B-NEXT: Name:'Struct' +// CHECK-B-NEXT: USR: '0E0522198A2C7D141073719DA0815FCD6DC95610' +// CHECK-B-NEXT: Location: +// CHECK-B-NEXT: - LineNumber: 13 +// CHECK-B-NEXT: Filename:'test' +// CHECK-B-NEXT: IsMethod:true +// CHECK-B-NEXT: Parent: +// CHECK-B-NEXT: Type:Record +// CHECK-B-NEXT: Name:'Struct' +// CHECK-B-NEXT: USR: '0E0522198A2C7D141073719DA0815FCD6DC95610' +// CHECK-B-NEXT: ReturnType: +// CHECK-B-NEXT: Type: +// CHECK-B-NEXT: Name:'void' +// CHECK-B-NEXT: ... + + +class Class { + public: + void publicMethod(); + int publicField; + protected: + void protectedMethod(); + int protectedField; + private: + void privateMethod(); + int privateField; +}; + + +// CHECK-C: --- +// CHECK-C-NEXT: USR: '7CDD73DCD6CD72F7E5CE25502810A182C66C4B45' +// CHECK-C-NEXT: Name:'Class' +// CHECK-C-NEXT: DefLocation: +// CHECK-C-NEXT: LineNumber: 58 +// CHECK-C-NEXT: Filename:'test' +// CHECK-C-NEXT: TagType: Class +// CHECK-C-NEXT: Members: +// CHECK-C-NEXT: - Type: +// CHECK-C-NEXT: Name:'int' +// CHECK-C-NEXT: Name:'publicField' +// CHECK-C-NEXT: ... + + +// CHECK-D: --- +// CHECK-D-NEXT: USR: '05682AF6307337176313391E00A231C2C55A4972' +// CHECK-D-NEXT: Name:'publicMethod' +// CHECK-D-NEXT: Namespace: +// CHECK-D-NEXT: - Type:Record +// CHECK-D-NEXT: Name:'Class' +// CHECK-D-NEXT: USR: '7CDD73DCD6CD72F7E5CE25502810A182C66C4B45' +// CHECK-D-NEXT: Location: +// CHECK-D-NEXT: - LineNumber: 60 +// CHECK-D-NEXT: Filename:'test' +// CHECK-D-NEXT: IsMethod:true +// CHECK-D-NEXT: Parent: +// CHECK-D-NEXT: Type:Record +// CHECK-D-NEXT: Name:'Class' +// CHECK-D-NEXT: USR: '7CDD73DCD6CD72F7E5CE25502810A182C66C4B45' +// CHECK-D-NEXT: ReturnType: +// CHECK-D-NEXT: Type: +// CHECK-D-NEXT: Name:'void' +// CHECK-D-NEXT: ... Index: clang-tools-extra/clang-doc/tool/ClangDocMain.cpp === --- clang-tools-extra/clang-doc/tool/ClangDocMain.cpp +++ clang-tools-extra/clang-doc/tool/ClangDocMain.cpp @@ -64,6 +64,11 @@ llvm::cl::desc("Dump intermediate results to bitcode file."), llvm::cl::init(false), llvm::cl::cat(ClangDocCategory)); +static llvm::cl::opt PublicOnly( +"public-only", +llvm::cl::desc("Only document public methods & public fields."), +llvm::cl::init(false), llvm::cl::cat(ClangDocCategory)); + enum