[PATCH] D107703: [AST][clangd] Expose documentation of Attrs on hover.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 12 04:04:17 PDT 2021


aaron.ballman added inline comments.


================
Comment at: clang/unittests/AST/AttrTest.cpp:19
+TEST(Attr, Doc) {
+  EXPECT_THAT(Attr::getDocumentation(attr::Used),
+              testing::HasSubstr("The compiler must emit the definition even "
----------------
It seems this is failing the premerge CI -- I think you need a call to `.str()` in here to convert the `StringRef` to a `std::string`?


================
Comment at: clang/utils/TableGen/ClangAttrEmitter.cpp:4237
+  static const llvm::StringRef AttrDoc[] = {
+  #define ATTR(NAME) AttrDoc_##NAME,
+  #include "clang/Basic/AttrList.inc"
----------------
kadircet wrote:
> i am not well-versed in tablegen, so sorry if i am being dense here, butt what happens to the attributes we skipped above (e.g. the ones without a `ASTNode` flag)?
> 
> Maybe we should be emitting a `... AttrDoc_X[] = "";` for all attributes, no matter what?
The ones without an AST node don't get an `attr::Kind` enumeration generated for them, so I believe this interface is safe.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107703



More information about the cfe-commits mailing list