aaron.ballman added inline comments.
================ Comment at: lib/Sema/SemaExpr.cpp:10929 + // Do not diagnose if xor keyword is used. + if (ExprStr.find("xor") != llvm::StringRef::npos) + return; ---------------- xbolva00 wrote: > xbolva00 wrote: > > jfb wrote: > > > xbolva00 wrote: > > > > Quuxplusone wrote: > > > > > xbolva00 wrote: > > > > > > jfb wrote: > > > > > > > Doesn't this match any expression that contains `xor`? Put > > > > > > > another way, I don't see `"xor"` used anywhere else under clang, > > > > > > > what's usually done? > > > > > > Yes, but since xor is keyword in C++, I think this is safe. > > > > > I believe JF is worried about expressions like `constexpr int > > > > > flexor_exponent = 3; return 10 ^ flexor_exponent;`. That expression > > > > > contains the substring `"xor"` but does not use the `xor` keyword. > > > > > Which reminds me, can you add some test cases showing what behavior > > > > > you expect for operands that are not integer literals but still > > > > > compile-time `const`, or `constexpr`, or template arguments? > > > > Ah, I will change it to “ xor “. > > > Spaces aren't the only valid whitespace character :) > > > > > > ``` > > > 2 xor > > > 31 > > > ``` > > I will rework it to chech only XOR op, not the while expr. > Well, 10 ^ flexor .. > > We cannot reach xor check, flexor is not a integer literal. So I will rework > nothing here. ``` #define flexor 7 ``` Now `flexor` is an integer literal. (A test case for this would be beneficial.) CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63423/new/ https://reviews.llvm.org/D63423 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits