================
@@ -9247,9 +9247,12 @@ bool Sema::AddOverriddenMethods(CXXRecordDecl *DC,
CXXMethodDecl *MD) {
continue;
if (Overridden.insert(BaseMD).second) {
MD->addOverriddenMethod(BaseMD);
- CheckOverridingFunctionReturnType(MD, BaseMD);
- CheckOverridingFunctionAttributes(MD, BaseMD);
- CheckOverridingFunctionExceptionSpec(MD, BaseMD);
+ bool Invalid = false;
+ Invalid |= CheckOverridingFunctionReturnType(MD, BaseMD);
+ Invalid |= CheckOverridingFunctionAttributes(MD, BaseMD);
+ Invalid |= CheckOverridingFunctionExceptionSpec(MD, BaseMD);
+ if (Invalid)
----------------
a-tarasyuk wrote:
That’s the case I was thinking about — whether it should be treated as invalid
at this stage or not. For now, I decided to keep it as-is.
Some checks depend on `New` decl not being marked as invalid when diagnosing
inconsistent override control. Marking it as invalid at this stage may cause
certain diagnostics to be skipped
https://github.com/llvm/llvm-project/blob/e8275dfe2a030e6f06a47ca23746c7dab00ea01f/clang/lib/Sema/SemaDeclCXX.cpp#L7323-L7327
https://github.com/llvm/llvm-project/blob/e8275dfe2a030e6f06a47ca23746c7dab00ea01f/clang/lib/Sema/SemaDeclCXX.cpp#L3311-L3313
Removing the `isInvalidDecl` checks would likely introduce noisy diagnostics
for unrelated invalid methods, since this runs as a broad late pass over class
methods. WDYT?
https://github.com/llvm/llvm-project/pull/184048
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits