]> granicus.if.org Git - clang/commitdiff
[libclang] Avoid copying the CompileCommand related strings when wrapping them to...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 4 Dec 2012 07:26:48 +0000 (07:26 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 4 Dec 2012 07:26:48 +0000 (07:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169227 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CXCompilationDatabase.cpp

index 8567d318a275f87d90cf20d03850c57e667b8cda..7216307a96a23016663fefb29868ab48fbdd7daf 100644 (file)
@@ -110,7 +110,7 @@ clang_CompileCommand_getDirectory(CXCompileCommand CCmd)
     return createCXString((const char*)NULL);
 
   CompileCommand *cmd = static_cast<CompileCommand *>(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);
 }