[PATCH] D113793: Comment Sema: Run checks only when appropriate (NFC)

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 12 05:00:27 PDT 2022


aaron.ballman added a comment.

In general, I think this approach is defensible. Though I do wonder if we want to put an assert in the check functions to assert that the command is what you'd expect, so someone calling the check functions incorrectly will get some early feedback. WDYT?



================
Comment at: clang/lib/AST/CommentSema.cpp:666-667
 void Sema::checkDeprecatedCommand(const BlockCommandComment *Command) {
-  if (!Traits.getCommandInfo(Command->getCommandID())->IsDeprecatedCommand)
-    return;
-
----------------
e.g., turn this into an assert so if someone calls checkDeprectedCommand when it's not a deprecated command, they get yelled at. This makes asserts builds slightly slower (because we're getting the command ID twice), but I don't think the overhead should be all that noticeable in practice.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113793



More information about the cfe-commits mailing list