[clang] [clang] solve crash due to function overloading. (PR #90255)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu May 2 00:32:40 PDT 2024


================
@@ -5702,13 +5702,16 @@ CodeGenModule::getLLVMLinkageVarDefinition(const VarDecl *VD) {
 static void replaceUsesOfNonProtoConstant(llvm::Constant *old,
                                           llvm::Function *newFn) {
   // Fast path.
-  if (old->use_empty()) return;
+  if (old->use_empty())
+    return;
 
   llvm::Type *newRetTy = newFn->getReturnType();
-  SmallVector<llvm::Value*, 4> newArgs;
+  SmallVector<llvm::Value *, 4> newArgs;
+
+  SmallVector<llvm::CallBase *> callSitesToBeRemovedFromParent;
 
   for (llvm::Value::use_iterator ui = old->use_begin(), ue = old->use_end();
-         ui != ue; ) {
+       ui != ue;) {
----------------
efriedma-quic wrote:

You can clean this up to use a regular for loop, without the early increment.

https://github.com/llvm/llvm-project/pull/90255


More information about the cfe-commits mailing list