[PATCH] D137927: Adapt unittests for isSelfContainedHeader to API
Jonas Hahnfeld via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 14 02:06:25 PST 2022
Hahnfeld created this revision.
Hahnfeld added reviewers: hokein, kadircet.
Herald added a project: All.
Hahnfeld requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
The function now takes a FileEntry instead of a FileID.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D137927
Files:
clang/unittests/Tooling/HeaderAnalysisTest.cpp
Index: clang/unittests/Tooling/HeaderAnalysisTest.cpp
===================================================================
--- clang/unittests/Tooling/HeaderAnalysisTest.cpp
+++ clang/unittests/Tooling/HeaderAnalysisTest.cpp
@@ -50,15 +50,15 @@
const auto &SM = AST.sourceManager();
auto &FM = SM.getFileManager();
auto &HI = AST.preprocessor().getHeaderSearchInfo();
- auto getFileID = [&](llvm::StringRef FileName) {
- return SM.translateFile(FM.getFile(FileName).get());
+ auto getFileEntry = [&](llvm::StringRef FileName) {
+ return FM.getFile(FileName).get();
};
- EXPECT_TRUE(isSelfContainedHeader(getFileID("headerguard.h"), SM, HI));
- EXPECT_TRUE(isSelfContainedHeader(getFileID("pragmaonce.h"), SM, HI));
- EXPECT_TRUE(isSelfContainedHeader(getFileID("imported.h"), SM, HI));
+ EXPECT_TRUE(isSelfContainedHeader(getFileEntry("headerguard.h"), SM, HI));
+ EXPECT_TRUE(isSelfContainedHeader(getFileEntry("pragmaonce.h"), SM, HI));
+ EXPECT_TRUE(isSelfContainedHeader(getFileEntry("imported.h"), SM, HI));
- EXPECT_FALSE(isSelfContainedHeader(getFileID("unguarded.h"), SM, HI));
- EXPECT_FALSE(isSelfContainedHeader(getFileID("bad.h"), SM, HI));
+ EXPECT_FALSE(isSelfContainedHeader(getFileEntry("unguarded.h"), SM, HI));
+ EXPECT_FALSE(isSelfContainedHeader(getFileEntry("bad.h"), SM, HI));
}
} // namespace
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137927.475084.patch
Type: text/x-patch
Size: 1351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221114/8adc9a84/attachment.bin>
More information about the cfe-commits
mailing list