ankineri added a comment.
I do agree that having it as part of `-Wunused-variable` is better on many
aspects, but I have a few concerns about it.
The proposed check can be applied to any type including STL ones such as
`std::string`, all as per codebase owner's choice. Adding this attribute to S
ankineri requested review of this revision.
ankineri added a comment.
`-Wunused-variable` does not detect unused non-trivially-destructible objects
because they may be used for RAII, i.e.
{
scoped_lock lock(&global_mutex);
critical_section();
}
`lock` here is not an unused variable
ankineri created this revision.
ankineri added a reviewer: sammccall.
Herald added a subscriber: carlosgalvezp.
Herald added a reviewer: njames93.
Herald added a project: All.
ankineri requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commi
AndreiGrischenko updated this revision to Diff 97866.
AndreiGrischenko added a comment.
Thanks Craig for the good advice. You are right I can check llc with MCU triple
using option -use-ctors. Please see updated patch.
https://reviews.llvm.org/D32543
Files:
llvm/lib/Target/X86/X86TargetMachi
AndreiGrischenko added a comment.
In https://reviews.llvm.org/D32543#738595, @ahatanak wrote:
> Do you need a front-end test? Since the changes are in the backend, I think
> it's better to add the test to the backend (using llc).
Yes, changes are in the backend, but they fix interface between
AndreiGrischenko created this revision.
Our runtime for MCU X86 target supports .init_array section for globals that
should be dynamically initialized.
But default Clang generates .ctors section and even if it has option
-fuse-init-array, the option has no effect if set explicitly in a command-l