[cfe-commits] r82120 - in /cfe/trunk: include/clang/Basic/DiagnosticDriverKinds.td lib/Driver/Driver.cpp
Daniel Dunbar
daniel at zuster.org
Wed Sep 16 21:13:26 PDT 2009
Author: ddunbar
Date: Wed Sep 16 23:13:26 2009
New Revision: 82120
URL: http://llvm.org/viewvc/llvm-project?rev=82120&view=rev
Log:
Improve driver error message when only running the preprocessor and an input is
already preprocessed.
--
ddunbar at giles:tmp$ touch t.i
ddunbar at giles:tmp$ gcc -E t.i
ddunbar at giles:tmp$ clang -E t.i
clang: warning: t.i: previously preprocessed input unused when '-E' is present
ddunbar at giles:tmp$
--
<rdar://problem/6813375> [driver] driver prints confusing message when running -E on preprocessed file
Modified:
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/lib/Driver/Driver.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=82120&r1=82119&r2=82120&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Wed Sep 16 23:13:26 2009
@@ -58,6 +58,8 @@
def warn_drv_input_file_unused : Warning<
"%0: '%1' input unused when '%2' is present">;
+def warn_drv_preprocessed_input_file_unused : Warning<
+ "%0: previously preprocessed input unused when '%1' is present">;
def warn_drv_unused_argument : Warning<
"argument unused during compilation: '%0'">;
def warn_drv_pipe_ignored_with_save_temps : Warning<
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=82120&r1=82119&r2=82120&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Sep 16 23:13:26 2009
@@ -803,10 +803,19 @@
if (InitialPhase > FinalPhase) {
// Claim here to avoid the more general unused warning.
InputArg->claim();
- Diag(clang::diag::warn_drv_input_file_unused)
- << InputArg->getAsString(Args)
- << getPhaseName(InitialPhase)
- << FinalPhaseArg->getOption().getName();
+
+ // Special case '-E' warning on a previously preprocessed file to make
+ // more sense.
+ if (InitialPhase == phases::Compile && FinalPhase == phases::Preprocess &&
+ getPreprocessedType(InputType) == types::TY_INVALID)
+ Diag(clang::diag::warn_drv_preprocessed_input_file_unused)
+ << InputArg->getAsString(Args)
+ << FinalPhaseArg->getOption().getName();
+ else
+ Diag(clang::diag::warn_drv_input_file_unused)
+ << InputArg->getAsString(Args)
+ << getPhaseName(InitialPhase)
+ << FinalPhaseArg->getOption().getName();
continue;
}
More information about the cfe-commits
mailing list