rnk added a comment. Nice, this is way less complicated than we thought originally.
================ Comment at: clang/lib/CodeGen/CGExprScalar.cpp:572 CGF.CGM.EmitExplicitCastExprType(E, &CGF); + return VisitCastExpr(E); ---------------- Please revert unrelated whitespace changes. ================ Comment at: clang/lib/CodeGen/CGExprScalar.cpp:2068 + // Update heapallocsite metadata when there is an explicit cast. + if (llvm::CallInst *CI = dyn_cast<llvm::CallInst>(Src)) + if (CI->getMetadata("heapallocsite") && dyn_cast<ExplicitCastExpr>(CE)) ---------------- One thought I had here was, should this look through casts? I guess, what does MSVC do in wacky cases like this: struct Foo; struct Bar; Foo *p = (Foo*)(Bar*)malloc(42); I tested locally, and MSVC emits the first cast as the allocated type, so I guess that's consistent with what you have. Let's add the double cast test case to be thorough, though. ================ Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:1093 OS.AddComment("Type index"); - OS.EmitIntValue(getCompleteTypeIndex(DITy).getIndex(), 4); endSymbolRecord(HeapAllocEnd); ---------------- This change is unrelated, and also surprising to me, usually any symbol record wants to refer to the complete type index if it can. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61407/new/ https://reviews.llvm.org/D61407 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits