[cfe-commits] r83766 - in /cfe/trunk: lib/Sema/SemaExceptionSpec.cpp test/SemaCXX/exception-spec.cpp
Sebastian Redl
sebastian.redl at getdesigned.at
Sun Oct 11 02:11:24 PDT 2009
Author: cornedbee
Date: Sun Oct 11 04:11:23 2009
New Revision: 83766
URL: http://llvm.org/viewvc/llvm-project?rev=83766&view=rev
Log:
Types appearing more than once in a spec shouldn't matter.
Modified:
cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
cfe/trunk/test/SemaCXX/exception-spec.cpp
Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=83766&r1=83765&r2=83766&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Sun Oct 11 04:11:23 2009
@@ -117,16 +117,21 @@
bool Success = true;
// Both have a definite exception spec. Collect the first set, then compare
// to the second.
- llvm::SmallPtrSet<const Type*, 8> Types;
+ llvm::SmallPtrSet<const Type*, 8> OldTypes, NewTypes;
for (FunctionProtoType::exception_iterator I = Old->exception_begin(),
E = Old->exception_end(); I != E; ++I)
- Types.insert(Context.getCanonicalType(*I).getTypePtr());
+ OldTypes.insert(Context.getCanonicalType(*I).getTypePtr());
for (FunctionProtoType::exception_iterator I = New->exception_begin(),
- E = New->exception_end(); I != E && Success; ++I)
- Success = Types.erase(Context.getCanonicalType(*I).getTypePtr());
+ E = New->exception_end(); I != E && Success; ++I) {
+ const Type *TypePtr = Context.getCanonicalType(*I).getTypePtr();
+ if(OldTypes.count(TypePtr))
+ NewTypes.insert(TypePtr);
+ else
+ Success = false;
+ }
- Success = Success && Types.empty();
+ Success = Success && OldTypes.size() == NewTypes.size();
if (Success) {
return false;
Modified: cfe/trunk/test/SemaCXX/exception-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/exception-spec.cpp?rev=83766&r1=83765&r2=83766&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/exception-spec.cpp (original)
+++ cfe/trunk/test/SemaCXX/exception-spec.cpp Sun Oct 11 04:11:23 2009
@@ -62,6 +62,10 @@
void r8() throw(int);
void r8() throw(const int);
+// Multiple appearances don't matter.
+void r9() throw(int, int);
+void r9() throw(int, int);
+
struct A
{
};
More information about the cfe-commits
mailing list