[cfe-commits] r62012 - in /cfe/trunk: include/clang/AST/Decl.h lib/Sema/SemaDeclCXX.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Fri Jan 9 14:29:03 PST 2009


Author: cornedbee
Date: Fri Jan  9 16:29:03 2009
New Revision: 62012

URL: http://llvm.org/viewvc/llvm-project?rev=62012&view=rev
Log:
Add some comments to the virtual work. Thanks to Doug Gregor for the review.

Modified:
    cfe/trunk/include/clang/AST/Decl.h
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=62012&r1=62011&r2=62012&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Fri Jan  9 16:29:03 2009
@@ -696,9 +696,13 @@
 
   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; }
 

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=62012&r1=62011&r2=62012&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Jan  9 16:29:03 2009
@@ -615,6 +615,9 @@
     } 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) {





More information about the cfe-commits mailing list