diff --git a/clang-tools-extra/test/clang-doc/namespace.cpp b/clang-tools-extra/test/clang-doc/namespace.cpp index 50200d20e38832..12f3cb8a84bc6e 100644 --- a/clang-tools-extra/test/clang-doc/namespace.cpp +++ b/clang-tools-extra/test/clang-doc/namespace.cpp @@ -2,27 +2,60 @@ // RUN: clang-doc --format=html --output=%t --executor=standalone %s // RUN: clang-doc --format=md --output=%t --executor=standalone %s // RUN: FileCheck %s < %t/index_json.js -check-prefix=JSON-INDEX +// RUN: FileCheck %s < %t/@nonymous_namespace/AnonClass.html -check-prefix=HTML-ANON-CLASS-LINE // RUN: FileCheck %s < %t/@nonymous_namespace/AnonClass.html -check-prefix=HTML-ANON-CLASS +// RUN: FileCheck %s < %t/@nonymous_namespace/index.html -check-prefix=HTML-ANON-INDEX-LINE // RUN: FileCheck %s < %t/@nonymous_namespace/index.html -check-prefix=HTML-ANON-INDEX +// RUN: FileCheck %s < %t/AnotherNamespace/ClassInAnotherNamespace.html -check-prefix=HTML-ANOTHER-CLASS-LINE // RUN: FileCheck %s < %t/AnotherNamespace/ClassInAnotherNamespace.html -check-prefix=HTML-ANOTHER-CLASS +// RUN: FileCheck %s < %t/AnotherNamespace/index.html -check-prefix=HTML-ANOTHER-INDEX-LINE // RUN: FileCheck %s < %t/AnotherNamespace/index.html -check-prefix=HTML-ANOTHER-INDEX -// RUN: FileCheck %s < %t/GlobalNamespace/index.html -check-prefix=HTML-GLOBAL-INDEX +// RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/ClassInNestedNamespace.html -check-prefix=HTML-NESTED-CLASS-LINE // RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/ClassInNestedNamespace.html -check-prefix=HTML-NESTED-CLASS +// RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/index.html -check-prefix=HTML-NESTED-INDEX-LINE // RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/index.html -check-prefix=HTML-NESTED-INDEX +// RUN: FileCheck %s < %t/PrimaryNamespace/index.html -check-prefix=HTML-PRIMARY-INDEX-LINE // RUN: FileCheck %s < %t/PrimaryNamespace/index.html -check-prefix=HTML-PRIMARY-INDEX +// RUN: FileCheck %s < %t/PrimaryNamespace/ClassInPrimaryNamespace.html -check-prefix=HTML-PRIMARY-CLASS-LINE // RUN: FileCheck %s < %t/PrimaryNamespace/ClassInPrimaryNamespace.html -check-prefix=HTML-PRIMARY-CLASS +// RUN: FileCheck %s < %t/@nonymous_namespace/AnonClass.md -check-prefix=MD-ANON-CLASS-LINE // RUN: FileCheck %s < %t/@nonymous_namespace/AnonClass.md -check-prefix=MD-ANON-CLASS +// RUN: FileCheck %s < %t/@nonymous_namespace/index.md -check-prefix=MD-ANON-INDEX-LINE // RUN: FileCheck %s < %t/@nonymous_namespace/index.md -check-prefix=MD-ANON-INDEX +// RUN: FileCheck %s < %t/AnotherNamespace/ClassInAnotherNamespace.md -check-prefix=MD-ANOTHER-CLASS-LINE // RUN: FileCheck %s < %t/AnotherNamespace/ClassInAnotherNamespace.md -check-prefix=MD-ANOTHER-CLASS +// RUN: FileCheck %s < %t/AnotherNamespace/index.md -check-prefix=MD-ANOTHER-INDEX-LINE // RUN: FileCheck %s < %t/AnotherNamespace/index.md -check-prefix=MD-ANOTHER-INDEX -// RUN: FileCheck %s < %t/GlobalNamespace/index.md -check-prefix=MD-GLOBAL-INDEX +// RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/ClassInNestedNamespace.md -check-prefix=MD-NESTED-CLASS-LINE // RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/ClassInNestedNamespace.md -check-prefix=MD-NESTED-CLASS +// RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/index.md -check-prefix=MD-NESTED-INDEX-LINE // RUN: FileCheck %s < %t/PrimaryNamespace/NestedNamespace/index.md -check-prefix=MD-NESTED-INDEX +// RUN: FileCheck %s < %t/PrimaryNamespace/index.md -check-prefix=MD-PRIMARY-INDEX-LINE // RUN: FileCheck %s < %t/PrimaryNamespace/index.md -check-prefix=MD-PRIMARY-INDEX +// RUN: FileCheck %s < %t/PrimaryNamespace/ClassInPrimaryNamespace.md -check-prefix=MD-PRIMARY-CLASS-LINE // RUN: FileCheck %s < %t/PrimaryNamespace/ClassInPrimaryNamespace.md -check-prefix=MD-PRIMARY-CLASS +// RUN: FileCheck %s < %t/GlobalNamespace/index.html -check-prefix=HTML-GLOBAL-INDEX +// RUN: FileCheck %s < %t/GlobalNamespace/index.md -check-prefix=MD-GLOBAL-INDEX // RUN: FileCheck %s < %t/all_files.md -check-prefix=MD-ALL-FILES // RUN: FileCheck %s < %t/index.md -check-prefix=MD-INDEX + + +// Anonymous Namespace +namespace +{ + void anonFunction() {} +// MD-ANON-INDEX-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]* +// HTML-ANON-INDEX-LINE:
Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
+ + class AnonClass {}; +// MD-ANON-CLASS-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]* +// HTML-ANON-CLASS-LINE:Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
+ +// MD-ANON-CLASS: # class AnonClass +// HTML-ANON-CLASS:Anonymous Namespace
@@ -39,62 +71,44 @@ // HTML-ANON-INDEX:void anonFunction()
-// HTML-ANON-INDEX:Defined at line [[@LINE+6]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
- -// Anonymous Namespace -namespace -{ - - void anonFunction() {} - -// MD-ANON-CLASS: # class AnonClass -// MD-ANON-CLASS: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE+5]]* - -// HTML-ANON-CLASS:Defined at line [[@LINE+2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
- - class AnonClass {}; -} - -// MD-PRIMARY-INDEX: # namespace PrimaryNamespace -// MD-PRIMARY-INDEX: Primary Namespace -// MD-PRIMARY-INDEX: ## Namespaces -// MD-PRIMARY-INDEX: * [NestedNamespace](NestedNamespace{{[\/]}}index.md) -// MD-PRIMARY-INDEX: ## Records -// MD-PRIMARY-INDEX: * [ClassInPrimaryNamespace](ClassInPrimaryNamespace.md) -// MD-PRIMARY-INDEX: ## Functions -// MD-PRIMARY-INDEX: ### functionInPrimaryNamespace -// MD-PRIMARY-INDEX: *void functionInPrimaryNamespace()* -// MD-PRIMARY-INDEX: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE+18]]* -// MD-PRIMARY-INDEX: Function in PrimaryNamespace -// HTML-PRIMARY-INDEX:Primary Namespace
-// HTML-PRIMARY-INDEX:void functionInPrimaryNamespace()
-// HTML-PRIMARY-INDEX:Defined at line [[@LINE+6]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
-// HTML-PRIMARY-INDEX:Function in PrimaryNamespace
// Primary Namespace namespace PrimaryNamespace { // Function in PrimaryNamespace void functionInPrimaryNamespace() {} +// MD-PRIMARY-INDEX-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]* +// HTML-PRIMARY-INDEX-LINE:Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
+ + // Class in PrimaryNamespace + class ClassInPrimaryNamespace {}; +// MD-PRIMARY-CLASS-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]* +// HTML-PRIMARY-CLASS-LINE:Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
// MD-PRIMARY-CLASS: # class ClassInPrimaryNamespace -// MD-PRIMARY-CLASS: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE+8]]* // MD-PRIMARY-CLASS: Class in PrimaryNamespace // HTML-PRIMARY-CLASS:Defined at line [[@LINE+4]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
// HTML-PRIMARY-CLASS:Class in PrimaryNamespace
- // Class in PrimaryNamespace - class ClassInPrimaryNamespace {}; + // Nested namespace + namespace NestedNamespace { + // Function in NestedNamespace + void functionInNestedNamespace() {} +// MD-NESTED-INDEX-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]* +// HTML-NESTED-INDEX-LINE:Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
+ + // Class in NestedNamespace + class ClassInNestedNamespace {}; +// MD-NESTED-CLASS-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]* +// HTML-NESTED-CLASS-LINE:Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
+ +// MD-NESTED-CLASS: # class ClassInNestedNamespace +// MD-NESTED-CLASS: Class in NestedNamespace + +// HTML-NESTED-CLASS:Class in NestedNamespace
+ } // MD-NESTED-INDEX: # namespace NestedNamespace // MD-NESTED-INDEX: Nested namespace @@ -103,7 +117,6 @@ namespace PrimaryNamespace { // MD-NESTED-INDEX: ## Functions // MD-NESTED-INDEX: ### functionInNestedNamespace // MD-NESTED-INDEX: *void functionInNestedNamespace()* -// MD-NESTED-INDEX: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE+16]]* // MD-NESTED-INDEX: Function in NestedNamespace // HTML-NESTED-INDEX:void functionInNestedNamespace()
-// HTML-NESTED-INDEX:Defined at line [[@LINE+6]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
// HTML-NESTED-INDEX:Function in NestedNamespace
+} - // Nested namespace - namespace NestedNamespace { - // Function in NestedNamespace - void functionInNestedNamespace() {} +// MD-PRIMARY-INDEX: # namespace PrimaryNamespace +// MD-PRIMARY-INDEX: Primary Namespace +// MD-PRIMARY-INDEX: ## Namespaces +// MD-PRIMARY-INDEX: * [NestedNamespace](NestedNamespace{{[\/]}}index.md) +// MD-PRIMARY-INDEX: ## Records +// MD-PRIMARY-INDEX: * [ClassInPrimaryNamespace](ClassInPrimaryNamespace.md) +// MD-PRIMARY-INDEX: ## Functions +// MD-PRIMARY-INDEX: ### functionInPrimaryNamespace +// MD-PRIMARY-INDEX: *void functionInPrimaryNamespace()* +// MD-PRIMARY-INDEX: Function in PrimaryNamespace -// MD-NESTED-CLASS: # class ClassInNestedNamespace -// MD-NESTED-CLASS: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE+8]]* -// MD-NESTED-CLASS: Class in NestedNamespace +// HTML-PRIMARY-INDEX:Primary Namespace
+// HTML-PRIMARY-INDEX:void functionInPrimaryNamespace()
+// HTML-PRIMARY-INDEX:Function in PrimaryNamespace
-// HTML-NESTED-CLASS:Defined at line [[@LINE+4]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
-// HTML-NESTED-CLASS:Class in NestedNamespace
- // Class in NestedNamespace - class ClassInNestedNamespace {}; - } +// AnotherNamespace +namespace AnotherNamespace { + // Function in AnotherNamespace + void functionInAnotherNamespace() {} +// MD-ANOTHER-INDEX-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]* +// HTML-ANOTHER-INDEX-LINE:Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
+ + // Class in AnotherNamespace + class ClassInAnotherNamespace {}; +// MD-ANOTHER-CLASS-LINE: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE-1]]* +// HTML-ANOTHER-CLASS-LINE:Defined at line [[@LINE-2]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
+ +// MD-ANOTHER-CLASS: # class ClassInAnotherNamespace +// MD-ANOTHER-CLASS: Class in AnotherNamespace + +// HTML-ANOTHER-CLASS:Class in AnotherNamespace
+ } // MD-ANOTHER-INDEX: # namespace AnotherNamespace @@ -141,7 +179,6 @@ namespace PrimaryNamespace { // MD-ANOTHER-INDEX: ## Functions // MD-ANOTHER-INDEX: ### functionInAnotherNamespace // MD-ANOTHER-INDEX: *void functionInAnotherNamespace()* -// MD-ANOTHER-INDEX: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE+16]]* // MD-ANOTHER-INDEX: Function in AnotherNamespace // HTML-ANOTHER-INDEX:void functionInAnotherNamespace()
-// HTML-ANOTHER-INDEX:Defined at line [[@LINE+6]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
// HTML-ANOTHER-INDEX:Function in AnotherNamespace
-// AnotherNamespace -namespace AnotherNamespace { - // Function in AnotherNamespace - void functionInAnotherNamespace() {} - -// MD-ANOTHER-CLASS: # class ClassInAnotherNamespace -// MD-ANOTHER-CLASS: *Defined at {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp#[[@LINE+8]]* -// MD-ANOTHER-CLASS: Class in AnotherNamespace - -// HTML-ANOTHER-CLASS:Defined at line [[@LINE+4]] of file {{.*}}clang-tools-extra{{[\/]}}test{{[\/]}}clang-doc{{[\/]}}namespace.cpp
-// HTML-ANOTHER-CLASS:Class in AnotherNamespace
- - // Class in AnotherNamespace - class ClassInAnotherNamespace {}; -} - // JSON-INDEX: async function LoadIndex() { // JSON-INDEX-NEXT: return{ // JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",