[clang] 1beb00d - Fix use-after-scope in 7209f83112db caught by the sanitizer bots

Daniel Sanders via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 3 16:55:11 PDT 2020


Author: Daniel Sanders
Date: 2020-08-03T16:55:00-07:00
New Revision: 1beb00db1f5197efb73f839da681b8e439f37628

URL: https://github.com/llvm/llvm-project/commit/1beb00db1f5197efb73f839da681b8e439f37628
DIFF: https://github.com/llvm/llvm-project/commit/1beb00db1f5197efb73f839da681b8e439f37628.diff

LOG: Fix use-after-scope in 7209f83112db caught by the sanitizer bots

Added: 
    

Modified: 
    clang/lib/Driver/Driver.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 35263fbe1b2d..e6a267621d8b 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -4601,12 +4601,12 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
   }
 
   SmallString<128> BasePath(BaseInput);
+  SmallString<128> ExternalPath("");
   StringRef BaseName;
 
   // Dsymutil actions should use the full path.
   if (isa<DsymutilJobAction>(JA) && C.getArgs().hasArg(options::OPT_dsym_dir)) {
-    SmallString<128> ExternalPath(
-        C.getArgs().getLastArg(options::OPT_dsym_dir)->getValue());
+    ExternalPath += C.getArgs().getLastArg(options::OPT_dsym_dir)->getValue();
     // We use posix style here because the tests (specifically
     // darwin-dsymutil.c) demonstrate that posix style paths are acceptable
     // even on Windows and if we don't then the similar test covering this


        


More information about the cfe-commits mailing list