[PATCH] D85028: [clangd] Support new/deleta operator in TargetFinder.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 1 10:56:57 PDT 2020


kadircet added a comment.

please note that this might require special handling for go-to-def. as go-to-def only jumps to canonical decl and in operator new's case the user provided one might not be canonical, whereas the canonical one is likely builtin without a source info.

also you have a typo in the review's title s/deleta/delete.

LGTM if you are not planning to make this work with go-to-def now (or ever), please LMK.



================
Comment at: clang-tools-extra/clangd/unittests/FindTargetTests.cpp:564
+  Code = R"cpp(
+    struct X {
+      static void *operator new(unsigned long s);
----------------
nit: you can simplify to (same for delete)

```cpp
void *operator new(unsigned long);
void foo() { new int; }
```


================
Comment at: clang-tools-extra/clangd/unittests/FindTargetTests.cpp:565
+    struct X {
+      static void *operator new(unsigned long s);
+    };
----------------
you might want to set --target to a fix triplet to ensure `size_t == unsigned long`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85028



More information about the cfe-commits mailing list