[PATCH] D51183: [clang-query] Continue if compilation command not found for some files

George Karpenkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 4 18:06:17 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL348328: [clang-query] Continue if compilation command not found for some files (authored by george.karpenkov, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51183?vs=176440&id=176751#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D51183/new/

https://reviews.llvm.org/D51183

Files:
  clang-tools-extra/trunk/clang-query/tool/ClangQuery.cpp


Index: clang-tools-extra/trunk/clang-query/tool/ClangQuery.cpp
===================================================================
--- clang-tools-extra/trunk/clang-query/tool/ClangQuery.cpp
+++ clang-tools-extra/trunk/clang-query/tool/ClangQuery.cpp
@@ -100,8 +100,19 @@
   ClangTool Tool(OptionsParser.getCompilations(),
                  OptionsParser.getSourcePathList());
   std::vector<std::unique_ptr<ASTUnit>> ASTs;
-  if (Tool.buildASTs(ASTs) != 0)
+  int Status = Tool.buildASTs(ASTs);
+  int ASTStatus = 0;
+  if (Status == 1) {
+    // Building ASTs failed.
     return 1;
+  } else if (Status == 2) {
+    ASTStatus |= 1;
+    llvm::errs() << "Failed to build AST for some of the files, "
+                 << "results may be incomplete."
+                 << "\n";
+  } else {
+    assert(Status == 0 && "Unexpected status returned");
+  }
 
   QuerySession QS(ASTs);
 
@@ -134,5 +145,5 @@
     }
   }
 
-  return 0;
+  return ASTStatus;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51183.176751.patch
Type: text/x-patch
Size: 955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181205/599ff62d/attachment.bin>


More information about the llvm-commits mailing list