[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 8567d31..7216307 100644
--- a/tools/libclang/CXCompilationDatabase.cpp
+++ b/tools/libclang/CXCompilationDatabase.cpp
@@ -110,7 +110,7 @@
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 @@
if (Arg >= Cmd->CommandLine.size())
return createCXString((const char*)NULL);
- return createCXString(Cmd->CommandLine[Arg]);
+ return createCXString(Cmd->CommandLine[Arg].c_str(), /*DupString=*/false);
}