diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-08-22 15:37:55 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-08-22 15:37:55 +0000 |
commit | d48bcb2f4dedf8e7b654cb017968b3d7b6663a57 (patch) | |
tree | 62b8921d396e49a8880d11fbf7027832d51982c4 /lib/CodeGen/CGRTTI.cpp | |
parent | 4bda1d8cfe7d42b2798a06d16a5b776d980aad5f (diff) |
Reduce duplicated hash map lookups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162361 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGRTTI.cpp')
-rw-r--r-- | lib/CodeGen/CGRTTI.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/CodeGen/CGRTTI.cpp b/lib/CodeGen/CGRTTI.cpp index d1b370a1f7..b5cdd7fea3 100644 --- a/lib/CodeGen/CGRTTI.cpp +++ b/lib/CodeGen/CGRTTI.cpp @@ -779,28 +779,24 @@ static unsigned ComputeVMIClassTypeInfoFlags(const CXXBaseSpecifier *Base, cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl()); if (Base->isVirtual()) { - if (Bases.VirtualBases.count(BaseDecl)) { + // Mark the virtual base as seen. + if (!Bases.VirtualBases.insert(BaseDecl)) { // If this virtual base has been seen before, then the class is diamond // shaped. Flags |= RTTIBuilder::VMI_DiamondShaped; } else { if (Bases.NonVirtualBases.count(BaseDecl)) Flags |= RTTIBuilder::VMI_NonDiamondRepeat; - - // Mark the virtual base as seen. - Bases.VirtualBases.insert(BaseDecl); } } else { - if (Bases.NonVirtualBases.count(BaseDecl)) { + // Mark the non-virtual base as seen. + if (!Bases.NonVirtualBases.insert(BaseDecl)) { // If this non-virtual base has been seen before, then the class has non- // diamond shaped repeated inheritance. Flags |= RTTIBuilder::VMI_NonDiamondRepeat; } else { if (Bases.VirtualBases.count(BaseDecl)) Flags |= RTTIBuilder::VMI_NonDiamondRepeat; - - // Mark the non-virtual base as seen. - Bases.NonVirtualBases.insert(BaseDecl); } } |