[PATCH] D65549: [Sema] Prevent -Wunused-lambda-capture from generating false positive warnings on templated member function

2019-08-07 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan updated this revision to Diff 214013. ziangwan added a comment. Fix style issue. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65549/new/ https://reviews.llvm.org/D65549 Files: clang/lib/Sema/SemaExpr.cpp clang/test/SemaCXX/warn-unused-lambda-capture-this.cpp Index:

[PATCH] D64666: [Sema] Enable -Wimplicit-int-float-conversion for integral to floating point precision loss

2019-08-04 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. In D64666#1613356 , @mgorny wrote: > In D64666#1613057 , @ziangwan wrote: > > > The warning is actually correct here. This implicit integral to float > > conversion loses precision. Is it

[PATCH] D64666: [Sema] Enable -Wimplicit-int-float-conversion for integral to floating point precision loss

2019-08-02 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. In D64666#1612947 , @mgorny wrote: > This change seems to have broken libc++ tests when run with trunk clang: > >

[PATCH] D64666: [Sema] Enable -Wimplicit-int-float-conversion for integral to floating point precision loss

2019-08-02 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. The two failing cases I am seeing are: /home/motus/netbsd8/netbsd8/llvm/projects/libcxx/include/random:3648:40: error: implicit conversion from 'unsigned long' to 'double' changes value from 18446744073709551615 to 18446744073709551616

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-31 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. Fixed. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64666/new/ https://reviews.llvm.org/D64666 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-31 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. Buildbot failed for x86_64 target. Fix in progress. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64666/new/ https://reviews.llvm.org/D64666 ___ cfe-commits mailing list

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-31 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. I have committed this patch. I will stay diligent in case anything fails. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64666/new/ https://reviews.llvm.org/D64666 ___ cfe-commits mailing

[PATCH] D65549: [Sema] Prevent -Wunused-lambda-capture from generating false positive warnings on templated member function

2019-07-31 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan created this revision. ziangwan added reviewers: rsmith, nickdesaulniers, kongyi, pirama, stephenkelly. Herald added a project: clang. Herald added a subscriber: cfe-commits. This is a continuation of https://reviews.llvm.org/D44844 and a potential fix for

[PATCH] D65184: [Sema] Thread Safety Analysis: Fix negative capability's LockKind representation.

2019-07-30 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan marked 2 inline comments as done. ziangwan added inline comments. Comment at: clang/test/SemaCXX/thread-safety-annotations.h:47 +// Enable thread safety attributes only with clang. +// The attributes can be safely erased when compiling with other compilers. +#if

[PATCH] D65184: [Sema] Thread Safety Analysis: Fix negative capability's LockKind representation.

2019-07-30 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan marked an inline comment as done. ziangwan added inline comments. Comment at: clang/test/SemaCXX/warn-thread-safety-negative.cpp:135-140 + if (condition) { +assertNotHeld(); // expected-warning {{mutex '!mu' is acquired exclusively and shared in the same scope}} +

[PATCH] D65184: [Sema] Thread Safety Analysis: Fix negative capability's LockKind representation.

2019-07-30 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan marked an inline comment as done. ziangwan added inline comments. Comment at: clang/test/SemaCXX/thread-safety-annotations.h:47 +// Enable thread safety attributes only with clang. +// The attributes can be safely erased when compiling with other compilers. +#if

[PATCH] D65184: [Sema] Thread Safety Analysis: Fix negative capability's LockKind representation.

2019-07-30 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. The problem is: by the current state of the thread safety analysis, `ASSERT_SHARED_CAPABILTIY(!mu)` introduces a shared negative capability, whereas `RELEASE(mu)` **and `RELEASE_SHARED(mu)`** introduce an exclusive negative capability, and `UNLOCK_FUNCTION(mu)`

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-30 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan marked an inline comment as done. ziangwan added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:11656 + IsListInit = + IsListInit || (isa(OrigE) && S.getLangOpts().CPlusPlus); + aaron.ballman wrote: > ziangwan wrote: > >

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-29 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan marked an inline comment as done. ziangwan added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:11656 + IsListInit = + IsListInit || (isa(OrigE) && S.getLangOpts().CPlusPlus); + aaron.ballman wrote: > Do you want to perform the

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-26 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan updated this revision to Diff 212015. ziangwan added a comment. Fix typos. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64666/new/ https://reviews.llvm.org/D64666 Files: clang/include/clang/Basic/DiagnosticGroups.td clang/include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-26 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan updated this revision to Diff 212001. ziangwan added a comment. Update diff. 1. Silence the warning when C++11 narrowing is in effect on intialization-list expression. 2. Add test cases to test "no duplicated warnings for c++11 narrowing" 3. Updated test cases to handle 32-bit host

[PATCH] D65184: [Sema] Thread Safety Analysis: Fix negative capability's LockKind representation.

2019-07-26 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan marked 4 inline comments as done. ziangwan added inline comments. Comment at: clang/lib/Analysis/ThreadSafety.cpp:2188-2190 +/// shared + exclusive = exclusive +/// generic + exclusive = exclusive +/// generic + shared = shared aaronpuchert wrote: >

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-25 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. My bad. I omit these two test cases. I apologize for my carelessness. Yes, this warning definitely is a duplicate of c++11 narrowing, *when the code actually uses initialization-list syntax. For example, the following code would issue duplicated warnings for now:

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-24 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan updated this revision to Diff 211666. ziangwan added a comment. Update diff. 1. Fix 2 failing test cases. I omitted these two. My mistake. 2. Fix trailing whitespaces. Okay? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64666/new/ https://reviews.llvm.org/D64666 Files:

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-24 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. In D64666#1600354 , @phosek wrote: > I'm seeing some test failures which appear to have been introduced by this > change: > > TEST 'Clang :: > CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp' FAILED

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-24 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan updated this revision to Diff 211617. ziangwan added a comment. Update diff. 1. Make the two warnings controlled by `-Wimplicit-int-float-conversion`, which is a subset of `-Wimplicit-float-conversion`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64666/new/

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-24 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. In D64666#1598194 , @jfb wrote: > Thanks, the update looks good. > > One thing I just noticed: if I have a codebase with > `-Wimplicit-float-conversion` it seems like updating clang will automatically > turn the two new

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-23 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan updated this revision to Diff 211381. ziangwan added a comment. Update diff. 1. Make "definitely lose" warning on by default. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64666/new/ https://reviews.llvm.org/D64666 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-23 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan marked an inline comment as done. ziangwan added inline comments. Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:3279 + "implicit conversion from %2 to %3 changes value from %0 to %1">, + InGroup, DefaultIgnore; + xbolva00 wrote: > Drop

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-23 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. In D64666#1597627 , @jfb wrote: > In D64666#1597193 , @aaron.ballman > wrote: > > > In D64666#1596660 , @xbolva00 > > wrote: > > > > > I think we

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-22 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. Final review ping. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64666/new/ https://reviews.llvm.org/D64666 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-22 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan updated this revision to Diff 211245. ziangwan added a comment. Update diff 1. Fix trailing whitespaces. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64666/new/ https://reviews.llvm.org/D64666 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-22 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. In D64666#1596512 , @xbolva00 wrote: > @jfb’s comment is not addressed yet. > > In D64666#1583629 , @jfb wrote: > > > I think you want to default-ignore the "may lose precision" warnings,

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-22 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. Ping. I am going to submit this patch if nobody objects. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64666/new/ https://reviews.llvm.org/D64666 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-16 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan marked an inline comment as done. ziangwan added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:11429 + S.Context.getFloatTypeSemantics(QualType(TargetBT, 0))); +TargetFloatValue.convertFromAPInt(SourceInt, +

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-15 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan updated this revision to Diff 209928. ziangwan marked an inline comment as done. ziangwan edited the summary of this revision. ziangwan added a comment. Update diff. 1. Adopt CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64666/new/ https://reviews.llvm.org/D64666 Files:

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-13 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan marked 9 inline comments as done. ziangwan added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:11430 +SmallString<32> PrettyTargetValue; +TargetFloatValue.toString(PrettyTargetValue, + TargetPrecision);

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-13 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan updated this revision to Diff 209710. ziangwan added a comment. Update diff: 1. fix the spelling issue `may loses integer precision` -> `may lose precision` 2. issue more accurate warnings when `int->float` conversion involves constant integer. CHANGES SINCE LAST ACTION

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-12 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. In D64666#1583792 , @xbolva00 wrote: > In D64666#1583667 , @ziangwan wrote: > > > In D64666#1583633 , @xbolva00 > > wrote: > > > > > You can check

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-12 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan marked 2 inline comments as done. ziangwan added inline comments. Comment at: clang/test/Sema/implicit-float-conversion.c:29 + double e = 0.0; + double f = i + e; +} etalvala wrote: > should this also test the case of: > ` > long g = L; >

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-12 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan marked 6 inline comments as done. ziangwan added inline comments. Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:3245 +def warn_impcast_integer_float_precision : Warning< + "implicit conversion from %0 to %1 may loses integer precision">, + InGroup,

[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

2019-07-12 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan updated this revision to Diff 209611. ziangwan added a comment. Fix spelling / comment / naming issues. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64666/new/ https://reviews.llvm.org/D64666 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D64666: Allow Clang -Wconversion, -Wimplicit-float-conversion warns about integer type -> floating point type implicit conversion precision loss.

2019-07-12 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. In D64666#1583633 , @xbolva00 wrote: > You can check also https://reviews.llvm.org/D52835. I hit there issue which I > didn't know how to solve. Hi David, I have read your patch. I think that integer-to-floating-point

[PATCH] D64666: Allow Clang -Wconversion, -Wimplicit-float-conversion warns about integer type -> floating point type implicit conversion precision loss.

2019-07-12 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan updated this revision to Diff 209591. ziangwan added a comment. Removed patch.patch. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64666/new/ https://reviews.llvm.org/D64666 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D64666: Allow Clang -Wconversion, -Wimplicit-float-conversion warns about integer type -> floating point type implicit conversion precision loss.

2019-07-12 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan created this revision. ziangwan added reviewers: kongyi, pirama, rsmith, nickdesaulniers. Herald added subscribers: cfe-commits, jdoerfert, jfb, mgrang, javed.absar. Herald added a project: clang. These code: long i = L; float a = L: float b = a + i; Will

[PATCH] D63822: [Driver] Fix style issues of --print-supported-cpus

2019-06-28 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan accepted this revision. ziangwan added a comment. This revision is now accepted and ready to land. LGTM Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63822/new/ https://reviews.llvm.org/D63822 ___

[PATCH] D63822: [Driver] Delete --print-supported-cpus in favor of -mcpu=? or -mtune=?

2019-06-26 Thread Ziang Wan via Phabricator via cfe-commits
ziangwan added a comment. Hey @MaskRay , can you explain why we should remove --print-supported-cpus. There already are similar options in clang such as `--print-effective-triple` and `--print-libgcc-file-name`. On the other hand, I almost never see an option goes like `-xxx=?`. Repository: