Author: jkorous Date: Fri Sep 6 17:59:13 2019 New Revision: 371279 URL: http://llvm.org/viewvc/llvm-project?rev=371279&view=rev Log: [clang][DependencyFileGenerator] Fix missing -MT option handling
Targets in DependencyFileGenerator don't necessarily come from -MT option. Differential Revision: https://reviews.llvm.org/D67308 Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Frontend/DependencyFile.cpp Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=371279&r1=371278&r2=371279&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Sep 6 17:59:13 2019 @@ -3406,6 +3406,11 @@ bool CompilerInvocation::CreateFromArgs( Success &= ParseAnalyzerArgs(*Res.getAnalyzerOpts(), Args, Diags); Success &= ParseMigratorArgs(Res.getMigratorOpts(), Args); ParseDependencyOutputArgs(Res.getDependencyOutputOpts(), Args); + if (!Res.getDependencyOutputOpts().OutputFile.empty() && + Res.getDependencyOutputOpts().Targets.empty()) { + Diags.Report(diag::err_fe_dependency_file_requires_MT); + Success = false; + } Success &= ParseDiagnosticArgs(Res.getDiagnosticOpts(), Args, &Diags, false /*DefaultDiagColor*/, false /*DefaultShowOpt*/); Modified: cfe/trunk/lib/Frontend/DependencyFile.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DependencyFile.cpp?rev=371279&r1=371278&r2=371279&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/DependencyFile.cpp (original) +++ cfe/trunk/lib/Frontend/DependencyFile.cpp Fri Sep 6 17:59:13 2019 @@ -192,11 +192,6 @@ DependencyFileGenerator::DependencyFileG } void DependencyFileGenerator::attachToPreprocessor(Preprocessor &PP) { - if (Targets.empty()) { - PP.getDiagnostics().Report(diag::err_fe_dependency_file_requires_MT); - return; - } - // Disable the "file not found" diagnostic if the -MG option was given. if (AddMissingHeaderDeps) PP.SetSuppressIncludeNotFoundError(true); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits