summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/examples/Tooling/ClangCheck.cpp6
-rw-r--r--clang/lib/Tooling/JsonCompileCommandLineDatabase.h2
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/examples/Tooling/ClangCheck.cpp b/clang/examples/Tooling/ClangCheck.cpp
index 0dfa53d44e6..db24ec31ecc 100644
--- a/clang/examples/Tooling/ClangCheck.cpp
+++ b/clang/examples/Tooling/ClangCheck.cpp
@@ -93,6 +93,12 @@ int main(int argc, char **argv) {
clang::tooling::FindCompileArgsInJsonDatabase(
File.str(), JsonDatabase->getBuffer(), ErrorMessage);
if (!LookupResult.CommandLine.empty()) {
+ if (LookupResult.Directory.size()) {
+ // FIXME: What should happen if CommandLine includes -working-directory
+ // as well?
+ LookupResult.CommandLine.push_back(
+ "-working-directory=" + LookupResult.Directory);
+ }
if (!clang::tooling::RunToolWithFlags(
new clang::SyntaxOnlyAction,
LookupResult.CommandLine.size(),
diff --git a/clang/lib/Tooling/JsonCompileCommandLineDatabase.h b/clang/lib/Tooling/JsonCompileCommandLineDatabase.h
index 9e776d60010..ea7cf0e6e15 100644
--- a/clang/lib/Tooling/JsonCompileCommandLineDatabase.h
+++ b/clang/lib/Tooling/JsonCompileCommandLineDatabase.h
@@ -78,7 +78,7 @@ class JsonCompileCommandLineParser {
CompileCommandHandler *CommandHandler);
/// \brief Parses the specified input. Returns true if no parsing errors were
- /// foudn.
+ /// found.
bool Parse();
/// \brief Returns an error message if Parse() returned false previously.
OpenPOWER on IntegriCloud