From: Argyrios Kyrtzidis Date: Tue, 4 Dec 2012 07:26:48 +0000 (+0000) Subject: [libclang] Avoid copying the CompileCommand related strings when wrapping them to... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9f9e0d2ecd4b9dd7ceeb57f662f6d8f549adca63;p=clang [libclang] Avoid copying the CompileCommand related strings when wrapping them to a CXString. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169227 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/libclang/CXCompilationDatabase.cpp b/tools/libclang/CXCompilationDatabase.cpp index 8567d318a2..7216307a96 100644 --- a/tools/libclang/CXCompilationDatabase.cpp +++ b/tools/libclang/CXCompilationDatabase.cpp @@ -110,7 +110,7 @@ clang_CompileCommand_getDirectory(CXCompileCommand CCmd) return createCXString((const char*)NULL); CompileCommand *cmd = static_cast(CCmd); - return createCXString(cmd->Directory); + return createCXString(cmd->Directory.c_str(), /*DupString=*/false); } unsigned @@ -133,7 +133,7 @@ clang_CompileCommand_getArg(CXCompileCommand CCmd, unsigned Arg) if (Arg >= Cmd->CommandLine.size()) return createCXString((const char*)NULL); - return createCXString(Cmd->CommandLine[Arg]); + return createCXString(Cmd->CommandLine[Arg].c_str(), /*DupString=*/false); }