r344915 added a call to ApplyDebugLocation to the sanitizer check
function emitter. Some of the sanitizers are emitted in the function
epilogue though and the LexicalScopeStack is emptied out before. By
detecting this situation and early-exiting from ApplyDebugLocation the
fallback location is used, which is equivalent to the return location.
rdar://problem/
45859802
........
Causes EXPENSIVE_CHECKS build bot failures: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346549
91177308-0d34-0410-b5e6-
96231b3b80d8
// Update our current location
setLocation(Loc);
- if (CurLoc.isInvalid() || CurLoc.isMacroID() || LexicalBlockStack.empty())
+ if (CurLoc.isInvalid() || CurLoc.isMacroID())
return;
llvm::MDNode *Scope = LexicalBlockStack.back();
+++ /dev/null
-// 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]]