[PATCH] D66124: [clang-doc] Add missing check in tests
Diego Astiazarán via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 12 18:43:50 PDT 2019
DiegoAstiazaran created this revision.
DiegoAstiazaran added reviewers: juliehockett, jakehehrlich.
DiegoAstiazaran added a project: clang-tools-extra.
Herald added subscribers: kadircet, arphaman.
Path is now checked when comparing two Infos in the unit tests.
https://reviews.llvm.org/D66124
Files:
clang-tools-extra/clang-doc/Representation.h
clang-tools-extra/unittests/clang-doc/ClangDocTest.cpp
clang-tools-extra/unittests/clang-doc/SerializeTest.cpp
Index: clang-tools-extra/unittests/clang-doc/SerializeTest.cpp
===================================================================
--- clang-tools-extra/unittests/clang-doc/SerializeTest.cpp
+++ clang-tools-extra/unittests/clang-doc/SerializeTest.cpp
@@ -91,7 +91,7 @@
CheckNamespaceInfo(&ExpectedA, A);
NamespaceInfo *B = InfoAsNamespace(Infos[2].get());
- NamespaceInfo ExpectedB(EmptySID, "B");
+ NamespaceInfo ExpectedB(EmptySID, /*Name=*/"B", /*Path=*/"A");
ExpectedB.Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
CheckNamespaceInfo(&ExpectedB, B);
@@ -276,7 +276,7 @@
CheckRecordInfo(&ExpectedE, E);
RecordInfo *G = InfoAsRecord(Infos[2].get());
- RecordInfo ExpectedG(EmptySID, "G");
+ RecordInfo ExpectedG(EmptySID, /*Name=*/"G", /*Path=*/"E");
ExpectedG.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
ExpectedG.TagType = TagTypeKind::TTK_Class;
ExpectedG.Namespace.emplace_back(EmptySID, "E", InfoType::IT_record);
Index: clang-tools-extra/unittests/clang-doc/ClangDocTest.cpp
===================================================================
--- clang-tools-extra/unittests/clang-doc/ClangDocTest.cpp
+++ clang-tools-extra/unittests/clang-doc/ClangDocTest.cpp
@@ -83,6 +83,7 @@
void CheckBaseInfo(Info *Expected, Info *Actual) {
EXPECT_EQ(size_t(20), Actual->USR.size());
EXPECT_EQ(Expected->Name, Actual->Name);
+ EXPECT_EQ(Expected->Path, Actual->Path);
ASSERT_EQ(Expected->Namespace.size(), Actual->Namespace.size());
for (size_t Idx = 0; Idx < Actual->Namespace.size(); ++Idx)
CheckReference(Expected->Namespace[Idx], Actual->Namespace[Idx]);
Index: clang-tools-extra/clang-doc/Representation.h
===================================================================
--- clang-tools-extra/clang-doc/Representation.h
+++ clang-tools-extra/clang-doc/Representation.h
@@ -238,6 +238,8 @@
Info(InfoType IT, SymbolID USR) : USR(USR), IT(IT) {}
Info(InfoType IT, SymbolID USR, StringRef Name)
: USR(USR), IT(IT), Name(Name) {}
+ Info(InfoType IT, SymbolID USR, StringRef Name, StringRef Path)
+ : USR(USR), IT(IT), Name(Name), Path(Path) {}
Info(const Info &Other) = delete;
Info(Info &&Other) = default;
@@ -269,6 +271,8 @@
NamespaceInfo(SymbolID USR) : Info(InfoType::IT_namespace, USR) {}
NamespaceInfo(SymbolID USR, StringRef Name)
: Info(InfoType::IT_namespace, USR, Name) {}
+ NamespaceInfo(SymbolID USR, StringRef Name, StringRef Path)
+ : Info(InfoType::IT_namespace, USR, Name, Path) {}
void merge(NamespaceInfo &&I);
@@ -287,6 +291,7 @@
SymbolInfo(InfoType IT) : Info(IT) {}
SymbolInfo(InfoType IT, SymbolID USR) : Info(IT, USR) {}
SymbolInfo(InfoType IT, SymbolID USR, StringRef Name) : Info(IT, USR, Name) {}
+ SymbolInfo(InfoType IT, SymbolID USR, StringRef Name, StringRef Path) : Info(IT, USR, Name, Path) {}
void merge(SymbolInfo &&I);
@@ -318,6 +323,8 @@
RecordInfo(SymbolID USR) : SymbolInfo(InfoType::IT_record, USR) {}
RecordInfo(SymbolID USR, StringRef Name)
: SymbolInfo(InfoType::IT_record, USR, Name) {}
+ RecordInfo(SymbolID USR, StringRef Name, StringRef Path)
+ : SymbolInfo(InfoType::IT_record, USR, Name, Path) {}
void merge(RecordInfo &&I);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66124.214749.patch
Type: text/x-patch
Size: 3256 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190813/264de5b6/attachment-0001.bin>
More information about the cfe-commits
mailing list