r257947 - Avoid self-assignment of SmallString, trigger UB behavior down the road.
Joerg Sonnenberger via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 16 06:51:11 PST 2016
Hello Richard,
can this be merged into 3.8? It creates some trivial noise under
valgrind.
Joerg
On Fri, Jan 15, 2016 at 10:29:34PM -0000, Joerg Sonnenberger via cfe-commits wrote:
> Author: joerg
> Date: Fri Jan 15 16:29:34 2016
> New Revision: 257947
>
> URL: http://llvm.org/viewvc/llvm-project?rev=257947&view=rev
> Log:
> Avoid self-assignment of SmallString, trigger UB behavior down the road.
>
> Modified:
> cfe/trunk/tools/driver/driver.cpp
>
> Modified: cfe/trunk/tools/driver/driver.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=257947&r1=257946&r2=257947&view=diff
> ==============================================================================
> --- cfe/trunk/tools/driver/driver.cpp (original)
> +++ cfe/trunk/tools/driver/driver.cpp Fri Jan 15 16:29:34 2016
> @@ -290,9 +290,9 @@ static void SetInstallDir(SmallVectorImp
> if (CanonicalPrefixes)
> llvm::sys::fs::make_absolute(InstalledPath);
>
> - InstalledPath = llvm::sys::path::parent_path(InstalledPath);
> - if (llvm::sys::fs::exists(InstalledPath.c_str()))
> - TheDriver.setInstalledDir(InstalledPath);
> + StringRef InstalledPathParent(llvm::sys::path::parent_path(InstalledPath));
> + if (llvm::sys::fs::exists(InstalledPathParent))
> + TheDriver.setInstalledDir(InstalledPathParent);
> }
>
> static int ExecuteCC1Tool(ArrayRef<const char *> argv, StringRef Tool) {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list