erik.pilkington added a comment.

In https://reviews.llvm.org/D48322#1148424, @rsmith wrote:

> Hmm, so this will mean that we can have internal linkage declarations marked 
> `Used` for which there is no definition, and we need to not warn on that.
>
> I think it might be better to avoid marking things used in this case (even 
> though they're still technically odr-used).


We already return `false` for discarded statements in `isOdrUseContext`, so 
neither `MarkVarDeclReferenced` nor `MarkFunctionReferenced` will set `Used`. 
With or without this patch, clang doesn't emit -Wundefined-internal for the 
following code:

  static int p();
  int main() {
    if constexpr (false) p();
  }

Is this what you were concerned about?


Repository:
  rC Clang

https://reviews.llvm.org/D48322



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D48322: [... Erik Pilkington via Phabricator via cfe-commits
    • [PATCH] D483... Erik Pilkington via Phabricator via cfe-commits
    • [PATCH] D483... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D483... Erik Pilkington via Phabricator via cfe-commits
    • [PATCH] D483... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D483... Phabricator via Phabricator via cfe-commits

Reply via email to