[clang] 2d84195 - [NFCI][clang][Codegen] CodeGenVTables::addVTableComponent(): use getGlobalDecl

Roman Lebedev via cfe-commits cfe-commits at lists.llvm.org
Wed May 12 10:40:21 PDT 2021


Author: Roman Lebedev
Date: 2021-05-12T20:39:54+03:00
New Revision: 2d84195d60b0cb5ea43b18ab8f6770a84bf32da4

URL: https://github.com/llvm/llvm-project/commit/2d84195d60b0cb5ea43b18ab8f6770a84bf32da4
DIFF: https://github.com/llvm/llvm-project/commit/2d84195d60b0cb5ea43b18ab8f6770a84bf32da4.diff

LOG: [NFCI][clang][Codegen] CodeGenVTables::addVTableComponent(): use getGlobalDecl

It does the same thing.
Split off from https://reviews.llvm.org/D100388

Added: 
    

Modified: 
    clang/lib/CodeGen/CGVTables.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index bef9a293b7ed5..a8e3a669353c3 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -727,22 +727,7 @@ void CodeGenVTables::addVTableComponent(ConstantArrayBuilder &builder,
   case VTableComponent::CK_FunctionPointer:
   case VTableComponent::CK_CompleteDtorPointer:
   case VTableComponent::CK_DeletingDtorPointer: {
-    GlobalDecl GD;
-
-    // Get the right global decl.
-    switch (component.getKind()) {
-    default:
-      llvm_unreachable("Unexpected vtable component kind");
-    case VTableComponent::CK_FunctionPointer:
-      GD = component.getFunctionDecl();
-      break;
-    case VTableComponent::CK_CompleteDtorPointer:
-      GD = GlobalDecl(component.getDestructorDecl(), Dtor_Complete);
-      break;
-    case VTableComponent::CK_DeletingDtorPointer:
-      GD = GlobalDecl(component.getDestructorDecl(), Dtor_Deleting);
-      break;
-    }
+    GlobalDecl GD = component.getGlobalDecl();
 
     if (CGM.getLangOpts().CUDA) {
       // Emit NULL for methods we can't codegen on this


        


More information about the cfe-commits mailing list