[clang] [clang][analyzer] Forward CTU-import failure conditions (PR #189064)

Arseniy Zaostrovnykh via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 30 05:40:04 PDT 2026


================
@@ -649,13 +732,23 @@ CrossTranslationUnitContext::ASTLoader::loadFromSource(
 }
 
 llvm::Expected<InvocationListTy>
-parseInvocationList(StringRef FileContent, llvm::sys::path::Style PathStyle) {
+parseInvocationList(StringRef FileContent, llvm::sys::path::Style PathStyle,
+                    StringRef FilePath) {
   InvocationListTy InvocationList;
 
   /// LLVM YAML parser is used to extract information from invocation list file.
   llvm::SourceMgr SM;
   llvm::yaml::Stream InvocationFile(FileContent, SM);
 
+  auto getLine = [&SM](const llvm::yaml::Node *N) -> int {
+    return N ? SM.FindLineNumber(N->getSourceRange().Start) : 0;
+  };
+  auto wrongFormat = [&](const llvm::yaml::Node *N) {
+    return llvm::make_error<IndexError>(
+        index_error_code::invocation_list_wrong_format, std::string(FilePath),
----------------
necto wrote:

59c602e84df5 Use member function instead of c-style type conversion


https://github.com/llvm/llvm-project/pull/189064


More information about the cfe-commits mailing list