Author: Haojian Wu Date: 2022-11-14T11:10:55+01:00 New Revision: 5c4ae8a86a865e622e2c663666c0c139334b5da2
URL: https://github.com/llvm/llvm-project/commit/5c4ae8a86a865e622e2c663666c0c139334b5da2 DIFF: https://github.com/llvm/llvm-project/commit/5c4ae8a86a865e622e2c663666c0c139334b5da2.diff LOG: Update the wrong isSelfContainedHeader API usage in the test. Added: Modified: clang/unittests/Tooling/HeaderAnalysisTest.cpp Removed: ################################################################################ diff --git a/clang/unittests/Tooling/HeaderAnalysisTest.cpp b/clang/unittests/Tooling/HeaderAnalysisTest.cpp index 1a121e7bf0a48..37a4c3ffb483e 100644 --- a/clang/unittests/Tooling/HeaderAnalysisTest.cpp +++ b/clang/unittests/Tooling/HeaderAnalysisTest.cpp @@ -50,15 +50,12 @@ TEST(HeaderAnalysisTest, IsSelfContained) { 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()); - }; - 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(FM.getFile("headerguard.h").get(), SM, HI)); + EXPECT_TRUE(isSelfContainedHeader(FM.getFile("pragmaonce.h").get(), SM, HI)); + EXPECT_TRUE(isSelfContainedHeader(FM.getFile("imported.h").get(), SM, HI)); - EXPECT_FALSE(isSelfContainedHeader(getFileID("unguarded.h"), SM, HI)); - EXPECT_FALSE(isSelfContainedHeader(getFileID("bad.h"), SM, HI)); + EXPECT_FALSE(isSelfContainedHeader(FM.getFile("unguarded.h").get(), SM, HI)); + EXPECT_FALSE(isSelfContainedHeader(FM.getFile("bad.h").get(), SM, HI)); } } // namespace _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits