[clang] 09ff2e5 - [Driver] Avoid unsafe Twine local variable after D136707

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 26 10:58:26 PDT 2022


Author: Fangrui Song
Date: 2022-10-26T10:58:22-07:00
New Revision: 09ff2e567a5f9bf9f3c82390020a5bd995feeaaf

URL: https://github.com/llvm/llvm-project/commit/09ff2e567a5f9bf9f3c82390020a5bd995feeaaf
DIFF: https://github.com/llvm/llvm-project/commit/09ff2e567a5f9bf9f3c82390020a5bd995feeaaf.diff

LOG: [Driver] Avoid unsafe Twine local variable after D136707

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Gnu.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index b2b71711c9d5..ea19e7af41bd 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -977,8 +977,7 @@ void tools::gnutools::Assembler::ConstructJob(Compilation &C,
       Args.AddLastArg(CmdArgs, options::OPT_g_Flag);
 
       unsigned DwarfVersion = getDwarfVersion(getToolChain(), Args);
-      Twine DV = "-gdwarf-" + Twine(DwarfVersion);
-      CmdArgs.push_back(Args.MakeArgString(DV));
+      CmdArgs.push_back(Args.MakeArgString("-gdwarf-" + Twine(DwarfVersion)));
     }
 
   const char *Exec =


        


More information about the cfe-commits mailing list