On 20/12/2013 21:40, Alp Toker wrote:
On 20/12/2013 21:02, Rafael Espíndola wrote:
Following IRC discussion, the attached patch gives preference to
-triple to match llc's behavior.
Cheers,
Rafael
--- a/lib/CodeGen/CodeGenAction.cpp
+++ b/lib/CodeGen/CodeGenAction.cpp
@@ -419,9 +419,18 @@ void CodeGenAction::ExecuteAction() {
CI.getDiagnostics().Report(Loc, DiagID);
return;
}
+ TargetOptions &TargetOpts = CI.getTargetOpts();
Constify this to make it clear to the casual reader that TargetOpts is
immutable.
+ if (TheModule->getTargetTriple() != TargetOpts.Triple) {
+ std::string Msg = "Forcing the target triple to " +
TargetOpts.Triple;
Caps. As for the message, I'd say "overriding the module target triple
with %0"
No need for std::string either after that change, just pass in the
message directly to getCustomDiagID().
Alp.
+ unsigned DiagID =
+ CI.getDiagnostics().getCustomDiagID(DiagnosticsEngine::Warning, Msg);
+
+ CI.getDiagnostics().Report(SourceLocation(), DiagID);
DiagIDs are hashed and uniqued, so pass in TargetOpts.Triple as a diag
argument here instead.
Alp.
+ TheModule->setTargetTriple(TargetOpts.Triple);
+ }
EmitBackendOutput(CI.getDiagnostics(), CI.getCodeGenOpts(),
- CI.getTargetOpts(), CI.getLangOpts(),
+ TargetOpts, CI.getLangOpts(),
TheModule.get(),
BA, OS);
return;
--
http://www.nuanti.com
the browser experts
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits