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 | 6138f2b4d84964baacaaa8780f789d2bf835d978 (patch) | |
| tree | ae742c22d1e30ec6e72dfea581735eef4ba6835e | |
| parent | 61f97e290a7a47aace03f7556b4d34874b26017e (diff) | |
| download | bcm5719-llvm-6138f2b4d84964baacaaa8780f789d2bf835d978.tar.gz bcm5719-llvm-6138f2b4d84964baacaaa8780f789d2bf835d978.zip | |
Add some comments to the virtual work. Thanks to Doug Gregor for the review.
llvm-svn: 62012
| -rw-r--r-- | clang/include/clang/AST/Decl.h | 4 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index 1d09ea71103..e0b0b169a2a 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/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/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index ba4a47d63ec..dcd378936a1 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/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) { |

