[PATCH] D49751: Add maybe-unused attribute to a variable.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 13:22:44 PDT 2018


dblaikie added inline comments.


================
Comment at: lib/IR/SafepointIRVerifier.cpp:87
     const BasicBlock* BB = PN->getParent();
+    [[maybe_unused]]
     bool Listed = false;
----------------
nickdesaulniers wrote:
> srhines wrote:
> > Did you run clang-format on this? I think it belongs on the same line for LLVM coding style.
> Running `$ clang-format -i lib/IR/SafepointIRVerifier.cpp` makes quite a few changes to this file (and puts the attribute on the same line). Is that ok?  I assume clang-format can find the `.clang-format` in the top of the tree (using the LLVM style, as opposed to whatever the defaults are)?
You can run clang-format on only the changed lines, rather than the whole file. There's also the git-clang-format script that can format only the lines changed in a git branch.

Though also, usually the way LLVM would fix these sort of issues is by including a separate statement "(void)Listed;" just before the assertion. (that way, if the assertion is removed hopefully someone would remove the void cast, which would allow the compiler to identify that the variable was unread, etc)


Repository:
  rL LLVM

https://reviews.llvm.org/D49751





More information about the llvm-commits mailing list