[PATCH] D63423: [Diagnostics] Diagnose misused xor as pow
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 10 09:11:54 PDT 2019
aaron.ballman added inline comments.
================
Comment at: include/clang/Basic/DiagnosticGroups.td:508
def Varargs : DiagGroup<"varargs">;
+def XorUsedAsPow : DiagGroup<"xor-used-as-pow">;
----------------
xbolva00 wrote:
> jfb wrote:
> > Does this match the naming that GCC ended up with?
> No, they have no progress yet. GCC should not block our progress here..
Agreed, but we should still coordinate to ensure the names we pick are the same since this is a user-facing option. If GCC isn't adding this yet, can you file a bug report (or comment on an existing one) with the name we've chosen?
================
Comment at: lib/Sema/SemaExpr.cpp:10977-10980
+ if (!isa<UnaryOperator>(RHS.get()))
+ return;
+
+ const auto *UO = cast<UnaryOperator>(RHS.get());
----------------
`if (const auto *UO = dyn_cast<UnaryOperator>(RHS.get())) { ... }` rather than doing an `isa<>` followed by a `cast<>`.
================
Comment at: lib/Sema/SemaExpr.cpp:10997
+
+ if (S.getLangOpts().CPlusPlus) {
+ CharSourceRange XorRange =
----------------
Why is this C++ only? C has an `xor` macro that comes from `iso646.h`. Should add a test case for this situation.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63423/new/
https://reviews.llvm.org/D63423
More information about the cfe-commits
mailing list