From: Kovarththanan Rajaratnam Date: Sat, 28 Nov 2009 07:52:34 +0000 (+0000) Subject: Move program actions implications to clang::InitializeFrontendOptions which already... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d06ab9d4427dff42986497c3ac67367d28e50883;p=clang Move program actions implications to clang::InitializeFrontendOptions which already contains such logic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90029 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/clang-cc/Options.cpp b/tools/clang-cc/Options.cpp index 5a298bb246..ac555ab9a7 100644 --- a/tools/clang-cc/Options.cpp +++ b/tools/clang-cc/Options.cpp @@ -831,13 +831,8 @@ void clang::InitializeDiagnosticOptions(DiagnosticOptions &Opts) { void clang::InitializeFrontendOptions(FrontendOptions &Opts) { using namespace frontendoptions; - // Select program action. Opts.ProgramAction = ProgAction; - if (PluginActionName.getPosition()) { - Opts.ProgramAction = frontend::PluginAction; - Opts.ActionName = PluginActionName; - } - + Opts.ActionName = PluginActionName; Opts.CodeCompletionAt = CodeCompletionAt; Opts.DebugCodeCompletionPrinter = !NoCodeCompletionDebugPrinter; Opts.DisableFree = DisableFree; @@ -850,6 +845,14 @@ void clang::InitializeFrontendOptions(FrontendOptions &Opts) { Opts.ShowTimers = TimeReport; Opts.ViewClassInheritance = InheritanceViewCls; + // Enforce certain program action implications. + if (!Opts.ActionName.empty()) + Opts.ProgramAction = frontend::PluginAction; + if (!Opts.ViewClassInheritance.empty()) + Opts.ProgramAction = frontend::InheritanceView; + if (!Opts.FixItLocations.empty()) + Opts.ProgramAction = frontend::FixIt; + // '-' is the default input if none is given. if (InputFilenames.empty()) { FrontendOptions::InputKind IK = InputType; diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp index 02eddc88f2..3dfe51190d 100644 --- a/tools/clang-cc/clang-cc.cpp +++ b/tools/clang-cc/clang-cc.cpp @@ -246,12 +246,6 @@ int main(int argc, char **argv) { if (Clang.getFrontendOpts().ShowTimers) ClangFrontendTimer = new llvm::Timer("Clang front-end time"); - // Enforce certain implications. - if (!Clang.getFrontendOpts().ViewClassInheritance.empty()) - Clang.getFrontendOpts().ProgramAction = frontend::InheritanceView; - if (!Clang.getFrontendOpts().FixItLocations.empty()) - Clang.getFrontendOpts().ProgramAction = frontend::FixIt; - for (unsigned i = 0, e = Clang.getFrontendOpts().Inputs.size(); i != e; ++i) { const std::string &InFile = Clang.getFrontendOpts().Inputs[i].second;