@@ -33,21 +33,21 @@ template <typename InputNode>
3333using ResolveFnT = std::function<std::vector<const NamedDecl *>(
3434 const HeuristicResolver *, InputNode)>;
3535
36- std::string format_error (const clang::StoredDiagnostic * D) {
36+ std::string format_error (const clang::StoredDiagnostic & D) {
3737 std::ostringstream Msg{};
38- if (D-> getLevel () == DiagnosticsEngine::Level::Ignored)
38+ if (D. getLevel () == DiagnosticsEngine::Level::Ignored)
3939 Msg << " Ignored: " ;
40- if (D-> getLevel () == DiagnosticsEngine::Level::Note)
40+ if (D. getLevel () == DiagnosticsEngine::Level::Note)
4141 Msg << " Note: " ;
42- if (D-> getLevel () == DiagnosticsEngine::Level::Remark)
42+ if (D. getLevel () == DiagnosticsEngine::Level::Remark)
4343 Msg << " Remark: " ;
44- if (D-> getLevel () == DiagnosticsEngine::Level::Warning)
44+ if (D. getLevel () == DiagnosticsEngine::Level::Warning)
4545 Msg << " Warning: " ;
46- if (D-> getLevel () == DiagnosticsEngine::Level::Error)
46+ if (D. getLevel () == DiagnosticsEngine::Level::Error)
4747 Msg << " Error: " ;
48- if (D-> getLevel () == DiagnosticsEngine::Level::Fatal)
48+ if (D. getLevel () == DiagnosticsEngine::Level::Fatal)
4949 Msg << " Fatal: " ;
50- Msg << D-> getID () << " : " << D-> getMessage ().str ();
50+ Msg << D. getID () << " : " << D. getMessage ().str ();
5151 return Msg.str ();
5252}
5353
@@ -61,14 +61,10 @@ template <typename InputNode, typename ParamT, typename InputMatcher,
6161 typename ... OutputMatchers>
6262void expectResolution (llvm::StringRef Code, ResolveFnT<ParamT> ResolveFn,
6363 const InputMatcher &IM, const OutputMatchers &...OMS) {
64- llvm::SmallSet<unsigned int , 16 > IgnoredDiagnostics{};
6564 auto TU = tooling::buildASTFromCodeWithArgs (Code, {" -std=c++23" });
6665
67- for (auto D = TU->stored_diag_begin (), DEnd = TU->stored_diag_end ();
68- D != DEnd; ++D) {
69- EXPECT_TRUE (D->getLevel () < DiagnosticsEngine::Warning ||
70- IgnoredDiagnostics.contains (D->getID ()))
71- << format_error (D);
66+ for (const auto &D : TU->storedDiagnostics ()) {
67+ EXPECT_TRUE (D.getLevel () < DiagnosticsEngine::Error) << format_error (D);
7268 }
7369
7470 auto &Ctx = TU->getASTContext ();
0 commit comments