r309912 - Update for llvm change.
Rafael Espindola via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 2 19:16:29 PDT 2017
Author: rafael
Date: Wed Aug 2 19:16:28 2017
New Revision: 309912
URL: http://llvm.org/viewvc/llvm-project?rev=309912&view=rev
Log:
Update for llvm change.
Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp
Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=309912&r1=309911&r2=309912&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Wed Aug 2 19:16:28 2017
@@ -335,16 +335,18 @@ static CodeGenOpt::Level getCGOptLevel(c
}
}
-static llvm::CodeModel::Model getCodeModel(const CodeGenOptions &CodeGenOpts) {
- unsigned CodeModel =
- llvm::StringSwitch<unsigned>(CodeGenOpts.CodeModel)
- .Case("small", llvm::CodeModel::Small)
- .Case("kernel", llvm::CodeModel::Kernel)
- .Case("medium", llvm::CodeModel::Medium)
- .Case("large", llvm::CodeModel::Large)
- .Case("default", llvm::CodeModel::Default)
- .Default(~0u);
+static Optional<llvm::CodeModel::Model>
+getCodeModel(const CodeGenOptions &CodeGenOpts) {
+ unsigned CodeModel = llvm::StringSwitch<unsigned>(CodeGenOpts.CodeModel)
+ .Case("small", llvm::CodeModel::Small)
+ .Case("kernel", llvm::CodeModel::Kernel)
+ .Case("medium", llvm::CodeModel::Medium)
+ .Case("large", llvm::CodeModel::Large)
+ .Case("default", ~1u)
+ .Default(~0u);
assert(CodeModel != ~0u && "invalid code model!");
+ if (CodeModel == ~1u)
+ return None;
return static_cast<llvm::CodeModel::Model>(CodeModel);
}
@@ -658,7 +660,7 @@ void EmitAssemblyHelper::CreateTargetMac
return;
}
- llvm::CodeModel::Model CM = getCodeModel(CodeGenOpts);
+ Optional<llvm::CodeModel::Model> CM = getCodeModel(CodeGenOpts);
std::string FeaturesStr =
llvm::join(TargetOpts.Features.begin(), TargetOpts.Features.end(), ",");
llvm::Reloc::Model RM = getRelocModel(CodeGenOpts);
More information about the cfe-commits
mailing list