@@ -530,9 +530,11 @@ TEST(ClangToolTest, StripDependencyFileAdjuster) {
530
530
EXPECT_TRUE (HasFlag (" -w" ));
531
531
}
532
532
533
- // Check getClangStripDependencyFileAdjuster strips /showIncludes
533
+ // Check getClangStripDependencyFileAdjuster strips /showIncludes and variants
534
534
TEST (ClangToolTest, StripDependencyFileAdjusterShowIncludes) {
535
- FixedCompilationDatabase Compilations (" /" , {" /showIncludes" , " -c" });
535
+ FixedCompilationDatabase Compilations (
536
+ " /" , {" /showIncludes" , " /showIncludes:user" , " -showIncludes" ,
537
+ " -showIncludes:user" , " -c" });
536
538
537
539
ClangTool Tool (Compilations, std::vector<std::string>(1 , " /a.cc" ));
538
540
Tool.mapVirtualFile (" /a.cc" , " void a() {}" );
@@ -555,34 +557,9 @@ TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludes) {
555
557
return llvm::find (FinalArgs, Flag) != FinalArgs.end ();
556
558
};
557
559
EXPECT_FALSE (HasFlag (" /showIncludes" ));
558
- EXPECT_TRUE (HasFlag (" -c" ));
559
- }
560
-
561
- // Check getClangStripDependencyFileAdjuster strips /showIncludes:user
562
- TEST (ClangToolTest, StripDependencyFileAdjusterShowIncludesUser) {
563
- FixedCompilationDatabase Compilations (" /" , {" /showIncludes:user" , " -c" });
564
-
565
- ClangTool Tool (Compilations, std::vector<std::string>(1 , " /a.cc" ));
566
- Tool.mapVirtualFile (" /a.cc" , " void a() {}" );
567
-
568
- std::unique_ptr<FrontendActionFactory> Action (
569
- newFrontendActionFactory<SyntaxOnlyAction>());
570
-
571
- CommandLineArguments FinalArgs;
572
- ArgumentsAdjuster CheckFlagsAdjuster =
573
- [&FinalArgs](const CommandLineArguments &Args, StringRef /* unused*/ ) {
574
- FinalArgs = Args;
575
- return Args;
576
- };
577
- Tool.clearArgumentsAdjusters ();
578
- Tool.appendArgumentsAdjuster (getClangStripDependencyFileAdjuster ());
579
- Tool.appendArgumentsAdjuster (CheckFlagsAdjuster);
580
- Tool.run (Action.get ());
581
-
582
- auto HasFlag = [&FinalArgs](const std::string &Flag) {
583
- return llvm::find (FinalArgs, Flag) != FinalArgs.end ();
584
- };
585
560
EXPECT_FALSE (HasFlag (" /showIncludes:user" ));
561
+ EXPECT_FALSE (HasFlag (" -showIncludes" ));
562
+ EXPECT_FALSE (HasFlag (" -showIncludes:user" ));
586
563
EXPECT_TRUE (HasFlag (" -c" ));
587
564
}
588
565
0 commit comments