From: Yaron Keren Date: Mon, 21 Oct 2013 20:07:37 +0000 (+0000) Subject: Fix string assignment, David Blaikie suggestion. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=921ac4d6dfab47090b167dc092133d747a18c71a;p=clang Fix string assignment, David Blaikie suggestion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193116 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 1feccf18e0..540d4054c5 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -37,6 +37,7 @@ #include "llvm/IR/Module.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/Path.h" using namespace clang; using namespace clang::CodeGen; @@ -340,8 +341,11 @@ void CGDebugInfo::CreateCompileUnit() { std::string MainFileDir; if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) { MainFileDir = MainFile->getDir()->getName(); - if (MainFileDir != ".") - MainFileName = MainFileDir + "/" + MainFileName; + if (MainFileDir != ".") { + llvm::SmallString<1024> MainFileDirSS(MainFileDir); + llvm::sys::path::append(MainFileDirSS, MainFileName); + MainFileName = MainFileDirSS.str(); + } } // Save filename string.