[Lldb-commits] [lldb] e7b929d - Adapt IRForTarget::RewriteObjCConstStrings() for D126689.

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 2 13:06:46 PDT 2022


Author: Adrian Prantl
Date: 2022-06-02T13:06:40-07:00
New Revision: e7b929d756504c70d3ab0d0ba82f28eec7f7b363

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

LOG: Adapt IRForTarget::RewriteObjCConstStrings() for D126689.

With opaque pointers, the LLVM IR expected by this function changed.

Added: 
    

Modified: 
    lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
index bd30ab546d4b..1cfa2b8742a6 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -615,29 +615,7 @@ bool IRForTarget::RewriteObjCConstStrings() {
         return false;
       }
 
-      ConstantExpr *nsstring_expr = dyn_cast<ConstantExpr>(nsstring_member);
-
-      if (!nsstring_expr) {
-        LLDB_LOG(log,
-                 "NSString initializer's str element is not a ConstantExpr");
-
-        m_error_stream.Printf("Internal error [IRForTarget]: An Objective-C "
-                              "constant string's string initializer is not "
-                              "constant\n");
-
-        return false;
-      }
-
-      GlobalVariable *cstr_global = nullptr;
-
-      if (nsstring_expr->getOpcode() == Instruction::GetElementPtr) {
-        Constant *nsstring_cstr = nsstring_expr->getOperand(0);
-        cstr_global = dyn_cast<GlobalVariable>(nsstring_cstr);
-      } else if (nsstring_expr->getOpcode() == Instruction::BitCast) {
-        Constant *nsstring_cstr = nsstring_expr->getOperand(0);
-        cstr_global = dyn_cast<GlobalVariable>(nsstring_cstr);
-      }
-
+      auto *cstr_global = dyn_cast<GlobalVariable>(nsstring_member);
       if (!cstr_global) {
         LLDB_LOG(log,
                  "NSString initializer's str element is not a GlobalVariable");


        


More information about the lldb-commits mailing list