[PATCH] D111259: [clang] Fix range for forward-declared enums

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 8 05:57:35 PDT 2021


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/AST/Decl.cpp:4509
+  auto Res = TagDecl::getSourceRange();
+  // Has a definition, we can use the usual source range.
+  if (TagDecl::getBraceRange().getEnd().isValid())
----------------
Both these comments echo the code a bit.

Maybe the only thing I'd mention is "TagDecl doesn't know about the enum base"


================
Comment at: clang/lib/AST/Decl.cpp:4510
+  // Has a definition, we can use the usual source range.
+  if (TagDecl::getBraceRange().getEnd().isValid())
+    return Res;
----------------
Nit: you don't need the TagDecl:: qualifier

Maybe move this condition inside the getITSI if, to make it clearer this is an exception/condition/interaction with that case.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111259



More information about the cfe-commits mailing list