[PATCH] D70624: [Diagnostics] Warn for comparison with string literals expanded from macro (PR44064)

2019-11-24 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment. Thank you for the review Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D70624/new/ https://reviews.llvm.org/D70624 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[PATCH] D70624: [Diagnostics] Warn for comparison with string literals expanded from macro (PR44064)

2019-11-24 Thread Dávid Bolvanský via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGba4017670e19: [Diagnostics] Warn for comparison with string literals expanded from macro… (authored by xbolva00). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.or

[PATCH] D70624: [Diagnostics] Warn for comparison with string literals expanded from macro (PR44064)

2019-11-24 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D70624/new/ https://reviews.llvm.org/D70624

[PATCH] D70624: [Diagnostics] Warn for comparison with string literals expanded from macro (PR44064)

2019-11-24 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 updated this revision to Diff 230797. xbolva00 added a comment. Added new tests. Improved recommendation how to fix warning. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D70624/new/ https://reviews.llvm.org/D70624 Files: clang/include/c

[PATCH] D70624: [Diagnostics] Warn for comparison with string literals expanded from macro (PR44064)

2019-11-24 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Sema/SemaExpr.cpp:10368 - if (Expr::isSameComparisonOperand(LHS, RHS)) { -unsigned Result; -switch (Opc) { -case BO_EQ: case BO_LE: case BO_GE: - Result = AlwaysTrue; - break; -case BO_NE: cas

[PATCH] D70624: [Diagnostics] Warn for comparison with string literals expanded from macro (PR44064)

2019-11-24 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 marked 2 inline comments as done. xbolva00 added inline comments. Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:8431 "result of comparison against %select{a string literal|@encode}0 is " - "unspecified (use strncmp instead)">, - InGroup; + "unspecifi

[PATCH] D70624: [Diagnostics] Warn for comparison with string literals expanded from macro (PR44064)

2019-11-24 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:8431 "result of comparison against %select{a string literal|@encode}0 is " - "unspecified (use strncmp instead)">, - InGroup; + "unspecified">, InGroup; I th

[PATCH] D70624: [Diagnostics] Warn for comparison with string literals expanded from macro (PR44064)

2019-11-22 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 marked an inline comment as done. xbolva00 added inline comments. Comment at: clang/test/Sema/warn-stringcompare.c:4-6 +#define DELIM "/" +#define NULL (void *)0 + Current behaviour: https://godbolt.org/z/7nYH6N Repository: rG LLVM Github Monorepo C

[PATCH] D70624: [Diagnostics] Warn for comparison with string literals expanded from macro (PR44064)

2019-11-22 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 created this revision. xbolva00 added a reviewer: aaron.ballman. Herald added a project: clang. Herald added a subscriber: cfe-commits. xbolva00 marked an inline comment as done. xbolva00 added inline comments. Comment at: clang/test/Sema/warn-stringcompare.c:4-6 +#defin