[clang] [clang] Disable missing definition warning on pure virtual functions (PR #74510)
Charalampos Mitrodimas via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 5 13:47:53 PST 2023
================
@@ -4952,7 +4952,8 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
std::make_pair(Function, PointOfInstantiation));
} else if (TSK == TSK_ImplicitInstantiation) {
if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() &&
- !getSourceManager().isInSystemHeader(PatternDecl->getBeginLoc())) {
+ !getSourceManager().isInSystemHeader(PatternDecl->getBeginLoc()) &&
+ !Function->isVirtualAsWritten() && !Function->isPure()) {
----------------
charmitro wrote:
After double-checking this, I think we should just check for `isPure()` and don't bother checking for `isVirtualAsWritten()` at all since non-virtual functions cannot be pure. Also, for reference,
https://github.com/llvm/llvm-project/blob/d6fbd96e5eaf3e8acbf1b43dce7a311352907567/clang/include/clang/AST/Decl.h#L2293-L2295
Code updated to match this. Also a test-case added to verify that non-pure virtual functions still get diagnosed.
https://github.com/llvm/llvm-project/pull/74510
More information about the cfe-commits
mailing list