Remove improper uses of DiagnosticErrorTrap and hasErrorOccurred.
authorRichard Smith <richard@metafoo.co.uk>
Mon, 8 Jun 2020 21:04:54 +0000 (14:04 -0700)
committerRichard Smith <richard@metafoo.co.uk>
Mon, 8 Jun 2020 21:19:57 +0000 (14:19 -0700)
commit56a872947acca7635ca969f39f50062f2f779af0
tree889c587ed785c9d24a0104f9616a7c02f97fe069
parentf07b3d41e73979e46f468dbaa27866bbb53c1ab6
Remove improper uses of DiagnosticErrorTrap and hasErrorOccurred.

DiagnosticErrorTrap is usually inappropriate because it indicates
whether an error message was rendered in a given region (and is
therefore affected by -ferror-limit and by suppression of errors if we
see an invalid declaration).

hasErrorOccurred() is usually inappropriate because it indicates
whethere an "error:" message was displayed, regardless of whether the
message was a warning promoted to an error, and therefore depends on
things like -Werror that are usually irrelevant.

Where applicable, CodeSynthesisContexts are used to attach notes to
the first diagnostic produced in a region of code, isnstead of using an
error trap and then attaching a note to whichever diagnostic happened to
be produced last (or suppressing the note if the final diagnostic is a
disabled warning!).

This is mostly NFC.
13 files changed:
clang/include/clang/Basic/Diagnostic.h
clang/include/clang/Sema/Scope.h
clang/include/clang/Sema/ScopeInfo.h
clang/include/clang/Sema/Sema.h
clang/lib/Frontend/FrontendActions.cpp
clang/lib/Parse/ParseExprCXX.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/Parser/cxx2a-concepts-requires-expr.cpp