[PATCH] D105904: [clangd] Support `#pragma mark` in the outline

David Goldman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 2 13:37:05 PDT 2021


dgoldman added inline comments.


================
Comment at: clang-tools-extra/clangd/CollectMacros.cpp:13
 
+namespace {
+class CollectPragmaMarks : public clang::PPCallbacks {
----------------
kadircet wrote:
> can you nest this inside `clang::clangd` and drop the qualifiers ?
Done, had to keep clangd qualifier to prevent mixup with the function below, otherwise I get `error: call to non-static member function without an object argument`


================
Comment at: clang-tools-extra/clangd/FindSymbols.cpp:682
+  // here since editors won't properly render the symbol otherwise.
+  StringRef MaybeGroupName = Name;
+  if (MaybeGroupName.consume_front("-") &&
----------------
kadircet wrote:
> I think this reads easier:
> 
> ```
> bool IsGroup = Name.consume_front("-");
> Name = Name.ltrim();
> if (Name.empty())
>   Name = IsGroup ? "unnamed group" : ...;
> ```
That behavior is slightly different, we want to treat `#pragma mark -Foo` as `-Foo` non group but `#pragma mark - Foo` as `Foo` group.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105904



More information about the cfe-commits mailing list