[patch] Assert that clang's datalayout strings are in sync with llvm's
Alp Toker
alp at nuanti.com
Fri Dec 20 13:40:37 PST 2013
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"
> + 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
More information about the cfe-commits
mailing list