diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-01-09 22:29:03 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-01-09 22:29:03 +0000 |
commit | c9b580a4de1824b3155048d31aaa153316e150c2 (patch) | |
tree | efd84a895eb0d65f24b7801a8d7d107d8db7f6a5 | |
parent | a75ea3d2ca9edfebf59bd14e51540fa68b069448 (diff) |
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
-rw-r--r-- | include/clang/AST/Decl.h | 4 | ||||
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 3 |
2 files changed, 7 insertions, 0 deletions
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<CXXMethodDecl>(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<IntegerLiteral>(Init)) && IL->getValue() == 0 && Context.getCanonicalType(IL->getType()) == Context.IntTy) { |