diff options
Diffstat (limited to 'clang/unittests/Tooling/CompilationDatabaseTest.cpp')
-rw-r--r-- | clang/unittests/Tooling/CompilationDatabaseTest.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp index 9e23428..168a1d6 100644 --- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp @@ -172,13 +172,15 @@ TEST(JSONCompilationDatabase, GetAllCompileCommands) { } static CompileCommand findCompileArgsInJsonDatabase(StringRef FileName, - StringRef JSONDatabase, + std::string JSONDatabase, std::string &ErrorMessage) { std::unique_ptr<CompilationDatabase> Database( JSONCompilationDatabase::loadFromBuffer(JSONDatabase, ErrorMessage, JSONCommandLineSyntax::Gnu)); if (!Database) return CompileCommand(); + // Overwrite the string to verify we're not reading from it later. + JSONDatabase.assign(JSONDatabase.size(), '*'); std::vector<CompileCommand> Commands = Database->getCompileCommands(FileName); EXPECT_LE(Commands.size(), 1u); if (Commands.empty()) |