Index: clang-tools-extra/clang-doc/ClangDoc.h =================================================================== --- clang-tools-extra/clang-doc/ClangDoc.h +++ clang-tools-extra/clang-doc/ClangDoc.h @@ -17,6 +17,7 @@ #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_CLANGDOC_H #define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_CLANGDOC_H +#include "Representation.h" #include "clang/Tooling/Execution.h" #include "clang/Tooling/StandaloneExecution.h" #include "clang/Tooling/Tooling.h" @@ -25,7 +26,7 @@ namespace doc { std::unique_ptr -newMapperActionFactory(tooling::ExecutionContext *ECtx); +newMapperActionFactory(ClangDocContext CDCtx); } // namespace doc } // namespace clang Index: clang-tools-extra/clang-doc/ClangDoc.cpp =================================================================== --- clang-tools-extra/clang-doc/ClangDoc.cpp +++ clang-tools-extra/clang-doc/ClangDoc.cpp @@ -15,6 +15,7 @@ #include "ClangDoc.h" #include "Mapper.h" +#include "Representation.h" #include "clang/AST/AST.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/ASTContext.h" @@ -28,33 +29,33 @@ class MapperActionFactory : public tooling::FrontendActionFactory { public: - MapperActionFactory(tooling::ExecutionContext *ECtx) : ECtx(ECtx) {} + MapperActionFactory(ClangDocContext CDCtx) : CDCtx(CDCtx) {} clang::FrontendAction *create() override; private: - tooling::ExecutionContext *ECtx; + ClangDocContext CDCtx; }; clang::FrontendAction *MapperActionFactory::create() { class ClangDocAction : public clang::ASTFrontendAction { public: - ClangDocAction(ExecutionContext *ECtx) : ECtx(ECtx) {} + ClangDocAction(ClangDocContext CDCtx) : CDCtx(CDCtx) {} std::unique_ptr CreateASTConsumer(clang::CompilerInstance &Compiler, llvm::StringRef InFile) override { - return llvm::make_unique(&Compiler.getASTContext(), ECtx); + return llvm::make_unique(&Compiler.getASTContext(), CDCtx); } private: - ExecutionContext *ECtx; + ClangDocContext CDCtx; }; - return new ClangDocAction(ECtx); + return new ClangDocAction(CDCtx); } std::unique_ptr -newMapperActionFactory(tooling::ExecutionContext *ECtx) { - return llvm::make_unique(ECtx); +newMapperActionFactory(ClangDocContext CDCtx) { + return llvm::make_unique(CDCtx); } } // namespace doc Index: clang-tools-extra/clang-doc/Mapper.h =================================================================== --- clang-tools-extra/clang-doc/Mapper.h +++ clang-tools-extra/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 &Context) override; bool VisitNamespaceDecl(const NamespaceDecl *D); @@ -48,7 +49,7 @@ comments::FullComment *getComment(const NamedDecl *D, const ASTContext &Context) const; - ExecutionContext *ECtx; + ClangDocContext CDCtx; }; } // namespace doc Index: clang-tools-extra/clang-doc/Mapper.cpp =================================================================== --- clang-tools-extra/clang-doc/Mapper.cpp +++ clang-tools-extra/clang-doc/Mapper.cpp @@ -33,10 +33,14 @@ if (index::generateUSRForDecl(D, USR)) return true; - ECtx->reportResult(llvm::toHex(llvm::toStringRef(serialize::hashUSR(USR))), - serialize::emitInfo(D, getComment(D, D->getASTContext()), - getLine(D, D->getASTContext()), - getFile(D, D->getASTContext()))); + std::string info = serialize::emitInfo( + D, getComment(D, D->getASTContext()), getLine(D, D->getASTContext()), + getFile(D, D->getASTContext()), CDCtx.PublicOnly); + + if (info != "") + CDCtx.ECtx->reportResult( + llvm::toHex(llvm::toStringRef(serialize::hashUSR(USR))), info); + return true; } Index: clang-tools-extra/clang-doc/Representation.h =================================================================== --- clang-tools-extra/clang-doc/Representation.h +++ clang-tools-extra/clang-doc/Representation.h @@ -17,6 +17,7 @@ #include "clang/AST/Type.h" #include "clang/Basic/Specifiers.h" +#include "clang/Tooling/StandaloneExecution.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" @@ -239,6 +240,11 @@ llvm::Expected> mergeInfos(std::vector> &Values); +struct ClangDocContext { + tooling::ExecutionContext *ECtx; + bool PublicOnly; +}; + } // namespace doc } // namespace clang Index: clang-tools-extra/clang-doc/Representation.cpp =================================================================== --- clang-tools-extra/clang-doc/Representation.cpp +++ clang-tools-extra/clang-doc/Representation.cpp @@ -42,7 +42,7 @@ mergeInfos(std::vector> &Values) { 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-tools-extra/clang-doc/Serialize.h =================================================================== --- clang-tools-extra/clang-doc/Serialize.h +++ clang-tools-extra/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-tools-extra/clang-doc/Serialize.cpp =================================================================== --- clang-tools-extra/clang-doc/Serialize.cpp +++ clang-tools-extra/clang-doc/Serialize.cpp @@ -171,8 +171,20 @@ return Ty->getDecl()->getDefinition(); } -static void parseFields(RecordInfo &I, const RecordDecl *D) { +static bool isPublic(const clang::AccessSpecifier AS, + const clang::Linkage Link) { + if (AS == clang::AccessSpecifier::AS_private) + return false; + else if ((Link == clang::Linkage::ModuleLinkage) || + (Link == clang::Linkage::ExternalLinkage)) + return true; + return false; // otherwise, linkage is some form of internal linkage +} + +static void parseFields(RecordInfo &I, const RecordDecl *D, bool PublicOnly) { for (const FieldDecl *F : D->fields()) { + if (PublicOnly && !isPublic(F->getAccessUnsafe(), F->getLinkageInternal())) + continue; if (const auto *T = getDeclForType(F->getTypeSourceInfo()->getType())) { // Use getAccessUnsafe so that we just get the default AS_none if it's not // valid, as opposed to an assert. @@ -295,25 +307,32 @@ } std::string emitInfo(const NamespaceDecl *D, const FullComment *FC, - int LineNumber, llvm::StringRef File) { + int LineNumber, llvm::StringRef File, bool PublicOnly) { + if (PublicOnly && ((D->isAnonymousNamespace()) || + !isPublic(D->getAccess(), D->getLinkageInternal()))) + return ""; NamespaceInfo I; populateInfo(I, D, FC); return serialize(I); } std::string emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber, - llvm::StringRef File) { + llvm::StringRef File, bool PublicOnly) { + if (PublicOnly && !isPublic(D->getAccess(), D->getLinkageInternal())) + return ""; RecordInfo I; populateSymbolInfo(I, D, FC, LineNumber, File); I.TagType = D->getTagKind(); - parseFields(I, D); + parseFields(I, D, PublicOnly); if (const auto *C = dyn_cast(D)) parseBases(I, C); return serialize(I); } std::string emitInfo(const FunctionDecl *D, const FullComment *FC, - int LineNumber, llvm::StringRef File) { + int LineNumber, llvm::StringRef File, bool PublicOnly) { + if (PublicOnly && !isPublic(D->getAccess(), D->getLinkageInternal())) + return ""; FunctionInfo I; populateFunctionInfo(I, D, FC, LineNumber, File); I.Access = clang::AccessSpecifier::AS_none; @@ -321,7 +340,9 @@ } std::string emitInfo(const CXXMethodDecl *D, const FullComment *FC, - int LineNumber, llvm::StringRef File) { + int LineNumber, llvm::StringRef File, bool PublicOnly) { + if (PublicOnly && !isPublic(D->getAccess(), D->getLinkageInternal())) + return ""; FunctionInfo I; populateFunctionInfo(I, D, FC, LineNumber, File); I.IsMethod = true; @@ -332,7 +353,9 @@ } std::string emitInfo(const EnumDecl *D, const FullComment *FC, int LineNumber, - llvm::StringRef File) { + llvm::StringRef File, bool PublicOnly) { + if (PublicOnly && !isPublic(D->getAccess(), D->getLinkageInternal())) + return ""; EnumInfo I; populateSymbolInfo(I, D, FC, LineNumber, File); I.Scoped = D->isScoped(); 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,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-tools-extra/test/clang-doc/yaml-module.cpp =================================================================== --- /dev/null +++ clang-tools-extra/test/clang-doc/yaml-module.cpp @@ -0,0 +1,61 @@ +// 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: '{{[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' +// CHECK-A-NEXT: Location: +// CHECK-A-NEXT: - LineNumber: 12 +// 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: 'int' +// CHECK-A-NEXT: ... + +static int staticModuleFunction(int x); //ModuleInternalLinkage +// 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: 'staticModuleFunction' +// CHECK-B-NEXT: Location: +// CHECK-B-NEXT: - LineNumber: 28 +// 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: ... + +export double exportedModuleFunction(double y, int z); //ExternalLinkage +// 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: 'exportedModuleFunction' +// CHECK-C-NEXT: Location: +// CHECK-C-NEXT: - LineNumber: 44 +// CHECK-C-NEXT: Filename: {{.*}} +// 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/yaml-public-module.cpp =================================================================== --- /dev/null +++ clang-tools-extra/test/clang-doc/yaml-public-module.cpp @@ -0,0 +1,51 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" +// RUN: clang-doc --public --extra-arg=-fmodules-ts --doxygen -p %t %t/test.cpp -output=%t/docs-with-public-flag +// RUN: clang-doc --extra-arg=-fmodules-ts --doxygen -p %t %t/test.cpp -output=%t/docs-without +// RUN: cat %t/docs-with-public-flag/moduleFunction.yaml | FileCheck %s --check-prefix=CHECK-A +// RUN: cat %t/docs-with-public-flag/exportedModuleFunction.yaml | FileCheck %s --check-prefix=CHECK-B +// RUN: (diff -qry %t/docs-with-public-flag %t/docs-without | sed 's:.*/::' > %t/public.diff) || true +// RUN: cat %t/public.diff | FileCheck %s --check-prefix=CHECK-C + +export module M; + +int moduleFunction(int x); //ModuleLinkage +// 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' +// CHECK-A-NEXT: Location: +// CHECK-A-NEXT: - LineNumber: 14 +// 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: 'int' +// CHECK-A-NEXT: ... + +static int staticModuleFunction(int x); //ModuleInternalLinkage + +export double exportedModuleFunction(double y, int z); //ExternalLinkage +// 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: 'exportedModuleFunction' +// CHECK-B-NEXT: Location: +// CHECK-B-NEXT: - LineNumber: 32 +// CHECK-B-NEXT: Filename: {{.*}} +// CHECK-B-NEXT: Params: +// CHECK-B-NEXT: - Type: +// CHECK-B-NEXT: Name: 'double' +// CHECK-B-NEXT: Name: 'y' +// CHECK-B-NEXT: - Type: +// CHECK-B-NEXT: Name: 'int' +// CHECK-B-NEXT: Name: 'z' +// CHECK-B-NEXT: ReturnType: +// CHECK-B-NEXT: Type: +// CHECK-B-NEXT: Name: 'double' +// CHECK-B-NEXT: ... + +// CHECK-C: docs-without: staticModuleFunction.yaml 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: '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: '{{[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-D-NEXT: Name: 'inlinedFunctionWithInnerClass' +// CHECK-D-NEXT: DefLocation: +// CHECK-D-NEXT: LineNumber: 81 +// CHECK-D-NEXT: Filename: {{.*}} +// CHECK-D-NEXT: Params: +// CHECK-D-NEXT: - Type: +// CHECK-D-NEXT: Name: 'int' +// CHECK-D-NEXT: Name: 'x' +// CHECK-D-NEXT: ReturnType: +// CHECK-D-NEXT: Type: +// CHECK-D-NEXT: Name: 'int' +// CHECK-D-NEXT: ... + +class Class { + public: + void publicMethod(); + int publicField; + protected: + void protectedMethod(); + int protectedField; + private: + void privateMethod(); + int privateField; +}; + +// CHECK-E: --- +// CHECK-E-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-E-NEXT: Name: 'publicMethod' +// CHECK-E-NEXT: Namespace: +// CHECK-E-NEXT: - Type: Record +// CHECK-E-NEXT: Name: 'Class' +// CHECK-E-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-E-NEXT: Location: +// CHECK-E-NEXT: - LineNumber: 107 +// CHECK-E-NEXT: Filename: {{.*}} +// CHECK-E-NEXT: IsMethod: true +// CHECK-E-NEXT: Parent: +// CHECK-E-NEXT: Type: Record +// CHECK-E-NEXT: Name: 'Class' +// CHECK-E-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-E-NEXT: ReturnType: +// CHECK-E-NEXT: Type: +// CHECK-E-NEXT: Name: 'void' +// CHECK-E-NEXT: ... + +// CHECK-F: --- +// CHECK-F-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-F-NEXT: Name: 'Class' +// CHECK-F-NEXT: DefLocation: +// CHECK-F-NEXT: LineNumber: 105 +// CHECK-F-NEXT: Filename: {{.*}} +// CHECK-F-NEXT: TagType: Class +// CHECK-F-NEXT: Members: +// CHECK-F-NEXT: - Type: +// CHECK-F-NEXT: Name: 'int' +// CHECK-F-NEXT: Name: 'publicField' +// CHECK-F-NEXT: - Type: +// CHECK-F-NEXT: Name: 'int' +// CHECK-F-NEXT: Name: 'protectedField' +// CHECK-F-NEXT: Access: Protected +// CHECK-F-NEXT: ... + +// CHECK-G: --- +// CHECK-G-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-G-NEXT: Name: 'protectedMethod' +// CHECK-G-NEXT: Namespace: +// CHECK-G-NEXT: - Type: Record +// CHECK-G-NEXT: Name: 'Class' +// CHECK-G-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-G-NEXT: Location: +// CHECK-G-NEXT: - LineNumber: 110 +// CHECK-G-NEXT: Filename: {{.*}} +// CHECK-G-NEXT: IsMethod: true +// CHECK-G-NEXT: Parent: +// CHECK-G-NEXT: Type: Record +// CHECK-G-NEXT: Name: 'Class' +// CHECK-G-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-G-NEXT: ReturnType: +// CHECK-G-NEXT: Type: +// CHECK-G-NEXT: Name: 'void' +// CHECK-G-NEXT: ... + +namespace named{ + class NamedClass { + public: + void namedPublicMethod(); + int namedPublicField; + protected: + void namedProtectedMethod(); + int namedProtectedField; + private: + void namedPrivateMethod(); + int namedPrivateField; + }; + + void namedFunction(); + static void namedStaticFunction(); + inline void namedInlineFunction(); +} + +// CHECK-H: --- +// CHECK-H-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-H-NEXT: Name: 'named' +// CHECK-H-NEXT: ... + +// CHECK-I: --- +// CHECK-I-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-I-NEXT: Name: 'NamedClass' +// CHECK-I-NEXT: Namespace: +// CHECK-I-NEXT: - Type: Namespace +// CHECK-I-NEXT: Name: 'named' +// CHECK-I-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-I-NEXT: DefLocation: +// CHECK-I-NEXT: LineNumber: 175 +// CHECK-I-NEXT: Filename: {{.*}} +// CHECK-I-NEXT: TagType: Class +// CHECK-I-NEXT: Members: +// CHECK-I-NEXT: - Type: +// CHECK-I-NEXT: Name: 'int' +// CHECK-I-NEXT: Name: 'namedPublicField' +// CHECK-I-NEXT: - Type: +// CHECK-I-NEXT: Name: 'int' +// CHECK-I-NEXT: Name: 'namedProtectedField' +// CHECK-I-NEXT: Access: Protected +// CHECK-I-NEXT: ... + +// CHECK-J: --- +// CHECK-J-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-J-NEXT: Name: 'namedFunction' +// CHECK-J-NEXT: Namespace: +// CHECK-J-NEXT: - Type: Namespace +// CHECK-J-NEXT: Name: 'named' +// CHECK-J-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-J-NEXT: Location: +// CHECK-J-NEXT: - LineNumber: 187 +// CHECK-J-NEXT: Filename: {{.*}} +// CHECK-J-NEXT: ReturnType: +// CHECK-J-NEXT: Type: +// CHECK-J-NEXT: Name: 'void' +// CHECK-J-NEXT: ... + +// CHECK-K: --- +// CHECK-K-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-K-NEXT: Name: 'namedInlineFunction' +// CHECK-K-NEXT: Namespace: +// CHECK-K-NEXT: - Type: Namespace +// CHECK-K-NEXT: Name: 'named' +// CHECK-K-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-K-NEXT: Location: +// CHECK-K-NEXT: - LineNumber: 189 +// CHECK-K-NEXT: Filename: {{.*}} +// CHECK-K-NEXT: ReturnType: +// CHECK-K-NEXT: Type: +// CHECK-K-NEXT: Name: 'void' +// CHECK-K-NEXT: ... + +// CHECK-L: --- +// CHECK-L-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-L-NEXT: Name: 'namedPublicMethod' +// CHECK-L-NEXT: Namespace: +// CHECK-L-NEXT: - Type: Record +// CHECK-L-NEXT: Name: 'NamedClass' +// CHECK-L-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-L-NEXT: - Type: Namespace +// CHECK-L-NEXT: Name: 'named' +// CHECK-L-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-L-NEXT: Location: +// CHECK-L-NEXT: - LineNumber: 177 +// CHECK-L-NEXT: Filename: {{.*}} +// CHECK-L-NEXT: IsMethod: true +// CHECK-L-NEXT: Parent: +// CHECK-L-NEXT: Type: Record +// CHECK-L-NEXT: Name: 'NamedClass' +// CHECK-L-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-L-NEXT: ReturnType: +// CHECK-L-NEXT: Type: +// CHECK-L-NEXT: Name: 'void' +// CHECK-L-NEXT: ... + +// CHECK-M: --- +// CHECK-M-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-M-NEXT: Name: 'namedProtectedMethod' +// CHECK-M-NEXT: Namespace: +// CHECK-M-NEXT: - Type: Record +// CHECK-M-NEXT: Name: 'NamedClass' +// CHECK-M-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-M-NEXT: - Type: Namespace +// CHECK-M-NEXT: Name: 'named' +// CHECK-M-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-M-NEXT: Location: +// CHECK-M-NEXT: - LineNumber: 180 +// CHECK-M-NEXT: Filename: {{.*}} +// CHECK-M-NEXT: IsMethod: true +// CHECK-M-NEXT: Parent: +// CHECK-M-NEXT: Type: Record +// CHECK-M-NEXT: Name: 'NamedClass' +// CHECK-M-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-M-NEXT: ReturnType: +// CHECK-M-NEXT: Type: +// CHECK-M-NEXT: Name: 'void' +// CHECK-M-NEXT: ... + + +static void staticFunction(int x); //Internal Linkage + +static int staticFunctionWithInnerClass(int x){ + class InnerClass { //NoLinkage + public: + int innerPublicMethod() { return 2; }; + }; //end class + InnerClass temp; + return temp.innerPublicMethod(); +}; + +namespace{ + class AnonClass { + public: + void anonPublicMethod(); + int anonPublicField; + protected: + void anonProtectedMethod(); + int anonProtectedField; + private: + void anonPrivateMethod(); + int anonPrivateField; + }; + + void anonFunction(); + static void anonStaticFunction(); + inline void anonInlineFunction(); +} + +// CHECK-N: docs-without-flag: .yaml +// CHECK-N-NEXT: docs-without-flag: AnonClass +// CHECK-N-NEXT: docs-without-flag: AnonClass.yaml +// CHECK-N-NEXT: Class: privateMethod.yaml +// CHECK-N-NEXT: Class.yaml differ +// CHECK-N-NEXT: docs-without-flag: anonFunction.yaml +// CHECK-N-NEXT: docs-without-flag: anonInlineFunction.yaml +// CHECK-N-NEXT: docs-without-flag: anonStaticFunction.yaml +// CHECK-N-NEXT: docs-without-flag: functionWithInnerClass +// CHECK-N-NEXT: docs-without-flag: inlinedFunctionWithInnerClass +// CHECK-N-NEXT: NamedClass: namedPrivateMethod.yaml +// CHECK-N-NEXT: NamedClass.yaml differ +// CHECK-N-NEXT: named: namedStaticFunction.yaml +// CHECK-N-NEXT: docs-without-flag: staticFunction.yaml +// CHECK-N-NEXT: docs-without-flag: staticFunctionWithInnerClass +// CHECK-N-NEXT: docs-without-flag: staticFunctionWithInnerClass.yaml