};
static llvm::cl::opt<unsigned, false, OptLevelParser>
OptLevel("O", llvm::cl::Prefix,
- llvm::cl::desc("Optimization level"),
- llvm::cl::init(0));
+ llvm::cl::desc("Optimization level"));
static llvm::cl::opt<bool>
OptSize("Os", llvm::cl::desc("Optimize for size"));
static llvm::cl::opt<int>
StackProtector("stack-protector",
- llvm::cl::desc("Enable stack protectors"),
- llvm::cl::init(-1));
+ llvm::cl::desc("Enable stack protectors"));
static llvm::cl::opt<LangOptions::VisibilityMode>
SymbolVisibility("fvisibility",
clEnumValEnd));
static llvm::cl::opt<unsigned>
-TemplateDepth("ftemplate-depth", llvm::cl::init(99),
+TemplateDepth("ftemplate-depth",
llvm::cl::desc("Maximum depth of recursive template "
"instantiation"));
llvm::cl::desc("Set directory to include search path with prefix"));
static llvm::cl::opt<std::string>
-isysroot("isysroot", llvm::cl::value_desc("dir"), llvm::cl::init("/"),
+isysroot("isysroot", llvm::cl::value_desc("dir"),
llvm::cl::desc("Set the system root directory (usually /)"));
static llvm::cl::opt<bool>
using namespace codegenoptions;
// -Os implies -O2
- Opts.OptimizationLevel = OptSize ? 2 : OptLevel;
+ unsigned Opt = OptLevel.getPosition() ? OptLevel : 0;
+ Opts.OptimizationLevel = OptSize ? 2 : Opt;
// We must always run at least the always inlining pass.
Opts.Inlining = (Opts.OptimizationLevel > 1) ? CodeGenOptions::NormalInlining
llvm::StringRef BuiltinIncludePath) {
using namespace headersearchoptions;
- Opts.Sysroot = isysroot;
+ if (isysroot.getPosition())
+ Opts.Sysroot = isysroot;
Opts.Verbose = Verbose;
// Handle -I... and -F... options, walking the lists in parallel.
Options.MathErrno = !NoMathErrno;
- Options.InstantiationDepth = TemplateDepth;
+ if (TemplateDepth.getPosition())
+ Options.InstantiationDepth = TemplateDepth;
// Override the default runtime if the user requested it.
if (GNURuntime)
Options.EmitAllDecls = 1;
// The __OPTIMIZE_SIZE__ define is tied to -Oz, which we don't support.
+ unsigned Opt =
+ codegenoptions::OptLevel.getPosition() ? codegenoptions::OptLevel : 0;
Options.OptimizeSize = 0;
- Options.Optimize = codegenoptions::OptSize || codegenoptions::OptLevel;
+ Options.Optimize = codegenoptions::OptSize || Opt;
assert(PICLevel <= 2 && "Invalid value for -pic-level");
Options.PICLevel = PICLevel;
// inlining enabled.
//
// FIXME: This is affected by other options (-fno-inline).
- Options.NoInline = !codegenoptions::OptLevel;
+ Options.NoInline = !Opt;
Options.Static = StaticDefine;
- switch (StackProtector) {
- default:
- assert(StackProtector <= 2 && "Invalid value for -stack-protector");
- case -1: break;
- case 0: Options.setStackProtectorMode(LangOptions::SSPOff); break;
- case 1: Options.setStackProtectorMode(LangOptions::SSPOn); break;
- case 2: Options.setStackProtectorMode(LangOptions::SSPReq); break;
+ if (StackProtector.getPosition()) {
+ switch (StackProtector) {
+ default:
+ assert(0 && "Invalid value for -stack-protector");
+ case 0: Options.setStackProtectorMode(LangOptions::SSPOff); break;
+ case 1: Options.setStackProtectorMode(LangOptions::SSPOn); break;
+ case 2: Options.setStackProtectorMode(LangOptions::SSPReq); break;
+ }
}
if (MainFileName.getPosition())