From 0621cb2e7dfd89f558a045f145f900b62379dcc2 Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Wed, 16 Jul 2014 16:48:33 +0000 Subject: Make clang's rewrite engine a core feature The rewrite facility's footprint is small so it's not worth going to these lengths to support disabling at configure time, particularly since key compiler features now depend on it. Meanwhile the Objective-C rewriters have been moved under the ENABLE_CLANG_ARCMT umbrella for now as they're comparatively heavy and still potentially worth excluding from lightweight builds. Tests are now passing with any combination of feature flags. The flags historically haven't been tested by LLVM's build servers so caveat emptor. llvm-svn: 213171 --- .../lib/FrontendTool/ExecuteCompilerInvocation.cpp | 26 ++++------------------ 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp') diff --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index 76baec7..de864f6 100644 --- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -45,20 +45,12 @@ static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) { case DumpTokens: return new DumpTokensAction(); case EmitAssembly: return new EmitAssemblyAction(); case EmitBC: return new EmitBCAction(); -#ifdef CLANG_ENABLE_REWRITER case EmitHTML: return new HTMLPrintAction(); -#else - case EmitHTML: Action = "EmitHTML"; break; -#endif case EmitLLVM: return new EmitLLVMAction(); case EmitLLVMOnly: return new EmitLLVMOnlyAction(); case EmitCodeGenOnly: return new EmitCodeGenOnlyAction(); case EmitObj: return new EmitObjAction(); -#ifdef CLANG_ENABLE_REWRITER case FixIt: return new FixItAction(); -#else - case FixIt: Action = "FixIt"; break; -#endif case GenerateModule: return new GenerateModuleAction; case GeneratePCH: return new GeneratePCHAction; case GeneratePTH: return new GeneratePTHAction(); @@ -87,25 +79,17 @@ static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) { case PrintDeclContext: return new DeclContextPrintAction(); case PrintPreamble: return new PrintPreambleAction(); case PrintPreprocessedInput: { - if (CI.getPreprocessorOutputOpts().RewriteIncludes) { -#ifdef CLANG_ENABLE_REWRITER + if (CI.getPreprocessorOutputOpts().RewriteIncludes) return new RewriteIncludesAction(); -#else - Action = "RewriteIncludesAction"; - break; -#endif - } return new PrintPreprocessedAction(); } -#ifdef CLANG_ENABLE_REWRITER case RewriteMacros: return new RewriteMacrosAction(); - case RewriteObjC: return new RewriteObjCAction(); case RewriteTest: return new RewriteTestAction(); +#ifdef CLANG_ENABLE_OBJC_REWRITER + case RewriteObjC: return new RewriteObjCAction(); #else - case RewriteMacros: Action = "RewriteMacros"; break; case RewriteObjC: Action = "RewriteObjC"; break; - case RewriteTest: Action = "RewriteTest"; break; #endif #ifdef CLANG_ENABLE_ARCMT case MigrateSource: return new arcmt::MigrateSourceAction(); @@ -121,7 +105,7 @@ static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) { } #if !defined(CLANG_ENABLE_ARCMT) || !defined(CLANG_ENABLE_STATIC_ANALYZER) \ - || !defined(CLANG_ENABLE_REWRITER) + || !defined(CLANG_ENABLE_OBJC_REWRITER) CI.getDiagnostics().Report(diag::err_fe_action_not_available) << Action; return 0; #else @@ -137,11 +121,9 @@ static FrontendAction *CreateFrontendAction(CompilerInstance &CI) { const FrontendOptions &FEOpts = CI.getFrontendOpts(); -#ifdef CLANG_ENABLE_REWRITER if (FEOpts.FixAndRecompile) { Act = new FixItRecompile(Act); } -#endif #ifdef CLANG_ENABLE_ARCMT if (CI.getFrontendOpts().ProgramAction != frontend::MigrateSource && -- cgit v1.1