Quuxplusone added a comment.

> I think that, ultimately, this warning isn't worth the code complexity in 
> clang to support it.

The code complexity is //at most// 11 lines (the 11 lines removed by this 
patch), which really isn't much.  But there's an interface-complexity argument 
to be made, for sure.  If you added a new option `-Wret-addr-label` as 
suggested above (for a total patch of +2 lines), then is it accurate to say:

- if `-Wret-addr-label` was enabled by default, we know of at least one 
codebase that would pass `-Wno-ret-addr-label` to their build
- if `-Wret-addr-label` was disabled by default, we don't know of any codebases 
that would voluntarily enable it

And if nobody would enable it voluntarily... might as well eliminate it, right?



================
Comment at: clang/test/Analysis/stack-addr-ps.cpp:81
     label:
-    void *const &x = &&label; // expected-note {{binding reference variable 
'x' here}}
-    return x; // expected-warning {{returning address of label, which is 
local}}
+    void *const &x = &&label;
+    return x;
----------------
Is it just me, or is this test case relying on lifetime extension for no good 
reason? Why is this not `void *const x = &&label;`?


https://reviews.llvm.org/D50805



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to