[clang-tools-extra] [clangd] Guard against trivial FunctionProtoTypeLoc when creating inlay hints (PR #143087)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 6 07:33:49 PDT 2025
================
@@ -368,6 +368,14 @@ static FunctionProtoTypeLoc getPrototypeLoc(Expr *Fn) {
}
if (auto F = Target.getAs<FunctionProtoTypeLoc>()) {
+ // In some edge cases the AST can contain a "trivial" FunctionProtoTypeLoc
+ // which has null parameters. Avoid these as they don't contain useful
+ // information.
+ for (const auto *Param : F.getParams()) {
----------------
hokein wrote:
This smells like a clang bug — having a nullptr parameter shouldn’t happen. That said, I’m not objecting to the change here; it makes the tool more robust.
https://github.com/llvm/llvm-project/pull/143087
More information about the cfe-commits
mailing list