[PATCH] D107292: [clang] adds warning to alert user when they use alternative tokens as references

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 2 11:18:26 PDT 2021


cjdb added inline comments.


================
Comment at: clang/lib/Parse/ParseDecl.cpp:5847-5849
+        constexpr int AmpAmp = 1;
+        Diag(Loc, diag::warn_declare_references_with_symbols)
+            << AmpAmp << AmpAmp;
----------------
aaron.ballman wrote:
> For consistency with the `Lvalue` case above.
I originally had `Rvalue`, but this is //technically// diagnosing both rvalue refs and forwarding refs (hence the awkward name). I guess it doesn't really matter at the parsing stage though, so this is just commentary.


================
Comment at: clang/test/Parser/warn-declare-references-with-symbols.cpp:2
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -Wdeclare-references-with-symbols -verify %s
+
----------------
aaron.ballman wrote:
> cjdb wrote:
> > I'm pretty confident there's a lit way for me to test specific lines with specific C++ modes, but I can't find it :(
> Are you thinking of `-verify=prefix` and `// prefix-warning {{whatever}}` combinations?
I thought it was possible to do have a RUN line where C++98 mode would only check lines 4-17, for example.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107292



More information about the cfe-commits mailing list