]> granicus.if.org Git - clang/commitdiff
Let clang-check actually use the Directory entry in the json file.
authorNico Weber <nicolasweber@gmx.de>
Sat, 14 May 2011 21:20:23 +0000 (21:20 +0000)
committerNico Weber <nicolasweber@gmx.de>
Sat, 14 May 2011 21:20:23 +0000 (21:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131367 91177308-0d34-0410-b5e6-96231b3b80d8

examples/Tooling/ClangCheck.cpp
lib/Tooling/JsonCompileCommandLineDatabase.h

index 0dfa53d44e642f5cbbcd6626df6ba23427e72eba..db24ec31eccfaa2a31f12c80d43d737c540fed7e 100644 (file)
@@ -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(),
index 9e776d60010dfa9c03f269b5eea5694ae6557ebb..ea7cf0e6e1524ddbfc2da0f325a0074e821af3e6 100644 (file)
@@ -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.