From: Daniel Dunbar Date: Thu, 12 Nov 2009 15:42:53 +0000 (+0000) Subject: Disallow FIX-ITs when generating code. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e0c4ff2fcef19a84afaacf9eff71636b3bdad071;p=clang Disallow FIX-ITs when generating code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86990 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index a3d7906255..130628b5d4 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -18,10 +18,14 @@ def err_fe_error_reading_stdin : Error<"error reading stdin">; def err_fe_error_backend : Error<"error in backend: %0">, DefaultFatal; def err_fe_invalid_ast_file : Error<"invalid AST file: '%0'">, DefaultFatal; def err_fe_invalid_ast_action : Error<"invalid action for AST input">, DefaultFatal; -def err_fe_invalid_code_complete_file +def err_fe_invalid_code_complete_file : Error<"cannot locate code-completion file %0">, DefaultFatal; def err_fe_dependency_file_requires_MT : Error< "-dependency-file requires at least one -MT option">; +def err_fe_incompatible_options : Error< + "'%0' cannot be used with '%1'">, DefaultFatal; +def err_fe_no_fixit_and_codegen : Error< + "FIX-ITs cannot be applied when generating code">; def note_fixit_applied : Note<"FIX-IT applied suggested code changes">; def note_fixit_in_macro : Note< diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp index fdac9b9501..e78cc9387a 100644 --- a/tools/clang-cc/clang-cc.cpp +++ b/tools/clang-cc/clang-cc.cpp @@ -558,6 +558,12 @@ static ASTConsumer *CreateConsumerAction(const CompilerInvocation &CompOpts, OS.reset(ComputeOutFile(CompOpts, InFile, "bc", true, OutPath)); } + // Fix-its can change semantics, disallow with any IRgen action. + if (FixItAll || !FixItAtLocations.empty()) { + PP.getDiagnostics().Report(diag::err_fe_no_fixit_and_codegen); + return 0; + } + return CreateBackendConsumer(Act, PP.getDiagnostics(), PP.getLangOptions(), CompOpts.getCompileOpts(), InFile, OS.get(), Context);