[clang-tools-extra] 42ee0d8 - [clangd][unittests][IncludeCleaner] Don't call findReferencedFiles() if the result is not used

Aleksandr Platonov via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 12 11:00:52 PDT 2022


Author: Aleksandr Platonov
Date: 2022-08-12T21:00:11+03:00
New Revision: 42ee0d8c16f7052c3bc8434325868f48a501baf2

URL: https://github.com/llvm/llvm-project/commit/42ee0d8c16f7052c3bc8434325868f48a501baf2
DIFF: https://github.com/llvm/llvm-project/commit/42ee0d8c16f7052c3bc8434325868f48a501baf2.diff

LOG: [clangd][unittests][IncludeCleaner] Don't call findReferencedFiles() if the result is not used

IncludeCleaner.RecursiveInclusion and IncludeCleaner.IWYUPragmaExport tests don't check referenced files list, so we don't need to call findReferencedFiles() there.

Reviewed By: kbobyrev

Differential Revision: https://reviews.llvm.org/D131706

Added: 
    

Modified: 
    clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp b/clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
index 527db2a5d2193..d79f1219511f8 100644
--- a/clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
+++ b/clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
@@ -571,9 +571,6 @@ TEST(IncludeCleaner, RecursiveInclusion) {
   )cpp");
   ParsedAST AST = TU.build();
 
-  auto ReferencedFiles = findReferencedFiles(
-      findReferencedLocations(AST), AST.getIncludeStructure(),
-      AST.getCanonicalIncludes(), AST.getSourceManager());
   EXPECT_THAT(AST.getDiagnostics(), llvm::ValueIs(IsEmpty()));
   EXPECT_THAT(computeUnusedIncludes(AST), IsEmpty());
 }
@@ -596,9 +593,6 @@ TEST(IncludeCleaner, IWYUPragmaExport) {
   )cpp");
   ParsedAST AST = TU.build();
 
-  auto ReferencedFiles = findReferencedFiles(
-      findReferencedLocations(AST), AST.getIncludeStructure(),
-      AST.getCanonicalIncludes(), AST.getSourceManager());
   EXPECT_THAT(AST.getDiagnostics(), llvm::ValueIs(IsEmpty()));
   // FIXME: This is not correct: foo.h is unused but is not diagnosed as such
   // because we ignore headers with IWYU export pragmas for now.


        


More information about the cfe-commits mailing list