From: Duncan P. N. Exon Smith Date: Wed, 6 May 2015 22:18:39 +0000 (+0000) Subject: CGCXX: Use cast in getAddrOfCXXStructor() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b4492d4784885bdc1306a09a2408cde8a73e6020;p=clang CGCXX: Use cast in getAddrOfCXXStructor() All callers should be passing `CXXConstructorDecl` or `CXXDestructorDecl` here, so use `cast<>` instead of `dyn_cast<>` when setting up the `GlobalDecl`. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236651 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index c8f2629c61..29a199d697 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -231,8 +231,7 @@ llvm::GlobalValue *CodeGenModule::getAddrOfCXXStructor( if (auto *CD = dyn_cast(MD)) { GD = GlobalDecl(CD, toCXXCtorType(Type)); } else { - auto *DD = dyn_cast(MD); - GD = GlobalDecl(DD, toCXXDtorType(Type)); + GD = GlobalDecl(cast(MD), toCXXDtorType(Type)); } StringRef Name = getMangledName(GD);