[cfe-commits] r126262 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/abstract.cpp
Douglas Gregor
dgregor at apple.com
Tue Feb 22 15:21:06 PST 2011
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/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/abstract.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=126262&r1=126261&r2=126262&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue Feb 22 17:21:06 2011
@@ -2588,6 +2588,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/trunk/test/SemaCXX/abstract.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/abstract.cpp?rev=126262&r1=126261&r2=126262&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/abstract.cpp (original)
+++ cfe/trunk/test/SemaCXX/abstract.cpp Tue Feb 22 17:21:06 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 cfe-commits
mailing list