[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-05-22 Thread Fangrui Song via lldb-commits


@@ -801,7 +801,7 @@ static OutputDesc 
*addInputSec(StringMap> ,
   auto *firstIsec = cast(
   cast(sec->commands[0])->sectionBases[0]);
   OutputSection *firstIsecOut =
-  firstIsec->flags & SHF_LINK_ORDER

MaskRay wrote:

A CppCheck issue may or may not be useful for the project. Projects have 
different code styles. Applying a random static analyzer report may not be 
useful.

https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-05-06 Thread via lldb-commits


@@ -801,7 +801,7 @@ static OutputDesc 
*addInputSec(StringMap> ,
   auto *firstIsec = cast(
   cast(sec->commands[0])->sectionBases[0]);
   OutputSection *firstIsecOut =
-  firstIsec->flags & SHF_LINK_ORDER

luolent wrote:

Hi @MaskRay ,

the PR modifies all the files with non-trivial ternary operators given by 
Cppcheck ([issue](https://github.com/llvm/llvm-project/issues/85868)).
You can find the Cppcheck report inside the comments thread of the issue.

https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-05-04 Thread Jessica Clarke via lldb-commits


@@ -3802,7 +3802,7 @@ bool X86AsmParser::validateInstruction(MCInst , 
const OperandVector ) {
 //VFMULCPHZrr   Dest, Src1, Src2
 //VFMULCPHZrrk  Dest, Dest, Mask, Src1, Src2
 //VFMULCPHZrrkz Dest, Mask, Src1, Src2
-for (unsigned i = TSFlags & X86II::EVEX_K ? 2 : 1;

jrtc27 wrote:

The second level seems like a bug, it's not consistent with how `type 
identifier = expr ? expr : expr;` is handled in a block.

https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-05-04 Thread Fangrui Song via lldb-commits


@@ -801,7 +801,7 @@ static OutputDesc 
*addInputSec(StringMap> ,
   auto *firstIsec = cast(
   cast(sec->commands[0])->sectionBases[0]);
   OutputSection *firstIsecOut =
-  firstIsec->flags & SHF_LINK_ORDER

MaskRay wrote:

Why is random change made to lld/ELF?

`[-+*%] \w+ \?'` is extensively used and I don't see we add `)`

https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-05-04 Thread Fangrui Song via lldb-commits


@@ -3802,7 +3802,7 @@ bool X86AsmParser::validateInstruction(MCInst , 
const OperandVector ) {
 //VFMULCPHZrr   Dest, Src1, Src2
 //VFMULCPHZrrk  Dest, Dest, Mask, Src1, Src2
 //VFMULCPHZrrkz Dest, Mask, Src1, Src2
-for (unsigned i = TSFlags & X86II::EVEX_K ? 2 : 1;

MaskRay wrote:

I know it's subjective, but the new code with two levels of parens decreases 
readability.

https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-05-04 Thread via lldb-commits

github-actions[bot] wrote:



@luolent Congratulations on having your first Pull Request (PR) merged into the 
LLVM Project!

Your changes will be combined with recent changes from other authors, then 
tested
by our [build bots](https://lab.llvm.org/buildbot/). If there is a problem with 
a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as
the builds can include changes from many authors. It is not uncommon for your
change to be included in a build that fails due to someone else's changes, or
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail 
[here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr).

If your change does cause a problem, it may be reverted, or you can revert it 
yourself.
This is a normal part of [LLVM 
development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy).
 You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are 
working as expected, well done!


https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-05-04 Thread Simon Pilgrim via lldb-commits

https://github.com/RKSimon closed 
https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-05-03 Thread Simon Pilgrim via lldb-commits

https://github.com/RKSimon approved this pull request.

LGTM

https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-05-03 Thread via lldb-commits

https://github.com/luolent updated 
https://github.com/llvm/llvm-project/pull/90391

>From 54c6c6b7d71f5ff293412f5f91e9f880480284f8 Mon Sep 17 00:00:00 2001
From: luolent 
Date: Sat, 27 Apr 2024 22:17:58 +0300
Subject: [PATCH] llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp:3804: lacking
 () for clarity

---
 clang/lib/Basic/Targets/AMDGPU.cpp|  2 +-
 compiler-rt/lib/xray/xray_utils.h |  2 +-
 libc/src/__support/FPUtil/aarch64/FEnvImpl.h  | 20 
 .../FPUtil/aarch64/fenv_darwin_impl.h | 48 +--
 libc/src/__support/FPUtil/arm/FEnvImpl.h  | 40 
 libc/src/__support/FPUtil/riscv/FEnvImpl.h| 20 
 libc/src/__support/FPUtil/x86_64/FEnvImpl.h   | 24 +-
 libclc/generic/lib/math/log_base.h|  2 +-
 libcxxabi/src/cxa_personality.cpp |  4 +-
 lld/ELF/LinkerScript.cpp  |  2 +-
 .../source/MacOSX/MachException.cpp   |  2 +-
 .../AMDGPU/AsmParser/AMDGPUAsmParser.cpp  |  4 +-
 .../Disassembler/AMDGPUDisassembler.cpp   |  4 +-
 llvm/lib/Target/AVR/AVRAsmPrinter.cpp |  4 +-
 llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp  |  4 +-
 .../lib/Target/X86/AsmParser/X86AsmParser.cpp |  2 +-
 .../X86/MCTargetDesc/X86MCCodeEmitter.cpp |  2 +-
 .../Transforms/TosaDecomposeTransposeConv.cpp |  4 +-
 18 files changed, 94 insertions(+), 96 deletions(-)

diff --git a/clang/lib/Basic/Targets/AMDGPU.cpp 
b/clang/lib/Basic/Targets/AMDGPU.cpp
index 5742885df0461b..cc7be64656e5b2 100644
--- a/clang/lib/Basic/Targets/AMDGPU.cpp
+++ b/clang/lib/Basic/Targets/AMDGPU.cpp
@@ -232,7 +232,7 @@ AMDGPUTargetInfo::AMDGPUTargetInfo(const llvm::Triple 
,
 
   HasLegalHalfType = true;
   HasFloat16 = true;
-  WavefrontSize = GPUFeatures & llvm::AMDGPU::FEATURE_WAVE32 ? 32 : 64;
+  WavefrontSize = (GPUFeatures & llvm::AMDGPU::FEATURE_WAVE32) ? 32 : 64;
   AllowAMDGPUUnsafeFPAtomics = Opts.AllowAMDGPUUnsafeFPAtomics;
 
   // Set pointer width and alignment for the generic address space.
diff --git a/compiler-rt/lib/xray/xray_utils.h 
b/compiler-rt/lib/xray/xray_utils.h
index 333826168c0db2..5dc73d7fa8cdea 100644
--- a/compiler-rt/lib/xray/xray_utils.h
+++ b/compiler-rt/lib/xray/xray_utils.h
@@ -61,7 +61,7 @@ constexpr size_t gcd(size_t a, size_t b) {
 constexpr size_t lcm(size_t a, size_t b) { return a * b / gcd(a, b); }
 
 constexpr size_t nearest_boundary(size_t number, size_t multiple) {
-  return multiple * ((number / multiple) + (number % multiple ? 1 : 0));
+  return multiple * ((number / multiple) + ((number % multiple) ? 1 : 0));
 }
 
 constexpr size_t next_pow2_helper(size_t num, size_t acc) {
diff --git a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h 
b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
index d1d92169475d15..cd8a5970edd65a 100644
--- a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
@@ -53,19 +53,19 @@ struct FEnv {
   static constexpr uint32_t ExceptionControlFlagsBitPosition = 8;
 
   LIBC_INLINE static uint32_t getStatusValueForExcept(int excepts) {
-return (excepts & FE_INVALID ? INVALID : 0) |
-   (excepts & FE_DIVBYZERO ? DIVBYZERO : 0) |
-   (excepts & FE_OVERFLOW ? OVERFLOW : 0) |
-   (excepts & FE_UNDERFLOW ? UNDERFLOW : 0) |
-   (excepts & FE_INEXACT ? INEXACT : 0);
+return ((excepts & FE_INVALID) ? INVALID : 0) |
+   ((excepts & FE_DIVBYZERO) ? DIVBYZERO : 0) |
+   ((excepts & FE_OVERFLOW) ? OVERFLOW : 0) |
+   ((excepts & FE_UNDERFLOW) ? UNDERFLOW : 0) |
+   ((excepts & FE_INEXACT) ? INEXACT : 0);
   }
 
   LIBC_INLINE static int exceptionStatusToMacro(uint32_t status) {
-return (status & INVALID ? FE_INVALID : 0) |
-   (status & DIVBYZERO ? FE_DIVBYZERO : 0) |
-   (status & OVERFLOW ? FE_OVERFLOW : 0) |
-   (status & UNDERFLOW ? FE_UNDERFLOW : 0) |
-   (status & INEXACT ? FE_INEXACT : 0);
+return ((status & INVALID) ? FE_INVALID : 0) |
+   ((status & DIVBYZERO) ? FE_DIVBYZERO : 0) |
+   ((status & OVERFLOW) ? FE_OVERFLOW : 0) |
+   ((status & UNDERFLOW) ? FE_UNDERFLOW : 0) |
+   ((status & INEXACT) ? FE_INEXACT : 0);
   }
 
   static uint32_t getControlWord() {
diff --git a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h 
b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
index 5b59ba38d67bb6..feb48e3719bf16 100644
--- a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
+++ b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
@@ -63,39 +63,39 @@ struct FEnv {
   // located in a different place from FE_FLUSHTOZERO status bit relative to
   // the other exceptions.
   LIBC_INLINE static uint32_t exception_value_from_status(int status) {
-return (status & FE_INVALID ? EX_INVALID : 0) |
-   (status & FE_DIVBYZERO ? EX_DIVBYZERO : 0) |
-   (status & FE_OVERFLOW ? EX_OVERFLOW : 0) |
-   (status & FE_UNDERFLOW ? EX_UNDERFLOW : 0) |
-  

[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-04-30 Thread Alex Langford via lldb-commits

bulbazord wrote:

LLDB changes look fine.

https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-04-30 Thread Jay Foad via lldb-commits

jayfoad wrote:

AMDGPU changes are fine.

https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-04-30 Thread via lldb-commits

luolent wrote:

Hi @bulbazord , @lntue ,

thanks for your helpful comments, first time contributing here :)
I have updated the PR.

https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-04-30 Thread via lldb-commits

https://github.com/luolent edited 
https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-04-30 Thread via lldb-commits

https://github.com/luolent edited 
https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits