Improve driver error message when only running the preprocessor and an input is

already preprocessed.

--
ddunbar@giles:tmp$ touch t.i
ddunbar@giles:tmp$ gcc -E t.i
ddunbar@giles:tmp$ clang -E t.i
clang: warning: t.i: previously preprocessed input unused when '-E' is present
ddunbar@giles:tmp$ 
--

<rdar://problem/6813375> [driver] driver prints confusing message when running -E on preprocessed file

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82120 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-09-17 04:13:26 +00:00
Родитель 03c9d530db
Коммит 634b24563b
2 изменённых файлов: 15 добавлений и 4 удалений

Просмотреть файл

@ -58,6 +58,8 @@ def err_drv_invalid_mfloat_abi : Error<
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<

Просмотреть файл

@ -803,10 +803,19 @@ void Driver::BuildActions(const ArgList &Args, ActionList &Actions) const {
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;
}