[PATCH] D53459: Ensure sanitizer check function calls have a !dbg location

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 19 17:12:07 PDT 2018


vsk added inline comments.


================
Comment at: lib/CodeGen/CGExpr.cpp:2871
+  auto *DI = CGF.getDebugInfo();
+  SourceLocation Loc = DI ? DI->getLocation() : SourceLocation();
+  auto DL = ApplyDebugLocation::CreateDefaultArtificial(CGF, Loc);
----------------
Why shouldn't this always be line 0? A call to a check handler is always auto-generated.


================
Comment at: test/CodeGenCXX/ubsan-check-debuglocs.cpp:2
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited \
+// RUN:   -fsanitize=null,object-size,return -fsanitize-recover=null \
+// RUN:   %s -o - | FileCheck %s
----------------
Are all three sanitizers needed here to reproduce the bug? Seems like a simpler test would be:

```
// RUN: ... -fsanitize=null ...

int deref(int *p) { return *p; }
// CHECK-LABEL: @deref
// CHECK: __ubsan_handle_type_mismatch_v1{{.*}} !dbg [[ubsan_handler_loc:![0-9]+]]
// CHECK: [[ubsan_handler_loc]] = !DILocation(line: 0
```


https://reviews.llvm.org/D53459





More information about the cfe-commits mailing list