aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/Decl.h4
-rw-r--r--lib/Sema/SemaDeclCXX.cpp3
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) {