[lldb] Use byval type
authorNikita Popov <npopov@redhat.com>
Thu, 24 Mar 2022 11:55:42 +0000 (12:55 +0100)
committerNikita Popov <npopov@redhat.com>
Thu, 24 Mar 2022 11:55:42 +0000 (12:55 +0100)
Query byval type instead of pointer element type.

lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp

index f7f1982f4059af8481cfeae7a18476342bebddb9..ec8f8d83c4b3787c16a5dafe1453c91c69e25c8c 100644 (file)
@@ -56,21 +56,19 @@ static bool isRSLargeReturnCall(llvm::CallInst *call_inst) {
              ->getPrimitiveSizeInBits() > 128;
 }
 
-static bool isRSAllocationPtrTy(const llvm::Type *type) {
-  if (!type->isPointerTy())
-    return false;
-  auto ptr_type = type->getPointerElementType();
-
-  return ptr_type->isStructTy() &&
-         ptr_type->getStructName().startswith("struct.rs_allocation");
+static bool isRSAllocationTy(const llvm::Type *type) {
+  return type->isStructTy() &&
+         type->getStructName().startswith("struct.rs_allocation");
 }
 
 static bool isRSAllocationTyCallSite(llvm::CallInst *call_inst) {
   if (!call_inst->hasByValArgument())
     return false;
-  for (const auto *param : call_inst->operand_values())
-    if (isRSAllocationPtrTy(param->getType()))
-      return true;
+  for (unsigned i = 0; i < call_inst->arg_size(); ++i) {
+    if (llvm::Type *ByValTy = call_inst->getParamByValType(i))
+      if (isRSAllocationTy(ByValTy))
+        return true;
+  }
   return false;
 }