[clang] [clang][Sema] Don't emit 'declared here' note for builtin functions with no decl in source (PR #93394)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Sat May 25 23:08:02 PDT 2024


================
@@ -5897,6 +5897,16 @@ void Sema::diagnoseTypo(const TypoCorrection &Correction,
 
   NamedDecl *ChosenDecl =
       Correction.isKeyword() ? nullptr : Correction.getFoundDecl();
+
+  // For builtin functions which aren't declared anywhere in source,
+  // don't emit the "declared here" note.
+  if (auto *FD = dyn_cast_or_null<FunctionDecl>(ChosenDecl);
----------------
tbaederr wrote:

```suggestion
  if (const auto *FD = dyn_cast_if_present<FunctionDecl>(ChosenDecl);
```

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


More information about the cfe-commits mailing list