[PATCH] D31337: Use virtual functions in ParsedAttrInfo instead of function pointers

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 23 07:19:13 PST 2020


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from a minor nit and a question.



================
Comment at: clang/lib/Sema/ParsedAttr.cpp:144
+  // otherwise return a default ParsedAttrInfo.
+  if (A.getKind() < sizeof(AttrInfoMap)/sizeof(AttrInfoMap[0]))
+    return *AttrInfoMap[A.getKind()];
----------------
You can use `llvm::array_lengthof()` here instead.


================
Comment at: clang/utils/TableGen/ClangAttrEmitter.cpp:3646
+    OS << "};\n";
+    OS << "ParsedAttrInfo" << I->first << " ParsedAttrInfo" << I->first << "::Instance;\n";
   }
----------------
Would it make sense for this object to be `const` under the assumption that once we've generated a `ParsedAttrInfo` object, we don't want to modify its properties? I'm not certain if trying to be const-correct here would be a burden or not, so I don't insist on a change unless it's trivial to support.


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

https://reviews.llvm.org/D31337





More information about the cfe-commits mailing list