mstorsjo created this revision. mstorsjo added reviewers: sepavloff, hans, rnk, hfinkel.
This avoids warnings about unused linker parameters, just like other flags are ignored if they're from config files. Repository: rC Clang https://reviews.llvm.org/D46286 Files: lib/Driver/Driver.cpp test/Driver/Inputs/config-4.cfg test/Driver/config-file.c Index: test/Driver/config-file.c =================================================================== --- test/Driver/config-file.c +++ test/Driver/config-file.c @@ -63,6 +63,7 @@ // // RUN: %clang --config %S/Inputs/config-4.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-UNUSED // CHECK-UNUSED-NOT: argument unused during compilation: +// CHECK-UNUSED-NOT: 'linker' input unused //--- User directory is searched first. Index: test/Driver/Inputs/config-4.cfg =================================================================== --- test/Driver/Inputs/config-4.cfg +++ test/Driver/Inputs/config-4.cfg @@ -1,2 +1,3 @@ -L/usr/local/lib --stdlib=libc++ \ No newline at end of file +-lfoo +-stdlib=libc++ Index: lib/Driver/Driver.cpp =================================================================== --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -2899,6 +2899,9 @@ // this compilation, warn the user about it. phases::ID InitialPhase = PL[0]; if (InitialPhase > FinalPhase) { + if (InputArg->isClaimed()) + continue; + // Claim here to avoid the more general unused warning. InputArg->claim();
Index: test/Driver/config-file.c =================================================================== --- test/Driver/config-file.c +++ test/Driver/config-file.c @@ -63,6 +63,7 @@ // // RUN: %clang --config %S/Inputs/config-4.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-UNUSED // CHECK-UNUSED-NOT: argument unused during compilation: +// CHECK-UNUSED-NOT: 'linker' input unused //--- User directory is searched first. Index: test/Driver/Inputs/config-4.cfg =================================================================== --- test/Driver/Inputs/config-4.cfg +++ test/Driver/Inputs/config-4.cfg @@ -1,2 +1,3 @@ -L/usr/local/lib --stdlib=libc++ \ No newline at end of file +-lfoo +-stdlib=libc++ Index: lib/Driver/Driver.cpp =================================================================== --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -2899,6 +2899,9 @@ // this compilation, warn the user about it. phases::ID InitialPhase = PL[0]; if (InitialPhase > FinalPhase) { + if (InputArg->isClaimed()) + continue; + // Claim here to avoid the more general unused warning. InputArg->claim();
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits