[clang] [clang][analyzer] Forward CTU-import failure conditions (PR #189064)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 30 04:31:53 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),
----------------
steakhal wrote:
I think it's more llvm-idiomatic to use the member conversion instead of an explicit conversion.
```suggestion
index_error_code::invocation_list_wrong_format, FilePath.str(),
```
Same goes for the other `std::string(X)` of `llvm::StringRef`
https://github.com/llvm/llvm-project/pull/189064
More information about the cfe-commits
mailing list