diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-12-20 22:01:25 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-12-20 22:01:25 +0000 |
commit | d5e81e59b5a7016b9dc71e1042e620829b4f6875 (patch) | |
tree | 6f15a53a388282863a7075e5db932a46c0ae85e2 /clang/lib/CodeGen/CodeGenAction.cpp | |
parent | d2d1cc5156bd13b78d66e11f4b51fcc7dc4b52af (diff) | |
download | bcm5719-llvm-d5e81e59b5a7016b9dc71e1042e620829b4f6875.tar.gz bcm5719-llvm-d5e81e59b5a7016b9dc71e1042e620829b4f6875.zip |
Override the datalayout in a module with -triple.
This matches llc's behavior.
Before this patch clang would create a TargetInfo base on -triple but a llvm
CodeGen based on the triple in the module.
llvm-svn: 197837
Diffstat (limited to 'clang/lib/CodeGen/CodeGenAction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenAction.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index 047dc53a0b0..6fceabd109f 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -419,9 +419,18 @@ void CodeGenAction::ExecuteAction() { CI.getDiagnostics().Report(Loc, DiagID); return; } + const TargetOptions &TargetOpts = CI.getTargetOpts(); + if (TheModule->getTargetTriple() != TargetOpts.Triple) { + unsigned DiagID = CI.getDiagnostics().getCustomDiagID( + DiagnosticsEngine::Warning, + "overriding the module target triple with %0"); + + CI.getDiagnostics().Report(SourceLocation(), DiagID) << TargetOpts.Triple; + TheModule->setTargetTriple(TargetOpts.Triple); + } EmitBackendOutput(CI.getDiagnostics(), CI.getCodeGenOpts(), - CI.getTargetOpts(), CI.getLangOpts(), + TargetOpts, CI.getLangOpts(), TheModule.get(), BA, OS); return; |