Author: adrian Date: Fri Nov 9 13:17:38 2018 New Revision: 346556 URL: http://llvm.org/viewvc/llvm-project?rev=346556&view=rev Log: Revert "Revert rL346454: Fix a use-after-free introduced by r344915."
This un-reverts commit 346454 with a relaxed CHECK for Windows. Added: cfe/trunk/test/CodeGen/ubsan-debuglog-return.c Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=346556&r1=346555&r2=346556&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Nov 9 13:17:38 2018 @@ -3538,7 +3538,7 @@ void CGDebugInfo::EmitLocation(CGBuilder // Update our current location setLocation(Loc); - if (CurLoc.isInvalid() || CurLoc.isMacroID()) + if (CurLoc.isInvalid() || CurLoc.isMacroID() || LexicalBlockStack.empty()) return; llvm::MDNode *Scope = LexicalBlockStack.back(); Added: cfe/trunk/test/CodeGen/ubsan-debuglog-return.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ubsan-debuglog-return.c?rev=346556&view=auto ============================================================================== --- cfe/trunk/test/CodeGen/ubsan-debuglog-return.c (added) +++ cfe/trunk/test/CodeGen/ubsan-debuglog-return.c Fri Nov 9 13:17:38 2018 @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -x c -debug-info-kind=line-tables-only -emit-llvm -fsanitize=returns-nonnull-attribute -o - %s | FileCheck %s +// The UBSAN function call in the epilogue needs to have a debug location. + +__attribute__((returns_nonnull)) void *allocate() {} + +// CHECK: define {{.*}}nonnull i8* @allocate(){{.*}} !dbg +// CHECK: call void @__ubsan_handle_nonnull_return_v1_abort +// CHECK-SAME: !dbg ![[LOC:[0-9]+]] +// CHECK: ret i8* +// CHECK-SAME: !dbg ![[LOC]] _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits