[llvm-branch-commits] [clang] [clang][ssaf] Add FormatInfo sub-registry and tests [2/2] (PR #179517)
Aviral Goel via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Feb 4 11:51:02 PST 2026
================
@@ -26,4 +57,37 @@ TEST(SerializationFormatRegistryTest, EnumeratingRegistryEntries) {
EXPECT_EQ(Formats.begin()->getName(), "MockSerializationFormat");
}
+TEST(SerializationFormatRegistryTest, Roundtrip) {
+ StringLiteral FancyAnalysisFileData = "FancyAnalysisData{\n"
+ " SomeInternalList: zed, vayne, lux\n"
+ "}\n";
+
+ auto Inputs = makeIntrusiveRefCnt<vfs::InMemoryFileSystem>();
+ Inputs->addFile("input/analyses.txt", /*ModificationTime=*/{},
+ MemoryBuffer::getMemBufferCopy("FancyAnalysis\n"));
+ Inputs->addFile("input/FancyAnalysis.special", /*ModificationTime=*/{},
+ MemoryBuffer::getMemBufferCopy(FancyAnalysisFileData));
+
+ std::unique_ptr<SerializationFormat> Format =
+ makeFormat(Inputs, "MockSerializationFormat");
+ ASSERT_TRUE(Format);
+
+ TUSummary LoadedSummary = Format->readTUSummary("input");
+
+ // Create a temporary output directory
+ SmallString<128> OutputDir;
+ std::error_code EC = sys::fs::createUniqueDirectory("ssaf-test", OutputDir);
----------------
aviralg wrote:
It will be simpler to use the filesystem for input files as well. Using the InMemoryFileSystem in the test case makes it more mysterious and involved than it should be. We can probably present this as an example in the documentation.
https://github.com/llvm/llvm-project/pull/179517
More information about the llvm-branch-commits
mailing list