Index: clang-tools-extra/clang-doc/Mapper.cpp
===================================================================
--- clang-tools-extra/clang-doc/Mapper.cpp
+++ clang-tools-extra/clang-doc/Mapper.cpp
@@ -28,6 +28,10 @@
if (D->getASTContext().getSourceManager().isInSystemHeader(D->getLocation()))
return true;
+ // Skip function-internal decls.
+ if (const auto *F = D->getParentFunctionOrMethod())
+ return true;
+
llvm::SmallString<128> USR;
// If there is an error generating a USR for the decl, skip this decl.
if (index::generateUSRForDecl(D, USR))
Index: clang-tools-extra/test/clang-doc/bc-record.cpp
===================================================================
--- clang-tools-extra/test/clang-doc/bc-record.cpp
+++ clang-tools-extra/test/clang-doc/bc-record.cpp
@@ -16,7 +16,6 @@
// RUN: llvm-bcanalyzer %t/docs/bc/BD2BDEBD423F80BACCEA75DE6D6622D355FC2D17.bc --dump | FileCheck %s --check-prefix CHECK-EDES
// RUN: llvm-bcanalyzer %t/docs/bc/E3B54702FABFF4037025BA194FC27C47006330B5.bc --dump | FileCheck %s --check-prefix CHECK-F
// RUN: llvm-bcanalyzer %t/docs/bc/B6AC4C5C9F2EA3F2B3ECE1A33D349F4EE502B24E.bc --dump | FileCheck %s --check-prefix CHECK-H
-// RUN: llvm-bcanalyzer %t/docs/bc/6BA1EE2B3DAEACF6E4306F10AF44908F4807927C.bc --dump | FileCheck %s --check-prefix CHECK-I
// RUN: llvm-bcanalyzer %t/docs/bc/5093D428CDC62096A67547BA52566E4FB9404EEE.bc --dump | FileCheck %s --check-prefix CHECK-PM
// RUN: llvm-bcanalyzer %t/docs/bc/CA7C7935730B5EACD25F080E9C83FA087CCDC75E.bc --dump | FileCheck %s --check-prefix CHECK-X
// RUN: llvm-bcanalyzer %t/docs/bc/641AB4A3D36399954ACDE29C7A8833032BF40472.bc --dump | FileCheck %s --check-prefix CHECK-Y
@@ -27,7 +26,7 @@
// CHECK-H:
// CHECK-H-NEXT:
// CHECK-H-NEXT: blob data = 'H'
- // CHECK-H-NEXT: blob data = '{{.*}}'
+ // CHECK-H-NEXT: blob data = '{{.*}}'
// CHECK-H-NEXT:
// CHECK-H-NEXT:
// CHECK-H-NEXT: blob data = 'void'
@@ -36,25 +35,11 @@
// CHECK-H-NEXT:
// CHECK-H-NEXT:
-
-// CHECK-I:
- // CHECK-I-NEXT:
- // CHECK-I-NEXT: blob data = 'I'
- // CHECK-I-NEXT:
- // CHECK-I-NEXT:
- // CHECK-I-NEXT: blob data = 'H'
- // CHECK-I-NEXT:
- // CHECK-I-NEXT:
- // CHECK-I-NEXT:
- // CHECK-I-NEXT: blob data = '{{.*}}'
- // CHECK-I-NEXT:
-// CHECK-I-NEXT:
-
union A { int X; int Y; };
// CHECK-A:
// CHECK-A-NEXT:
// CHECK-A-NEXT: blob data = 'A'
- // CHECK-A-NEXT: blob data = '{{.*}}'
+ // CHECK-A-NEXT: blob data = '{{.*}}'
// CHECK-A-NEXT:
// CHECK-A-NEXT:
// CHECK-A-NEXT:
@@ -78,7 +63,7 @@
// CHECK-B:
// CHECK-B-NEXT:
// CHECK-B-NEXT: blob data = 'B'
- // CHECK-B-NEXT: blob data = '{{.*}}'
+ // CHECK-B-NEXT: blob data = '{{.*}}'
// CHECK-B-NEXT: blob data = 'X'
// CHECK-B-NEXT: blob data = 'Y'
// CHECK-B-NEXT:
@@ -87,7 +72,7 @@
// CHECK-BC:
// CHECK-BC-NEXT:
// CHECK-BC-NEXT: blob data = 'Bc'
- // CHECK-BC-NEXT: blob data = '{{.*}}'
+ // CHECK-BC-NEXT: blob data = '{{.*}}'
// CHECK-BC-NEXT:
// CHECK-BC-NEXT: blob data = 'A'
// CHECK-BC-NEXT: blob data = 'B'
@@ -97,7 +82,7 @@
// CHECK-C:
// CHECK-C-NEXT:
// CHECK-C-NEXT: blob data = 'C'
- // CHECK-C-NEXT: blob data = '{{.*}}'
+ // CHECK-C-NEXT: blob data = '{{.*}}'
// CHECK-C-NEXT:
// CHECK-C-NEXT:
// CHECK-C-NEXT: blob data = 'int'
@@ -112,7 +97,7 @@
// CHECK-D:
// CHECK-D-NEXT:
// CHECK-D-NEXT: blob data = 'D'
- // CHECK-D-NEXT: blob data = '{{.*}}'
+ // CHECK-D-NEXT: blob data = '{{.*}}'
// CHECK-D-NEXT:
// CHECK-D-NEXT:
@@ -127,7 +112,7 @@
// CHECK-E:
// CHECK-E-NEXT:
// CHECK-E-NEXT: blob data = 'E'
- // CHECK-E-NEXT: blob data = '{{.*}}'
+ // CHECK-E-NEXT: blob data = '{{.*}}'
// CHECK-E-NEXT:
// CHECK-E-NEXT:
@@ -141,7 +126,7 @@
// CHECK-ECON-NEXT:
// CHECK-ECON-NEXT:
// CHECK-ECON-NEXT:
- // CHECK-ECON-NEXT: blob data = '{{.*}}'
+ // CHECK-ECON-NEXT: blob data = '{{.*}}'
// CHECK-ECON-NEXT:
// CHECK-ECON-NEXT:
// CHECK-ECON-NEXT: blob data = 'E'
@@ -166,7 +151,7 @@
// CHECK-EDES-NEXT:
// CHECK-EDES-NEXT:
// CHECK-EDES-NEXT:
- // CHECK-EDES-NEXT: blob data = '{{.*}}'
+ // CHECK-EDES-NEXT: blob data = '{{.*}}'
// CHECK-EDES-NEXT:
// CHECK-EDES-NEXT:
// CHECK-EDES-NEXT: blob data = 'E'
@@ -192,8 +177,8 @@
// CHECK-PM-NEXT:
// CHECK-PM-NEXT:
// CHECK-PM-NEXT:
- // CHECK-PM-NEXT: blob data = '{{.*}}'
- // CHECK-PM-NEXT: blob data = '{{.*}}'
+ // CHECK-PM-NEXT: blob data = '{{.*}}'
+ // CHECK-PM-NEXT: blob data = '{{.*}}'
// CHECK-PM-NEXT:
// CHECK-PM-NEXT:
// CHECK-PM-NEXT: blob data = 'E'
@@ -214,7 +199,7 @@
// CHECK-F:
// CHECK-F-NEXT:
// CHECK-F-NEXT: blob data = 'F'
- // CHECK-F-NEXT: blob data = '{{.*}}'
+ // CHECK-F-NEXT: blob data = '{{.*}}'
// CHECK-F-NEXT:
// CHECK-F-NEXT:
// CHECK-F-NEXT:
@@ -236,7 +221,7 @@
// CHECK-X:
// CHECK-X-NEXT:
// CHECK-X-NEXT: blob data = 'X'
- // CHECK-X-NEXT: blob data = '{{.*}}'
+ // CHECK-X-NEXT: blob data = '{{.*}}'
// CHECK-X-NEXT:
// CHECK-X-NEXT:
@@ -249,6 +234,6 @@
// CHECK-Y-NEXT:
// CHECK-Y-NEXT:
// CHECK-Y-NEXT:
- // CHECK-Y-NEXT: blob data = '{{.*}}'
+ // CHECK-Y-NEXT: blob data = '{{.*}}'
// CHECK-Y-NEXT:
// CHECK-Y-NEXT:
Index: clang-tools-extra/test/clang-doc/mapper-class-in-function.cpp
===================================================================
--- clang-tools-extra/test/clang-doc/mapper-class-in-function.cpp
+++ clang-tools-extra/test/clang-doc/mapper-class-in-function.cpp
@@ -7,7 +7,6 @@
// RUN: cp "%s" "%t/test.cpp"
// RUN: clang-doc --dump-mapper -doxygen -p %t %t/test.cpp -output=%t/docs
// RUN: llvm-bcanalyzer %t/docs/bc/B6AC4C5C9F2EA3F2B3ECE1A33D349F4EE502B24E.bc --dump | FileCheck %s --check-prefix CHECK-H
-// RUN: llvm-bcanalyzer %t/docs/bc/01A95F3F73F53281B3E50109A577FD2493159365.bc --dump | FileCheck %s --check-prefix CHECK-H-I
void H() {
class I {};
@@ -20,7 +19,7 @@
// CHECK-H-NEXT:
// CHECK-H-NEXT:
// CHECK-H-NEXT: blob data = 'H'
- // CHECK-H-NEXT: blob data = '{{.*}}'
+ // CHECK-H-NEXT: blob data = '{{.*}}'
// CHECK-H-NEXT:
// CHECK-H-NEXT:
// CHECK-H-NEXT: blob data = 'void'
@@ -28,22 +27,3 @@
// CHECK-H-NEXT:
// CHECK-H-NEXT:
// CHECK-H-NEXT:
-
-// CHECK-H-I:
-// CHECK-H-I-NEXT:
- // CHECK-H-I-NEXT:
-// CHECK-H-I-NEXT:
-// CHECK-H-I-NEXT:
- // CHECK-H-I-NEXT:
- // CHECK-H-I-NEXT: blob data = 'I'
- // CHECK-H-I-NEXT:
- // CHECK-H-I-NEXT:
- // CHECK-H-I-NEXT: blob data = 'H'
- // CHECK-H-I-NEXT:
- // CHECK-H-I-NEXT:
- // CHECK-H-I-NEXT:
- // CHECK-H-I-NEXT: blob data = '{{.*}}'
- // CHECK-H-I-NEXT:
-// CHECK-H-I-NEXT:
-
-
Index: clang-tools-extra/test/clang-doc/yaml-record.cpp
===================================================================
--- clang-tools-extra/test/clang-doc/yaml-record.cpp
+++ clang-tools-extra/test/clang-doc/yaml-record.cpp
@@ -16,7 +16,6 @@
// RUN: cat %t/docs/X.yaml | FileCheck %s --check-prefix=CHECK-X
// RUN: cat %t/docs/X/Y.yaml | FileCheck %s --check-prefix=CHECK-Y
// RUN: cat %t/docs/H.yaml | FileCheck %s --check-prefix=CHECK-H
-// RUN: cat %t/docs/H/I.yaml | FileCheck %s --check-prefix=CHECK-I
union A { int X; int Y; };
@@ -24,7 +23,7 @@
// CHECK-A-NEXT: USR: 'ACE81AFA6627B4CEF2B456FB6E1252925674AF7E'
// CHECK-A-NEXT: Name: 'A'
// CHECK-A-NEXT: DefLocation:
-// CHECK-A-NEXT: LineNumber: 21
+// CHECK-A-NEXT: LineNumber: [[@LINE-6]]
// CHECK-A-NEXT: Filename: '{{.*}}'
// CHECK-A-NEXT: TagType: Union
// CHECK-A-NEXT: Members:
@@ -43,7 +42,7 @@
// CHECK-B-NEXT: USR: 'FC07BD34D5E77782C263FA944447929EA8753740'
// CHECK-B-NEXT: Name: 'B'
// CHECK-B-NEXT: DefLocation:
-// CHECK-B-NEXT: LineNumber: 40
+// CHECK-B-NEXT: LineNumber: [[@LINE-6]]
// CHECK-B-NEXT: Filename: '{{.*}}'
// CHECK-B-NEXT: Members:
// CHECK-B-NEXT: - 'X'
@@ -56,7 +55,7 @@
// CHECK-BC-NEXT: USR: '1E3438A08BA22025C0B46289FF0686F92C8924C5'
// CHECK-BC-NEXT: Name: 'Bc'
// CHECK-BC-NEXT: DefLocation:
-// CHECK-BC-NEXT: LineNumber: 53
+// CHECK-BC-NEXT: LineNumber: [[@LINE-6]]
// CHECK-BC-NEXT: Filename: '{{.*}}'
// CHECK-BC-NEXT: Scoped: true
// CHECK-BC-NEXT: Members:
@@ -70,7 +69,7 @@
// CHECK-C-NEXT: USR: '06B5F6A19BA9F6A832E127C9968282B94619B210'
// CHECK-C-NEXT: Name: 'C'
// CHECK-C-NEXT: DefLocation:
-// CHECK-C-NEXT: LineNumber: 67
+// CHECK-C-NEXT: LineNumber: [[@LINE-6]]
// CHECK-C-NEXT: Filename: '{{.*}}'
// CHECK-C-NEXT: Members:
// CHECK-C-NEXT: - Type:
@@ -84,7 +83,7 @@
// CHECK-D-NEXT: USR: '0921737541208B8FA9BB42B60F78AC1D779AA054'
// CHECK-D-NEXT: Name: 'D'
// CHECK-D-NEXT: DefLocation:
-// CHECK-D-NEXT: LineNumber: 81
+// CHECK-D-NEXT: LineNumber: [[@LINE-6]]
// CHECK-D-NEXT: Filename: '{{.*}}'
// CHECK-D-NEXT: TagType: Class
// CHECK-D-NEXT: ...
@@ -101,7 +100,7 @@
// CHECK-ECON-NEXT: Name: 'E'
// CHECK-ECON-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1'
// CHECK-ECON-NEXT: DefLocation:
-// CHECK-ECON-NEXT: LineNumber: 94
+// CHECK-ECON-NEXT: LineNumber: [[@LINE-10]]
// CHECK-ECON-NEXT: Filename: '{{.*}}'
// CHECK-ECON-NEXT: IsMethod: true
// CHECK-ECON-NEXT: Parent:
@@ -123,7 +122,7 @@
// CHECK-EDES-NEXT: Name: 'E'
// CHECK-EDES-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1'
// CHECK-EDES-NEXT: DefLocation:
-// CHECK-EDES-NEXT: LineNumber: 116
+// CHECK-EDES-NEXT: LineNumber: [[@LINE-10]]
// CHECK-EDES-NEXT: Filename: '{{.*}}'
// CHECK-EDES-NEXT: IsMethod: true
// CHECK-EDES-NEXT: Parent:
@@ -144,7 +143,7 @@
// CHECK-E-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1'
// CHECK-E-NEXT: Name: 'E'
// CHECK-E-NEXT: DefLocation:
-// CHECK-E-NEXT: LineNumber: 92
+// CHECK-E-NEXT: LineNumber: [[@LINE-55]]
// CHECK-E-NEXT: Filename: '{{.*}}'
// CHECK-E-NEXT: TagType: Class
// CHECK-E-NEXT: ...
@@ -159,10 +158,10 @@
// CHECK-EPM-NEXT: Name: 'E'
// CHECK-EPM-NEXT: USR: '289584A8E0FF4178A794622A547AA622503967A1'
// CHECK-EPM-NEXT: DefLocation:
-// CHECK-EPM-NEXT: LineNumber: 152
+// CHECK-EPM-NEXT: LineNumber: [[@LINE-10]]
// CHECK-EPM-NEXT: Filename: '{{.*}}'
// CHECK-EPM-NEXT: Location:
-// CHECK-EPM-NEXT: - LineNumber: 140
+// CHECK-EPM-NEXT: - LineNumber: [[@LINE-25]]
// CHECK-EPM-NEXT: Filename: '{{.*}}'
// CHECK-EPM-NEXT: IsMethod: true
// CHECK-EPM-NEXT: Parent:
@@ -180,7 +179,7 @@
// CHECK-F-NEXT: USR: 'E3B54702FABFF4037025BA194FC27C47006330B5'
// CHECK-F-NEXT: Name: 'F'
// CHECK-F-NEXT: DefLocation:
-// CHECK-F-NEXT: LineNumber: 177
+// CHECK-F-NEXT: LineNumber: [[@LINE-6]]
// CHECK-F-NEXT: Filename: '{{.*}}'
// CHECK-F-NEXT: TagType: Class
// CHECK-F-NEXT: Parents:
@@ -204,7 +203,7 @@
// CHECK-Y-NEXT: Name: 'X'
// CHECK-Y-NEXT: USR: 'CA7C7935730B5EACD25F080E9C83FA087CCDC75E'
// CHECK-Y-NEXT: DefLocation:
-// CHECK-Y-NEXT: LineNumber: 197
+// CHECK-Y-NEXT: LineNumber: [[@LINE-10]]
// CHECK-Y-NEXT: Filename: '{{.*}}'
// CHECK-Y-NEXT: TagType: Class
// CHECK-Y-NEXT: ...
@@ -215,34 +214,20 @@
// CHECK-X-NEXT: USR: 'CA7C7935730B5EACD25F080E9C83FA087CCDC75E'
// CHECK-X-NEXT: Name: 'X'
// CHECK-X-NEXT: DefLocation:
-// CHECK-X-NEXT: LineNumber: 196
+// CHECK-X-NEXT: LineNumber: [[@LINE-22]]
// CHECK-X-NEXT: Filename: '{{.*}}'
// CHECK-X-NEXT: TagType: Class
// CHECK-X-NEXT: ...
void H() {
class I {};
-
-// CHECK-I: ---
-// CHECK-I-NEXT: USR: '{{.*}}'
-// CHECK-I-NEXT: Name: 'I'
-// CHECK-I-NEXT: Namespace:
-// CHECK-I-NEXT: - Type: Function
-// CHECK-I-NEXT: Name: 'H'
-// CHECK-I-NEXT: USR: 'B6AC4C5C9F2EA3F2B3ECE1A33D349F4EE502B24E'
-// CHECK-I-NEXT: DefLocation:
-// CHECK-I-NEXT: LineNumber: 224
-// CHECK-I-NEXT: Filename: 'test'
-// CHECK-I-NEXT: TagType: Class
-// CHECK-I-NEXT: ...
-
}
// CHECK-H: ---
// CHECK-H-NEXT: USR: 'B6AC4C5C9F2EA3F2B3ECE1A33D349F4EE502B24E'
// CHECK-H-NEXT: Name: 'H'
// CHECK-H-NEXT: DefLocation:
-// CHECK-H-NEXT: LineNumber: 223
+// CHECK-H-NEXT: LineNumber: [[@LINE-8]]
// CHECK-H-NEXT: Filename: 'test'
// CHECK-H-NEXT: ReturnType:
// CHECK-H-NEXT: Type: