diff options
| author | Julie Hockett <juliehockett@google.com> | 2018-08-02 20:10:17 +0000 |
|---|---|---|
| committer | Julie Hockett <juliehockett@google.com> | 2018-08-02 20:10:17 +0000 |
| commit | 8899c29b1e0835f06972b03adab2e8fd91339c8d (patch) | |
| tree | 51f122d564bd08a833ce38a9954852516b40f849 /clang-tools-extra/test/clang-doc/test_cases/linkage.cpp | |
| parent | 31da130e4dcce5a4fe72eb187db3e169cba4ec23 (diff) | |
| download | bcm5719-llvm-8899c29b1e0835f06972b03adab2e8fd91339c8d.tar.gz bcm5719-llvm-8899c29b1e0835f06972b03adab2e8fd91339c8d.zip | |
Reland "[clang-doc] Refactoring mapper to map by scope"
Relanding with a minor change to prevent an assertion on release bots.
The result of this adjusted mapper pass is that all Function and Enum
infos are absorbed into the info of their enclosing scope (i.e. the class
or namespace in which they are defined). Namespace and Record infos are
passed along to the final output, but the second pass creates a reference
to each in its parent scope. As a result, the top-level final outputs are
Namespaces and Records.
Differential Revision: https://reviews.llvm.org/D48341
llvm-svn: 338763
Diffstat (limited to 'clang-tools-extra/test/clang-doc/test_cases/linkage.cpp')
| -rw-r--r-- | clang-tools-extra/test/clang-doc/test_cases/linkage.cpp | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-doc/test_cases/linkage.cpp b/clang-tools-extra/test/clang-doc/test_cases/linkage.cpp new file mode 100644 index 00000000000..ed4b4a30345 --- /dev/null +++ b/clang-tools-extra/test/clang-doc/test_cases/linkage.cpp @@ -0,0 +1,95 @@ +// THIS IS A GENERATED TEST. DO NOT EDIT. +// To regenerate, see clang-doc/gen_test.py docstring. +// +// REQUIRES: system-linux +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "" > %t/compile_flags.txt +// RUN: cp "%s" "%t/test.cpp" + +void function(int x); + +inline int inlinedFunction(int x); + +int functionWithInnerClass(int x) { + class InnerClass { //NoLinkage + public: + int innerPublicMethod() { return 2; }; + }; //end class + InnerClass temp; + return temp.innerPublicMethod(); +}; + +inline int inlinedFunctionWithInnerClass(int x) { + class InnerClass { //VisibleNoLinkage + public: + int innerPublicMethod() { return 2; }; + }; //end class + InnerClass temp; + return temp.innerPublicMethod(); +}; + +class Class { +public: + void publicMethod(); + int publicField; + +protected: + void protectedMethod(); + int protectedField; + +private: + void privateMethod(); + int privateField; +}; + +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(); +} // namespace named + +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(); +} // namespace |

