diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-10-11 09:11:23 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-10-11 09:11:23 +0000 |
commit | 6e4c8718558f9343538f6ac5d7effbf7b5cf207e (patch) | |
tree | 261c8949ba58e9c143b7903cd34d8a015767966b /clang/lib/Sema/SemaExceptionSpec.cpp | |
parent | 2dccb8571e863f07c29705f663b3b9782ada0e26 (diff) | |
download | bcm5719-llvm-6e4c8718558f9343538f6ac5d7effbf7b5cf207e.tar.gz bcm5719-llvm-6e4c8718558f9343538f6ac5d7effbf7b5cf207e.zip |
Types appearing more than once in a spec shouldn't matter.
llvm-svn: 83766
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index 8720d81d6e7..4171ecea8a1 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -117,16 +117,21 @@ bool Sema::CheckEquivalentExceptionSpec( 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; |