[PATCH] D94919: [clangd] Fix a crash when indexing invalid ObjC method declaration

Adam Czachorowski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 22 08:03:33 PST 2021


adamcz added inline comments.


================
Comment at: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp:1807-1811
+    @interface Foo
+    - (void)fun:(bool)foo
+      bar:(bool)bar,
+      baz:(bool)baz;
+    @end
----------------
dgoldman wrote:
> It's hard to tell what Clang makes of this, I think instead we should test out the root cause of this crash, IIUC, are the legacy C style parameters:
> 
> ```
> @interface Foo
> - (void)func:(bool)foo, bool bar;
> @end
> ```
Oh yeah, thanks. Like I said, I don't know ObjC, so I was just randomly changing code until it crashed ;-)


================
Comment at: clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp:1816-1819
+  // We mostly care about not crashing, but verify that we didn't insert garbage
+  // about X too.
+  EXPECT_THAT(TU.headerSymbols(), Not(Contains(QName("X"))));
+}
----------------
dgoldman wrote:
> We should verify the method name is exactly as expected but comment we mostly care about not crashing.
Oops, that's a copy/paste leftover, sorry about that. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94919



More information about the cfe-commits mailing list