Skip to content

Commit e90e43f

Browse files
authored
[Clang][NFC] Rename CXXMethodDecl::isPure -> is VirtualPure (#78463)
To avoid any possible confusion with the notion of pure function and the gnu::pure attribute.
1 parent d87a53a commit e90e43f

33 files changed

+61
-60
lines changed

clang-tools-extra/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ bool MultipleInheritanceCheck::isCurrentClassInterface(
5353

5454
// Interfaces should have exclusively pure methods.
5555
return llvm::none_of(Node->methods(), [](const CXXMethodDecl *M) {
56-
return M->isUserProvided() && !M->isPure() && !M->isStatic();
56+
return M->isUserProvided() && !M->isPureVirtual() && !M->isStatic();
5757
});
5858
}
5959

@@ -103,8 +103,8 @@ void MultipleInheritanceCheck::check(const MatchFinder::MatchResult &Result) {
103103
const auto *Base = cast<CXXRecordDecl>(Ty->getDecl()->getDefinition());
104104
if (!isInterface(Base)) NumConcrete++;
105105
}
106-
107-
// Check virtual bases to see if there is more than one concrete
106+
107+
// Check virtual bases to see if there is more than one concrete
108108
// non-virtual base.
109109
for (const auto &V : D->vbases()) {
110110
const auto *Ty = V.getType()->getAs<RecordType>();

clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ namespace clang::tidy::modernize {
1717

1818
namespace {
1919
AST_MATCHER(FunctionDecl, hasAnyDefinition) {
20-
if (Node.hasBody() || Node.isPure() || Node.isDefaulted() || Node.isDeleted())
20+
if (Node.hasBody() || Node.isPureVirtual() || Node.isDefaulted() ||
21+
Node.isDeleted())
2122
return true;
2223

2324
if (const FunctionDecl *Definition = Node.getDefinition())
24-
if (Definition->hasBody() || Definition->isPure() ||
25+
if (Definition->hasBody() || Definition->isPureVirtual() ||
2526
Definition->isDefaulted() || Definition->isDeleted())
2627
return true;
2728

clang-tools-extra/clangd/SemanticHighlighting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ bool isStatic(const Decl *D) {
265265

266266
bool isAbstract(const Decl *D) {
267267
if (const auto *CMD = llvm::dyn_cast<CXXMethodDecl>(D))
268-
return CMD->isPure();
268+
return CMD->isPureVirtual();
269269
if (const auto *CRD = llvm::dyn_cast<CXXRecordDecl>(D))
270270
return CRD->hasDefinition() && CRD->isAbstract();
271271
return false;

clang-tools-extra/clangd/XRefs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ locateASTReferent(SourceLocation CurLoc, const syntax::Token *TouchedIdentifier,
427427
// Special case: virtual void ^method() = 0: jump to all overrides.
428428
// FIXME: extend it to ^virtual, unfortunately, virtual location is not
429429
// saved in the AST.
430-
if (CMD->isPure()) {
430+
if (CMD->isPureVirtual()) {
431431
if (TouchedIdentifier && SM.getSpellingLoc(CMD->getLocation()) ==
432432
TouchedIdentifier->location()) {
433433
VirtualMethods.insert(getSymbolID(CMD));

clang/include/clang/AST/Decl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2294,8 +2294,8 @@ class FunctionDecl : public DeclaratorDecl,
22942294

22952295
/// Whether this virtual function is pure, i.e. makes the containing class
22962296
/// abstract.
2297-
bool isPure() const { return FunctionDeclBits.IsPure; }
2298-
void setPure(bool P = true);
2297+
bool isPureVirtual() const { return FunctionDeclBits.IsPureVirtual; }
2298+
void setIsPureVirtual(bool P = true);
22992299

23002300
/// Whether this templated function will be late parsed.
23012301
bool isLateTemplateParsed() const {

clang/include/clang/AST/DeclBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1708,7 +1708,7 @@ class DeclContext {
17081708
LLVM_PREFERRED_TYPE(bool)
17091709
uint64_t IsVirtualAsWritten : 1;
17101710
LLVM_PREFERRED_TYPE(bool)
1711-
uint64_t IsPure : 1;
1711+
uint64_t IsPureVirtual : 1;
17121712
LLVM_PREFERRED_TYPE(bool)
17131713
uint64_t HasInheritedPrototype : 1;
17141714
LLVM_PREFERRED_TYPE(bool)

clang/include/clang/AST/DeclCXX.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class CXXRecordDecl : public RecordDecl {
266266
friend class LambdaExpr;
267267
friend class ODRDiagsEmitter;
268268

269-
friend void FunctionDecl::setPure(bool);
269+
friend void FunctionDecl::setIsPureVirtual(bool);
270270
friend void TagDecl::startDefinition();
271271

272272
/// Values used in DefinitionData fields to represent special members.
@@ -2110,7 +2110,7 @@ class CXXMethodDecl : public FunctionDecl {
21102110

21112111
// Member function is virtual if it is marked explicitly so, or if it is
21122112
// declared in __interface -- then it is automatically pure virtual.
2113-
if (CD->isVirtualAsWritten() || CD->isPure())
2113+
if (CD->isVirtualAsWritten() || CD->isPureVirtual())
21142114
return true;
21152115

21162116
return CD->size_overridden_methods() != 0;

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6351,9 +6351,7 @@ AST_POLYMORPHIC_MATCHER(isFinal,
63516351
/// };
63526352
/// \endcode
63536353
/// matches A::x
6354-
AST_MATCHER(CXXMethodDecl, isPure) {
6355-
return Node.isPure();
6356-
}
6354+
AST_MATCHER(CXXMethodDecl, isPure) { return Node.isPureVirtual(); }
63576355

63586356
/// Matches if the given method declaration is const.
63596357
///

clang/lib/AST/ASTImporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3896,7 +3896,7 @@ ExpectedDecl ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) {
38963896
ToFunction->setLexicalDeclContext(LexicalDC);
38973897
ToFunction->setVirtualAsWritten(D->isVirtualAsWritten());
38983898
ToFunction->setTrivial(D->isTrivial());
3899-
ToFunction->setPure(D->isPure());
3899+
ToFunction->setIsPureVirtual(D->isPureVirtual());
39003900
ToFunction->setDefaulted(D->isDefaulted());
39013901
ToFunction->setExplicitlyDefaulted(D->isExplicitlyDefaulted());
39023902
ToFunction->setDeletedAsWritten(D->isDeletedAsWritten());

clang/lib/AST/ASTStructuralEquivalence.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
14671467
Method1->isConst() == Method2->isConst() &&
14681468
Method1->isVolatile() == Method2->isVolatile() &&
14691469
Method1->isVirtual() == Method2->isVirtual() &&
1470-
Method1->isPure() == Method2->isPure() &&
1470+
Method1->isPureVirtual() == Method2->isPureVirtual() &&
14711471
Method1->isDefaulted() == Method2->isDefaulted() &&
14721472
Method1->isDeleted() == Method2->isDeleted();
14731473
if (!PropertiesEqual)

clang/lib/AST/Decl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3036,7 +3036,7 @@ FunctionDecl::FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC,
30363036
FunctionDeclBits.IsInline = isInlineSpecified;
30373037
FunctionDeclBits.IsInlineSpecified = isInlineSpecified;
30383038
FunctionDeclBits.IsVirtualAsWritten = false;
3039-
FunctionDeclBits.IsPure = false;
3039+
FunctionDeclBits.IsPureVirtual = false;
30403040
FunctionDeclBits.HasInheritedPrototype = false;
30413041
FunctionDeclBits.HasWrittenPrototype = true;
30423042
FunctionDeclBits.IsDeleted = false;
@@ -3203,8 +3203,8 @@ void FunctionDecl::setBody(Stmt *B) {
32033203
EndRangeLoc = B->getEndLoc();
32043204
}
32053205

3206-
void FunctionDecl::setPure(bool P) {
3207-
FunctionDeclBits.IsPure = P;
3206+
void FunctionDecl::setIsPureVirtual(bool P) {
3207+
FunctionDeclBits.IsPureVirtual = P;
32083208
if (P)
32093209
if (auto *Parent = dyn_cast<CXXRecordDecl>(getDeclContext()))
32103210
Parent->markedVirtualFunctionPure();

clang/lib/AST/DeclCXX.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,7 +2079,7 @@ void CXXRecordDecl::completeDefinition(CXXFinalOverriderMap *FinalOverriders) {
20792079
// A class is abstract if it contains or inherits at least one
20802080
// pure virtual function for which the final overrider is pure
20812081
// virtual.
2082-
if (SO->second.front().Method->isPure()) {
2082+
if (SO->second.front().Method->isPureVirtual()) {
20832083
data().Abstract = true;
20842084
Done = true;
20852085
break;
@@ -2298,7 +2298,7 @@ CXXMethodDecl *CXXMethodDecl::getDevirtualizedMethod(const Expr *Base,
22982298
// If the member function is marked 'final', we know that it can't be
22992299
// overridden and can therefore devirtualize it unless it's pure virtual.
23002300
if (hasAttr<FinalAttr>())
2301-
return isPure() ? nullptr : this;
2301+
return isPureVirtual() ? nullptr : this;
23022302

23032303
// If Base is unknown, we cannot devirtualize.
23042304
if (!Base)
@@ -2327,7 +2327,7 @@ CXXMethodDecl *CXXMethodDecl::getDevirtualizedMethod(const Expr *Base,
23272327
// If that method is pure virtual, we can't devirtualize. If this code is
23282328
// reached, the result would be UB, not a direct call to the derived class
23292329
// function, and we can't assume the derived class function is defined.
2330-
if (DevirtualizedMethod->isPure())
2330+
if (DevirtualizedMethod->isPureVirtual())
23312331
return nullptr;
23322332

23332333
// If that method is marked final, we can devirtualize it.

clang/lib/AST/DeclPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
871871

872872
prettyPrintAttributes(D, Out, AttrPrintLoc::Right);
873873

874-
if (D->isPure())
874+
if (D->isPureVirtual())
875875
Out << " = 0";
876876
else if (D->isDeletedAsWritten())
877877
Out << " = delete";

clang/lib/AST/ExprConstant.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5839,7 +5839,7 @@ static const CXXMethodDecl *HandleVirtualDispatch(
58395839
// C++2a [class.abstract]p6:
58405840
// the effect of making a virtual call to a pure virtual function [...] is
58415841
// undefined
5842-
if (Callee->isPure()) {
5842+
if (Callee->isPureVirtual()) {
58435843
Info.FFDiag(E, diag::note_constexpr_pure_virtual_call, 1) << Callee;
58445844
Info.Note(Callee->getLocation(), diag::note_declared_at);
58455845
return nullptr;

clang/lib/AST/Interp/Interp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ bool CheckThis(InterpState &S, CodePtr OpPC, const Pointer &This) {
490490
}
491491

492492
bool CheckPure(InterpState &S, CodePtr OpPC, const CXXMethodDecl *MD) {
493-
if (!MD->isPure())
493+
if (!MD->isPureVirtual())
494494
return true;
495495
const SourceInfo &E = S.Current->getSource(OpPC);
496496
S.FFDiag(E, diag::note_constexpr_pure_virtual_call, 1) << MD;

clang/lib/AST/JSONNodeDumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ void JSONNodeDumper::VisitFunctionDecl(const FunctionDecl *FD) {
930930
JOS.attribute("storageClass", VarDecl::getStorageClassSpecifierString(SC));
931931
attributeOnlyIfTrue("inline", FD->isInlineSpecified());
932932
attributeOnlyIfTrue("virtual", FD->isVirtualAsWritten());
933-
attributeOnlyIfTrue("pure", FD->isPure());
933+
attributeOnlyIfTrue("pure", FD->isPureVirtual());
934934
attributeOnlyIfTrue("explicitlyDeleted", FD->isDeletedAsWritten());
935935
attributeOnlyIfTrue("constexpr", FD->isConstexpr());
936936
attributeOnlyIfTrue("variadic", FD->isVariadic());

clang/lib/AST/ODRDiagsEmitter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,8 +1102,8 @@ bool ODRDiagsEmitter::diagnoseMismatch(
11021102

11031103
const bool FirstVirtual = FirstMethod->isVirtualAsWritten();
11041104
const bool SecondVirtual = SecondMethod->isVirtualAsWritten();
1105-
const bool FirstPure = FirstMethod->isPure();
1106-
const bool SecondPure = SecondMethod->isPure();
1105+
const bool FirstPure = FirstMethod->isPureVirtual();
1106+
const bool SecondPure = SecondMethod->isPureVirtual();
11071107
if ((FirstVirtual || SecondVirtual) &&
11081108
(FirstVirtual != SecondVirtual || FirstPure != SecondPure)) {
11091109
DiagMethodError(MethodVirtual) << FirstPure << FirstVirtual;

clang/lib/AST/ODRHash.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ void ODRHash::AddFunctionDecl(const FunctionDecl *Function,
688688
ID.AddInteger(Function->getStorageClass());
689689
AddBoolean(Function->isInlineSpecified());
690690
AddBoolean(Function->isVirtualAsWritten());
691-
AddBoolean(Function->isPure());
691+
AddBoolean(Function->isPureVirtual());
692692
AddBoolean(Function->isDeletedAsWritten());
693693
AddBoolean(Function->isExplicitlyDefaulted());
694694

clang/lib/AST/RecordLayoutBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,7 +2349,7 @@ static const CXXMethodDecl *computeKeyFunction(ASTContext &Context,
23492349
if (!MD->isVirtual())
23502350
continue;
23512351

2352-
if (MD->isPure())
2352+
if (MD->isPureVirtual())
23532353
continue;
23542354

23552355
// Ignore implicit member functions, they are always marked as inline, but
@@ -3293,7 +3293,7 @@ void MicrosoftRecordLayoutBuilder::computeVtorDispSet(
32933293
// Seed the working set with our non-destructor, non-pure virtual methods.
32943294
for (const CXXMethodDecl *MD : RD->methods())
32953295
if (MicrosoftVTableContext::hasVtableSlot(MD) &&
3296-
!isa<CXXDestructorDecl>(MD) && !MD->isPure())
3296+
!isa<CXXDestructorDecl>(MD) && !MD->isPureVirtual())
32973297
Work.insert(MD);
32983298
while (!Work.empty()) {
32993299
const CXXMethodDecl *MD = *Work.begin();

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1875,7 +1875,7 @@ void TextNodeDumper::VisitFunctionDecl(const FunctionDecl *D) {
18751875
if (D->isModulePrivate())
18761876
OS << " __module_private__";
18771877

1878-
if (D->isPure())
1878+
if (D->isPureVirtual())
18791879
OS << " pure";
18801880
if (D->isDefaulted()) {
18811881
OS << " default";

clang/lib/AST/VTableBuilder.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ void FinalOverriders::dump(raw_ostream &Out, BaseSubobject Base,
422422
Out << ", " << Overrider.Offset.getQuantity() << ')';
423423

424424
BaseOffset Offset;
425-
if (!Overrider.Method->isPure())
425+
if (!Overrider.Method->isPureVirtual())
426426
Offset = ComputeReturnAdjustmentBaseOffset(Context, Overrider.Method, MD);
427427

428428
if (!Offset.isEmpty()) {
@@ -1261,7 +1261,7 @@ ThisAdjustment ItaniumVTableBuilder::ComputeThisAdjustment(
12611261
const CXXMethodDecl *MD, CharUnits BaseOffsetInLayoutClass,
12621262
FinalOverriders::OverriderInfo Overrider) {
12631263
// Ignore adjustments for pure virtual member functions.
1264-
if (Overrider.Method->isPure())
1264+
if (Overrider.Method->isPureVirtual())
12651265
return ThisAdjustment();
12661266

12671267
BaseSubobject OverriddenBaseSubobject(MD->getParent(),
@@ -1607,7 +1607,7 @@ void ItaniumVTableBuilder::AddMethods(
16071607
// Check if this overrider needs a return adjustment.
16081608
// We don't want to do this for pure virtual member functions.
16091609
BaseOffset ReturnAdjustmentOffset;
1610-
if (!OverriderMD->isPure()) {
1610+
if (!OverriderMD->isPureVirtual()) {
16111611
ReturnAdjustmentOffset =
16121612
ComputeReturnAdjustmentBaseOffset(Context, OverriderMD, MD);
16131613
}
@@ -1959,7 +1959,7 @@ void ItaniumVTableBuilder::dumpLayout(raw_ostream &Out) {
19591959
std::string Str = PredefinedExpr::ComputeName(
19601960
PredefinedIdentKind::PrettyFunctionNoVirtual, MD);
19611961
Out << Str;
1962-
if (MD->isPure())
1962+
if (MD->isPureVirtual())
19631963
Out << " [pure]";
19641964

19651965
if (MD->isDeleted())
@@ -2010,7 +2010,7 @@ void ItaniumVTableBuilder::dumpLayout(raw_ostream &Out) {
20102010
else
20112011
Out << "() [deleting]";
20122012

2013-
if (DD->isPure())
2013+
if (DD->isPureVirtual())
20142014
Out << " [pure]";
20152015

20162016
ThunkInfo Thunk = VTableThunks.lookup(I);
@@ -2038,7 +2038,7 @@ void ItaniumVTableBuilder::dumpLayout(raw_ostream &Out) {
20382038
std::string Str = PredefinedExpr::ComputeName(
20392039
PredefinedIdentKind::PrettyFunctionNoVirtual, MD);
20402040
Out << "[unused] " << Str;
2041-
if (MD->isPure())
2041+
if (MD->isPureVirtual())
20422042
Out << " [pure]";
20432043
}
20442044

@@ -3076,7 +3076,7 @@ void VFTableBuilder::AddMethods(BaseSubobject Base, unsigned BaseDepth,
30763076
// We don't want to do this for pure virtual member functions.
30773077
BaseOffset ReturnAdjustmentOffset;
30783078
ReturnAdjustment ReturnAdjustment;
3079-
if (!FinalOverriderMD->isPure()) {
3079+
if (!FinalOverriderMD->isPureVirtual()) {
30803080
ReturnAdjustmentOffset =
30813081
ComputeReturnAdjustmentBaseOffset(Context, FinalOverriderMD, MD);
30823082
}
@@ -3175,7 +3175,7 @@ void VFTableBuilder::dumpLayout(raw_ostream &Out) {
31753175
std::string Str = PredefinedExpr::ComputeName(
31763176
PredefinedIdentKind::PrettyFunctionNoVirtual, MD);
31773177
Out << Str;
3178-
if (MD->isPure())
3178+
if (MD->isPureVirtual())
31793179
Out << " [pure]";
31803180

31813181
if (MD->isDeleted())
@@ -3194,7 +3194,7 @@ void VFTableBuilder::dumpLayout(raw_ostream &Out) {
31943194
DD->printQualifiedName(Out);
31953195
Out << "() [scalar deleting]";
31963196

3197-
if (DD->isPure())
3197+
if (DD->isPureVirtual())
31983198
Out << " [pure]";
31993199

32003200
ThunkInfo Thunk = VTableThunks.lookup(I);

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1926,7 +1926,7 @@ llvm::DISubprogram *CGDebugInfo::CreateCXXMemberFunction(
19261926
int ThisAdjustment = 0;
19271927

19281928
if (VTableContextBase::hasVtableSlot(Method)) {
1929-
if (Method->isPure())
1929+
if (Method->isPureVirtual())
19301930
SPFlags |= llvm::DISubprogram::SPFlagPureVirtual;
19311931
else
19321932
SPFlags |= llvm::DISubprogram::SPFlagVirtual;

clang/lib/CodeGen/CGVTables.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ void CodeGenVTables::addVTableComponent(ConstantArrayBuilder &builder,
793793
llvm::Constant *fnPtr;
794794

795795
// Pure virtual member functions.
796-
if (cast<CXXMethodDecl>(GD.getDecl())->isPure()) {
796+
if (cast<CXXMethodDecl>(GD.getDecl())->isPureVirtual()) {
797797
if (!PureVirtualFn)
798798
PureVirtualFn =
799799
getSpecialVirtualFn(CGM.getCXXABI().GetPureVirtualCallName());

clang/lib/Sema/Sema.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ static bool MethodsAndNestedClassesComplete(const CXXRecordDecl *RD,
957957
I != E && Complete; ++I) {
958958
if (const CXXMethodDecl *M = dyn_cast<CXXMethodDecl>(*I))
959959
Complete = M->isDefined() || M->isDefaulted() ||
960-
(M->isPure() && !isa<CXXDestructorDecl>(M));
960+
(M->isPureVirtual() && !isa<CXXDestructorDecl>(M));
961961
else if (const FunctionTemplateDecl *F = dyn_cast<FunctionTemplateDecl>(*I))
962962
// If the template function is marked as late template parsed at this
963963
// point, it has not been instantiated and therefore we have not

clang/lib/Sema/SemaDecl.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4390,8 +4390,8 @@ bool Sema::MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old,
43904390
mergeDeclAttributes(New, Old);
43914391

43924392
// Merge "pure" flag.
4393-
if (Old->isPure())
4394-
New->setPure();
4393+
if (Old->isPureVirtual())
4394+
New->setIsPureVirtual();
43954395

43964396
// Merge "used" flag.
43974397
if (Old->getMostRecentDecl()->isUsed(false))
@@ -9878,7 +9878,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
98789878
if (const CXXRecordDecl *Parent =
98799879
dyn_cast<CXXRecordDecl>(NewFD->getDeclContext())) {
98809880
if (Parent->isInterface() && cast<CXXMethodDecl>(NewFD)->isUserProvided())
9881-
NewFD->setPure(true);
9881+
NewFD->setIsPureVirtual(true);
98829882

98839883
// C++ [class.union]p2
98849884
// A union can have member functions, but not virtual functions.
@@ -16012,7 +16012,8 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
1601216012

1601316013
// MSVC permits the use of pure specifier (=0) on function definition,
1601416014
// defined at class scope, warn about this non-standard construct.
16015-
if (getLangOpts().MicrosoftExt && FD->isPure() && !FD->isOutOfLine())
16015+
if (getLangOpts().MicrosoftExt && FD->isPureVirtual() &&
16016+
!FD->isOutOfLine())
1601616017
Diag(FD->getLocation(), diag::ext_pure_function_definition);
1601716018

1601816019
if (!FD->isInvalidDecl()) {

0 commit comments

Comments
 (0)