Quuxplusone added inline comments.

================
Comment at: clang/test/CodeGenCXX/attr-no-zero-initializer.cpp:40
+// CHECK: @unt = global %struct.nontrivial undef
+nontrivial unt [[clang::no_zero_initializer]];
----------------
Can you explain a bit about how this interacts with C++ constructors? Will this 
object not have its constructor called at startup; or is it that the 
constructor will be called but the memory simply won't have been zeroed 
//before// calling the constructor?

For [P1144 relocation](https://wg21.link/p1144) (D50114, D61761, etc), Anton 
Zhilin and I have been discussing the possibility of a similar-sounding 
attribute that would skip the constructor of a local variable altogether, 
allowing someone to write e.g.
```
T relocate(T *source) {
    [[unconstructed]] T result;
    memcpy(result, source, sizeof(T));
    return result;
}
```
If your attribute does exactly that, then I'm interested. If your attribute 
doesn't do that, but is occupying real estate that //implies// that it does, 
then I'm also interested.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74361/new/

https://reviews.llvm.org/D74361



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

Reply via email to