[llvm-branch-commits] [cfe-branch] r127204 - in /cfe/branches/Apple/sill: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/abstract.cpp

Douglas Gregor dgregor at apple.com
Mon Mar 7 17:53:06 PST 2011


Author: dgregor
Date: Mon Mar  7 19:53:05 2011
New Revision: 127204

URL: http://llvm.org/viewvc/llvm-project?rev=127204&view=rev
Log:
Merge r126262:

Author: dgregor
Date: Tue Feb 22 17:21:06 2011
New Revision: 126262

URL: http://llvm.org/viewvc/llvm-project?rev=126262&view=rev
Log:
When checking for abstract types, don't crash when we have a
FunctionProtoTypeLoc with NULL function parameter types, which can
occur in invalid code. Fixes PR9247 / <rdar://problem/9037911>.


Modified:
    cfe/branches/Apple/sill/lib/Sema/SemaDeclCXX.cpp
    cfe/branches/Apple/sill/test/SemaCXX/abstract.cpp

Modified: cfe/branches/Apple/sill/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/sill/lib/Sema/SemaDeclCXX.cpp?rev=127204&r1=127203&r2=127204&view=diff
==============================================================================
--- cfe/branches/Apple/sill/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/branches/Apple/sill/lib/Sema/SemaDeclCXX.cpp Mon Mar  7 19:53:05 2011
@@ -2429,6 +2429,9 @@
   void Check(FunctionProtoTypeLoc TL, Sema::AbstractDiagSelID Sel) {
     Visit(TL.getResultLoc(), Sema::AbstractReturnType);
     for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
+      if (!TL.getArg(I))
+        continue;
+      
       TypeSourceInfo *TSI = TL.getArg(I)->getTypeSourceInfo();
       if (TSI) Visit(TSI->getTypeLoc(), Sema::AbstractParamType);
     }

Modified: cfe/branches/Apple/sill/test/SemaCXX/abstract.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/sill/test/SemaCXX/abstract.cpp?rev=127204&r1=127203&r2=127204&view=diff
==============================================================================
--- cfe/branches/Apple/sill/test/SemaCXX/abstract.cpp (original)
+++ cfe/branches/Apple/sill/test/SemaCXX/abstract.cpp Mon Mar  7 19:53:05 2011
@@ -249,3 +249,13 @@
     static D x; // expected-error {{abstract class}}
   };
 }
+
+// PR9247: Crash on invalid in clang::Sema::ActOnFinishCXXMemberSpecification
+namespace pr9247 {
+  struct A {
+    virtual void g(const A& input) = 0;
+    struct B {
+      C* f(int foo);
+    };
+  };
+}





More information about the llvm-branch-commits mailing list