From 922cec29a9366f70d593d6225aea01dcd3daf8cf Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 3 Feb 2013 18:55:34 +0000 Subject: [PATCH] CodeGen: Remove unnecessary const_casts. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174292 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/VTableBuilder.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/AST/VTableBuilder.cpp b/lib/AST/VTableBuilder.cpp index 5af3b65261..9a03faace2 100644 --- a/lib/AST/VTableBuilder.cpp +++ b/lib/AST/VTableBuilder.cpp @@ -257,11 +257,9 @@ static BaseOffset ComputeBaseOffset(ASTContext &Context, const CXXRecordDecl *DerivedRD) { CXXBasePaths Paths(/*FindAmbiguities=*/false, /*RecordPaths=*/true, /*DetectVirtual=*/false); - - if (!const_cast(DerivedRD)-> - isDerivedFrom(const_cast(BaseRD), Paths)) { + + if (!DerivedRD->isDerivedFrom(BaseRD, Paths)) llvm_unreachable("Class must be derived from the passed in base class!"); - } return ComputeBaseOffset(Context, DerivedRD, Paths.front()); } @@ -1202,10 +1200,8 @@ VTableBuilder::ComputeThisAdjustmentBaseOffset(BaseSubobject Base, CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true, /*DetectVirtual=*/true); - if (!const_cast(DerivedRD)-> - isDerivedFrom(const_cast(BaseRD), Paths)) { + if (!DerivedRD->isDerivedFrom(BaseRD, Paths)) llvm_unreachable("Class must be derived from the passed in base class!"); - } // We have to go through all the paths, and see which one leads us to the // right base subobject.