aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-10 18:47:35 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-10 18:47:35 +0000
commitfcb0c3b39b2bf3390ea21749b4a1a8946aa927ed (patch)
tree12eae44fe0058e9f47ee82da56217fb8215024d8
parent8d35314401047092eb97b989ed930967ed9e8ccc (diff)
Factor out parts of InitializeCompileOptions that depend on the LangOptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86696 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/clang-cc/clang-cc.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index d177bab185..c0719bf576 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -1299,7 +1299,6 @@ static void ComputeFeatureMap(TargetInfo &Target,
}
static void InitializeCompileOptions(CompileOptions &Opts,
- const LangOptions &LangOpts,
const llvm::StringMap<bool> &Features) {
using namespace codegenoptions;
Opts.OptimizeSize = OptSize;
@@ -1314,7 +1313,7 @@ static void InitializeCompileOptions(CompileOptions &Opts,
: CompileOptions::OnlyAlwaysInlining;
Opts.UnrollLoops = (Opts.OptimizationLevel > 1 && !OptSize);
- Opts.SimplifyLibCalls = !LangOpts.NoBuiltin;
+ Opts.SimplifyLibCalls = 1;
#ifdef NDEBUG
Opts.VerifyModule = 0;
@@ -1331,7 +1330,7 @@ static void InitializeCompileOptions(CompileOptions &Opts,
Opts.Features.push_back(Name);
}
- Opts.NoCommon = NoCommon | LangOpts.CPlusPlus;
+ Opts.NoCommon = NoCommon;
// Handle -ftime-report.
Opts.TimePasses = TimeReport;
@@ -1342,6 +1341,14 @@ static void InitializeCompileOptions(CompileOptions &Opts,
Opts.MergeAllConstants = !NoMergeConstants;
}
+static void FinalizeCompileOptions(CompileOptions &Opts,
+ const LangOptions &Lang) {
+ if (Lang.NoBuiltin)
+ Opts.SimplifyLibCalls = 0;
+ if (Lang.CPlusPlus)
+ Opts.NoCommon = 1;
+}
+
//===----------------------------------------------------------------------===//
// Fix-It Options
//===----------------------------------------------------------------------===//
@@ -2157,6 +2164,10 @@ static void ConstructCompilerInvocation(CompilerInvocation &Opts,
// Compute the feature set, which may effect the language.
ComputeFeatureMap(Target, Opts.getTargetFeatures());
+ // Initialize backend options, which may also be used to key some language
+ // options.
+ InitializeCompileOptions(Opts.getCompileOpts(), Opts.getTargetFeatures());
+
// Initialize language options.
LangOptions LangInfo;
@@ -2174,9 +2185,8 @@ static void ConstructCompilerInvocation(CompilerInvocation &Opts,
// Initialize the other preprocessor options.
InitializePreprocessorOptions(Opts.getPreprocessorOpts());
- // Initialize backend options.
- InitializeCompileOptions(Opts.getCompileOpts(), Opts.getLangOpts(),
- Opts.getTargetFeatures());
+ // Finalize, some code generation options.
+ FinalizeCompileOptions(Opts.getCompileOpts(), Opts.getLangOpts());
}
int main(int argc, char **argv) {