It was easy to miss last terminating element while defining a new OptionValueEnumeration.
Neither assertion nor compiler warning were emitted.
Details
- Reviewers
clayborg jingham zturner - Commits
- rG8fe53c490a56: Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer llvm…
rLLDB343130: Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer llvm…
rL343130: Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer llvm…
Diff Detail
Event Timeline
My only concern with this is are we adding a bunch of C++ global constructors now in each global "static PropertyDefinition ...". Before each "static PropertyDefinition" would just be in the const data section.
Thank you for pointing this problem. Though ArrayRef constructor with std::array parameter is declared as constexpr, it is not a constant expression actually because std::array::data() member function is not constexpr until C++17.
So, I reverted using std::array and added constexpr keyword to each static PropertyDefinition and OptionDefinition to ensure that constant initialization requirements remain satisfied.
Looks fine to me, constexpr on the declaration guarantees it will be linker
initialized
This broke the apt.llvm.org CI on Debian Jessie and Ubuntu trusty (at least).
I reported https://bugs.llvm.org/show_bug.cgi?id=39131