[PATCH] D37529: [codeview] omit debug locations for nested exprs unless column info enabled

Zachary Turner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 6 15:26:37 PDT 2017


zturner added inline comments.


================
Comment at: clang/test/CodeGenCXX/debug-info-nested-exprs.cpp:44
+  int a = bar(x, y) +
+          baz(x, z) +
+          qux(y, z);
----------------
inglorion wrote:
> zturner wrote:
> > inglorion wrote:
> > > zturner wrote:
> > > > Can you make a function called `int foo()` and make this `int a = bar(foo(), y) + ...`
> > > Yes. Why? To test an additional level of nesting?
> > Yes.  for that matter, even better would be if this call to `foo()` spans multiple lines.  Right here you've got a single statement which spans multiple lines, but no individual sub-expression spans multiple lines.  And FWICT there is no nesting at all, since + is just a builtin operator.
> The nesting here is the calls to bar, baz, and qux inside the declaration of a. The old behavior would emit separate locations for each of the calls, the new behavior annotates each of the calls with the same location as the declaration. This causes the debugger to stop only once for the entire statement when using step over, and makes step into specific work.
Sure, but does that execute the same codepath as:

```
int a = bar(
                  baz());

a = bar(baz());

for (const auto &X : foo(bar()))

for (int x = foo(); x < bar(); baz(x))

if (foo() && bar())

if (createObject().func())
```

etc?  And what if one or more of these functions get inlined?  For example, what if you have:

```
int a = foo(bar(baz()), bar(buzz()));
```



https://reviews.llvm.org/D37529





More information about the cfe-commits mailing list