summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Wilson <brettw@google.com>2022-08-12 18:38:21 +0000
committerPaul Kirth <paulkirth@google.com>2022-08-12 18:39:20 +0000
commit68266828b170d2f978d0bc2f508de2b3b9e41665 (patch)
treec055717f8f1ab0ce2d64cf83c6916ca7726355f8 /clang-tools-extra/unittests
parent[clang-doc] Fix assert on startup (diff)
downloadllvm-project-68266828b170d2f978d0bc2f508de2b3b9e41665.tar.gz
llvm-project-68266828b170d2f978d0bc2f508de2b3b9e41665.tar.bz2
llvm-project-68266828b170d2f978d0bc2f508de2b3b9e41665.zip
[clang-doc] Always emit the TagType for RecordInfo
Always emit the TagType for RecordInfo in YAML output. Previously this omitted the type for "struct", considering it the default. But records in C++ don't really have a default type so always emitting this is more clear. Emit IsTypeDef in YAML. Previously this existed only in the Representation but was never written. Additionally, adds IsTypeDef to the record merge operation which was clearing it (all RecordInfo structures are merged with am empty RecordInfo during the reduce phase). Reviewed By: paulkirth Differential Revision: https://reviews.llvm.org/D131739
Diffstat (limited to 'clang-tools-extra/unittests')
-rw-r--r--clang-tools-extra/unittests/clang-doc/MergeTest.cpp2
-rw-r--r--clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp3
2 files changed, 5 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clang-doc/MergeTest.cpp b/clang-tools-extra/unittests/clang-doc/MergeTest.cpp
index 31b565352ee2..3647ebdbc377 100644
--- a/clang-tools-extra/unittests/clang-doc/MergeTest.cpp
+++ b/clang-tools-extra/unittests/clang-doc/MergeTest.cpp
@@ -78,6 +78,7 @@ TEST(MergeTest, mergeNamespaceInfos) {
TEST(MergeTest, mergeRecordInfos) {
RecordInfo One;
One.Name = "r";
+ One.IsTypeDef = true;
One.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
One.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});
@@ -119,6 +120,7 @@ TEST(MergeTest, mergeRecordInfos) {
auto Expected = std::make_unique<RecordInfo>();
Expected->Name = "r";
+ Expected->IsTypeDef = true;
Expected->Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
Expected->DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});
diff --git a/clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp b/clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp
index b87b62bd9a4e..ea30bfdefada 100644
--- a/clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp
+++ b/clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp
@@ -76,6 +76,7 @@ TEST(YAMLGeneratorTest, emitRecordYAML) {
RecordInfo I;
I.Name = "r";
I.Path = "path/to/A";
+ I.IsTypeDef = true;
I.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
I.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});
@@ -136,6 +137,7 @@ Location:
- LineNumber: 12
Filename: 'test.cpp'
TagType: Class
+IsTypeDef: true
Members:
- Type:
Name: 'int'
@@ -154,6 +156,7 @@ Bases:
- USR: '0000000000000000000000000000000000000000'
Name: 'F'
Path: 'path/to/F'
+ TagType: Struct
Members:
- Type:
Name: 'int'