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 | 6d984eb5d2d4b4a0fb64504e03c3d3c19c32024a (patch) | |
| tree | b1f2dbaee58cbff2fdff047aa01ad1af6254d352 /lib/CodeGen/CodeGenAction.cpp | |
| parent | 97679f3c8caa3edaea2ce577f9f22809b1bfbb2f (diff) | |
| download | clang-6d984eb5d2d4b4a0fb64504e03c3d3c19c32024a.tar.gz clang-6d984eb5d2d4b4a0fb64504e03c3d3c19c32024a.tar.bz2 clang-6d984eb5d2d4b4a0fb64504e03c3d3c19c32024a.tar.xz | |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197837 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenAction.cpp')
| -rw-r--r-- | lib/CodeGen/CodeGenAction.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenAction.cpp b/lib/CodeGen/CodeGenAction.cpp index 047dc53a0b..6fceabd109 100644 --- a/lib/CodeGen/CodeGenAction.cpp +++ b/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; |
