[clang] Add error check for HeuristicResolver (PR #155561)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 30 16:10:15 PDT 2025


================
@@ -31,6 +33,24 @@ template <typename InputNode>
 using ResolveFnT = std::function<std::vector<const NamedDecl *>(
     const HeuristicResolver *, InputNode)>;
 
+std::string format_error(const clang::StoredDiagnostic &D) {
+  std::ostringstream Msg{};
+  if (D.getLevel() == DiagnosticsEngine::Level::Ignored)
----------------
HighCommander4 wrote:

We don't actually need the first four cases, and I'm not sure the distinction between the remaining two (`Error` vs. `Fatal`) is that important; we could just skip printing the level?

On the other hand, we could print a short message prefix that provides some context, such as "Unexpected error diagnostic while building AST for test code:".

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


More information about the cfe-commits mailing list