[PATCH] D94599: [clang][Tooling] Get rid of a hack in SymbolOccurrences, NFCI

Simon Tatham via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 19 05:16:06 PST 2021


simon_tatham added inline comments.


================
Comment at: clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h:81
+  union {
+    SourceRange SingleRange;
+    unsigned NumRanges;
----------------
simon_tatham wrote:
> This surely relies on `SourceRange` having no destructor (or rather, a trivial one). If that ever changes, then destruction of this class will risk either a spurious call to the destructor or a missing one.
> 
> Is there any way to somehow arrange that a build failure will occur if the definition of `SourceRange` changes in that way?
... aha, found one. Such as a static assertion that `std::is_trivially_destructible<clang::SourceLocation>::value` is 1.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94599



More information about the cfe-commits mailing list