diff options
author | Vedant Kumar <vsk@apple.com> | 2016-07-18 19:56:38 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2016-07-18 19:56:38 +0000 |
commit | bf51e703cfaf006f3f162d837435de4815e9007e (patch) | |
tree | 7a91e21395551a31c536117b0b5ce989d0437722 /clang/lib/Driver/SanitizerArgs.cpp | |
parent | f2030b931caca4c89e680f125a0d8aa2e6593551 (diff) | |
download | bcm5719-llvm-bf51e703cfaf006f3f162d837435de4815e9007e.tar.gz bcm5719-llvm-bf51e703cfaf006f3f162d837435de4815e9007e.zip |
[Driver] Compute effective target triples once per job (NFCI)
Compute an effective target triple exactly once in ConstructJob(), and
then simply pass around references to it. This eliminates wasteful
re-computation of effective triples (e.g in getARMFloatABI()).
Differential Revision: https://reviews.llvm.org/D22290
llvm-svn: 275895
Diffstat (limited to 'clang/lib/Driver/SanitizerArgs.cpp')
-rw-r--r-- | clang/lib/Driver/SanitizerArgs.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp index 30cc3f45c9e..6df5bba565e 100644 --- a/clang/lib/Driver/SanitizerArgs.cpp +++ b/clang/lib/Driver/SanitizerArgs.cpp @@ -602,7 +602,9 @@ static void addIncludeLinkerOption(const ToolChain &TC, CmdArgs.push_back(Args.MakeArgString(LinkerOptionFlag)); } -void SanitizerArgs::addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args, +void SanitizerArgs::addArgs(const ToolChain &TC, + const llvm::Triple &EffectiveTriple, + const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, types::ID InputType) const { // Translate available CoverageFeatures to corresponding clang-cc1 flags. @@ -626,21 +628,24 @@ void SanitizerArgs::addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args, // Instruct the code generator to embed linker directives in the object file // that cause the required runtime libraries to be linked. CmdArgs.push_back(Args.MakeArgString( - "--dependent-lib=" + TC.getCompilerRT(Args, "ubsan_standalone"))); + "--dependent-lib=" + + TC.getCompilerRT(EffectiveTriple, Args, "ubsan_standalone"))); if (types::isCXX(InputType)) CmdArgs.push_back(Args.MakeArgString( - "--dependent-lib=" + TC.getCompilerRT(Args, "ubsan_standalone_cxx"))); + "--dependent-lib=" + + TC.getCompilerRT(EffectiveTriple, Args, "ubsan_standalone_cxx"))); } if (TC.getTriple().isOSWindows() && needsStatsRt()) { - CmdArgs.push_back(Args.MakeArgString("--dependent-lib=" + - TC.getCompilerRT(Args, "stats_client"))); + CmdArgs.push_back(Args.MakeArgString( + "--dependent-lib=" + + TC.getCompilerRT(EffectiveTriple, Args, "stats_client"))); // The main executable must export the stats runtime. // FIXME: Only exporting from the main executable (e.g. based on whether the // translation unit defines main()) would save a little space, but having // multiple copies of the runtime shouldn't hurt. - CmdArgs.push_back(Args.MakeArgString("--dependent-lib=" + - TC.getCompilerRT(Args, "stats"))); + CmdArgs.push_back(Args.MakeArgString( + "--dependent-lib=" + TC.getCompilerRT(EffectiveTriple, Args, "stats"))); addIncludeLinkerOption(TC, Args, CmdArgs, "__sanitizer_stats_register"); } |