diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-11-18 14:58:34 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-11-18 14:58:34 +0000 |
| commit | 907da171cc911d701da02a5cab898a9c49dd7724 (patch) | |
| tree | 6a111e552c75afc66228e3d8f19b6731e4013f10 /lib/VMCore/Verifier.cpp | |
| parent | 72cc50852bec44580ee7efe1aa2076273008a6ae (diff) | |
Notes
Diffstat (limited to 'lib/VMCore/Verifier.cpp')
| -rw-r--r-- | lib/VMCore/Verifier.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 5990e481686c..7ab7b1516844 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -780,9 +780,13 @@ void Verifier::visitSwitchInst(SwitchInst &SI) { // Check to make sure that all of the constants in the switch instruction // have the same type as the switched-on value. const Type *SwitchTy = SI.getCondition()->getType(); - for (unsigned i = 1, e = SI.getNumCases(); i != e; ++i) + SmallPtrSet<ConstantInt*, 32> Constants; + for (unsigned i = 1, e = SI.getNumCases(); i != e; ++i) { Assert1(SI.getCaseValue(i)->getType() == SwitchTy, "Switch constants must all be same type as switch value!", &SI); + Assert2(Constants.insert(SI.getCaseValue(i)), + "Duplicate integer as switch case", &SI, SI.getCaseValue(i)); + } visitTerminatorInst(SI); } |
