[clang] [AST] Include clang/Basic/DiagnosticComment.h instead of clang/AST/CommentDiagnostic.h (PR #117499)

2024-12-06 Thread Richard Trieu via cfe-commits
Weverything wrote: I support getting rid of the Diagnostic.h files outside of the Basic directory, at least when they are just forwarding headers. From a layering point of view, Clang_Diagnostics should be the same level as Basic so it shouldn't be having things from AST. Removing the forwar

[clang] c4a1e0e - [clang] Remove redundant integer values in template type diffing

2024-12-01 Thread Richard Trieu via cfe-commits
Author: Richard Trieu Date: 2024-12-01T19:21:42-08:00 New Revision: c4a1e0efe6b0767dfb5861a7e8814d7db0c0de8a URL: https://github.com/llvm/llvm-project/commit/c4a1e0efe6b0767dfb5861a7e8814d7db0c0de8a DIFF: https://github.com/llvm/llvm-project/commit/c4a1e0efe6b0767dfb5861a7e8814d7db0c0de8a.diff

[PATCH] D138914: Make evaluation of nested requirement consistent with requires expr.

2022-12-21 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added inline comments. Comment at: clang/lib/Sema/SemaTemplateInstantiate.cpp:2339 +Req->getConstraintExpr()->getSourceRange(), Satisfaction)) + TransConstraint = Result[0]; +assert(!Trap.hasErrorOccurred() && "Substitution failures must be handled " -

[PATCH] D136564: [clang] Instantiate NTTPs and template default arguments with sugar

2022-10-27 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. I noticed some build failures after your commit. I'm trying to get a standalone reproducer. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136564/new/ https://reviews.llvm.org/D136564 __

[PATCH] D133586: [clang] initialize type qualifiers for FunctionNoProtoType

2022-09-22 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added inline comments. Comment at: clang/include/clang/AST/Type.h:3947 + Info) { +FunctionTypeBits.FastTypeQuals = 0; + } rmaz wrote: > aaron.ballman wrote: > > It seems a bit odd to me that we only want to initialize one member of

[PATCH] D133586: [clang] do not hash undefined qualifiers for FunctionNoProtoType

2022-09-09 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. In D133586#3781468 , @rmaz wrote: > In D133586#3781381 , @rtrieu wrote: > >> Do you have a test case for this? > > Was struggling to think of a good one. How about a test that repeatedly >

[PATCH] D133586: [clang] do not hash undefined qualifiers for FunctionNoProtoType

2022-09-09 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. Do you have a test case for this? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133586/new/ https://reviews.llvm.org/D133586 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

[PATCH] D130510: Missing tautological compare warnings due to unary operators

2022-08-17 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. In D130510#3728719 , @aaron.ballman wrote: > In D130510#3727096 , @rtrieu wrote: > >> This patch has been moving back and forth between >> `IsIntegerLiteralConstantExpr` and `getIntegerLi

[PATCH] D130510: Missing tautological compare warnings due to unary operators

2022-08-16 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. This patch has been moving back and forth between `IsIntegerLiteralConstantExpr` and `getIntegerLiteralSubexpressionValue`. The first function is preexisting and the second one is a new function. The final patch seems to settle on using just `getIntegerLiteralSubexpres

[PATCH] D131532: [Sema] Avoid isNullPointerConstant invocation

2022-08-10 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu accepted this revision. rtrieu added a comment. This revision is now accepted and ready to land. I think this is a reasonable step for improving compile times. I put some suggestions for more descriptive names below (he said, after suggesting those names in the first place). The descrip

[PATCH] D130510: Missing tautological compare warnings due to unary operators

2022-08-04 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. void foo(long x) { if ((x & 1) == 1L) return; // bad always false warning here static_assert(sizeof(int) < sizeof(long), "long is bigger than int"); static_assert((long(15) & 1) == 1L, "proof that condition can be true"); } I found this false positive case

[PATCH] D130510: Missing tautological compare warnings due to unary operators

2022-08-03 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. Can you add my earlier test case or something like it to SemaCXX/warn-bitwise-compare.cpp ? template void foo(int x) { bool b1 = (x & sizeof(T)) == 8; bool b2 = (x & I) == 8; bool b3 = (x & 4) == 8; // only warn here } void run(int x) {

[PATCH] D130510: Missing tautological compare warnings due to unary operators

2022-08-02 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. In D130510#3693494 , @aaron.ballman wrote: > In D130510#3692654 , @rtrieu wrote: > >> Because of this, warnings should treat dependent expressions as non-constant >> even when they can be

[PATCH] D130510: Missing tautological compare warnings due to unary operators

2022-08-01 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu reopened this revision. rtrieu added a comment. This revision is now accepted and ready to land. This warning is now flagging some code which I believe is a false positive. In particular, when template arguments are involved, their values can be calculated during template instantiation,

[PATCH] D112374: [clang] Implement ElaboratedType sugaring for types written bare

2022-07-29 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added inline comments. Comment at: clang/lib/AST/QualTypeNames.cpp:455 + if (const auto *UT = QT->getAs()) { +return getFullyQualifiedType(UT->getUnderlyingType(), Ctx, + WithGlobalNsPrefix); Moving this down here means

[PATCH] D119136: [clang] Implement Change scope of lambda trailing-return-type

2022-04-18 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. This seems to be acting weird in template instantations. Here's an example where the lambda only errors inside a template. template int foo(int x = 0) { auto lambda = [x = x+1]() -> decltype(x) { return x; }; return -1; } // no tem

[PATCH] D119496: [Clang][OpaquePtr] Remove calls to deprecated Address constructor

2022-02-11 Thread Richard Trieu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGd5c314cdf43a: [Clang][OpaquePtr] Remove deprecated Address constructor calls (authored by rtrieu). Repository: rG LLVM Github Monorepo CHANGES SI

[PATCH] D119496: [Clang][OpaquePtr] Remove calls to deprecated Address constructor

2022-02-10 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu created this revision. rtrieu added reviewers: cfe-commits, aeubanks. rtrieu requested review of this revision. Herald added a reviewer: jdoerfert. Herald added a subscriber: sstefan1. Herald added a project: clang. Explicitly specify element type when constructing Address in CGExpr.cpp.

[PATCH] D117376: Remove reference type when checking const structs

2022-01-28 Thread Richard Trieu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGbe2147db054e: Remove reference type when checking const structs (authored by rtrieu). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTI

[PATCH] D117376: Remove reference type when checking const structs

2022-01-14 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu created this revision. rtrieu added reviewers: rsmith, cfe-commits. rtrieu requested review of this revision. Herald added a project: clang. ConstStructBuilder::Finalize in CGExprConstant.ccp assumes that the passed in QualType is a RecordType. In some instances, the type is a reference t

[PATCH] D114382: [clang] Fix wrong -Wunused-local-typedef warning within a template function

2021-12-01 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added inline comments. Comment at: clang/test/Modules/odr_hash.cpp:4288 S s; +// expected-error@first.h:* {{'ParameterTest::S::Foo' has different definitions in different modules; definition in module 'FirstModule' first difference is 1st parameter with name ''}} +/

[PATCH] D108794: Fully qualify template template parameters when printing

2021-09-02 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu accepted this revision. rtrieu added a comment. This revision is now accepted and ready to land. In D108794#2978134 , @dblaikie wrote: > Ping > > In D108794#2976063 , @rtrieu wrote: > >> It looks like a str

[PATCH] D108794: Fully qualify template template parameters when printing

2021-08-31 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. It looks like a strict improvement on printing and most callers using the default args won't need to be updated. There's one more function call that should be updated: https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clangd/DumpAST.cpp#L298 Fixing that an

Re: [clang] c411c1b - Fix missing qualifier in template type diffing

2021-08-17 Thread Richard Trieu via cfe-commits
Thanks for the simplified test case. I've pushed it at 02e73d4 On Mon, Aug 16, 2021 at 10:31 PM David Blaikie wrote: > Perhaps the test case could be stripped down a bit? > > template > class Array {}; > > template > class S {}; > > template > Array Make(); > > void Call() { > Array> v = Mak

[PATCH] D101387: remove single quotes around sugguestion diagnostic

2021-04-27 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. In D101387#2720500 , @MaskRay wrote: > @rtrieu Do we have a way appending arbitrary messages to a diagnostic > template? Not an arbitrary number. The diagnostic format string is indexed, so it diagnostic string needs to know ah

[PATCH] D85778: More accurately compute the ranges of possible values for +, -, *, &, %.

2020-08-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu accepted this revision. rtrieu added a comment. This revision is now accepted and ready to land. LGTM Comment at: clang/lib/Sema/SemaChecking.cpp:10166 + /// The number of bits active in the int. Note that this includes exactly one + /// sign bit if !NoNegative. uns

[PATCH] D85574: [Sema] Fix missing warning on initializer lists on field initializers with overloaded operators

2020-08-10 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu accepted this revision. rtrieu 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/D85574/new/ https://reviews.llvm.org/D85574 ___ c

[PATCH] D85574: [Sema] Fix missing warning on initializer lists on field initializers with overloaded operators

2020-08-10 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added inline comments. Comment at: clang/lib/Sema/SemaDeclCXX.cpp:3584-3585 if (!isa(Base->IgnoreParenImpCasts())) return; Does the warning work if it was changed to be "Visit(Base);" before the return here instead of the change above?

[PATCH] D85287: Extend -Wtautological-bitwise-compare "bitwise or with non-zero value" warnings

2020-08-06 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. In D85287#2199490 , @sberg wrote: > In D85287#2199463 , @rtrieu wrote: > >> Also, have you tried running warning over a codebase? > > As I wrote: "At least building LibreOffice with this chan

[PATCH] D85287: Extend -Wtautological-bitwise-compare "bitwise or with non-zero value" warnings

2020-08-06 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a subscriber: AndersRonnholm. rtrieu added a comment. I looked back on the commits and while I did commit, I did it on the behalf of Anders Rönnholm, who did not have commit access at the time. I haven't seen activity from Anders in a while, but added to subscribers just in case.

[PATCH] D85256: Add -Wtautological-value-range-compare warning.

2020-08-06 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu accepted this revision. rtrieu 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/D85256/new/ https://reviews.llvm.org/D85256 ___ c

[PATCH] D79548: Fix false positive with warning -Wnon-c-typedef-for-linkage

2020-05-07 Thread Richard Trieu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG4ae537c2220f: Fix false positive with -Wnon-c-typedef-for-linkage (authored by rtrieu). Changed prior to commit: https://reviews.llvm.org/D79548?vs=262536&id=262808#toc Repository: rG LLVM Github Mon

[PATCH] D79548: Fix false positive with warning -Wnon-c-typedef-for-linkage

2020-05-06 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu created this revision. rtrieu added a reviewer: rsmith. Herald added a project: clang. Fix false positives for -Wnon-c-typedef-for-linkage Implicit methods for structs can confuse the warning, so exclude checking the Decl's that are implicit. Implicit Decl's for lambdas still need to be

[PATCH] D73762: New warning for for-loops where the iteration does not match the loop condition

2020-01-30 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu created this revision. This is a warning for when the increment/decrement in a for loop does not match the condition in the loop. If the condition has a relational operator, one operand can be deduced to be the larger value and the other operand the smaller value when the loop is run.

[PATCH] D73007: [Sema] Avoid Wrange-loop-analysis false positives

2020-01-23 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. I'm in favor of splitting the warning into subgroups, then deciding which ones should be in -Wall. We've done this with other warnings such as the conversion warnings and tautological compare warnings, with only a subset of them in -Wall. Repository: rG LLVM Github M

[PATCH] D72552: [Concepts] Constraint Satisfaction Caching

2020-01-21 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added inline comments. Comment at: clang/lib/AST/ASTConcept.cpp:17 #include "clang/AST/ASTContext.h" +#include "clang/Sema/SemaConcept.h" using namespace clang; This causes a circular dependency between AST and Sema. It looks like you are including thi

[PATCH] D71734: [Modules] Handle tag types and complain about bad merges in C/Objective-C mode

2020-01-14 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. Heads up in case it affects you refactoring work: While looking through this code, I found a bug I previously made. I fixed it with a small change, but that lies in the middle of your refactoring during FieldDecl handling. The change is here: https://reviews.llvm.org/r

[PATCH] D72551: Warn when a string literal is used in a range-based for-loop

2020-01-10 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu created this revision. String literals used in ranged-based for-loops will actually process the terminating null character as part of the loop, which may be unexpected. // This runs three times, once for c = 'h', then c = 'i', and finally as c = '\0' for (char c : "hi") This patch

[PATCH] D71734: [Modules] Handle tag types and complain about bad merges in C/Objective-C mode

2020-01-10 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added inline comments. Comment at: clang/lib/Serialization/ASTReader.cpp:11007 + // Issue any pending ODR-failure diagnostics. + for (auto &Merge : RecordOdrMergeFailures) { bruno wrote: > rtrieu wrote: > > Is this just a copy of the other loop? That'

[PATCH] D71734: [Modules] Handle tag types and complain about bad merges in C/Objective-C mode

2020-01-09 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added inline comments. Comment at: clang/lib/Serialization/ASTReader.cpp:11007 + // Issue any pending ODR-failure diagnostics. + for (auto &Merge : RecordOdrMergeFailures) { Is this just a copy of the other loop? That's a lot of code duplication. Re

[PATCH] D72212: [Sema] Improve -Wrange-loop-analysis warnings

2020-01-08 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added inline comments. Comment at: clang/lib/Sema/SemaStmt.cpp:2812-2813 - // TODO: Determine a maximum size that a POD type can be before a diagnostic - // should be emitted. Also, only ignore POD types with trivial copy - // constructors. - if (VariableType.isPODT

[PATCH] D71503: New warning on for-loops that never run because condition is false on the first iteration

2019-12-16 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu updated this revision to Diff 234180. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71503/new/ https://reviews.llvm.org/D71503 Files: clang/include/clang/AST/Expr.h clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/AST/ExprConstant.cpp clang/lib/Sema/SemaStmt.cpp

[PATCH] D71503: New warning on for-loops that never run because condition is false on the first iteration

2019-12-16 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. In D71503#1784697 , @lebedev.ri wrote: > Thank you for working on this! > This seems to be missing tests. My bad, still getting used to git. Updated with a test now. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71503/

[PATCH] D71503: New warning on for-loops that never run because condition is false on the first iteration

2019-12-13 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu created this revision. This is a proposed warning to be added to -Wfor-loop-analysis, which is part of -Wall. This warning will catch instances where the condition will be false on the first iteration and the loop body will never be run. The warning will be emitted when: 1. The for-lo

[PATCH] D69292: Proposal to add -Wtautological-compare to -Wall

2019-11-16 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. In D69292#1747062 , @mclow.lists wrote: > Sorry I'm late to the party; I've been traveling for 3+ weeks. > I would like to be reassured that the following code will not warn: > > ` >long foo = ...; // some calculation >if

[PATCH] D69292: Proposal to add -Wtautological-compare to -Wall

2019-11-12 Thread Richard Trieu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG9740f9f0b6e5: Add -Wtautological-compare to -Wall (authored by rtrieu). Herald added a project: clang. Changed prior to commit: https://reviews.llvm.org/D69292?vs=228361&id=228970#toc Repository: rG

[PATCH] D69292: Proposal to add -Wtautological-compare to -Wall

2019-11-07 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu updated this revision to Diff 228361. rtrieu added a comment. Add -Wall tests to check that certain warning groups are active with it and a test to check all warning groups that are turned on by -Wall. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D69292/new/ https://reviews.llvm

[PATCH] D69292: Proposal to add -Wtautological-compare to -Wall

2019-10-25 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. In D69292#1718415 , @thakis wrote: > Abstractly this lgtm. Do you have any data on true / false positive rates? Looking at the various warnings in -Wtautological-compare, only -Wtautological-overlap-compare and -Wtautological-bit

[PATCH] D66046: Add new tautological compare warning for bitwise-or with a non-zero constant

2019-10-21 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. In D66046#1717229 , @thakis wrote: > Mr Trieu, what do you think about adding some or all of the > Wtautological-compare warnings to Wall I thought -Wtautological-compare was already part of -Wall, so I'm all for adding it. I m

[PATCH] D69292: Proposal to add -Wtautological-compare to -Wall

2019-10-21 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu created this revision. Per https://reviews.llvm.org/D66046, patch to move -Wtautological-compare to -Wmost, which also adds it to -Wall. Some warnings in -Wtautological-compare and its diagnostic sub-groups are DefaultIgnore, so making them visible in -Wall will make them more discovera

[PATCH] D66043: Add to -Wparentheses case of bitwise-and ("&") and bitwise-or ("|") verses conditional operator ("?:")

2019-10-18 Thread Richard Trieu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG637af4cc3780: Add -Wbitwise-conditional-parentheses to warn on mixing '|' and '&' with "?:" (authored by rtrieu). Herald added a project: clang. Changed prior to commit: https://reviews.llvm.org/D66043

r375326 - Add -Wbitwise-conditional-parentheses to warn on mixing '|' and '&' with "?:"

2019-10-18 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Fri Oct 18 18:47:49 2019 New Revision: 375326 URL: http://llvm.org/viewvc/llvm-project?rev=375326&view=rev Log: Add -Wbitwise-conditional-parentheses to warn on mixing '|' and '&' with "?:" Extend -Wparentheses to cover mixing bitwise-and and bitwise-or with the conditional o

[PATCH] D66046: Add new tautological compare warning for bitwise-or with a non-zero constant

2019-10-18 Thread Richard Trieu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG8b0d14a8f0cc: New tautological warning for bitwise-or with non-zero constant always true. (authored by rtrieu). Herald added a project: clang. Changed prior to commit: https://reviews.llvm.org/D66046?vs

r375318 - New tautological warning for bitwise-or with non-zero constant always true.

2019-10-18 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Fri Oct 18 17:57:23 2019 New Revision: 375318 URL: http://llvm.org/viewvc/llvm-project?rev=375318&view=rev Log: New tautological warning for bitwise-or with non-zero constant always true. Taking a value and the bitwise-or it with a non-zero constant will always result in a no

[PATCH] D66046: Add new tautological compare warning for bitwise-or with a non-zero constant

2019-10-10 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added a comment. In D66046#1696785 , @xbolva00 wrote: > Could this patch solve https://bugs.llvm.org/show_bug.cgi?id=43573? No, but I left some notes on the bug on why negative values are hard and where to fix it. CHANGES SINCE LAST ACTION ht

r373421 - Revert r368237 - Update fix-it hints for std::move warnings.

2019-10-01 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Tue Oct 1 19:32:15 2019 New Revision: 373421 URL: http://llvm.org/viewvc/llvm-project?rev=373421&view=rev Log: Revert r368237 - Update fix-it hints for std::move warnings. r368237 attempted to improve fix-its for move warnings, but introduced some regressions to -Wpessimizin

r372454 - Fix bad APInt compare.

2019-09-20 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Fri Sep 20 21:18:54 2019 New Revision: 372454 URL: http://llvm.org/viewvc/llvm-project?rev=372454&view=rev Log: Fix bad APInt compare. APInt comparison require both to have the same bitwidth. Since only the value is needed, use the compare function APInt::isSameValue instead

[PATCH] D66045: Improve detection of same value in comparisons

2019-09-20 Thread Richard Trieu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL372453: Merge and improve code that detects same value in comparisons. (authored by rtrieu, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to commit:

r372453 - Merge and improve code that detects same value in comparisons.

2019-09-20 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Fri Sep 20 20:02:26 2019 New Revision: 372453 URL: http://llvm.org/viewvc/llvm-project?rev=372453&view=rev Log: Merge and improve code that detects same value in comparisons. -Wtautological-overlap-compare and self-comparison from -Wtautological-compare relay on detecting the

[PATCH] D66044: Extend -Wtautological-overlap-compare to accept negative values and integer conversions

2019-09-20 Thread Richard Trieu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL372448: Improve -Wtautological-overlap-compare (authored by rtrieu, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.o

r372448 - Improve -Wtautological-overlap-compare

2019-09-20 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Fri Sep 20 19:37:10 2019 New Revision: 372448 URL: http://llvm.org/viewvc/llvm-project?rev=372448&view=rev Log: Improve -Wtautological-overlap-compare Allow this warning to detect a larger number of constant values, including negative numbers, and handle non-int types better.

[PATCH] D66043: Add to -Wparentheses case of bitwise-and ("&") and bitwise-or ("|") verses conditional operator ("?:")

2019-09-06 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu updated this revision to Diff 219213. rtrieu added a comment. Add more test cases and split new warnings into a separate warning group, but still under -Wparentheses CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66043/new/ https://reviews.llvm.org/D66043 Files: include/clang/

[clang-tools-extra] r369316 - Fix typo. "piont" => "point"

2019-08-19 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Mon Aug 19 17:28:21 2019 New Revision: 369316 URL: http://llvm.org/viewvc/llvm-project?rev=369316&view=rev Log: Fix typo. "piont" => "point" Found by Chris Morris (cwmorris). Modified: clang-tools-extra/trunk/clang-tidy/abseil/DurationConversionCastCheck.cpp clang-t

[PATCH] D66044: Extend -Wtautological-overlap-compare to accept negative values and integer conversions

2019-08-13 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu marked an inline comment as done. rtrieu added a comment. In D66044#1626008 , @NoQ wrote: > Looks great, thanks! I'd appreciate direct CFG tests for the part that > changes the CFG (cf. `test/Analysis/cfg.cpp`), but i don't insist. Let's make > su

[PATCH] D66044: Extend -Wtautological-overlap-compare to accept negative values and integer conversions

2019-08-13 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu updated this revision to Diff 215021. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66044/new/ https://reviews.llvm.org/D66044 Files: lib/Analysis/CFG.cpp lib/Analysis/ReachableCode.cpp test/Analysis/cfg.cpp test/Sema/warn-overlap.c test/Sema/warn-unreachable.c test/Se

[PATCH] D66045: Improve detection of same value in comparisons

2019-08-13 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu marked an inline comment as done. rtrieu added inline comments. Comment at: test/SemaCXX/self-comparison.cpp:87 +}; +} // namespace member_tests jfb wrote: > rtrieu wrote: > > rtrieu wrote: > > > jfb wrote: > > > > The test only has `==`. Do other operator

[PATCH] D66045: Improve detection of same value in comparisons

2019-08-13 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu updated this revision to Diff 215002. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66045/new/ https://reviews.llvm.org/D66045 Files: include/clang/AST/Expr.h lib/AST/Expr.cpp lib/Analysis/CFG.cpp lib/Sema/SemaExpr.cpp test/Analysis/array-struct-region.cpp test/Sema/wa

[PATCH] D66043: Add to -Wparentheses case of bitwise-and ("&") and bitwise-or ("|") verses conditional operator ("?:")

2019-08-13 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu marked an inline comment as done. rtrieu added inline comments. Comment at: test/Sema/parentheses.c:148 + + (void)(x | b ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '|'}} expected-note 2{{place parentheses}} + (void)(x & b ? 1 : 2); // expect

[PATCH] D66043: Add to -Wparentheses case of bitwise-and ("&") and bitwise-or ("|") verses conditional operator ("?:")

2019-08-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu marked an inline comment as done. rtrieu added inline comments. Comment at: test/Sema/parentheses.c:156 + + (void)(x ^ b ? 1 : 2); // no warning, ^ is often used as logical xor + (void)(x || b ? 1 : 2); // no warning, logical operator jfb wrote: > rtri

[PATCH] D66043: Add to -Wparentheses case of bitwise-and ("&") and bitwise-or ("|") verses conditional operator ("?:")

2019-08-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu updated this revision to Diff 214753. rtrieu added a comment. Update comments to explain why bitwise-xor is treated as a logical operator. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66043/new/ https://reviews.llvm.org/D66043 Files: lib/Sema/SemaExpr.cpp test/Sema/parenthe

[PATCH] D66045: Improve detection of same value in comparisons

2019-08-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu marked 3 inline comments as done. rtrieu added inline comments. Comment at: test/Analysis/array-struct-region.cpp:31 + bool check() const { return this == this + 0; } + bool operator !() const { return this != this + 0; } NoQ wrote: > rtrieu wrote: > >

[PATCH] D66045: Improve detection of same value in comparisons

2019-08-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu updated this revision to Diff 214752. rtrieu added a comment. Check array accesses. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66045/new/ https://reviews.llvm.org/D66045 Files: include/clang/AST/Expr.h lib/AST/Expr.cpp lib/Analysis/CFG.cpp lib/Sema/SemaExpr.cpp test

[PATCH] D66045: Improve detection of same value in comparisons

2019-08-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu marked 2 inline comments as done. rtrieu added inline comments. Comment at: lib/AST/Expr.cpp:3931-3932 +case DeclRefExprClass: { + // DeclRefExpr without an ImplicitCastExpr can happen for integral + // template parameters. + const auto *DRE1 = cast(E1);

[PATCH] D66046: Add new tautological compare warning for bitwise-or with a non-zero constant

2019-08-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu marked 2 inline comments as done. rtrieu added inline comments. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:8161 + "bitwise or with non-zero value always evaluates to true">, + InGroup, DefaultIgnore; def warn_tautological_overlap_comparison : Warning< --

[PATCH] D66046: Add new tautological compare warning for bitwise-or with a non-zero constant

2019-08-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu updated this revision to Diff 214733. rtrieu added a comment. Create new function isIntOrEnumConstantZero to use instead of EvaluateAsInt CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66046/new/ https://reviews.llvm.org/D66046 Files: include/clang/Analysis/CFG.h include/clan

[PATCH] D66043: Add to -Wparentheses case of bitwise-and ("&") and bitwise-or ("|") verses conditional operator ("?:")

2019-08-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu marked an inline comment as done. rtrieu added inline comments. Comment at: test/Sema/parentheses.c:156 + + (void)(x ^ b ? 1 : 2); // no warning, ^ is often used as logical xor + (void)(x || b ? 1 : 2); // no warning, logical operator jfb wrote: > rtri

[PATCH] D66045: Improve detection of same value in comparisons

2019-08-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu marked 3 inline comments as done. rtrieu added a comment. In D66045#1624389 , @jfb wrote: > Does this work for unions as well? This will work for union accesses via the same member name, but not different member names. union U { int x; int y;

[PATCH] D66046: Add new tautological compare warning for bitwise-or with a non-zero constant

2019-08-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu marked an inline comment as done. rtrieu added inline comments. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:8161 + "bitwise or with non-zero value always evaluates to true">, + InGroup, DefaultIgnore; def warn_tautological_overlap_comparison : Warning< --

[PATCH] D66044: Extend -Wtautological-overlap-compare to accept negative values and integer conversions

2019-08-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu marked an inline comment as done. rtrieu added inline comments. Comment at: test/Sema/warn-unreachable.c:437 + if (~ 1) return; // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]] unaryOpNoFixit(); // expected-warning {{code will never be executed}} jfb wr

[PATCH] D66043: Add to -Wparentheses case of bitwise-and ("&") and bitwise-or ("|") verses conditional operator ("?:")

2019-08-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu marked 2 inline comments as done. rtrieu added inline comments. Comment at: test/Sema/parentheses.c:148 + + (void)(x | b ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '|'}} expected-note 2{{place parentheses}} + (void)(x & b ? 1 : 2); // expect

r368244 - Inline diagnostic text into .td file. NFC.

2019-08-07 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Wed Aug 7 18:45:31 2019 New Revision: 368244 URL: http://llvm.org/viewvc/llvm-project?rev=368244&view=rev Log: Inline diagnostic text into .td file. NFC. Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaExpr.cpp Modified: cfe/tr

r368237 - Update fix-it hints for std::move warnings.

2019-08-07 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Wed Aug 7 17:12:51 2019 New Revision: 368237 URL: http://llvm.org/viewvc/llvm-project?rev=368237&view=rev Log: Update fix-it hints for std::move warnings. Fix -Wpessimizing-move and -Wredundant-move when warning on initializer lists. The new fix-it hints for removing the std

Re: LLVM Types

2019-08-06 Thread Richard Trieu via cfe-commits
To avoid confusion, there's both a LLVM Type and a Clang Type. The LLVM Type is used in the LLVM IR while the Clang Type represents types in a language, like C++. The Clang Doxygen pages have this hierarchy, although it's truncated because Type is so large, but you can click through to get the mi

r365727 - Increase the number of parser diagnostics.

2019-07-10 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Wed Jul 10 19:54:15 2019 New Revision: 365727 URL: http://llvm.org/viewvc/llvm-project?rev=365727&view=rev Log: Increase the number of parser diagnostics. The reserved range for parser diagnostics is getting close to being filled, so increase the space for them. Modified:

[PATCH] D63789: [ODRHash] Fix null pointer dereference for ObjC selectors with empty slots.

2019-06-27 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu accepted this revision. rtrieu 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/D63789/new/ https://reviews.llvm.org/D63789 ___

[PATCH] D63789: [ODRHash] Fix null pointer dereference for ObjC selectors with empty slots.

2019-06-26 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added inline comments. Comment at: clang/lib/AST/ODRHash.cpp:73 AddBoolean(S.isUnarySelector()); unsigned NumArgs = S.getNumArgs(); for (unsigned i = 0; i < NumArgs; ++i) { vsapsai wrote: > rtrieu wrote: > > There's actually a second bug her

[PATCH] D63789: [ODRHash] Fix null pointer dereference for ObjC selectors with empty slots.

2019-06-25 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu added inline comments. Comment at: clang/lib/AST/ODRHash.cpp:73 AddBoolean(S.isUnarySelector()); unsigned NumArgs = S.getNumArgs(); for (unsigned i = 0; i < NumArgs; ++i) { There's actually a second bug here as well. When processing an arbi

r364119 - [ODRHash] Skip some typedef types.

2019-06-21 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Fri Jun 21 17:32:19 2019 New Revision: 364119 URL: http://llvm.org/viewvc/llvm-project?rev=364119&view=rev Log: [ODRHash] Skip some typedef types. In some cases, a typedef only strips aways a keyword for a type, keeping the same name as the root record type. This causes some

r362187 - Redirect test output to /dev/null

2019-05-30 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Thu May 30 19:23:33 2019 New Revision: 362187 URL: http://llvm.org/viewvc/llvm-project?rev=362187&view=rev Log: Redirect test output to /dev/null Modified: cfe/trunk/test/Driver/armv8.1m.main.s Modified: cfe/trunk/test/Driver/armv8.1m.main.s URL: http://llvm.org/viewvc/

Re: r359960 - Reduce amount of work ODR hashing does.

2019-05-07 Thread Richard Trieu via cfe-commits
*From: *David Blaikie *Date: *Mon, May 6, 2019 at 4:39 PM *To: *Richard Trieu *Cc: *cfe-commits On Mon, May 6, 2019 at 4:24 PM Richard Trieu wrote: > > > > There was no cycle for this crash. > > Oh, yeah, didn't mean to imply there were - but that a system designed &g

Re: r359960 - Reduce amount of work ODR hashing does.

2019-05-06 Thread Richard Trieu via cfe-commits
multiple times is expected. *From: *David Blaikie *Date: *Sat, May 4, 2019 at 9:06 AM *To: *Richard Trieu *Cc: *cfe-commits Does the ODR hashing have some sort of cycle breaking infrastructure - > so that if the same type is seen more than once (eg: classes have > members that have point

r359960 - Reduce amount of work ODR hashing does.

2019-05-03 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Fri May 3 21:22:33 2019 New Revision: 359960 URL: http://llvm.org/viewvc/llvm-project?rev=359960&view=rev Log: Reduce amount of work ODR hashing does. When a FunctionProtoType is in the original type in a DecayedType, the decayed type is a PointerType which points back the o

r359740 - Consume unexpected "template" keywords after "using"

2019-05-01 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Wed May 1 16:33:49 2019 New Revision: 359740 URL: http://llvm.org/viewvc/llvm-project?rev=359740&view=rev Log: Consume unexpected "template" keywords after "using" The parser was dealing with unexpected "template" keywords after "using" keywords too late and putting the pars

r356231 - Remove an assert in template pack deduction during nested instantiation.

2019-03-14 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Thu Mar 14 21:26:02 2019 New Revision: 356231 URL: http://llvm.org/viewvc/llvm-project?rev=356231&view=rev Log: Remove an assert in template pack deduction during nested instantiation. Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp cfe/trunk/test/SemaTem

[PATCH] D58122: Restore Check for Unreachable Exit Block in -Winfinite-recursion

2019-02-12 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu accepted this revision. rtrieu added a comment. This revision is now accepted and ready to land. LGTM Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D58122/new/ https://reviews.llvm.org/D58122 ___ cfe-commits ma

r350913 - Fix header issues.

2019-01-10 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Thu Jan 10 17:32:35 2019 New Revision: 350913 URL: http://llvm.org/viewvc/llvm-project?rev=350913&view=rev Log: Fix header issues. Several headers would fail to compile if other headers were not previously included. The usual issue is that a class is forward declared, but th

[clang-tools-extra] r350797 - Remove unnecessary include.

2019-01-09 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Wed Jan 9 20:53:10 2019 New Revision: 350797 URL: http://llvm.org/viewvc/llvm-project?rev=350797&view=rev Log: Remove unnecessary include. QuerySession.h does not need anything from Query.h, so it does not need to include it. Modified: clang-tools-extra/trunk/clang-quer

r350792 - Refactor declarations of ASTContext allocate functions into its own header.

2019-01-09 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Wed Jan 9 19:23:25 2019 New Revision: 350792 URL: http://llvm.org/viewvc/llvm-project?rev=350792&view=rev Log: Refactor declarations of ASTContext allocate functions into its own header. Forward declarations of the allocate functions combine with the forward declaration of t

Re: r350143 - Add vtable anchor to classes.

2019-01-04 Thread Richard Trieu via cfe-commits
s in the coding standard - is there any particular > other motivation for this? (Given you've been doing layering cleanup - I'm > wondering fi this is an interesting workaround for some layering problems, > for instance?) > > On Sat, Dec 29, 2018 at 1:05 PM Richard Trie

r350143 - Add vtable anchor to classes.

2018-12-28 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Fri Dec 28 18:02:30 2018 New Revision: 350143 URL: http://llvm.org/viewvc/llvm-project?rev=350143&view=rev Log: Add vtable anchor to classes. Modified: cfe/trunk/include/clang/AST/DeclCXX.h cfe/trunk/include/clang/AST/DeclTemplate.h cfe/trunk/include/clang/Lex/Mod

  1   2   3   4   5   >