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

John Brawn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 26 06:45:07 PST 2020


john.brawn marked 2 inline comments as done.
john.brawn added inline comments.


================
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()];
----------------
aaron.ballman wrote:
> You can use `llvm::array_lengthof()` here instead.
Will do.


================
Comment at: clang/utils/TableGen/ClangAttrEmitter.cpp:3646
+    OS << "};\n";
+    OS << "ParsedAttrInfo" << I->first << " ParsedAttrInfo" << I->first << "::Instance;\n";
   }
----------------
aaron.ballman wrote:
> 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.
Making this const actually is trivial, so I'll do that.


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

https://reviews.llvm.org/D31337





More information about the cfe-commits mailing list