From: Sebastian Redl Date: Fri, 9 Jan 2009 22:29:03 +0000 (+0000) Subject: Add some comments to the virtual work. Thanks to Doug Gregor for the review. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9b580a4de1824b3155048d31aaa153316e150c2;p=clang Add some comments to the virtual work. Thanks to Doug Gregor for the review. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62012 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 1d09ea7110..e0b0b169a2 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -696,9 +696,13 @@ public: void setBody(Stmt *B) { Body = B; } + /// Whether this function is virtual, either by explicit marking, or by + /// overriding a virtual function. Only valid on C++ member functions. bool isVirtual() { return IsVirtual; } void setVirtual() { IsVirtual = true; } + /// Whether this virtual function is pure, i.e. makes the containing class + /// abstract. bool isPure() { return IsPure; } void setPure() { IsPure = true; } diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index ba4a47d63e..dcd378936a 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -615,6 +615,9 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, } else { // not static member. perhaps virtual function? if (CXXMethodDecl *MD = dyn_cast(Member)) { + // With declarators parsed the way they are, the parser cannot + // distinguish between a normal initializer and a pure-specifier. + // Thus this grotesque test. IntegerLiteral *IL; if ((IL = dyn_cast(Init)) && IL->getValue() == 0 && Context.getCanonicalType(IL->getType()) == Context.IntTy) {