r236651 - CGCXX: Use cast in getAddrOfCXXStructor()

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed May 6 15:18:39 PDT 2015


Author: dexonsmith
Date: Wed May  6 17:18:39 2015
New Revision: 236651

URL: http://llvm.org/viewvc/llvm-project?rev=236651&view=rev
Log:
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`.

Modified:
    cfe/trunk/lib/CodeGen/CGCXX.cpp

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=236651&r1=236650&r2=236651&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Wed May  6 17:18:39 2015
@@ -231,8 +231,7 @@ llvm::GlobalValue *CodeGenModule::getAdd
   if (auto *CD = dyn_cast<CXXConstructorDecl>(MD)) {
     GD = GlobalDecl(CD, toCXXCtorType(Type));
   } else {
-    auto *DD = dyn_cast<CXXDestructorDecl>(MD);
-    GD = GlobalDecl(DD, toCXXDtorType(Type));
+    GD = GlobalDecl(cast<CXXDestructorDecl>(MD), toCXXDtorType(Type));
   }
 
   StringRef Name = getMangledName(GD);





More information about the cfe-commits mailing list