r359164 - [PowerPC][NFC]Update licence to Apache 2
Author: jsji Date: Wed Apr 24 19:40:06 2019 New Revision: 359164 URL: http://llvm.org/viewvc/llvm-project?rev=359164&view=rev Log: [PowerPC][NFC]Update licence to Apache 2 Modified: cfe/trunk/lib/Headers/ppc_wrappers/mmintrin.h Modified: cfe/trunk/lib/Headers/ppc_wrappers/mmintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/ppc_wrappers/mmintrin.h?rev=359164&r1=359163&r2=359164&view=diff == --- cfe/trunk/lib/Headers/ppc_wrappers/mmintrin.h (original) +++ cfe/trunk/lib/Headers/ppc_wrappers/mmintrin.h Wed Apr 24 19:40:06 2019 @@ -1,22 +1,8 @@ /*=== mmintrin.h - Implementation of MMX intrinsics on PowerPC -=== * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * *===---=== */ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 9671d1d - [clang]Fixup clang -Werror, , -Wcovered-switch-default build failures
Author: Jinsong Ji Date: 2019-10-24T22:49:17Z New Revision: 9671d1dc1764701824913ecca2b76ab17c33c29e URL: https://github.com/llvm/llvm-project/commit/9671d1dc1764701824913ecca2b76ab17c33c29e DIFF: https://github.com/llvm/llvm-project/commit/9671d1dc1764701824913ecca2b76ab17c33c29e.diff LOG: [clang]Fixup clang -Werror,,-Wcovered-switch-default build failures llvm/clang/lib/CodeGen/CGBuiltin.cpp:6877:3: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default] Similar to https://reviews.llvm.org/rG7b3de1e811972b874d91554642ccb2ef5b32eed6 Added: Modified: clang/lib/CodeGen/CGBuiltin.cpp Removed: diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index c35d0a88e761..2caa8509ea06 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -6873,9 +6873,6 @@ Value *CodeGenFunction::EmitARMMVEBuiltinExpr(unsigned BuiltinID, } return ToReturn; } - - default: -llvm_unreachable("bad CustomCodegen enum value"); } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 2e43bab - [docs] Fix warnings in ConstantInterpreter
Author: Jinsong Ji Date: 2020-05-23T19:36:05Z New Revision: 2e43bab1c161a97df4883def3c4c4a8b92883377 URL: https://github.com/llvm/llvm-project/commit/2e43bab1c161a97df4883def3c4c4a8b92883377 DIFF: https://github.com/llvm/llvm-project/commit/2e43bab1c161a97df4883def3c4c4a8b92883377.diff LOG: [docs] Fix warnings in ConstantInterpreter Fixed following trivial issues that caught by warnings by adding indents. clang/docs/ConstantInterpreter.rst:133: WARNING: Bullet list ends without a blank line; unexpected unindent. clang/docs/ConstantInterpreter.rst:136: WARNING: Bullet list ends without a blank line; unexpected unindent. clang/docs/ConstantInterpreter.rst:153: WARNING: Bullet list ends without a blank line; unexpected unindent. clang/docs/ConstantInterpreter.rst:195: WARNING: Bullet list ends without a blank line; unexpected unindent. clang/docs/ConstantInterpreter.rst:225: WARNING: Bullet list ends without a blank line; unexpected unindent. clang/docs/ConstantInterpreter.rst:370: WARNING: Bullet list ends without a blank line; unexpected unindent. clang/docs/ConstantInterpreter.rst:383: WARNING: Bullet list ends without a blank line; unexpected unindent. Added: Modified: clang/docs/ConstantInterpreter.rst Removed: diff --git a/clang/docs/ConstantInterpreter.rst b/clang/docs/ConstantInterpreter.rst index c976f35a67c5..eba637585b8f 100644 --- a/clang/docs/ConstantInterpreter.rst +++ b/clang/docs/ConstantInterpreter.rst @@ -13,7 +13,7 @@ clang, improving performance on constructs which are executed inefficiently by the evaluator. The interpreter is activated using the following flags: * ``-fexperimental-new-constant-interpreter`` enables the interpreter, -emitting an error if an unsupported feature is encountered + emitting an error if an unsupported feature is encountered Bytecode Compilation @@ -130,11 +130,11 @@ descriptor that characterises the entire allocation, along with a few additional attributes: * ``IsStatic`` indicates whether the block has static duration in the -interpreter, i.e. it is not a local in a frame. + interpreter, i.e. it is not a local in a frame. * ``DeclID`` identifies each global declaration (it is set to an invalid -and irrelevant value for locals) in order to prevent illegal writes and -reads involving globals and temporaries with static storage duration. + and irrelevant value for locals) in order to prevent illegal writes and + reads involving globals and temporaries with static storage duration. Static blocks are never deallocated, but local ones might be deallocated even when there are live pointers to them. Pointers are only valid as @@ -150,8 +150,8 @@ The lifetime of blocks is managed through 3 methods stored in the descriptor of the block: * **CtorFn**: initializes the metadata which is store in the block, -alongside actual data. Invokes the default constructors of objects -which are not trivial (``Pointer``, ``RealFP``, etc.) + alongside actual data. Invokes the default constructors of objects + which are not trivial (``Pointer``, ``RealFP``, etc.) * **DtorFn**: invokes the destructors of non-trivial objects. @@ -192,13 +192,13 @@ The interpreter distinguishes 3 diff erent kinds of blocks: has the following fields: * **Offset**: byte offset into the array or record, used to step back to the - parent array or record. + parent array or record. * **IsConst**: flag indicating if the field is const-qualified. * **IsInitialized**: flag indicating whether the field or element was - initialized. For non-primitive fields, this is only relevant to determine - the dynamic type of objects during construction. + initialized. For non-primitive fields, this is only relevant to determine + the dynamic type of objects during construction. * **IsBase**: flag indicating whether the record is a base class. In that - case, the offset can be used to identify the derived class. + case, the offset can be used to identify the derived class. * **IsActive**: indicates if the field is the active field of a union. * **IsMutable**: indicates if the field is marked as mutable. @@ -222,19 +222,19 @@ Pointers, implemented in ``Pointer.h`` are represented as a tagged union. Some of these may not yet be available in upstream ``clang``. * **BlockPointer**: used to reference memory allocated and managed by the - interpreter, being the only pointer kind which allows dereferencing in the - interpreter + interpreter, being the only pointer kind which allows dereferencing in the + interpreter * **ExternPointer**: points to memory which can be addressed, but not read by - the interpreter. It is equivalent to APValue, tracking a declaration and a path - of fields and indices into that allocation. + the interpreter. It is equivalent to APValue, tracking a declaration and a path
[clang] e07f934 - [libclang] Check LLVM_HAVE_LINK_VERSION_SCRIPT
Author: Jinsong Ji Date: 2021-07-27T20:18:50Z New Revision: e07f9342be7132f433963880d95e471ae2246d64 URL: https://github.com/llvm/llvm-project/commit/e07f9342be7132f433963880d95e471ae2246d64 DIFF: https://github.com/llvm/llvm-project/commit/e07f9342be7132f433963880d95e471ae2246d64.diff LOG: [libclang] Check LLVM_HAVE_LINK_VERSION_SCRIPT There are some platform that might not have version script support, don't try to use version script on those. Reviewed By: MaskRay, hubert.reinterpretcast Differential Revision: https://reviews.llvm.org/D106914 Added: Modified: clang/tools/libclang/CMakeLists.txt Removed: diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt index 65863d7508a8c..8cc0fc622174a 100644 --- a/clang/tools/libclang/CMakeLists.txt +++ b/clang/tools/libclang/CMakeLists.txt @@ -76,7 +76,7 @@ endif() if (UNIX AND NOT APPLE) set(LLVM_EXPORTED_SYMBOL_FILE) - set(USE_VERSION_SCRIPT TRUE) + set(USE_VERSION_SCRIPT ${LLVM_HAVE_LINK_VERSION_SCRIPT}) endif() if (LLVM_EXPORTED_SYMBOL_FILE) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] edbdf8e - [AIX] Update fetch_and_add type
Author: Jinsong Ji Date: 2021-07-27T22:13:29Z New Revision: edbdf8e5b5aad9f1d7f12dd4025d6811a6fff0b2 URL: https://github.com/llvm/llvm-project/commit/edbdf8e5b5aad9f1d7f12dd4025d6811a6fff0b2 DIFF: https://github.com/llvm/llvm-project/commit/edbdf8e5b5aad9f1d7f12dd4025d6811a6fff0b2.diff LOG: [AIX] Update fetch_and_add type It turns out that the AIX kernel is defining int instead of unsigned int for fetch_and_add. Legacy XL also defines this to be signed. https://www.ibm.com/docs/en/aix/7.2?topic=f-fetch-add-kernel-services So update the type for compat. Reviewed By: hubert.reinterpretcast Differential Revision: https://reviews.llvm.org/D106920 Added: Modified: clang/include/clang/Basic/BuiltinsPPC.def clang/test/CodeGen/builtins-ppc-xlcompat-fetch-error.c clang/test/CodeGen/builtins-ppc-xlcompat-fetch.c Removed: diff --git a/clang/include/clang/Basic/BuiltinsPPC.def b/clang/include/clang/Basic/BuiltinsPPC.def index 3873231cdfe4..dfe97af300f4 100644 --- a/clang/include/clang/Basic/BuiltinsPPC.def +++ b/clang/include/clang/Basic/BuiltinsPPC.def @@ -64,8 +64,8 @@ BUILTIN(__builtin_ppc_fsqrt, "dd", "") BUILTIN(__builtin_ppc_fsqrts, "ff", "") BUILTIN(__builtin_ppc_compare_and_swap, "iiD*i*i", "") BUILTIN(__builtin_ppc_compare_and_swaplp, "iLiD*Li*Li", "") -BUILTIN(__builtin_ppc_fetch_and_add, "UiUiD*Ui", "") -BUILTIN(__builtin_ppc_fetch_and_addlp, "ULiULiD*ULi", "") +BUILTIN(__builtin_ppc_fetch_and_add, "iiD*i", "") +BUILTIN(__builtin_ppc_fetch_and_addlp, "LiLiD*Li", "") BUILTIN(__builtin_ppc_fetch_and_and, "UiUiD*Ui", "") BUILTIN(__builtin_ppc_fetch_and_andlp, "ULiULiD*ULi", "") BUILTIN(__builtin_ppc_fetch_and_or, "UiUiD*Ui", "") diff --git a/clang/test/CodeGen/builtins-ppc-xlcompat-fetch-error.c b/clang/test/CodeGen/builtins-ppc-xlcompat-fetch-error.c index a5124e3c10e9..3e9042df7a2c 100644 --- a/clang/test/CodeGen/builtins-ppc-xlcompat-fetch-error.c +++ b/clang/test/CodeGen/builtins-ppc-xlcompat-fetch-error.c @@ -1,17 +1,18 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // REQUIRES: powerpc-registered-target // RUN: %clang_cc1 -triple powerpc64-unknown-aix -target-cpu pwr8 \ // RUN: -verify %s void test_builtin_ppc_fetch_and_add2() { - volatile int a = 0; + volatile unsigned int a = 0; unsigned int b = 0; - __fetch_and_add(&a, b); // expected-warning {{passing 'volatile int *' to parameter of type 'volatile unsigned int *' converts between pointers to integer types with diff erent sign}} + __fetch_and_add(&a, b); // expected-warning {{passing 'volatile unsigned int *' to parameter of type 'volatile int *' converts between pointers to integer types with diff erent sign}} } void test_builtin_ppc_fetch_and_addlp() { - volatile long a = 0; + volatile unsigned long a = 0; unsigned long b = 0; - __fetch_and_addlp(&a, b); // expected-warning {{passing 'volatile long *' to parameter of type 'volatile unsigned long *' converts between pointers to integer types with diff erent sign}} + __fetch_and_addlp(&a, b); // expected-warning {{passing 'volatile unsigned long *' to parameter of type 'volatile long *' converts between pointers to integer types with diff erent sign}} } diff --git a/clang/test/CodeGen/builtins-ppc-xlcompat-fetch.c b/clang/test/CodeGen/builtins-ppc-xlcompat-fetch.c index 7d0b674b39c2..8b2b3630300d 100644 --- a/clang/test/CodeGen/builtins-ppc-xlcompat-fetch.c +++ b/clang/test/CodeGen/builtins-ppc-xlcompat-fetch.c @@ -16,7 +16,7 @@ // CHECK-NEXT:[[TMP2:%.*]] = atomicrmw add i32* [[A_ADDR]], i32 [[TMP1]] monotonic, align 4 // CHECK-NEXT:ret void // -void test_builtin_ppc_fetch_and_add(unsigned int a, unsigned int b) { +void test_builtin_ppc_fetch_and_add(int a, int b) { __fetch_and_add(&a, b); } @@ -31,7 +31,7 @@ void test_builtin_ppc_fetch_and_add(unsigned int a, unsigned int b) { // CHECK-NEXT:[[TMP2:%.*]] = atomicrmw add i64* [[A_ADDR]], i64 [[TMP1]] monotonic, align 8 // CHECK-NEXT:ret void // -void test_builtin_ppc_fetch_and_addlp(unsigned long a, unsigned long b) { +void test_builtin_ppc_fetch_and_addlp(long a, long b) { __fetch_and_addlp(&a, b); } // CHECK-LABEL: @test_builtin_ppc_fetch_and_and( ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Fix typo in __fprintf_chk Prototype (PR #80012)
https://github.com/jsji created https://github.com/llvm/llvm-project/pull/80012 And extra int was copied. >From 6df91613ae5a5a5f844167cae6f2f799c6a32aa8 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Tue, 30 Jan 2024 06:46:54 -0800 Subject: [PATCH] [Clang] Fix typo in __fprintf_chk Prototype And extra int was copied. --- clang/include/clang/Basic/Builtins.td | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td index 1af01fe0d700c..31a2bdeb2d3e5 100644 --- a/clang/include/clang/Basic/Builtins.td +++ b/clang/include/clang/Basic/Builtins.td @@ -1065,7 +1065,7 @@ def FPrintfChk : Builtin { def PrintfChk : Builtin { let Spellings = ["__builtin___printf_chk"]; let Attributes = [FunctionWithBuiltinPrefix, PrintfFormat<1>]; - let Prototype = "int(int, int, char const* restrict, ...)"; + let Prototype = "int(int, char const* restrict, ...)"; } def VFPrintfChk : Builtin { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Fix typo in __fprintf_chk Prototype (PR #80012)
https://github.com/jsji edited https://github.com/llvm/llvm-project/pull/80012 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Fix typo in __fprintf_chk Prototype (PR #80012)
https://github.com/jsji closed https://github.com/llvm/llvm-project/pull/80012 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][test] Add fPIC when building shared library (PR #80065)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/80065 >From 5eff606d672cd94175419080819a26bc01882b80 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Tue, 30 Jan 2024 13:32:59 -0800 Subject: [PATCH] [Clang][test] Add fPIC when building shared library --- clang/test/Interpreter/cxx20-modules.cppm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/test/Interpreter/cxx20-modules.cppm b/clang/test/Interpreter/cxx20-modules.cppm index cd2b04fdc547d..239968d8c7445 100644 --- a/clang/test/Interpreter/cxx20-modules.cppm +++ b/clang/test/Interpreter/cxx20-modules.cppm @@ -7,8 +7,8 @@ // // RUN: %clang -std=c++20 %t/mod.cppm --precompile \ // RUN: -o %t/mod.pcm --target=x86_64-linux-gnu -// RUN: %clang %t/mod.pcm -c -o %t/mod.o --target=x86_64-linux-gnu -// RUN: %clang -shared %t/mod.o -o %t/libmod.so --target=x86_64-linux-gnu +// RUN: %clang -fPIC %t/mod.pcm -c -o %t/mod.o --target=x86_64-linux-gnu +// RUN: %clang -fPIC -shared %t/mod.o -o %t/libmod.so --target=x86_64-linux-gnu // // RUN: cat %t/import.cpp | env LD_LIBRARY_PATH=%t:$LD_LIBRARY_PATH \ // RUN: clang-repl -Xcc=-std=c++20 -Xcc=-fmodule-file=M=%t/mod.pcm \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][test] Add fPIC when building shared library (PR #80065)
https://github.com/jsji closed https://github.com/llvm/llvm-project/pull/80065 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [LinkerWrapper] Handle AMDGPU Target-IDs correctly when linking (PR #78359)
jsji wrote: FYI. There is a failure in liner-wrapper.c in https://buildkite.com/llvm-project/github-pull-requests/builds/30337#018d1aaa-8225-4630-a5f0-527d1c7c129d ``` # note: command had no output on stdout or stderr | # error: command failed with exit status: 1 | # executed command: 'c:\ws\src\build\bin\filecheck.exe' 'C:\ws\src\clang\test\Driver\linker-wrapper.c' --check-prefix=AMD-TARGET-ID | # .---command stderr | # \| C:\ws\src\clang\test\Driver\linker-wrapper.c:172:19: error: AMD-TARGET-ID: expected string not found in input | # \| // AMD-TARGET-ID: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -mcpu=gfx90a:xnack+ -O2 -Wl,--no-undefined {{.*}}.o {{.*}}.o | # \| ^ | # \| :1:1: note: scanning from here | # \| c:\ws\src\build\bin\clang-linker-wrapper.exe: error: invalid argument | # \| ^ | # \| | # \| Input file: | # \| Check file: C:\ws\src\clang\test\Driver\linker-wrapper.c | # \| | # \| -dump-input=help explains the following input dump. | # \| | # \| Input was: | # \| << | # \|1: c:\ws\src\build\bin\clang-linker-wrapper.exe: error: invalid argument | # \| check:172 X~ error: no match found | # \|2: invalid argument | # \| check:172 ~ | # \| >> | # `- | # error: command failed with exit status: 1 ``` https://github.com/llvm/llvm-project/pull/78359 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [LinkerWrapper] Handle AMDGPU Target-IDs correctly when linking (PR #78359)
jsji wrote: Oh, Thanks, will give it a try, haven't pulled latest this morning. https://github.com/llvm/llvm-project/pull/78359 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r370902 - [PowerPC][Altivec] Fix constant argument for vec_dss
Author: jsji Date: Wed Sep 4 07:01:47 2019 New Revision: 370902 URL: http://llvm.org/viewvc/llvm-project?rev=370902&view=rev Log: [PowerPC][Altivec] Fix constant argument for vec_dss Summary: This is similar to vec_ct* in https://reviews.llvm.org/rL304205. The argument must be a constant, otherwise instruction selection will fail. always_inline is not enough for isel to always fold everything away at -O0. The fix is to turn the function into macros in altivec.h. Fixes https://bugs.llvm.org/show_bug.cgi?id=43072 Reviewers: nemanjai, hfinkel, #powerpc, wuzish Reviewed By: #powerpc, wuzish Subscribers: wuzish, kbarton, MaskRay, shchenz, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66699 Added: cfe/trunk/test/CodeGen/altivec-dss.c Modified: cfe/trunk/include/clang/Basic/BuiltinsPPC.def cfe/trunk/lib/Headers/altivec.h cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/test/CodeGen/builtins-ppc-error.c Modified: cfe/trunk/include/clang/Basic/BuiltinsPPC.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsPPC.def?rev=370902&r1=370901&r2=370902&view=diff == --- cfe/trunk/include/clang/Basic/BuiltinsPPC.def (original) +++ cfe/trunk/include/clang/Basic/BuiltinsPPC.def Wed Sep 4 07:01:47 2019 @@ -55,7 +55,7 @@ BUILTIN(__builtin_altivec_vcfux, "V4fV4i BUILTIN(__builtin_altivec_vctsxs, "V4SiV4fIi", "") BUILTIN(__builtin_altivec_vctuxs, "V4UiV4fIi", "") -BUILTIN(__builtin_altivec_dss, "vUi", "") +BUILTIN(__builtin_altivec_dss, "vUIi", "") BUILTIN(__builtin_altivec_dssall, "v", "") BUILTIN(__builtin_altivec_dst, "vvC*iUi", "") BUILTIN(__builtin_altivec_dstt, "vvC*iUi", "") Modified: cfe/trunk/lib/Headers/altivec.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=370902&r1=370901&r2=370902&view=diff == --- cfe/trunk/lib/Headers/altivec.h (original) +++ cfe/trunk/lib/Headers/altivec.h Wed Sep 4 07:01:47 2019 @@ -3286,9 +3286,7 @@ static __inline__ vector double __ATTRS_ /* vec_dss */ -static __inline__ void __attribute__((__always_inline__)) vec_dss(int __a) { - __builtin_altivec_dss(__a); -} +#define vec_dss __builtin_altivec_dss /* vec_dssall */ Modified: cfe/trunk/lib/Sema/SemaChecking.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=370902&r1=370901&r2=370902&view=diff == --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) +++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Sep 4 07:01:47 2019 @@ -3220,6 +3220,8 @@ bool Sema::CheckPPCBuiltinFunctionCall(u case PPC::BI__builtin_altivec_crypto_vshasigmad: return SemaBuiltinConstantArgRange(TheCall, 1, 0, 1) || SemaBuiltinConstantArgRange(TheCall, 2, 0, 15); + case PPC::BI__builtin_altivec_dss: +return SemaBuiltinConstantArgRange(TheCall, 0, 0, 3); case PPC::BI__builtin_tbegin: case PPC::BI__builtin_tend: i = 0; l = 0; u = 1; break; case PPC::BI__builtin_tsr: i = 0; l = 0; u = 7; break; Added: cfe/trunk/test/CodeGen/altivec-dss.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/altivec-dss.c?rev=370902&view=auto == --- cfe/trunk/test/CodeGen/altivec-dss.c (added) +++ cfe/trunk/test/CodeGen/altivec-dss.c Wed Sep 4 07:01:47 2019 @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple powerpc-linux-gnu -S -O0 -o - %s -target-feature +altivec | FileCheck %s + +// REQUIRES: powerpc-registered-target + +#include + +// CHECK-LABEL: test1 +// CHECK: dss +void test1() { + vec_dss(1); +} Modified: cfe/trunk/test/CodeGen/builtins-ppc-error.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-error.c?rev=370902&r1=370901&r2=370902&view=diff == --- cfe/trunk/test/CodeGen/builtins-ppc-error.c (original) +++ cfe/trunk/test/CodeGen/builtins-ppc-error.c Wed Sep 4 07:01:47 2019 @@ -73,3 +73,8 @@ void testUnpack128(int index) { __builtin_unpack_vector_int128(vsllli, index); //expected-error {{argument to '__builtin_unpack_vector_int128' must be a constant integer}} __builtin_unpack_vector_int128(vsllli, 5); //expected-error {{argument value 5 is outside the valid range [0, 1]}} } + +void testDSS(int index) { + vec_dss(index); //expected-error {{argument to '__builtin_altivec_dss' must be a constant integer}} + vec_dss(5); //expected-error {{argument value 5 is outside the valid range [0, 3]}} +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r370912 - [PowerPC][Altivec][Clang] Check compile-time constant for vec_dst*
Author: jsji Date: Wed Sep 4 08:22:26 2019 New Revision: 370912 URL: http://llvm.org/viewvc/llvm-project?rev=370912&view=rev Log: [PowerPC][Altivec][Clang] Check compile-time constant for vec_dst* Summary: This is follow up of https://reviews.llvm.org/D66699. We might get ISEL ICE if we call vec_dss with non const 3rd arg. ``` Cannot select: intrinsic %llvm.ppc.altivec.dst ``` We should check the constraints in clang and generate better error messages. Reviewers: nemanjai, hfinkel, echristo, #powerpc, wuzish Reviewed By: #powerpc, wuzish Subscribers: wuzish, kbarton, MaskRay, shchenz, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66748 Modified: cfe/trunk/include/clang/Basic/BuiltinsPPC.def cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/test/CodeGen/builtins-ppc-error.c Modified: cfe/trunk/include/clang/Basic/BuiltinsPPC.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsPPC.def?rev=370912&r1=370911&r2=370912&view=diff == --- cfe/trunk/include/clang/Basic/BuiltinsPPC.def (original) +++ cfe/trunk/include/clang/Basic/BuiltinsPPC.def Wed Sep 4 08:22:26 2019 @@ -57,10 +57,10 @@ BUILTIN(__builtin_altivec_vctuxs, "V4UiV BUILTIN(__builtin_altivec_dss, "vUIi", "") BUILTIN(__builtin_altivec_dssall, "v", "") -BUILTIN(__builtin_altivec_dst, "vvC*iUi", "") -BUILTIN(__builtin_altivec_dstt, "vvC*iUi", "") -BUILTIN(__builtin_altivec_dstst, "vvC*iUi", "") -BUILTIN(__builtin_altivec_dststt, "vvC*iUi", "") +BUILTIN(__builtin_altivec_dst, "vvC*iUIi", "") +BUILTIN(__builtin_altivec_dstt, "vvC*iUIi", "") +BUILTIN(__builtin_altivec_dstst, "vvC*iUIi", "") +BUILTIN(__builtin_altivec_dststt, "vvC*iUIi", "") BUILTIN(__builtin_altivec_vexptefp, "V4fV4f", "") Modified: cfe/trunk/lib/Sema/SemaChecking.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=370912&r1=370911&r2=370912&view=diff == --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) +++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Sep 4 08:22:26 2019 @@ -3231,6 +3231,11 @@ bool Sema::CheckPPCBuiltinFunctionCall(u case PPC::BI__builtin_tabortdci: return SemaBuiltinConstantArgRange(TheCall, 0, 0, 31) || SemaBuiltinConstantArgRange(TheCall, 2, 0, 31); + case PPC::BI__builtin_altivec_dst: + case PPC::BI__builtin_altivec_dstt: + case PPC::BI__builtin_altivec_dstst: + case PPC::BI__builtin_altivec_dststt: +return SemaBuiltinConstantArgRange(TheCall, 2, 0, 3); case PPC::BI__builtin_vsx_xxpermdi: case PPC::BI__builtin_vsx_xxsldwi: return SemaBuiltinVSX(TheCall); Modified: cfe/trunk/test/CodeGen/builtins-ppc-error.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-error.c?rev=370912&r1=370911&r2=370912&view=diff == --- cfe/trunk/test/CodeGen/builtins-ppc-error.c (original) +++ cfe/trunk/test/CodeGen/builtins-ppc-error.c Wed Sep 4 08:22:26 2019 @@ -78,3 +78,14 @@ void testDSS(int index) { vec_dss(index); //expected-error {{argument to '__builtin_altivec_dss' must be a constant integer}} vec_dss(5); //expected-error {{argument value 5 is outside the valid range [0, 3]}} } + +void testDST(int index) { + vec_dst(&vsi, index, index); //expected-error {{argument to '__builtin_altivec_dst' must be a constant integer}} + vec_dst(&vsi, index, 5); //expected-error {{argument value 5 is outside the valid range [0, 3]}} + vec_dstt(&vsi, index, index); //expected-error {{argument to '__builtin_altivec_dstt' must be a constant integer}} + vec_dstt(&vsi, index, 5); //expected-error {{argument value 5 is outside the valid range [0, 3]}} + vec_dstst(&vsi, index, index); //expected-error {{argument to '__builtin_altivec_dstst' must be a constant integer}} + vec_dstst(&vsi, index, 5); //expected-error {{argument value 5 is outside the valid range [0, 3]}} + vec_dststt(&vsi, index, index); //expected-error {{argument to '__builtin_altivec_dststt' must be a constant integer}} + vec_dststt(&vsi, index, 5); //expected-error {{argument value 5 is outside the valid range [0, 3]}} +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] e2b8e21 - [clang][OpenCL] Fix covered switch warning
Author: Jinsong Ji Date: 2020-01-14T16:21:42Z New Revision: e2b8e2113a4929027a237b67f7be86db4ec103d3 URL: https://github.com/llvm/llvm-project/commit/e2b8e2113a4929027a237b67f7be86db4ec103d3 DIFF: https://github.com/llvm/llvm-project/commit/e2b8e2113a4929027a237b67f7be86db4ec103d3.diff LOG: [clang][OpenCL] Fix covered switch warning -Werror clang build is broken now. tools/clang/lib/Sema/OpenCLBuiltins.inc:11824:5: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default] default: We don't need default now, since all enumeration values are covered. Reviewed By: svenvh Differential Revision: https://reviews.llvm.org/D72707 Added: Modified: clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp Removed: diff --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp index dcdc4bf12e98..41d33b550680 100644 --- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp +++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp @@ -751,9 +751,7 @@ static void OCL2Qual(ASTContext &Context, const OpenCLTypeStruct &Ty, } // End of switch statement. - OS << "default:\n" - << " llvm_unreachable(\"OpenCL builtin type not handled yet\");\n" - << " } // end of switch (Ty.ID)\n\n"; + OS << " } // end of switch (Ty.ID)\n\n"; // Step 2. // Add ExtVector types if this was a generic type, as the switch statement ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b49b8f0 - [PowerPC][Clang] Remove QPX support
Author: Jinsong Ji Date: 2020-12-07T10:15:39-05:00 New Revision: b49b8f096c0382da17d3203dfaa3f54d04a47d27 URL: https://github.com/llvm/llvm-project/commit/b49b8f096c0382da17d3203dfaa3f54d04a47d27 DIFF: https://github.com/llvm/llvm-project/commit/b49b8f096c0382da17d3203dfaa3f54d04a47d27.diff LOG: [PowerPC][Clang] Remove QPX support Clean up QPX code in clang missed in https://reviews.llvm.org/D83915 Reviewed By: #powerpc, steven.zhang Differential Revision: https://reviews.llvm.org/D92329 Added: Modified: clang/docs/ClangCommandLineReference.rst clang/include/clang/Driver/Options.td clang/lib/AST/ASTContext.cpp clang/lib/Basic/Targets/PPC.h clang/lib/CodeGen/TargetInfo.cpp clang/test/CodeGen/ppc64-elf-abi.c clang/test/Driver/linux-ld.c clang/test/Driver/ppc-features.cpp clang/test/OpenMP/simd_metadata.c llvm/test/Transforms/LoopVectorize/PowerPC/vectorize-only-for-real.ll Removed: clang/test/CodeGen/ppc64-qpx-vector.c diff --git a/clang/docs/ClangCommandLineReference.rst b/clang/docs/ClangCommandLineReference.rst index 3674f3a62695..ce510f335bd4 100644 --- a/clang/docs/ClangCommandLineReference.rst +++ b/clang/docs/ClangCommandLineReference.rst @@ -3169,8 +3169,6 @@ PowerPC .. option:: -mpower9-vector, -mno-power9-vector -.. option:: -mqpx, -mno-qpx - .. option:: -msecure-plt .. option:: -mspe, -mno-spe diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index b58f5cbc63d0..6480d6e80293 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2639,8 +2639,6 @@ def mno_mfocrf : Flag<["-"], "mno-mfocrf">, Group; def mno_mfcrf : Flag<["-"], "mno-mfcrf">, Alias; def mpopcntd : Flag<["-"], "mpopcntd">, Group; def mno_popcntd : Flag<["-"], "mno-popcntd">, Group; -def mqpx : Flag<["-"], "mqpx">, Group; -def mno_qpx : Flag<["-"], "mno-qpx">, Group; def mcrbits : Flag<["-"], "mcrbits">, Group; def mno_crbits : Flag<["-"], "mno-crbits">, Group; def minvariant_function_descriptors : diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index dacb9679c493..c52369cd8a02 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -2360,12 +2360,6 @@ unsigned ASTContext::getTypeUnadjustedAlign(const Type *T) const { unsigned ASTContext::getOpenMPDefaultSimdAlign(QualType T) const { unsigned SimdAlign = getTargetInfo().getSimdDefaultAlign(); - // Target ppc64 with QPX: simd default alignment for pointer to double is 32. - if ((getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64 || - getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64le) && - getTargetInfo().getABI() == "elfv1-qpx" && - T->isSpecificBuiltinType(BuiltinType::Double)) -SimdAlign = 256; return SimdAlign; } diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h index ad754462370f..a4677cd067f7 100644 --- a/clang/lib/Basic/Targets/PPC.h +++ b/clang/lib/Basic/Targets/PPC.h @@ -438,7 +438,7 @@ class LLVM_LIBRARY_VISIBILITY PPC64TargetInfo : public PPCTargetInfo { // PPC64 Linux-specific ABI options. bool setABI(const std::string &Name) override { -if (Name == "elfv1" || Name == "elfv1-qpx" || Name == "elfv2") { +if (Name == "elfv1" || Name == "elfv2") { ABI = Name; return true; } diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 4815266371bc..7213f7864d43 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -4885,42 +4885,12 @@ class PPC64_SVR4_ABIInfo : public SwiftABIInfo { private: static const unsigned GPRBits = 64; ABIKind Kind; - bool HasQPX; bool IsSoftFloatABI; - // A vector of float or double will be promoted to <4 x f32> or <4 x f64> and - // will be passed in a QPX register. - bool IsQPXVectorTy(const Type *Ty) const { -if (!HasQPX) - return false; - -if (const VectorType *VT = Ty->getAs()) { - unsigned NumElements = VT->getNumElements(); - if (NumElements == 1) -return false; - - if (VT->getElementType()->isSpecificBuiltinType(BuiltinType::Double)) { -if (getContext().getTypeSize(Ty) <= 256) - return true; - } else if (VT->getElementType()-> - isSpecificBuiltinType(BuiltinType::Float)) { -if (getContext().getTypeSize(Ty) <= 128) - return true; - } -} - -return false; - } - - bool IsQPXVectorTy(QualType Ty) const { -return IsQPXVectorTy(Ty.getTypePtr()); - } - public: - PPC64_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT, ABIKind Kind, bool HasQPX, + PPC64_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT, ABIKind Kind, bool SoftFloatABI) - : SwiftABIInfo(CGT), Kind(Kind), HasQPX(HasQPX), -IsSoftFloatABI(SoftFloatABI) {} + : SwiftABII
[clang] 82b5281 - [Driver][test] Don't assume integrated-as
Author: Jinsong Ji Date: 2021-05-17T20:24:21Z New Revision: 82b52812471ca4e7228714aab15110bb740669d0 URL: https://github.com/llvm/llvm-project/commit/82b52812471ca4e7228714aab15110bb740669d0 DIFF: https://github.com/llvm/llvm-project/commit/82b52812471ca4e7228714aab15110bb740669d0.diff LOG: [Driver][test] Don't assume integrated-as The tests of fdebug-compilation-dir and -ffile-compilation-dir for `-x assembler` are assuming integrated-as. If the platform set the no-itegrated-as by default (eg: AIX for now), then this test will fail. Add the -integrated-as to aviod relying on the platform defaults. Reviewed By: thakis Differential Revision: https://reviews.llvm.org/D102647 Added: Modified: clang/test/Driver/clang_f_opts.c Removed: diff --git a/clang/test/Driver/clang_f_opts.c b/clang/test/Driver/clang_f_opts.c index 6077058ad5b2..a255f68713ae 100644 --- a/clang/test/Driver/clang_f_opts.c +++ b/clang/test/Driver/clang_f_opts.c @@ -516,10 +516,10 @@ // RUN: %clang -### -S -fdebug-compilation-dir . %s 2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s // RUN: %clang -### -S -fdebug-compilation-dir=. %s 2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s -// RUN: %clang -### -fdebug-compilation-dir . -x assembler %s 2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s -// RUN: %clang -### -fdebug-compilation-dir=. -x assembler %s 2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s +// RUN: %clang -### -integrated-as -fdebug-compilation-dir . -x assembler %s 2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s +// RUN: %clang -### -integrated-as -fdebug-compilation-dir=. -x assembler %s 2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s // RUN: %clang -### -S -ffile-compilation-dir=. %s 2>&1 | FileCheck -check-prefix=CHECK-DEBUG-COMPILATION-DIR %s -// RUN: %clang -### -ffile-compilation-dir=. -x assembler %s 2>&1 | FileCheck -check-prefixes=CHECK-DEBUG-COMPILATION-DIR %s +// RUN: %clang -### -integrated-as -ffile-compilation-dir=. -x assembler %s 2>&1 | FileCheck -check-prefixes=CHECK-DEBUG-COMPILATION-DIR %s // CHECK-DEBUG-COMPILATION-DIR: "-fdebug-compilation-dir=." // CHECK-DEBUG-COMPILATION-DIR-NOT: "-ffile-compilation-dir=." ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 7d64493 - [DebugInfo][test] Check specific func name to ignore codegen differences
Author: Jinsong Ji Date: 2021-05-18T14:03:27Z New Revision: 7d6449322ecba2fa34090ca8ed610328febee108 URL: https://github.com/llvm/llvm-project/commit/7d6449322ecba2fa34090ca8ed610328febee108 DIFF: https://github.com/llvm/llvm-project/commit/7d6449322ecba2fa34090ca8ed610328febee108.diff LOG: [DebugInfo][test] Check specific func name to ignore codegen differences We use `CHECK-LABEL: define` to divide input stream into functions, this works well on most platforms. But there are cases that some platforms (eg: AIX) may have different codegen , especially for global constructor and descructors. On AIX, the codegen will have two more functions: __dtor_b, __finalize_b, which will fail the test. The fix is to use specific function name so that we can safely ignore those unrelated codegen differences. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102654 Added: Modified: clang/test/CodeGenCXX/debug-info-line.cpp Removed: diff --git a/clang/test/CodeGenCXX/debug-info-line.cpp b/clang/test/CodeGenCXX/debug-info-line.cpp index 3c09b94b0f8e8..2581ea0712af3 100644 --- a/clang/test/CodeGenCXX/debug-info-line.cpp +++ b/clang/test/CodeGenCXX/debug-info-line.cpp @@ -146,7 +146,7 @@ bar b[1] = { // (fn(), // bar())}; -// CHECK-LABEL: define +// CHECK-LABEL: define{{.*}}f11 __complex double f11() { __complex double f; // CHECK: store {{.*}} !dbg [[DBG_F11:!.*]] ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] edf4d69 - [AIX] Print printable byte list as quoted string
Author: Jinsong Ji Date: 2021-05-21T02:37:55Z New Revision: edf4d69d3888d99187ac28cfcd96a93b41623896 URL: https://github.com/llvm/llvm-project/commit/edf4d69d3888d99187ac28cfcd96a93b41623896 DIFF: https://github.com/llvm/llvm-project/commit/edf4d69d3888d99187ac28cfcd96a93b41623896.diff LOG: [AIX] Print printable byte list as quoted string .byte supports string, so if the whole byte list are printable, we can actually print the string for readability and LIT tests maintainence. .byte 'H,'e,'l,'l,'o,',,' ,'w,'o,'r,'l,'d -> .byte "Hello, world" Reviewed By: hubert.reinterpretcast Differential Revision: https://reviews.llvm.org/D102814 Added: Modified: clang/test/CodeGenCXX/debug-info-byval.cpp llvm/include/llvm/MC/MCAsmInfo.h llvm/lib/MC/MCAsmInfoXCOFF.cpp llvm/lib/MC/MCAsmStreamer.cpp llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-clobber-register.ll llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable.ll llvm/test/CodeGen/PowerPC/aix-exception.ll llvm/test/CodeGen/PowerPC/aix-xcoff-data-sections.ll llvm/test/CodeGen/PowerPC/aix-xcoff-data.ll llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-str.ll llvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll llvm/test/DebugInfo/XCOFF/empty.ll llvm/test/DebugInfo/XCOFF/explicit-section.ll llvm/test/DebugInfo/XCOFF/function-sections.ll Removed: diff --git a/clang/test/CodeGenCXX/debug-info-byval.cpp b/clang/test/CodeGenCXX/debug-info-byval.cpp index 38f803d6d9bb..d61c289b3c48 100644 --- a/clang/test/CodeGenCXX/debug-info-byval.cpp +++ b/clang/test/CodeGenCXX/debug-info-byval.cpp @@ -24,7 +24,7 @@ void foo(EVT e); EVT bar(); void get(int *i, unsigned dl, VAL v, VAL *p, unsigned n, EVT missing_arg) { -//CHECK: .{{asciz|string}} "missing_arg" +//CHECK: .{{asciz|string|byte}} "missing_arg" EVT e = bar(); if (dl == n) foo(missing_arg); diff --git a/llvm/include/llvm/MC/MCAsmInfo.h b/llvm/include/llvm/MC/MCAsmInfo.h index dcc39f0a77cf..e1283c4f7513 100644 --- a/llvm/include/llvm/MC/MCAsmInfo.h +++ b/llvm/include/llvm/MC/MCAsmInfo.h @@ -265,6 +265,11 @@ class MCAsmInfo { /// null. Defaults to null. const char *ByteListDirective = nullptr; + /// This directive allows emission of a zero-terminated ascii string without + /// the standard C escape characters embedded into it. If a target doesn't + /// support this, it can be set to null. Defaults to null. + const char *PlainStringDirective = nullptr; + /// Form used for character literals in the assembly syntax. Useful for /// producing strings as byte lists. If a target does not use or support /// this, it shall be set to ACLS_Unknown. Defaults to ACLS_Unknown. @@ -686,6 +691,7 @@ class MCAsmInfo { const char *getAsciiDirective() const { return AsciiDirective; } const char *getAscizDirective() const { return AscizDirective; } const char *getByteListDirective() const { return ByteListDirective; } + const char *getPlainStringDirective() const { return PlainStringDirective; } AsmCharLiteralSyntax characterLiteralSyntax() const { return CharacterLiteralSyntax; } diff --git a/llvm/lib/MC/MCAsmInfoXCOFF.cpp b/llvm/lib/MC/MCAsmInfoXCOFF.cpp index 603f894dacd2..a55257897608 100644 --- a/llvm/lib/MC/MCAsmInfoXCOFF.cpp +++ b/llvm/lib/MC/MCAsmInfoXCOFF.cpp @@ -40,6 +40,7 @@ MCAsmInfoXCOFF::MCAsmInfoXCOFF() { AsciiDirective = nullptr; // not supported AscizDirective = nullptr; // not supported ByteListDirective = "\t.byte\t"; + PlainStringDirective = "\t.string\t"; CharacterLiteralSyntax = ACLS_SingleQuotePrefix; // Use .vbyte for data definition to avoid directives that apply an implicit diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index ec4429d62900..2da51f8df391 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -1003,6 +1003,15 @@ void MCAsmStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, EmitEOL(); } +static inline bool isPrintableString(StringRef Data) { + const auto BeginPtr = Data.begin(), EndPtr = Data.end(); + for (const unsigned char C : make_range(BeginPtr, EndPtr - 1)) { +if (!isPrint(C)) + return false; + } + return isPrint(Data.back()) || Data.back() == 0; +} + static inline char toOctal(int X) { return (X&7)+'0'; } static void PrintByteList(StringRef Data, raw_ostream &OS, @@ -1112,6 +1121,22 @@ void MCAsmStreamer::emitBytes(StringRef Data) { Data = Data.substr(0, Data.size() - 1); } else if (LLVM_LIKELY(MAI->getAsciiDirective())) { OS << MAI->getAsciiDirective(); +} else if (MAI->hasPairedDoubleQuoteStringConstants() && + isPrintableString(Data)) { + // For target with DoubleQuoteString constants, .string and .byte are used + // as replacement of .asciz and .ascii. + assert(MAI->getPlainStringDirective() && +
[clang] 25c3032 - [AIX] Change the linkage of profiling counter/data to be private
Author: Jinsong Ji Date: 2021-09-29T00:47:25Z New Revision: 25c30324e953c1c0011d1ab7529991db5c6ba741 URL: https://github.com/llvm/llvm-project/commit/25c30324e953c1c0011d1ab7529991db5c6ba741 DIFF: https://github.com/llvm/llvm-project/commit/25c30324e953c1c0011d1ab7529991db5c6ba741.diff LOG: [AIX] Change the linkage of profiling counter/data to be private We generate symbols like `profc`/`profd` for each function, and put them into csects. When there are weak functions, we generate weak symbols for the functions as well, with ELF (and some others), linker (binder) will discard and only keep one copy of the weak symbols. However, on AIX, the current binder can NOT discard the weak symbols if we put all of them into the same csect, as binder can NOT discard a subset of a csect. This creates a unique challenge for using those symbols to calculate some relative offsets. This patch changed the linkage of `profc`/`profd` symbols to be private, so that all the profc/profd for each weak symbol will be *local* to objects, and all kept in the csect, so we won't have problem. Although only one of the counters will be used, all the pointer in the profd is correct. The downside is that we won't be able to discard the duplicated counters and profile data, but those can not be discarded even if we keep the weak linkage, due to the binder limitation of not discarding a subsect of the csect either . Reviewed By: Whitney, MaskRay Differential Revision: https://reviews.llvm.org/D110422 Added: Modified: clang/test/Profile/cxx-templates.cpp llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp llvm/test/Instrumentation/InstrProfiling/profiling.ll Removed: diff --git a/clang/test/Profile/cxx-templates.cpp b/clang/test/Profile/cxx-templates.cpp index 7af6660f521db..9f8c5a0bcf593 100644 --- a/clang/test/Profile/cxx-templates.cpp +++ b/clang/test/Profile/cxx-templates.cpp @@ -10,8 +10,10 @@ // RUN: FileCheck --input-file=%tuse -check-prefix=T0USE -check-prefix=ALL %s // RUN: FileCheck --input-file=%tuse -check-prefix=T100USE -check-prefix=ALL %s -// T0GEN: @[[T0C:__profc__Z4loopILj0EEvv]] = linkonce_odr {{(hidden|dso_local)}} global [2 x i64] zeroinitializer -// T100GEN: @[[T100C:__profc__Z4loopILj100EEvv]] = linkonce_odr {{(hidden|dso_local)}} global [2 x i64] zeroinitializer +// The linkage can be target dependent, so accept all linkage here, +// the linkage tests for diff erent target are in llvm/test/Instrumentation/InstrProfiling/profiling.ll +// T0GEN: @[[T0C:__profc__Z4loopILj0EEvv]] = {{.*}} global [2 x i64] zeroinitializer +// T100GEN: @[[T100C:__profc__Z4loopILj100EEvv]] = {{.*}} global [2 x i64] zeroinitializer // T0GEN-LABEL: define linkonce_odr {{.*}}void @_Z4loopILj0EEvv() // T0USE-LABEL: define linkonce_odr {{.*}}void @_Z4loopILj0EEvv() diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index bdeb7c8cbbb15..fe93e27075044 100644 --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -862,6 +862,15 @@ InstrProfiling::getOrCreateRegionCounters(InstrProfIncrementInst *Inc) { GlobalValue::LinkageTypes Linkage = NamePtr->getLinkage(); GlobalValue::VisibilityTypes Visibility = NamePtr->getVisibility(); + // Due to the limitation of binder as of 2021/09/28, the duplicate weak + // symbols in the same csect won't be discarded. When there are duplicate weak + // symbols, we can NOT guarantee that the relocations get resolved to the + // intended weak symbol, so we can not ensure the correctness of the relative + // CounterPtr, so we have to use private linkage for counter and data symbols. + if (TT.isOSBinFormatXCOFF()) { +Linkage = GlobalValue::PrivateLinkage; +Visibility = GlobalValue::DefaultVisibility; + } // Move the name variable to the right section. Place them in a COMDAT group // if the associated function is a COMDAT. This will make sure that only one // copy of counters of the COMDAT function will be emitted after linking. Keep diff --git a/llvm/test/Instrumentation/InstrProfiling/profiling.ll b/llvm/test/Instrumentation/InstrProfiling/profiling.ll index e4bc8387ef294..8138552b42d59 100644 --- a/llvm/test/Instrumentation/InstrProfiling/profiling.ll +++ b/llvm/test/Instrumentation/InstrProfiling/profiling.ll @@ -45,8 +45,8 @@ define void @foo() { ; MACHO: @__profd_foo_weak = weak hidden global ; COFF: @__profc_foo_weak = weak hidden global ; COFF: @__profd_foo_weak = private global -; XCOFF: @__profc_foo_weak = weak hidden global -; XCOFF: @__profd_foo_weak = weak hidden global +; XCOFF: @__profc_foo_weak = private global +; XCOFF: @__profd_foo_weak = private global define weak void @foo_weak() { call void @llvm.instrprof.increment(i8* getelementptr inbounds ([8 x i8], [8 x i8]*
[clang] 1e48951 - [AIX] Enable PGO without LTO
Author: Jinsong Ji Date: 2021-09-29T02:00:11Z New Revision: 1e48951c736cb346df34605fc42a39ef6c349b29 URL: https://github.com/llvm/llvm-project/commit/1e48951c736cb346df34605fc42a39ef6c349b29 DIFF: https://github.com/llvm/llvm-project/commit/1e48951c736cb346df34605fc42a39ef6c349b29.diff LOG: [AIX] Enable PGO without LTO On AIX, we relied on LTO to merge the csects for profiling data/counter sections. AIX binder now get the namedcsect support to support the merging, so now we can enable PGO without LTO with the new binder. Reviewed By: Whitney Differential Revision: https://reviews.llvm.org/D110671 Added: Modified: clang/lib/Driver/ToolChains/AIX.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/test/Driver/unsupported-option.c Removed: diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp index 2a380d9676003..5c82d6566497e 100644 --- a/clang/lib/Driver/ToolChains/AIX.cpp +++ b/clang/lib/Driver/ToolChains/AIX.cpp @@ -98,6 +98,25 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-bnoentry"); } + // Specify PGO linker option + if ((Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs, +false) || + Args.hasFlag(options::OPT_fprofile_generate, +options::OPT_fno_profile_generate, false) || + Args.hasFlag(options::OPT_fprofile_generate_EQ, +options::OPT_fno_profile_generate, false) || + Args.hasFlag(options::OPT_fprofile_instr_generate, +options::OPT_fno_profile_instr_generate, false) || + Args.hasFlag(options::OPT_fprofile_instr_generate_EQ, +options::OPT_fno_profile_instr_generate, false) || + Args.hasFlag(options::OPT_fcs_profile_generate, +options::OPT_fno_profile_generate, false) || + Args.hasFlag(options::OPT_fcs_profile_generate_EQ, +options::OPT_fno_profile_generate, false) || + Args.hasArg(options::OPT_fcreate_profile) || + Args.hasArg(options::OPT_coverage))) +CmdArgs.push_back("-bdbg:namedcsects"); + // Specify linker output file. assert((Output.isFilename() || Output.isNothing()) && "Invalid output."); if (Output.isFilename()) { diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 7642692ced99b..23932bf9fd24e 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -795,11 +795,6 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C, } if (TC.getTriple().isOSAIX()) { -if (PGOGenerateArg) - if (!D.isUsingLTO(false /*IsDeviceOffloadAction */) || - D.getLTOMode() != LTOK_Full) -D.Diag(clang::diag::err_drv_argument_only_allowed_with) -<< PGOGenerateArg->getSpelling() << "-flto"; if (ProfileGenerateArg) D.Diag(diag::err_drv_unsupported_opt_for_target) << ProfileGenerateArg->getSpelling() << TC.getTriple().str(); diff --git a/clang/test/Driver/unsupported-option.c b/clang/test/Driver/unsupported-option.c index c263bb0b853c5..7594d0fc17eeb 100644 --- a/clang/test/Driver/unsupported-option.c +++ b/clang/test/Driver/unsupported-option.c @@ -14,14 +14,6 @@ // RUN: FileCheck %s --check-prefix=AIX-PROFILE-SAMPLE // AIX-PROFILE-SAMPLE: error: unsupported option '-fprofile-sample-use=' for target -// RUN: not %clang -fprofile-generate --target=powerpc-ibm-aix %s 2>&1 | \ -// RUN: FileCheck %s --check-prefix=AIX-PROFILE-LTO -// AIX-PROFILE-LTO: error: invalid argument '-fprofile-generate' only allowed with '-flto' - -// RUN: not %clang -fprofile-generate -flto=thin --target=powerpc64-ibm-aix %s 2>&1 | \ -// RUN: FileCheck %s --check-prefix=AIX-PROFILE-THINLTO -// AIX-PROFILE-THINLTO: error: invalid argument '-fprofile-generate' only allowed with '-flto' - // RUN: not %clang --target=powerpc-ibm-aix %s -mlong-double-128 2>&1 | \ // RUN: FileCheck %s --check-prefix=AIX-LONGDOUBLE128-ERR // AIX-LONGDOUBLE128-ERR: error: unsupported option '-mlong-double-128' for target 'powerpc-ibm-aix' ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 2443320 - [AIX] Rename binder option for PGO support
Author: Jinsong Ji Date: 2021-09-30T19:58:42Z New Revision: 2443320d68387c83c9d13ffb5e5de44c2159125c URL: https://github.com/llvm/llvm-project/commit/2443320d68387c83c9d13ffb5e5de44c2159125c DIFF: https://github.com/llvm/llvm-project/commit/2443320d68387c83c9d13ffb5e5de44c2159125c.diff LOG: [AIX] Rename binder option for PGO support Update the binder option. Added: Modified: clang/lib/Driver/ToolChains/AIX.cpp Removed: diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp index 5c82d6566497..053f6389dc0e 100644 --- a/clang/lib/Driver/ToolChains/AIX.cpp +++ b/clang/lib/Driver/ToolChains/AIX.cpp @@ -115,7 +115,7 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_fno_profile_generate, false) || Args.hasArg(options::OPT_fcreate_profile) || Args.hasArg(options::OPT_coverage))) -CmdArgs.push_back("-bdbg:namedcsects"); +CmdArgs.push_back("-bdbg:namedsects"); // Specify linker output file. assert((Output.isFilename() || Output.isNothing()) && "Invalid output."); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 9c31969 - [AIX] Don't pass namedsects in LTO mode
Author: Jinsong Ji Date: 2021-10-01T19:22:40Z New Revision: 9c31969e8df2f4b41b05e415fc9a66ff0bfa0802 URL: https://github.com/llvm/llvm-project/commit/9c31969e8df2f4b41b05e415fc9a66ff0bfa0802 DIFF: https://github.com/llvm/llvm-project/commit/9c31969e8df2f4b41b05e415fc9a66ff0bfa0802.diff LOG: [AIX] Don't pass namedsects in LTO mode LTO don't need binder option , don't pass it in LTO mode. Reviewed By: Whitney Differential Revision: https://reviews.llvm.org/D110955 Added: Modified: clang/lib/Driver/ToolChains/AIX.cpp clang/test/Driver/aix-ld.c Removed: diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp index 053f6389dc0e..e4bbf498b9cd 100644 --- a/clang/lib/Driver/ToolChains/AIX.cpp +++ b/clang/lib/Driver/ToolChains/AIX.cpp @@ -98,8 +98,9 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-bnoentry"); } - // Specify PGO linker option - if ((Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs, + // Specify PGO linker option without LTO + if (!D.isUsingLTO() && + (Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs, false) || Args.hasFlag(options::OPT_fprofile_generate, options::OPT_fno_profile_generate, false) || diff --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c index de70c2f03046..fc40e50d4509 100644 --- a/clang/test/Driver/aix-ld.c +++ b/clang/test/Driver/aix-ld.c @@ -649,3 +649,58 @@ // CHECK-LD64-SHARED-NOT: "--no-as-needed" // CHECK-LD64-SHARED: "-lm" // CHECK-LD64-SHARED: "-lc" + +// Check powerpc-ibm-aix7.3.0.0, -fprofile-generate +// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \ +// RUN:-resource-dir=%S/Inputs/resource_dir \ +// RUN:-static \ +// RUN:-fprofile-generate\ +// RUN:-target powerpc-ibm-aix7.3.0.0 \ +// RUN:--sysroot %S/Inputs/aix_ppc_tree \ +// RUN:-unwindlib=libunwind \ +// RUN: | FileCheck --check-prefix=CHECK-PGO-NON-LTO %s +// CHECK-PGO-NON-LTO-NOT: warning: +// CHECK-PGO-NON-LTO: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.3.0.0" +// CHECK-PGO-NON-LTO: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" +// CHECK-PGO-NON-LTO: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK-PGO-NON-LTO: "{{.*}}ld{{(.exe)?}}" +// CHECK-PGO-NON-LTO: "-bdbg:namedsects" +// CHECK-PGO-NON-LTO: "-b32" +// CHECK-PGO-NON-LTO: "-bpT:0x1000" "-bpD:0x2000" +// CHECK-PGO-NON-LTO: "[[SYSROOT]]/usr/lib{{/|}}crt0.o" +// CHECK-PGO-NON-LTO-NOT: "-lc++" +// CHECK-PGO-NON-LTO-NOT: "-lc++abi" +// CHECK-PGO-NON-LTO: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a" +// CHECK-PGO-NON-LTO-NOT: "--as-needed" +// CHECK-PGO-NON-LTO-NOT: "-lunwind" +// CHECK-PGO-NON-LTO-NOT: "--no-as-needed" +// CHECK-PGO-NON-LTO-NOT: "-lm" +// CHECK-PGO-NON-LTO: "-lc" + +// Check powerpc-ibm-aix7.2.5.3, -fprofile-generate, -flto +// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \ +// RUN:-resource-dir=%S/Inputs/resource_dir \ +// RUN:-static \ +// RUN:-fprofile-generate\ +// RUN:-flto\ +// RUN:-target powerpc-ibm-aix7.2.5.3 \ +// RUN:--sysroot %S/Inputs/aix_ppc_tree \ +// RUN:-unwindlib=libunwind \ +// RUN: | FileCheck --check-prefix=CHECK-PGO-LTO %s +// CHECK-PGO-LTO-NOT: warning: +// CHECK-PGO-LTO: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.2.5.3" +// CHECK-PGO-LTO: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" +// CHECK-PGO-LTO: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK-PGO-LTO: "{{.*}}ld{{(.exe)?}}" +// CHECK-PGO-LTO-NOT: "-bdbg:namedsects" +// CHECK-PGO-LTO: "-b32" +// CHECK-PGO-LTO: "-bpT:0x1000" "-bpD:0x2000" +// CHECK-PGO-LTO: "[[SYSROOT]]/usr/lib{{/|}}crt0.o" +// CHECK-PGO-LTO-NOT: "-lc++" +// CHECK-PGO-LTO-NOT: "-lc++abi" +// CHECK-PGO-LTO: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a" +// CHECK-PGO-LTO-NOT: "--as-needed" +// CHECK-PGO-LTO-NOT: "-lunwind" +// CHECK-PGO-LTO-NOT: "--no-as-needed" +// CHECK-PGO-LTO-NOT: "-lm" +// CHECK-PGO-LTO: "-lc" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] f3ef4f5 - [PowerPC] Add XL compat __compare_and_swap builtins
Author: Jinsong Ji Date: 2021-06-25T01:08:48Z New Revision: f3ef4f5bff26ac4196a15dad7773a03b9d6df21d URL: https://github.com/llvm/llvm-project/commit/f3ef4f5bff26ac4196a15dad7773a03b9d6df21d DIFF: https://github.com/llvm/llvm-project/commit/f3ef4f5bff26ac4196a15dad7773a03b9d6df21d.diff LOG: [PowerPC] Add XL compat __compare_and_swap builtins Prototype int __compare_and_swap (volatile int* addr, int* old_val_addr, int new_val); int __compare_and_swaplp (volatile long* addr, long* old_val_addr, long new_val); Refer to https://www.ibm.com/docs/en/xl-c-and-cpp-aix/16.1?topic=functions-compare-swap-compare-swaplp Reviewed By: w2yehia Differential Revision: https://reviews.llvm.org/D104837 Added: clang/test/CodeGen/builtins-ppc-xlcompat-cas-error.c clang/test/CodeGen/builtins-ppc-xlcompat-cas.c Modified: clang/include/clang/Basic/BuiltinsPPC.def clang/lib/Basic/Targets/PPC.cpp clang/lib/CodeGen/CGBuiltin.cpp Removed: diff --git a/clang/include/clang/Basic/BuiltinsPPC.def b/clang/include/clang/Basic/BuiltinsPPC.def index 9d7f765a2133c..47b485473342b 100644 --- a/clang/include/clang/Basic/BuiltinsPPC.def +++ b/clang/include/clang/Basic/BuiltinsPPC.def @@ -45,6 +45,8 @@ BUILTIN(__builtin_ppc_dcbt, "vv*", "") BUILTIN(__builtin_ppc_dcbtst, "vv*", "") BUILTIN(__builtin_ppc_dcbz, "vv*", "") BUILTIN(__builtin_ppc_icbt, "vv*", "") +BUILTIN(__builtin_ppc_compare_and_swap, "iiD*i*i", "") +BUILTIN(__builtin_ppc_compare_and_swaplp, "iLiD*Li*Li", "") BUILTIN(__builtin_ppc_get_timebase, "ULLi", "n") diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp index 3dfc0c0751e44..e051826c52168 100644 --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -97,6 +97,9 @@ static void defineXLCompatMacros(MacroBuilder &Builder) { Builder.defineMacro("__dcbtst", "__builtin_ppc_dcbtst"); Builder.defineMacro("__dcbz", "__builtin_ppc_dcbz"); Builder.defineMacro("__icbt", "__builtin_ppc_icbt"); + Builder.defineMacro("__compare_and_swap", "__builtin_ppc_compare_and_swap"); + Builder.defineMacro("__compare_and_swaplp", + "__builtin_ppc_compare_and_swaplp"); } /// PPCTargetInfo::getTargetDefines - Return a set of the PowerPC-specific diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index da16ee3ea722f..e8ad4e009bfb2 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -15427,6 +15427,19 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, Value *Call = Builder.CreateCall(F, CallOps); return Builder.CreateAlignedStore(Call, Ops[0], MaybeAlign(64)); } + + case PPC::BI__builtin_ppc_compare_and_swap: + case PPC::BI__builtin_ppc_compare_and_swaplp: { +Address Addr = EmitPointerWithAlignment(E->getArg(0)); +Address OldValAddr = EmitPointerWithAlignment(E->getArg(1)); +Value *OldVal = Builder.CreateLoad(OldValAddr); +QualType AtomicTy = E->getArg(0)->getType()->getPointeeType(); +LValue LV = MakeAddrLValue(Addr, AtomicTy); +auto Pair = EmitAtomicCompareExchange( +LV, RValue::get(OldVal), RValue::get(Ops[2]), E->getExprLoc(), +llvm::AtomicOrdering::Monotonic, llvm::AtomicOrdering::Monotonic, true); +return Pair.second; + } } } diff --git a/clang/test/CodeGen/builtins-ppc-xlcompat-cas-error.c b/clang/test/CodeGen/builtins-ppc-xlcompat-cas-error.c new file mode 100644 index 0..c35c54d6b1858 --- /dev/null +++ b/clang/test/CodeGen/builtins-ppc-xlcompat-cas-error.c @@ -0,0 +1,19 @@ +// REQUIRES: powerpc-registered-target +// RUN: %clang_cc1 -triple powerpc64-unknown-aix -target-cpu pwr8 \ +// RUN: -verify %s + +void test_builtin_ppc_compare_and_swap() { + volatile int a = 0; + long b = 0, c = 0; + + __compare_and_swap(&a, &b, c); // expected-warning {{incompatible pointer types passing 'long *' to parameter of type 'int *'}} + +} + +void test_builtin_ppc_compare_and_swaplp() { + volatile long a = 0; + int b = 0, c = 0; + + __compare_and_swaplp(&a, &b, c);// expected-warning {{incompatible pointer types passing 'int *' to parameter of type 'long *'}} + +} diff --git a/clang/test/CodeGen/builtins-ppc-xlcompat-cas.c b/clang/test/CodeGen/builtins-ppc-xlcompat-cas.c new file mode 100644 index 0..ea4b349d9a523 --- /dev/null +++ b/clang/test/CodeGen/builtins-ppc-xlcompat-cas.c @@ -0,0 +1,47 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// REQUIRES: powerpc-registered-target +// RUN: %clang_cc1 -triple powerpc64-unknown-unknown \ +// RUN:-emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown \ +// RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s + + +// CHECK-LABEL: @test_builtin_ppc_compare_and_swap( +// CHECK-NEXT: entry: +// CHECK-NEXT:[[A_ADDR:%.*]] = allo
[clang] eb237ff - [PowerPC] Add XL Compat fetch builtins
Author: Jinsong Ji Date: 2021-06-28T02:52:32Z New Revision: eb237ffca821839374574b2195c865765ebf5d09 URL: https://github.com/llvm/llvm-project/commit/eb237ffca821839374574b2195c865765ebf5d09 DIFF: https://github.com/llvm/llvm-project/commit/eb237ffca821839374574b2195c865765ebf5d09.diff LOG: [PowerPC] Add XL Compat fetch builtins Prototype ``` unsigned int __fetch_and_add (volatile unsigned int* addr, unsigned int val); unsigned long __fetch_and_addlp (volatile unsigned long* addr, unsigned long val); ``` Ref: https://www.ibm.com/docs/en/xl-c-and-cpp-linux/16.1.1?topic=functions-fetch Reviewed By: #powerpc, w2yehia, lkail Differential Revision: https://reviews.llvm.org/D104991 Added: clang/test/CodeGen/builtins-ppc-xlcompat-fetch-error.c clang/test/CodeGen/builtins-ppc-xlcompat-fetch.c Modified: clang/include/clang/Basic/BuiltinsPPC.def clang/lib/Basic/Targets/PPC.cpp clang/lib/CodeGen/CGBuiltin.cpp Removed: diff --git a/clang/include/clang/Basic/BuiltinsPPC.def b/clang/include/clang/Basic/BuiltinsPPC.def index 47b485473342b..e07632d415109 100644 --- a/clang/include/clang/Basic/BuiltinsPPC.def +++ b/clang/include/clang/Basic/BuiltinsPPC.def @@ -47,6 +47,14 @@ BUILTIN(__builtin_ppc_dcbz, "vv*", "") BUILTIN(__builtin_ppc_icbt, "vv*", "") BUILTIN(__builtin_ppc_compare_and_swap, "iiD*i*i", "") BUILTIN(__builtin_ppc_compare_and_swaplp, "iLiD*Li*Li", "") +BUILTIN(__builtin_ppc_fetch_and_add, "UiUiD*Ui", "") +BUILTIN(__builtin_ppc_fetch_and_addlp, "ULiULiD*ULi", "") +BUILTIN(__builtin_ppc_fetch_and_and, "UiUiD*Ui", "") +BUILTIN(__builtin_ppc_fetch_and_andlp, "ULiULiD*ULi", "") +BUILTIN(__builtin_ppc_fetch_and_or, "UiUiD*Ui", "") +BUILTIN(__builtin_ppc_fetch_and_orlp, "ULiULiD*ULi", "") +BUILTIN(__builtin_ppc_fetch_and_swap, "UiUiD*Ui", "") +BUILTIN(__builtin_ppc_fetch_and_swaplp, "ULiULiD*ULi", "") BUILTIN(__builtin_ppc_get_timebase, "ULLi", "n") diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp index e051826c52168..6860b5e5d02fa 100644 --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -100,6 +100,14 @@ static void defineXLCompatMacros(MacroBuilder &Builder) { Builder.defineMacro("__compare_and_swap", "__builtin_ppc_compare_and_swap"); Builder.defineMacro("__compare_and_swaplp", "__builtin_ppc_compare_and_swaplp"); + Builder.defineMacro("__fetch_and_add", "__builtin_ppc_fetch_and_add"); + Builder.defineMacro("__fetch_and_addlp", "__builtin_ppc_fetch_and_addlp"); + Builder.defineMacro("__fetch_and_and", "__builtin_ppc_fetch_and_and"); + Builder.defineMacro("__fetch_and_andlp", "__builtin_ppc_fetch_and_andlp"); + Builder.defineMacro("__fetch_and_or", "__builtin_ppc_fetch_and_or"); + Builder.defineMacro("__fetch_and_orlp", "__builtin_ppc_fetch_and_orlp"); + Builder.defineMacro("__fetch_and_swap", "__builtin_ppc_fetch_and_swap"); + Builder.defineMacro("__fetch_and_swaplp", "__builtin_ppc_fetch_and_swaplp"); } /// PPCTargetInfo::getTargetDefines - Return a set of the PowerPC-specific diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 97f2db9bec2c8..2e9454921ffa8 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -15440,6 +15440,27 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, llvm::AtomicOrdering::Monotonic, llvm::AtomicOrdering::Monotonic, true); return Pair.second; } + case PPC::BI__builtin_ppc_fetch_and_add: + case PPC::BI__builtin_ppc_fetch_and_addlp: { +return MakeBinaryAtomicValue(*this, AtomicRMWInst::Add, E, + llvm::AtomicOrdering::Monotonic); + } + case PPC::BI__builtin_ppc_fetch_and_and: + case PPC::BI__builtin_ppc_fetch_and_andlp: { +return MakeBinaryAtomicValue(*this, AtomicRMWInst::And, E, + llvm::AtomicOrdering::Monotonic); + } + + case PPC::BI__builtin_ppc_fetch_and_or: + case PPC::BI__builtin_ppc_fetch_and_orlp: { +return MakeBinaryAtomicValue(*this, AtomicRMWInst::Or, E, + llvm::AtomicOrdering::Monotonic); + } + case PPC::BI__builtin_ppc_fetch_and_swap: + case PPC::BI__builtin_ppc_fetch_and_swaplp: { +return MakeBinaryAtomicValue(*this, AtomicRMWInst::Xchg, E, + llvm::AtomicOrdering::Monotonic); + } } } diff --git a/clang/test/CodeGen/builtins-ppc-xlcompat-fetch-error.c b/clang/test/CodeGen/builtins-ppc-xlcompat-fetch-error.c new file mode 100644 index 0..a5124e3c10e93 --- /dev/null +++ b/clang/test/CodeGen/builtins-ppc-xlcompat-fetch-error.c @@ -0,0 +1,17 @@ +// REQUIRES: powerpc-registered-target +// RUN: %clang_cc1 -triple powerpc64-unknown-aix -target-cpu pwr8 \ +// RUN: -verify %s + +void test_builtin_ppc_fetch_and_add2() { + volatile int a = 0; + unsigned int b = 0; + + __fetch_and_
[clang] 31d10ea - [AIX] Don't pass no-integrated-as by default
Author: Jinsong Ji Date: 2021-07-08T02:50:17Z New Revision: 31d10ea10ee1c24e6c7d7c172e52960717d41817 URL: https://github.com/llvm/llvm-project/commit/31d10ea10ee1c24e6c7d7c172e52960717d41817 DIFF: https://github.com/llvm/llvm-project/commit/31d10ea10ee1c24e6c7d7c172e52960717d41817.diff LOG: [AIX] Don't pass no-integrated-as by default D105314 added the abibility choose to use AsmParser for parsing inline asm. -no-intergrated-as will override this default if specified explicitly. If toolchain choose to use MCAsmParser for inline asm, don't pass the option to disable integrated-as explictly unless set by user. Reviewed By: #powerpc, shchenz Differential Revision: https://reviews.llvm.org/D105512 Added: Modified: clang/include/clang/Driver/ToolChain.h clang/lib/Driver/ToolChains/AIX.cpp clang/lib/Driver/ToolChains/AIX.h clang/lib/Driver/ToolChains/Clang.cpp clang/test/Driver/aix-as.c Removed: diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h index 8ec4cf853fed..882ae40086ce 100644 --- a/clang/include/clang/Driver/ToolChain.h +++ b/clang/include/clang/Driver/ToolChain.h @@ -380,6 +380,10 @@ class ToolChain { /// Check if the toolchain should use the integrated assembler. virtual bool useIntegratedAs() const; + /// Check if the toolchain should use AsmParser to parse inlineAsm when + /// integrated assembler is not default. + virtual bool parseInlineAsmUsingAsmParser() const { return false; } + /// IsMathErrnoDefault - Does this tool chain use -fmath-errno by default. virtual bool IsMathErrnoDefault() const { return true; } diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp index ca3fc5af7689..3000b8416adf 100644 --- a/clang/lib/Driver/ToolChains/AIX.cpp +++ b/clang/lib/Driver/ToolChains/AIX.cpp @@ -176,6 +176,8 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA, /// AIX - AIX tool chain which can call as(1) and ld(1) directly. AIX::AIX(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) : ToolChain(D, Triple, Args) { + ParseInlineAsmUsingAsmParser = Args.hasFlag( + options::OPT_fintegrated_as, options::OPT_fno_integrated_as, true); getLibraryPaths().push_back(getDriver().SysRoot + "/usr/lib"); } diff --git a/clang/lib/Driver/ToolChains/AIX.h b/clang/lib/Driver/ToolChains/AIX.h index 1534af950c88..d1ec6d10fb3a 100644 --- a/clang/lib/Driver/ToolChains/AIX.h +++ b/clang/lib/Driver/ToolChains/AIX.h @@ -59,6 +59,9 @@ class LLVM_LIBRARY_VISIBILITY AIX : public ToolChain { AIX(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); + bool parseInlineAsmUsingAsmParser() const override { +return ParseInlineAsmUsingAsmParser; + } bool isPICDefault() const override { return true; } bool isPIEDefault() const override { return false; } bool isPICDefaultForced() const override { return true; } @@ -87,6 +90,7 @@ class LLVM_LIBRARY_VISIBILITY AIX : public ToolChain { private: llvm::StringRef GetHeaderSysroot(const llvm::opt::ArgList &DriverArgs) const; + bool ParseInlineAsmUsingAsmParser; }; } // end namespace toolchains diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 9c0922c8497c..85204ceaa49a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -5038,7 +5038,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, << A->getValue() << A->getOption().getName(); } - if (!TC.useIntegratedAs()) + // If toolchain choose to use MCAsmParser for inline asm don't pass the + // option to disable integrated-as explictly. + if (!TC.useIntegratedAs() && !TC.parseInlineAsmUsingAsmParser()) CmdArgs.push_back("-no-integrated-as"); if (Args.hasArg(options::OPT_fdebug_pass_structure)) { diff --git a/clang/test/Driver/aix-as.c b/clang/test/Driver/aix-as.c index aa8c61035903..def2adc97daa 100644 --- a/clang/test/Driver/aix-as.c +++ b/clang/test/Driver/aix-as.c @@ -63,3 +63,18 @@ // CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}" // CHECK-AS32-MultiInput: "-a32" // CHECK-AS32-MultiInput: "-many" + +// Check not passing no-integrated-as flag by default. +// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \ +// RUN: -target powerpc64-ibm-aix7.1.0.0 \ +// RUN: | FileCheck --check-prefix=CHECK-IAS --implicit-check-not=-no-integrated-as %s +// CHECK-IAS: InstalledDir +// CHECK-IAS: "-a64" + +// Check passing no-integrated-as flag if specified by user. +// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \ +// RUN: -target powerpc64-ibm-aix7.1.0.0 -fno-integrated-as \ +// RUN: | FileCheck --check-prefix=CHECK-NOIAS %s +// CHECK-NOIAS: InstalledDir +// CHECK-NOIAS: -no-integrated-as +// CHECK-NOIAS: "-a64"
[clang] 838d8d1 - [AIX][NFC] Unsupported object-c test
Author: Jinsong Ji Date: 2021-11-01T13:44:23Z New Revision: 838d8d1e2b93ae89d4edfdc5da58f7622f1b1c71 URL: https://github.com/llvm/llvm-project/commit/838d8d1e2b93ae89d4edfdc5da58f7622f1b1c71 DIFF: https://github.com/llvm/llvm-project/commit/838d8d1e2b93ae89d4edfdc5da58f7622f1b1c71.diff LOG: [AIX][NFC] Unsupported object-c test Added: Modified: clang/test/Modules/merge-objc-interface-visibility.m Removed: diff --git a/clang/test/Modules/merge-objc-interface-visibility.m b/clang/test/Modules/merge-objc-interface-visibility.m index 181a2c716c6b3..a075611a420c8 100644 --- a/clang/test/Modules/merge-objc-interface-visibility.m +++ b/clang/test/Modules/merge-objc-interface-visibility.m @@ -4,6 +4,7 @@ // RUN:-fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache // RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m -DHIDDEN_FIRST=0 \ // RUN:-fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache +// UNSUPPORTED: -zos, -aix // Test a case when Objective-C interface is imported both as hidden and as visible. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8e2fd87 - [PowerPC] [Clang] Enable Intel intrinsics support on FreeBSD
Author: Alfredo Dal'\''Ava Junior Date: 2021-11-22T20:42:10Z New Revision: 8e2fd879e6f91b1e4fdf6217a667079aaeaece99 URL: https://github.com/llvm/llvm-project/commit/8e2fd879e6f91b1e4fdf6217a667079aaeaece99 DIFF: https://github.com/llvm/llvm-project/commit/8e2fd879e6f91b1e4fdf6217a667079aaeaece99.diff LOG: [PowerPC] [Clang] Enable Intel intrinsics support on FreeBSD This enables Intel intrinsics support on FreeBSD. Thanks to @pkubaj who noticed this feature was missing Reviewed By: jsji Differential Revision: https://reviews.llvm.org/D113451 Added: clang/lib/Driver/ToolChains/PPCFreeBSD.cpp clang/lib/Driver/ToolChains/PPCFreeBSD.h Modified: clang/lib/Driver/CMakeLists.txt clang/lib/Driver/Driver.cpp clang/lib/Headers/ppc_wrappers/emmintrin.h clang/lib/Headers/ppc_wrappers/mm_malloc.h clang/lib/Headers/ppc_wrappers/mmintrin.h clang/lib/Headers/ppc_wrappers/pmmintrin.h clang/lib/Headers/ppc_wrappers/smmintrin.h clang/lib/Headers/ppc_wrappers/tmmintrin.h clang/lib/Headers/ppc_wrappers/xmmintrin.h clang/test/CodeGen/ppc-mm-malloc.c clang/test/CodeGen/ppc-mmintrin.c clang/test/CodeGen/ppc-pmmintrin.c clang/test/CodeGen/ppc-smmintrin.c clang/test/CodeGen/ppc-tmmintrin.c clang/test/CodeGen/ppc-xmmintrin.c Removed: diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt index 31e357b67361d..580355ba7e121 100644 --- a/clang/lib/Driver/CMakeLists.txt +++ b/clang/lib/Driver/CMakeLists.txt @@ -75,6 +75,7 @@ add_clang_library(clangDriver ToolChains/WebAssembly.cpp ToolChains/XCore.cpp ToolChains/PPCLinux.cpp + ToolChains/PPCFreeBSD.cpp ToolChains/InterfaceStubs.cpp ToolChains/ZOS.cpp Types.cpp diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 8023d03013a16..d501bd0262199 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -38,6 +38,7 @@ #include "ToolChains/NaCl.h" #include "ToolChains/NetBSD.h" #include "ToolChains/OpenBSD.h" +#include "ToolChains/PPCFreeBSD.h" #include "ToolChains/PPCLinux.h" #include "ToolChains/PS4CPU.h" #include "ToolChains/RISCVToolchain.h" @@ -5302,7 +5303,11 @@ const ToolChain &Driver::getToolChain(const ArgList &Args, TC = std::make_unique(*this, Target, Args); break; case llvm::Triple::FreeBSD: - TC = std::make_unique(*this, Target, Args); + if (Target.isPPC()) +TC = std::make_unique(*this, Target, + Args); + else +TC = std::make_unique(*this, Target, Args); break; case llvm::Triple::Minix: TC = std::make_unique(*this, Target, Args); diff --git a/clang/lib/Driver/ToolChains/PPCFreeBSD.cpp b/clang/lib/Driver/ToolChains/PPCFreeBSD.cpp new file mode 100644 index 0..8d381c4f14371 --- /dev/null +++ b/clang/lib/Driver/ToolChains/PPCFreeBSD.cpp @@ -0,0 +1,28 @@ +//===-- PPCFreeBSD.cpp - PowerPC ToolChain Implementations --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "PPCFreeBSD.h" +#include "clang/Driver/Driver.h" +#include "clang/Driver/Options.h" +#include "llvm/Support/Path.h" + +using namespace clang::driver::toolchains; +using namespace llvm::opt; + +void PPCFreeBSDToolChain::AddClangSystemIncludeArgs( +const ArgList &DriverArgs, ArgStringList &CC1Args) const { + if (!DriverArgs.hasArg(clang::driver::options::OPT_nostdinc) && + !DriverArgs.hasArg(options::OPT_nobuiltininc)) { +const Driver &D = getDriver(); +SmallString<128> P(D.ResourceDir); +llvm::sys::path::append(P, "include", "ppc_wrappers"); +addSystemInclude(DriverArgs, CC1Args, P); + } + + FreeBSD::AddClangSystemIncludeArgs(DriverArgs, CC1Args); +} diff --git a/clang/lib/Driver/ToolChains/PPCFreeBSD.h b/clang/lib/Driver/ToolChains/PPCFreeBSD.h new file mode 100644 index 0..d5d9cf4e83a06 --- /dev/null +++ b/clang/lib/Driver/ToolChains/PPCFreeBSD.h @@ -0,0 +1,33 @@ +//===--- PPCFreeBSD.h - PowerPC ToolChain Implementations ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_PPC_FREEBSD_H +#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_PPC_FREEBSD_H + +#include "FreeBSD.h" + +namespace clang { +namespace driver { +namespace toolchains { + +class LLVM_LIBRARY_VISIBILITY PPCFreeBSDToolChain : public FreeBSD {
RE: [PATCH] D74436: Change clang option -ffp-model=precise to select ffp-contract=on
Thanks Melanie. I have pushed one fix to test-suite to explicitly add -ffp-contract=off to unblock our internal buildbot for now. https://github.com/llvm/llvm-test-suite/commit/c04a7178a3a50fe919964df59b041c5671db50f7 Our buildbot are OK now. I think you can proceed as long as the change is intended and reasonable. Thanks. Best, Jinsong Ji (纪金松), PhD. XL/LLVM on Power Compiler Development E-mail: j...@us.ibm.com From: "Blower, Melanie I" To: "reviews+d74436+public+e2b40a7853ffb...@reviews.llvm.org" , "lebedev...@gmail.com" , "rjmcc...@gmail.com" , "sepavl...@gmail.com" Cc: "mask...@google.com" , "j...@us.ibm.com" , "david.bolvan...@gmail.com" , "mar...@martin.st" , "Wang, Pengfei" , "wuz...@cn.ibm.com" , "nemanja.i@gmail.com" , "kit.bar...@gmail.com" , "cfe-commits@lists.llvm.org" , "mlek...@skidmore.edu" , "blitzrak...@gmail.com" , "shen...@google.com" , "peter.wal...@arm.com" Date: 02/14/2020 10:34 AM Subject:[EXTERNAL] RE: [PATCH] D74436: Change clang option -ffp-model=precise to select ffp-contract=on I reverted MaskRay's "reland" since the original patch is causing trouble on PowerPC, check-all is passing on my box. Sorry for the trouble. > -Original Message- > From: Andy Kaylor via Phabricator > Sent: Thursday, February 13, 2020 9:20 PM > To: Blower, Melanie I ; lebedev...@gmail.com; > rjmcc...@gmail.com; sepavl...@gmail.com > Cc: mask...@google.com; j...@us.ibm.com; david.bolvan...@gmail.com; > mar...@martin.st; Wang, Pengfei ; > wuz...@cn.ibm.com; nemanja.i@gmail.com; kit.bar...@gmail.com; cfe- > comm...@lists.llvm.org; mlek...@skidmore.edu; blitzrak...@gmail.com; > shen...@google.com; peter.wal...@arm.com > Subject: [PATCH] D74436: Change clang option -ffp-model=precise to select ffp- > contract=on > > andrew.w.kaylor added a subscriber: MaskRay. > andrew.w.kaylor added a comment. > > In D74436#1875386 < https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D74436-231875386&d=DwIFAg&c=jf_iaSHvJObTbx-siA1ZOg&r=DvnnfavFQBGT2CDyHzTr_Q&m=cvHv8MkmryQUMVKDW_JEP3rPsAVn_T77lN-oqkY9X2Y&s=4moq7_F2LQUHDL0EsCHrNKUtm43d0NQb2Fmh4CISYOM&e= >, @thakis > wrote: > > > The revert of this breaks tests everywhere, as far as I can tell. > > > It looks like something strange happened with the revert: > > > clang-11: warning: overriding '-ffp-model=strict' option with '-ffp- > model=strict' [-Woverriding-t-option] > > I believe the problem is that the original change that was being reverted > contained this: > > clang/lib/Driver/ToolChains/Clang.cpp > @@ -2768,7 +2766,7 @@ static void RenderFloatingPointOptions(const > ToolChain &TC, const Driver &D, > !AssociativeMath && !ReciprocalMath && > SignedZeros && TrappingMath && RoundingFPMath && > DenormalFPMath != llvm::DenormalMode::getIEEE() && > +FPContract.empty()) > -(FPContract.equals("off") || FPContract.empty())) > > But sometime in the land-revert-land-revert cycle the line above that changed, > causing the merge to miss this change in the most recent revert. I see that > @MaskRay has since re-landed this change set, but it's going to cause problems > for PowerPC. If someone needs to revert this yet again, I think it can be safely > done by recovering the change above. > > Apologies for the mess! > > > Repository: > rG LLVM Github Monorepo > > CHANGES SINCE LAST ACTION > https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D74436_new_&d=DwIFAg&c=jf_iaSHvJObTbx-siA1ZOg&r=DvnnfavFQBGT2CDyHzTr_Q&m=cvHv8MkmryQUMVKDW_JEP3rPsAVn_T77lN-oqkY9X2Y&s=x-uw-PdxKFtF2QXI5p8pFIGwDP53ma6WcFfJSt7NiPY&e= > > https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D74436&d=DwIFAg&c=jf_iaSHvJObTbx-siA1ZOg&r=DvnnfavFQBGT2CDyHzTr_Q&m=cvHv8MkmryQUMVKDW_JEP3rPsAVn_T77lN-oqkY9X2Y&s=VJzMi9ZvFzcqz_BCC84nlLx_A4agCXEmi9bNsJMnkJQ&e= > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 2d0b29e - [clang] Fix covered default in switch
Author: Jinsong Ji Date: 2020-01-27T19:28:11Z New Revision: 2d0b29e0de5b2fd7cc05e8a341db3bf460e18d46 URL: https://github.com/llvm/llvm-project/commit/2d0b29e0de5b2fd7cc05e8a341db3bf460e18d46 DIFF: https://github.com/llvm/llvm-project/commit/2d0b29e0de5b2fd7cc05e8a341db3bf460e18d46.diff LOG: [clang] Fix covered default in switch clang/lib/Format/TokenAnnotator.cpp:3162:7: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default] default: ^ 1 error generated. Added: Modified: clang/lib/Format/TokenAnnotator.cpp Removed: diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 8f9a29ab2f29..c4798f65592a 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -3159,8 +3159,6 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, // functions. return (Left.NestingLevel == 0 && Line.Level == 0) && !Left.Children.empty(); - default: -break; } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] [Sema] Fix dependence of DREs in lambdas with an explicit object parameter (PR #84473)
jsji wrote: https://godbolt.org/z/WTTKfG1ha Looks like this is causing some assert failures. @Sirraide Thanks @jyu2-git for helping identifying the commit. https://github.com/llvm/llvm-project/pull/84473 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] [Sema] Fix dependence of DREs in lambdas with an explicit object parameter (PR #84473)
jsji wrote: Thank you @Sirraide for the quick fix. https://github.com/llvm/llvm-project/pull/84473 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [SCCP] Swap out range metadata to range attribute (PR #90134)
jsji wrote: With this, range attribute may prevent us from doing tailcall. eg: https://godbolt.org/z/7cfTqe4Wq A fix is proposed here: https://github.com/llvm/llvm-project/pull/91122 Please help to have a look. Thanks. https://github.com/llvm/llvm-project/pull/90134 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 20d0aca - [clang][Driver] Add -fintegrate-as to debug-pass-structure test
Author: Jinsong Ji Date: 2021-05-05T16:10:57Z New Revision: 20d0aca43073f18f70b1c5a665631dee1be1598d URL: https://github.com/llvm/llvm-project/commit/20d0aca43073f18f70b1c5a665631dee1be1598d DIFF: https://github.com/llvm/llvm-project/commit/20d0aca43073f18f70b1c5a665631dee1be1598d.diff LOG: [clang][Driver] Add -fintegrate-as to debug-pass-structure test CGProfilePass is not always on, it will be disabled when using non-intergrated assemblers. // Only enable CGProfilePass when using integrated assembler, since // non-integrated assemblers don't recognize .cgprofile section. PMBuilder.CallGraphProfile = !CodeGenOpts.DisableIntegratedAS; Add -fintegrate-as to make sure the output don't rely on the platform default. Reviewed By: evgeny777 Differential Revision: https://reviews.llvm.org/D101918 Added: Modified: clang/test/Driver/debug-pass-structure.c Removed: diff --git a/clang/test/Driver/debug-pass-structure.c b/clang/test/Driver/debug-pass-structure.c index 2f250105d7b3..ca22e69baf07 100644 --- a/clang/test/Driver/debug-pass-structure.c +++ b/clang/test/Driver/debug-pass-structure.c @@ -1,5 +1,5 @@ // Test that we print pass structure with new and legacy PM. -// RUN: %clang -fexperimental-new-pass-manager -fdebug-pass-structure -O3 -S -emit-llvm %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=NEWPM +// RUN: %clang -fexperimental-new-pass-manager -fdebug-pass-structure -fintegrated-as -O3 -S -emit-llvm %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=NEWPM // RUN: %clang -flegacy-pass-manager -fdebug-pass-structure -O0 -S -emit-llvm %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LEGACYPM // REQUIRES: asserts @@ -32,6 +32,7 @@ // NEWPM-NEXT: ReversePostOrderFunctionAttrsPass on [module] // NEWPM-NEXT: RequireAnalysisPass<{{.*}}> on [module] // NEWPM-NEXT: ModuleToFunctionPassAdaptor on [module] +// CGProfilePass is disabled with non-integrated assemblers // NEWPM-NEXT: CGProfilePass on [module] // NEWPM-NEXT: GlobalDCEPass on [module] // NEWPM-NEXT: ConstantMergePass on [module] ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] a723310 - [Driver][test] Test intended target only
Author: Jinsong Ji Date: 2021-04-07T20:08:26Z New Revision: a723310b419be870acf72aafd3bfabacbaace642 URL: https://github.com/llvm/llvm-project/commit/a723310b419be870acf72aafd3bfabacbaace642 DIFF: https://github.com/llvm/llvm-project/commit/a723310b419be870acf72aafd3bfabacbaace642.diff LOG: [Driver][test] Test intended target only 6fe7de90b9e4e466a5c2baadafd5f72d3203651d changed GNU toolchain, and added new RUN line to test expected behavior. The change is for GNU toolchain only, so this will fail other toolchain, eg: AIX. Update the test with `-target` to test GNU tool chain only. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D99901 Added: Modified: clang/test/Driver/nostdincxx.cpp Removed: diff --git a/clang/test/Driver/nostdincxx.cpp b/clang/test/Driver/nostdincxx.cpp index c919c73fa126..774874d80d82 100644 --- a/clang/test/Driver/nostdincxx.cpp +++ b/clang/test/Driver/nostdincxx.cpp @@ -1,7 +1,7 @@ // RUN: not %clangxx -nostdinc %s 2>&1 | FileCheck %s // RUN: not %clangxx -nostdinc++ %s 2>&1 | FileCheck %s // RUN: not %clangxx -nostdlibinc %s 2>&1 | FileCheck %s -// RUN: not %clangxx -fsyntax-only -nostdinc -nostdinc++ %s 2>&1 | FileCheck /dev/null --implicit-check-not=-Wunused-command-line-argument +// RUN: not %clangxx -triple x86_64-unknown-unknown-gnu -fsyntax-only -nostdinc -nostdinc++ %s 2>&1 | FileCheck /dev/null --implicit-check-not=-Wunused-command-line-argument // CHECK: file not found #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 75127bc - [AIX][ZOS] Excluding merge-objc-interface.m from Tests
Author: Qiongsi Wu Date: 2021-10-08T14:00:06Z New Revision: 75127bce6de78b83b70b898a04473f213451f13e URL: https://github.com/llvm/llvm-project/commit/75127bce6de78b83b70b898a04473f213451f13e DIFF: https://github.com/llvm/llvm-project/commit/75127bce6de78b83b70b898a04473f213451f13e.diff LOG: [AIX][ZOS] Excluding merge-objc-interface.m from Tests Objective C is not supported on AIX or ZOS. This patch excludes the newly added `clang/test/Modules/merge-objc-interface.m` (added by https://reviews.llvm.org/D110280) from AIX and ZOS testing. Many existing tests are already disabled by https://reviews.llvm.org/D109060. Reviewed By: jsji Differential Revision: https://reviews.llvm.org/D111406 Added: Modified: clang/test/Modules/merge-objc-interface.m Removed: diff --git a/clang/test/Modules/merge-objc-interface.m b/clang/test/Modules/merge-objc-interface.m index fba06294a26af..f62f541c1a297 100644 --- a/clang/test/Modules/merge-objc-interface.m +++ b/clang/test/Modules/merge-objc-interface.m @@ -1,3 +1,4 @@ +// UNSUPPORTED: -zos, -aix // RUN: rm -rf %t // RUN: split-file %s %t // RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 64d1d5f - [AIX] Unsupported newly added AMDGPU clang test
Author: Jinsong Ji Date: 2021-10-11T21:34:48Z New Revision: 64d1d5f336c3356ac77c588329ce3e449cc46de3 URL: https://github.com/llvm/llvm-project/commit/64d1d5f336c3356ac77c588329ce3e449cc46de3 DIFF: https://github.com/llvm/llvm-project/commit/64d1d5f336c3356ac77c588329ce3e449cc46de3.diff LOG: [AIX] Unsupported newly added AMDGPU clang test Added: Modified: clang/test/Driver/fat_archive_amdgpu.cpp Removed: diff --git a/clang/test/Driver/fat_archive_amdgpu.cpp b/clang/test/Driver/fat_archive_amdgpu.cpp index 78732e520e392..94327eab1654e 100644 --- a/clang/test/Driver/fat_archive_amdgpu.cpp +++ b/clang/test/Driver/fat_archive_amdgpu.cpp @@ -1,6 +1,7 @@ // REQUIRES: clang-driver // REQUIRES: x86-registered-target // REQUIRES: amdgpu-registered-target +// UNSUPPORTED: -aix // See the steps to create a fat archive are given at the end of the file. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 42eea2b - [AIX] Enable int128 in 64 bit mode
Author: Jinsong Ji Date: 2021-10-15T16:23:04Z New Revision: 42eea2b69bb99415f5116ca8e28efdd5f836a03b URL: https://github.com/llvm/llvm-project/commit/42eea2b69bb99415f5116ca8e28efdd5f836a03b DIFF: https://github.com/llvm/llvm-project/commit/42eea2b69bb99415f5116ca8e28efdd5f836a03b.diff LOG: [AIX] Enable int128 in 64 bit mode This patch remove the override in AIX target, so the int128 is enabled in 64 bit mode or with ForceEnableInt128. Reviewed By: lkail Differential Revision: https://reviews.llvm.org/D111078 Added: Modified: clang/lib/Basic/Targets/OSTargets.h clang/test/AST/ast-print-int128.cpp clang/test/Analysis/sval-dump-int128.c clang/test/CodeGen/dbg-const-int128.c clang/test/CodeGen/debug-info.c clang/test/CodeGen/extend-arg-64.c clang/test/CodeGen/ppc-varargs-struct.c clang/test/CodeGen/uint128_t.c clang/test/CodeGenCXX/debug-info-enum-i128.cpp clang/test/Driver/types.c clang/test/Preprocessor/init-ppc64.c clang/test/Sema/128bitint.c clang/test/Sema/const-eval.c clang/test/Sema/redefine_extname.c clang/test/Sema/types.c llvm/test/CodeGen/PowerPC/ctrloop-i128.ll llvm/test/CodeGen/PowerPC/int128_ldst.ll llvm/test/CodeGen/PowerPC/ppc64-i128-abi.ll Removed: diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index 220290c1bacf..3adb12568eea 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -743,7 +743,6 @@ class AIXTargetInfo : public OSTargetInfo { // AIX sets FLT_EVAL_METHOD to be 1. unsigned getFloatEvalMethod() const override { return 1; } - bool hasInt128Type() const override { return false; } bool defaultsToAIXPowerAlignment() const override { return true; } }; diff --git a/clang/test/AST/ast-print-int128.cpp b/clang/test/AST/ast-print-int128.cpp index 51d15b609f0b..8086ea7c751a 100644 --- a/clang/test/AST/ast-print-int128.cpp +++ b/clang/test/AST/ast-print-int128.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -ast-print -std=c++20 %s -o - -triple x86_64-linux | FileCheck %s +// RUN: %clang_cc1 -ast-print -std=c++20 %s -o - -triple powerpc64-ibm-aix-xcoff | FileCheck %s template struct enable_if { diff --git a/clang/test/Analysis/sval-dump-int128.c b/clang/test/Analysis/sval-dump-int128.c index 3c28f1bd1bb6..82f2fe37c2e8 100644 --- a/clang/test/Analysis/sval-dump-int128.c +++ b/clang/test/Analysis/sval-dump-int128.c @@ -1,4 +1,5 @@ // RUN: %clang_analyze_cc1 -triple x86_64-linux-gnu -analyzer-checker=debug.ExprInspection %s -verify +// RUN: %clang_analyze_cc1 -triple powerpc64-ibm-aix-xcoff -analyzer-checker=debug.ExprInspection %s -verify void clang_analyzer_dump(unsigned __int128 x); diff --git a/clang/test/CodeGen/dbg-const-int128.c b/clang/test/CodeGen/dbg-const-int128.c index 966c22705500..0af788e26304 100644 --- a/clang/test/CodeGen/dbg-const-int128.c +++ b/clang/test/CodeGen/dbg-const-int128.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux -S -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -S -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s // CHECK: !DIGlobalVariable({{.*}} // CHECK-NOT: expr: diff --git a/clang/test/CodeGen/debug-info.c b/clang/test/CodeGen/debug-info.c index 0958f4d0298e..8850ed4a4daa 100644 --- a/clang/test/CodeGen/debug-info.c +++ b/clang/test/CodeGen/debug-info.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s // PR3023 void convert(void) { diff --git a/clang/test/CodeGen/extend-arg-64.c b/clang/test/CodeGen/extend-arg-64.c index 85b70e0238cb..8cdbda8e4ff5 100644 --- a/clang/test/CodeGen/extend-arg-64.c +++ b/clang/test/CodeGen/extend-arg-64.c @@ -16,6 +16,12 @@ // RUN: %s -emit-llvm -o - | FileCheck %s \ // RUN:--implicit-check-not "ext {{.*}}to i64" +// The option isn't supported on ppc, no effect +// RUN: %clang_cc1 -DD128 -triple powerpc64-ibm-aix-xcoff -fextend-arguments=64 \ +// RUN: %s -emit-llvm -o - | FileCheck %s \ +// RUN:--implicit-check-not "ext {{.*}}to i64" + + int vararg(int, ...); void knr(); diff --git a/clang/test/CodeGen/ppc-varargs-struct.c b/clang/test/CodeGen/ppc-varargs-struct.c index c201074e1fd9..9a54c47a067e 100644 --- a/clang/test/CodeGen/ppc-varargs-struct.c +++ b/clang/test/CodeGen/ppc-varargs-struct.c @@ -2,6 +2,7 @@ // REQUIRES: asserts // RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s // RUN: %clang_cc1 -triple powerpc-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-PPC +// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -emit-llvm -o
[clang] d364ecc - [NFC][OpenMP] Use clang_cc1 to driver tests
Author: Jinsong Ji Date: 2021-09-03T20:33:48Z New Revision: d364eccdd5a924d34284dca47ed8b029507167ce URL: https://github.com/llvm/llvm-project/commit/d364eccdd5a924d34284dca47ed8b029507167ce DIFF: https://github.com/llvm/llvm-project/commit/d364eccdd5a924d34284dca47ed8b029507167ce.diff LOG: [NFC][OpenMP] Use clang_cc1 to driver tests The test driver-fopenmp-extensions.c is failing on platforms that does not use integrated-as. It can be reproduced using -fno-integrated-as on Linux too. bin/clang -c -Xclang -verify=omp -fopenmp -fopenmp-extensions -fno-openmp-extensions ../llvm-project/clang/test/OpenMP/driver-fopenmp-extensions.c -fno-integrated-as Assembler messages: Error: can't open /tmp/driver-fopenmp-extensions-8fafe8.s for reading: No such file or directory clang-14: error: assembler command failed with exit code 1 (use -v to see invocation) The goal of this test is to verify syntax diags only, so we should use clang_cc1 to test. Reviewed By: jdenny, ABataev Differential Revision: https://reviews.llvm.org/D109255 Added: clang/test/OpenMP/fopenmp-extensions.c Modified: Removed: clang/test/OpenMP/driver-fopenmp-extensions.c diff --git a/clang/test/OpenMP/driver-fopenmp-extensions.c b/clang/test/OpenMP/driver-fopenmp-extensions.c deleted file mode 100644 index b5753e424678a..0 --- a/clang/test/OpenMP/driver-fopenmp-extensions.c +++ /dev/null @@ -1,26 +0,0 @@ -// RUN: %clang -c -Xclang -verify=ompx -fopenmp %s -// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd %s - -// RUN: %clang -c -Xclang -verify=ompx -fopenmp -fopenmp-extensions %s -// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd -fopenmp-extensions %s - -// RUN: %clang -c -Xclang -verify=omp -fopenmp -fno-openmp-extensions %s -// RUN: %clang -c -Xclang -verify=omp -fopenmp-simd -fno-openmp-extensions %s - -// RUN: %clang -c -Xclang -verify=omp -fopenmp \ -// RUN: -fopenmp-extensions -fno-openmp-extensions %s -// RUN: %clang -c -Xclang -verify=omp -fopenmp-simd \ -// RUN: -fopenmp-extensions -fno-openmp-extensions %s - -// RUN: %clang -c -Xclang -verify=ompx -fopenmp \ -// RUN: -fno-openmp-extensions -fopenmp-extensions %s -// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd \ -// RUN: -fno-openmp-extensions -fopenmp-extensions %s - -void foo() { - int x; - // ompx-no-diagnostics - // omp-error@+1 {{incorrect map type modifier}} - #pragma omp target map(ompx_hold, alloc: x) - ; -} diff --git a/clang/test/OpenMP/fopenmp-extensions.c b/clang/test/OpenMP/fopenmp-extensions.c new file mode 100644 index 0..0ba66c964e3c1 --- /dev/null +++ b/clang/test/OpenMP/fopenmp-extensions.c @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -verify=ompx -fopenmp %s +// RUN: %clang_cc1 -verify=ompx -fopenmp-simd %s + +// RUN: %clang_cc1 -verify=ompx -fopenmp -fopenmp-extensions %s +// RUN: %clang_cc1 -verify=ompx -fopenmp-simd -fopenmp-extensions %s + +// RUN: %clang_cc1 -verify=omp -fopenmp -fno-openmp-extensions %s +// RUN: %clang_cc1 -verify=omp -fopenmp-simd -fno-openmp-extensions %s + +// RUN: %clang_cc1 -verify=omp -fopenmp \ +// RUN: -fopenmp-extensions -fno-openmp-extensions %s +// RUN: %clang_cc1 -verify=omp -fopenmp-simd \ +// RUN: -fopenmp-extensions -fno-openmp-extensions %s + +// RUN: %clang_cc1 -verify=ompx -fopenmp \ +// RUN: -fno-openmp-extensions -fopenmp-extensions %s +// RUN: %clang_cc1 -verify=ompx -fopenmp-simd \ +// RUN: -fno-openmp-extensions -fopenmp-extensions %s + +void foo() { + int x; + // ompx-no-diagnostics + // omp-error@+1 {{incorrect map type modifier}} + #pragma omp target map(ompx_hold, alloc: x) + ; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] [clang][SPIR-V] Use AMDGPU prefix to avoid confusion (PR #96962)
https://github.com/jsji created https://github.com/llvm/llvm-project/pull/96962 Reusing prefix SPIRV64 while adding an useless(and wrong) line AMDGPUSPIRV64 is confusing. Update it by copying SPIRV64 line to AMDGPU line. >From 6779f76293607026f844f4246695a9741b4ea21e Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Thu, 27 Jun 2024 13:33:37 -0700 Subject: [PATCH] [NFC] [clang][SPIR-V] Use AMDGPU prefix to avoid confusion Reusing prefix SPIRV64 while adding an useless(and wrong) line AMDGPUSPIRV64 is confusing. Update it by copying SPIRV64 line to AMDGPU line. --- clang/test/CodeGen/target-data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/test/CodeGen/target-data.c b/clang/test/CodeGen/target-data.c index 7f7005d21b99a..e3dddb6d14fb0 100644 --- a/clang/test/CodeGen/target-data.c +++ b/clang/test/CodeGen/target-data.c @@ -270,5 +270,5 @@ // VE: target datalayout = "e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64" // RUN: %clang_cc1 -triple spirv64-amd -o - -emit-llvm %s | \ -// RUN: FileCheck %s -check-prefix=SPIR64 -// AMDGPUSPIRV64: target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1-P4-A0" +// RUN: FileCheck %s -check-prefix=AMDGPUSPIRV64 +// AMDGPUSPIRV64: target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] [clang][SPIR-V] Use AMDGPU prefix to avoid confusion (PR #96962)
@@ -270,5 +270,5 @@ // VE: target datalayout = "e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64" // RUN: %clang_cc1 -triple spirv64-amd -o - -emit-llvm %s | \ -// RUN: FileCheck %s -check-prefix=SPIR64 -// AMDGPUSPIRV64: target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1-P4-A0" +// RUN: FileCheck %s -check-prefix=AMDGPUSPIRV64 +// AMDGPUSPIRV64: target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1" jsji wrote: Hmm, if so, then there might be some bug ? because apparently the test pass with `SPIR64` datalayout, no `P4-A0` are seen. https://github.com/llvm/llvm-project/pull/96962 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] [clang][SPIR-V] Use AMDGPU prefix to avoid confusion (PR #96962)
https://github.com/jsji edited https://github.com/llvm/llvm-project/pull/96962 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] [clang][SPIR-V] Use AMDGPU prefix to avoid confusion (PR #96962)
@@ -270,5 +270,5 @@ // VE: target datalayout = "e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64" // RUN: %clang_cc1 -triple spirv64-amd -o - -emit-llvm %s | \ -// RUN: FileCheck %s -check-prefix=SPIR64 -// AMDGPUSPIRV64: target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1-P4-A0" +// RUN: FileCheck %s -check-prefix=AMDGPUSPIRV64 +// AMDGPUSPIRV64: target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1" jsji wrote: Do you mind take over to fix the bug (also the prefix ?) . I can cancel this PR if you like. Thanks. https://github.com/llvm/llvm-project/pull/96962 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] [clang][SPIR-V] Use AMDGPU prefix to avoid confusion (PR #96962)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/96962 >From 6779f76293607026f844f4246695a9741b4ea21e Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Thu, 27 Jun 2024 13:33:37 -0700 Subject: [PATCH 1/2] [NFC] [clang][SPIR-V] Use AMDGPU prefix to avoid confusion Reusing prefix SPIRV64 while adding an useless(and wrong) line AMDGPUSPIRV64 is confusing. Update it by copying SPIRV64 line to AMDGPU line. --- clang/test/CodeGen/target-data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/test/CodeGen/target-data.c b/clang/test/CodeGen/target-data.c index 7f7005d21b99a..e3dddb6d14fb0 100644 --- a/clang/test/CodeGen/target-data.c +++ b/clang/test/CodeGen/target-data.c @@ -270,5 +270,5 @@ // VE: target datalayout = "e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64" // RUN: %clang_cc1 -triple spirv64-amd -o - -emit-llvm %s | \ -// RUN: FileCheck %s -check-prefix=SPIR64 -// AMDGPUSPIRV64: target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1-P4-A0" +// RUN: FileCheck %s -check-prefix=AMDGPUSPIRV64 +// AMDGPUSPIRV64: target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1" >From 7afc1424adecd1637bdfca929cccffea905c4acb Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Thu, 27 Jun 2024 19:14:33 -0700 Subject: [PATCH 2/2] fix triple --- clang/test/CodeGen/target-data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/test/CodeGen/target-data.c b/clang/test/CodeGen/target-data.c index e3dddb6d14fb0..9a9fda70226fc 100644 --- a/clang/test/CodeGen/target-data.c +++ b/clang/test/CodeGen/target-data.c @@ -269,6 +269,6 @@ // RUN: FileCheck %s -check-prefix=VE // VE: target datalayout = "e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64" -// RUN: %clang_cc1 -triple spirv64-amd -o - -emit-llvm %s | \ +// RUN: %clang_cc1 -triple spirv64-amd-amdhsa -o - -emit-llvm %s | \ // RUN: FileCheck %s -check-prefix=AMDGPUSPIRV64 -// AMDGPUSPIRV64: target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1" +// AMDGPUSPIRV64: target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1-P4-A0" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] [clang][SPIR-V] Use AMDGPU prefix to avoid confusion (PR #96962)
@@ -270,5 +270,5 @@ // VE: target datalayout = "e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64" // RUN: %clang_cc1 -triple spirv64-amd -o - -emit-llvm %s | \ -// RUN: FileCheck %s -check-prefix=SPIR64 -// AMDGPUSPIRV64: target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1-P4-A0" +// RUN: FileCheck %s -check-prefix=AMDGPUSPIRV64 +// AMDGPUSPIRV64: target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1" jsji wrote: Updated. Thanks. https://github.com/llvm/llvm-project/pull/96962 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] [clang][SPIR-V] Use AMDGPU prefix to avoid confusion (PR #96962)
https://github.com/jsji closed https://github.com/llvm/llvm-project/pull/96962 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] [clang][SPIR-V] Use AMDGPU prefix to avoid confusion (PR #96962)
jsji wrote: > LLVM Buildbot has detected a new failure on builder `sanitizer-x86_64-linux` > running on `sanitizer-buildbot1` while building `clang` at step 2 "annotate". Flaky failure. https://github.com/llvm/llvm-project/pull/96962 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] clang add DiagnosticsTestHelper decl (PR #112820)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112820 >From 53683a8543bb6a558a778dc1cc15adb3180df7e4 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:23:19 +0200 Subject: [PATCH 1/4] [NFC] clang add DiagnosticsTestHelper decl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:19:6: error: ‘void clang::DiagnosticsTestHelper(clang::DiagnosticsEngine&)’ has not been declared within ‘clang’ [-Werror] 19 | void clang::DiagnosticsTestHelper(DiagnosticsEngine &diag) { | ^ In file included from /iusers/jinsongj/llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:9: /iusers/jinsongj/llvm-project/clang/include/clang/Basic/Diagnostic.h:567:15: note: only here as a ‘friend’ 567 | friend void DiagnosticsTestHelper(DiagnosticsEngine &); --- clang/include/clang/Basic/Diagnostic.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 3b1efdb12824c7..3f6e85634c3cf5 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1024,6 +1024,8 @@ class DiagnosticsEngine : public RefCountedBase { /// @} }; +void DiagnosticsTestHelper(DiagnosticsEngine &); + /// RAII class that determines when any errors have occurred /// between the time the instance was created and the time it was /// queried. >From 677dab12a67b801dd0406e38f092f89b71045785 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 14:54:56 +0200 Subject: [PATCH 2/4] Add comments --- clang/include/clang/Basic/Diagnostic.h | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 3f6e85634c3cf5..dc7e49beb9a0f4 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1024,6 +1024,7 @@ class DiagnosticsEngine : public RefCountedBase { /// @} }; +/// Declare the friend function for testing to avoid GCC warning. void DiagnosticsTestHelper(DiagnosticsEngine &); /// RAII class that determines when any errors have occurred >From 1154286563d33ffedc4981a1e7c9f72518a1cf6f Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 08:37:38 -0700 Subject: [PATCH 3/4] Revert "Add comments" This reverts commit 677dab12a67b801dd0406e38f092f89b71045785. --- clang/include/clang/Basic/Diagnostic.h | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index dc7e49beb9a0f4..3f6e85634c3cf5 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1024,7 +1024,6 @@ class DiagnosticsEngine : public RefCountedBase { /// @} }; -/// Declare the friend function for testing to avoid GCC warning. void DiagnosticsTestHelper(DiagnosticsEngine &); /// RAII class that determines when any errors have occurred >From a40fb059ae8bb81806cc399361c48ea5caca0336 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 08:37:11 -0700 Subject: [PATCH 4/4] Add the decl in unittest file only --- clang/include/clang/Basic/Diagnostic.h | 2 -- clang/unittests/Basic/DiagnosticTest.cpp | 4 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 3f6e85634c3cf5..3b1efdb12824c7 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1024,8 +1024,6 @@ class DiagnosticsEngine : public RefCountedBase { /// @} }; -void DiagnosticsTestHelper(DiagnosticsEngine &); - /// RAII class that determines when any errors have occurred /// between the time the instance was created and the time it was /// queried. diff --git a/clang/unittests/Basic/DiagnosticTest.cpp b/clang/unittests/Basic/DiagnosticTest.cpp index 691d74f697f278..54b32bc2bb7833 100644 --- a/clang/unittests/Basic/DiagnosticTest.cpp +++ b/clang/unittests/Basic/DiagnosticTest.cpp @@ -16,6 +16,10 @@ using namespace llvm; using namespace clang; +namespace clang { + void DiagnosticsTestHelper(DiagnosticsEngine &diag); +} + void clang::DiagnosticsTestHelper(DiagnosticsEngine &diag) { EXPECT_FALSE(diag.DiagStates.empty()); EXPECT_TRUE(diag.DiagStatesByLoc.empty()); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] clang add DiagnosticsTestHelper decl (PR #112820)
@@ -1024,6 +1024,9 @@ class DiagnosticsEngine : public RefCountedBase { /// @} }; +/// Declare the friend function for testing to avoid GCC warning. jsji wrote: Sure. https://github.com/llvm/llvm-project/pull/112820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] add DiagnosticsTestHelper decl (PR #112820)
https://github.com/jsji edited https://github.com/llvm/llvm-project/pull/112820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] add DiagnosticsTestHelper decl (PR #112820)
https://github.com/jsji edited https://github.com/llvm/llvm-project/pull/112820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] Fix c++ style comment in c file (PR #112814)
@@ -8,7 +8,6 @@ #include "clang-c/Documentation.h" #include "clang-c/Index.h" #include "clang/Config/config.h" -#include "llvm/Support/AutoConvert.h" jsji wrote: This is a c++ header, if we really need it, then we need to update it to c. @abhina-sree Can you please help to do so? Thanks. https://github.com/llvm/llvm-project/pull/112814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Clang] Fix enumerated mismatch warning (PR #112816)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112816 >From 6b85331c4927c031fb8a937467cf62c5d0f80e64 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:03:22 +0200 Subject: [PATCH 1/5] [NFC][Clang] Fix enumerated mismatch warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning: llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3153:14: error: enumerated mismatch in conditional expression: ‘clang::diag::’ vs ‘clang::diag::’ [-Werror=enum-compare] 3152 | DS.isFriendSpecified() || NextToken().is(tok::kw_friend) | 3153 | ? diag::err_friend_concept | ^~ 3154 | : diag:: | 3155 | err_concept_decls_may_only_appear_in_global_namespace_scope); --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 78510e61a639fa..cb52629f9c61c7 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,9 +983,6 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; -def err_friend_concept : Error< - "friend declaration cannot be a concept">; - // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 883db838ca0147..d102a45f8c1ed2 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,6 +3020,8 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts +def err_friend_concept : Error< + "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< >From 1733184c9a6fa8a375dec2c10f5456cfb86e9a57 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 14:58:27 +0200 Subject: [PATCH 2/5] cast instead --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 +++ clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 -- clang/lib/Parse/ParseDeclCXX.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index cb52629f9c61c7..78510e61a639fa 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,6 +983,9 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; +def err_friend_concept : Error< + "friend declaration cannot be a concept">; + // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index d102a45f8c1ed2..883db838ca0147 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,8 +3020,6 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts -def err_friend_concept : Error< - "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 6f0f5a0311bc18..fb159eb997ce9d 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -3150,8 +3150,8 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclaration( if (Tok.is(tok::kw_concept)) { Diag(Tok.getLocation(), DS.isFriendSpecified() || NextToken().is(tok::kw_friend) - ? diag::err_friend_concept - : diag:: + ? (unsigned)diag::err_friend_concept + : (unsigned)diag:: err_concept_decls_may_only_appear_in_global_namespace_scope); SkipUntil(tok::semi, tok::r
[clang] [NFC][Clang] Fix enumerated mismatch warning (PR #112816)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112816 >From 6b85331c4927c031fb8a937467cf62c5d0f80e64 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:03:22 +0200 Subject: [PATCH 1/6] [NFC][Clang] Fix enumerated mismatch warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning: llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3153:14: error: enumerated mismatch in conditional expression: ‘clang::diag::’ vs ‘clang::diag::’ [-Werror=enum-compare] 3152 | DS.isFriendSpecified() || NextToken().is(tok::kw_friend) | 3153 | ? diag::err_friend_concept | ^~ 3154 | : diag:: | 3155 | err_concept_decls_may_only_appear_in_global_namespace_scope); --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 78510e61a639fa..cb52629f9c61c7 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,9 +983,6 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; -def err_friend_concept : Error< - "friend declaration cannot be a concept">; - // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 883db838ca0147..d102a45f8c1ed2 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,6 +3020,8 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts +def err_friend_concept : Error< + "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< >From 1733184c9a6fa8a375dec2c10f5456cfb86e9a57 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 14:58:27 +0200 Subject: [PATCH 2/6] cast instead --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 +++ clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 -- clang/lib/Parse/ParseDeclCXX.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index cb52629f9c61c7..78510e61a639fa 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,6 +983,9 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; +def err_friend_concept : Error< + "friend declaration cannot be a concept">; + // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index d102a45f8c1ed2..883db838ca0147 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,8 +3020,6 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts -def err_friend_concept : Error< - "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 6f0f5a0311bc18..fb159eb997ce9d 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -3150,8 +3150,8 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclaration( if (Tok.is(tok::kw_concept)) { Diag(Tok.getLocation(), DS.isFriendSpecified() || NextToken().is(tok::kw_friend) - ? diag::err_friend_concept - : diag:: + ? (unsigned)diag::err_friend_concept + : (unsigned)diag:: err_concept_decls_may_only_appear_in_global_namespace_scope); SkipUntil(tok::semi, tok::r
[clang] [NFC][Clang] Fix enumerated mismatch warning (PR #112816)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112816 >From 3eabcb305e4c666b897a084615e4d53fc8052020 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:03:22 +0200 Subject: [PATCH 1/3] [NFC][Clang] Fix enumerated mismatch warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning: llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3153:14: error: enumerated mismatch in conditional expression: ‘clang::diag::’ vs ‘clang::diag::’ [-Werror=enum-compare] 3152 | DS.isFriendSpecified() || NextToken().is(tok::kw_friend) | 3153 | ? diag::err_friend_concept | ^~ 3154 | : diag:: | 3155 | err_concept_decls_may_only_appear_in_global_namespace_scope); --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 78510e61a639fa..cb52629f9c61c7 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,9 +983,6 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; -def err_friend_concept : Error< - "friend declaration cannot be a concept">; - // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 883db838ca0147..d102a45f8c1ed2 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,6 +3020,8 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts +def err_friend_concept : Error< + "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< >From caff2db504f8d98b7bbe399820cfef9f42215ddb Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 14:58:27 +0200 Subject: [PATCH 2/3] cast instead --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 +++ clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 -- clang/lib/Parse/ParseDeclCXX.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index cb52629f9c61c7..78510e61a639fa 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,6 +983,9 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; +def err_friend_concept : Error< + "friend declaration cannot be a concept">; + // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index d102a45f8c1ed2..883db838ca0147 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,8 +3020,6 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts -def err_friend_concept : Error< - "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 6f0f5a0311bc18..fb159eb997ce9d 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -3150,8 +3150,8 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclaration( if (Tok.is(tok::kw_concept)) { Diag(Tok.getLocation(), DS.isFriendSpecified() || NextToken().is(tok::kw_friend) - ? diag::err_friend_concept - : diag:: + ? (unsigned)diag::err_friend_concept + : (unsigned)diag:: err_concept_decls_may_only_appear_in_global_namespace_scope); SkipUntil(tok::semi, tok::r
[clang] [NFC][Clang] Fix enumerated mismatch warning (PR #112816)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112816 >From 3eabcb305e4c666b897a084615e4d53fc8052020 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:03:22 +0200 Subject: [PATCH 1/4] [NFC][Clang] Fix enumerated mismatch warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning: llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3153:14: error: enumerated mismatch in conditional expression: ‘clang::diag::’ vs ‘clang::diag::’ [-Werror=enum-compare] 3152 | DS.isFriendSpecified() || NextToken().is(tok::kw_friend) | 3153 | ? diag::err_friend_concept | ^~ 3154 | : diag:: | 3155 | err_concept_decls_may_only_appear_in_global_namespace_scope); --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 78510e61a639fa..cb52629f9c61c7 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,9 +983,6 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; -def err_friend_concept : Error< - "friend declaration cannot be a concept">; - // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 883db838ca0147..d102a45f8c1ed2 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,6 +3020,8 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts +def err_friend_concept : Error< + "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< >From caff2db504f8d98b7bbe399820cfef9f42215ddb Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 14:58:27 +0200 Subject: [PATCH 2/4] cast instead --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 +++ clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 -- clang/lib/Parse/ParseDeclCXX.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index cb52629f9c61c7..78510e61a639fa 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,6 +983,9 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; +def err_friend_concept : Error< + "friend declaration cannot be a concept">; + // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index d102a45f8c1ed2..883db838ca0147 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,8 +3020,6 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts -def err_friend_concept : Error< - "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 6f0f5a0311bc18..fb159eb997ce9d 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -3150,8 +3150,8 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclaration( if (Tok.is(tok::kw_concept)) { Diag(Tok.getLocation(), DS.isFriendSpecified() || NextToken().is(tok::kw_friend) - ? diag::err_friend_concept - : diag:: + ? (unsigned)diag::err_friend_concept + : (unsigned)diag:: err_concept_decls_may_only_appear_in_global_namespace_scope); SkipUntil(tok::semi, tok::r
[clang] [llvm] [NFC] Fix c++ style comment in c file (PR #112814)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112814 >From d37014d8da13a3de36a7aaa0ed9a6f72c72d155d Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 04:56:17 +0200 Subject: [PATCH 1/2] [NFC] Fix c++ style comment in c file This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warnings: llvm-project/clang/include/clang-c/Index.h:2983:3: error: C++ style comments are not allowed in ISO C90 [-Werror] 2983 | // HLSL Types --- clang/include/clang-c/Index.h | 2 +- clang/tools/c-index-test/c-index-test.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index 4f99bf4ebe309b..0c5ac80772e2b9 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -2980,7 +2980,7 @@ enum CXTypeKind { CXType_Atomic = 177, CXType_BTFTagAttributed = 178, - // HLSL Types + /* HLSL Types */ CXType_HLSLResource = 179, CXType_HLSLAttributedResource = 180 }; diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index b48f44950ab754..7995203c0925a4 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -8,7 +8,6 @@ #include "clang-c/Documentation.h" #include "clang-c/Index.h" #include "clang/Config/config.h" -#include "llvm/Support/AutoConvert.h" #include #include #include >From d72d0e3d31ec0569a2e8e35df2bbae469bbb1b27 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 08:53:31 -0700 Subject: [PATCH 2/2] convert to c style --- clang/tools/c-index-test/c-index-test.c | 1 + llvm/include/llvm/Support/AutoConvert.h | 33 + 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 7995203c0925a4..b48f44950ab754 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -8,6 +8,7 @@ #include "clang-c/Documentation.h" #include "clang-c/Index.h" #include "clang/Config/config.h" +#include "llvm/Support/AutoConvert.h" #include #include #include diff --git a/llvm/include/llvm/Support/AutoConvert.h b/llvm/include/llvm/Support/AutoConvert.h index 6f45c4683f7775..554ca7a924500d 100644 --- a/llvm/include/llvm/Support/AutoConvert.h +++ b/llvm/include/llvm/Support/AutoConvert.h @@ -1,4 +1,4 @@ -//===- AutoConvert.h - Auto conversion between ASCII/EBCDIC -*- C++ -*-===// +/*===- AutoConvert.h - Auto conversion between ASCII/EBCDIC -*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,7 +9,7 @@ // This file contains functions used for auto conversion between // ASCII/EBCDIC codepages specific to z/OS. // -//===--===// +//===--===*/ #ifndef LLVM_SUPPORT_AUTOCONVERT_H #define LLVM_SUPPORT_AUTOCONVERT_H @@ -18,7 +18,7 @@ #include <_Ccsid.h> #ifdef __cplusplus #include -#endif // __cplusplus +#endif /* __cplusplus */ #define CCSID_IBM_1047 1047 #define CCSID_UTF_8 1208 @@ -26,35 +26,36 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif /* __cplusplus */ int enablezOSAutoConversion(int FD); int disablezOSAutoConversion(int FD); int restorezOSStdHandleAutoConversion(int FD); #ifdef __cplusplus } -#endif // __cplusplus +#endif /* __cplusplus */ #ifdef __cplusplus namespace llvm { -/// \brief Disable the z/OS enhanced ASCII auto-conversion for the file -/// descriptor. +/** \brief Disable the z/OS enhanced ASCII auto-conversion for the file + * descriptor. + */ std::error_code disablezOSAutoConversion(int FD); -/// \brief Query the z/OS enhanced ASCII auto-conversion status of a file -/// descriptor and force the conversion if the file is not tagged with a -/// codepage. +/** \brief Query the z/OS enhanced ASCII auto-conversion status of a file + * descriptor and force the conversion if the file is not tagged with a + */ codepage. std::error_code enablezOSAutoConversion(int FD); -/// Restore the z/OS enhanced ASCII auto-conversion for the std handle. +/** Restore the z/OS enhanced ASCII auto-conversion for the std handle. */ std::error_code restorezOSStdHandleAutoConversion(int FD); -/// \brief Set the tag information for a file descriptor. +/** \brief Set the tag information for a file descriptor. */ std::error_code setzOSFileTag(int FD, int CCSID, bool Text); -} // namespace llvm -#endif // __cplusplus +} /* namespace llvm */ +#endif /* __cplusplus */ -#endif // __MVS__ +#endif /* __MVS__ */ -#endif // LLVM_SUPPORT_AUTOCONVERT_H +#endif /* LLVM_SUPPORT_AUTOCONVERT_H */ ___ cfe-commits mailing li
[clang] [NFC] add DiagnosticsTestHelper decl (PR #112820)
jsji wrote: CI failures are irrelvant. https://github.com/llvm/llvm-project/pull/112820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Sema][OpenMP] Fix free-nonheap-object warning (PR #112942)
https://github.com/jsji created https://github.com/llvm/llvm-project/pull/112942 This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning In destructor ‘llvm::APInt::~APInt()’, inlined from ‘llvm::APInt::~APInt()’ at llvm-project/llvm/include/llvm/ADT/APInt.h:190:3, inlined from ‘llvm::APSInt::~APSInt()’ at llvm-project/llvm/include/llvm/ADT/APSInt.h:23:21, inlined from ‘bool checkOMPArraySectionConstantForReduction(clang::ASTContext&, const clang::ArraySectionExpr*, bool&, llvm::SmallVectorImpl&)’ at llvm-project/clang/lib/Sema/SemaOpenMP.cpp:18357:45, inlined from ‘bool actOnOMPReductionKindClause(clang::Sema&, {anonymous}::DSAStackTy*, clang::OpenMPClauseKind, llvm::ArrayRef, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::CXXScopeSpec&, const clang::DeclarationNameInfo&, llvm::ArrayRef, {anonymous}::ReductionData&)’ at llvm-project/clang/lib/Sema/SemaOpenMP.cpp:18715:68: llvm-project/llvm/include/llvm/ADT/APInt.h:192:18: error: ‘void operator delete [](void*)’ called on a pointer to an unallocated object ‘1’ [-Werror=free-nonheap-object] 192 | delete[] U.pVal; | ^~~~ >From 91a703b2613580eabe77ba3617e7bc0525b55917 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 19:29:43 +0200 Subject: [PATCH] [NFC][Sema][OpenMP] Fix free-nonheap-object warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning In destructor ‘llvm::APInt::~APInt()’, inlined from ‘llvm::APInt::~APInt()’ at llvm-project/llvm/include/llvm/ADT/APInt.h:190:3, inlined from ‘llvm::APSInt::~APSInt()’ at llvm-project/llvm/include/llvm/ADT/APSInt.h:23:21, inlined from ‘bool checkOMPArraySectionConstantForReduction(clang::ASTContext&, const clang::ArraySectionExpr*, bool&, llvm::SmallVectorImpl&)’ at llvm-project/clang/lib/Sema/SemaOpenMP.cpp:18357:45, inlined from ‘bool actOnOMPReductionKindClause(clang::Sema&, {anonymous}::DSAStackTy*, clang::OpenMPClauseKind, llvm::ArrayRef, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::CXXScopeSpec&, const clang::DeclarationNameInfo&, llvm::ArrayRef, {anonymous}::ReductionData&)’ at llvm-project/clang/lib/Sema/SemaOpenMP.cpp:18715:68: llvm-project/llvm/include/llvm/ADT/APInt.h:192:18: error: ‘void operator delete [](void*)’ called on a pointer to an unallocated object ‘1’ [-Werror=free-nonheap-object] 192 | delete[] U.pVal; | ^~~~ --- clang/lib/Sema/SemaOpenMP.cpp | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 0232745b3c19e5..fa81fc42c0ee53 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -18335,7 +18335,8 @@ static bool checkOMPArraySectionConstantForReduction( return false; // This is an array subscript which has implicit length 1! - ArraySizes.push_back(llvm::APSInt::get(1)); + llvm::APSInt ConstantOne = llvm::APSInt::get(1); + ArraySizes.push_back(ConstantOne); } else { Expr::EvalResult Result; if (!Length->EvaluateAsInt(Result, Context)) @@ -18354,7 +18355,8 @@ static bool checkOMPArraySectionConstantForReduction( if (!SingleElement) { while (const auto *TempASE = dyn_cast(Base)) { // Has implicit length 1! - ArraySizes.push_back(llvm::APSInt::get(1)); + llvm::APSInt ConstantOne = llvm::APSInt::get(1); + ArraySizes.push_back(ConstantOne); Base = TempASE->getBase()->IgnoreParenImpCasts(); } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Clang] Fix enumerated mismatch warning (PR #112816)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112816 >From 3eabcb305e4c666b897a084615e4d53fc8052020 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:03:22 +0200 Subject: [PATCH 1/2] [NFC][Clang] Fix enumerated mismatch warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning: llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3153:14: error: enumerated mismatch in conditional expression: ‘clang::diag::’ vs ‘clang::diag::’ [-Werror=enum-compare] 3152 | DS.isFriendSpecified() || NextToken().is(tok::kw_friend) | 3153 | ? diag::err_friend_concept | ^~ 3154 | : diag:: | 3155 | err_concept_decls_may_only_appear_in_global_namespace_scope); --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 78510e61a639fa..cb52629f9c61c7 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,9 +983,6 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; -def err_friend_concept : Error< - "friend declaration cannot be a concept">; - // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 883db838ca0147..d102a45f8c1ed2 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,6 +3020,8 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts +def err_friend_concept : Error< + "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< >From caff2db504f8d98b7bbe399820cfef9f42215ddb Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 14:58:27 +0200 Subject: [PATCH 2/2] cast instead --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 +++ clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 -- clang/lib/Parse/ParseDeclCXX.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index cb52629f9c61c7..78510e61a639fa 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,6 +983,9 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; +def err_friend_concept : Error< + "friend declaration cannot be a concept">; + // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index d102a45f8c1ed2..883db838ca0147 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,8 +3020,6 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts -def err_friend_concept : Error< - "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 6f0f5a0311bc18..fb159eb997ce9d 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -3150,8 +3150,8 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclaration( if (Tok.is(tok::kw_concept)) { Diag(Tok.getLocation(), DS.isFriendSpecified() || NextToken().is(tok::kw_friend) - ? diag::err_friend_concept - : diag:: + ? (unsigned)diag::err_friend_concept + : (unsigned)diag:: err_concept_decls_may_only_appear_in_global_namespace_scope); SkipUntil(tok::semi, tok::r
[clang] [NFC] clang add DiagnosticsTestHelper decl (PR #112820)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112820 >From 53683a8543bb6a558a778dc1cc15adb3180df7e4 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:23:19 +0200 Subject: [PATCH 1/2] [NFC] clang add DiagnosticsTestHelper decl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:19:6: error: ‘void clang::DiagnosticsTestHelper(clang::DiagnosticsEngine&)’ has not been declared within ‘clang’ [-Werror] 19 | void clang::DiagnosticsTestHelper(DiagnosticsEngine &diag) { | ^ In file included from /iusers/jinsongj/llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:9: /iusers/jinsongj/llvm-project/clang/include/clang/Basic/Diagnostic.h:567:15: note: only here as a ‘friend’ 567 | friend void DiagnosticsTestHelper(DiagnosticsEngine &); --- clang/include/clang/Basic/Diagnostic.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 3b1efdb12824c7..3f6e85634c3cf5 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1024,6 +1024,8 @@ class DiagnosticsEngine : public RefCountedBase { /// @} }; +void DiagnosticsTestHelper(DiagnosticsEngine &); + /// RAII class that determines when any errors have occurred /// between the time the instance was created and the time it was /// queried. >From 677dab12a67b801dd0406e38f092f89b71045785 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 14:54:56 +0200 Subject: [PATCH 2/2] Add comments --- clang/include/clang/Basic/Diagnostic.h | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 3f6e85634c3cf5..dc7e49beb9a0f4 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1024,6 +1024,7 @@ class DiagnosticsEngine : public RefCountedBase { /// @} }; +/// Declare the friend function for testing to avoid GCC warning. void DiagnosticsTestHelper(DiagnosticsEngine &); /// RAII class that determines when any errors have occurred ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [NFC] Fix c++ style comment in c file (PR #112814)
https://github.com/jsji closed https://github.com/llvm/llvm-project/pull/112814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] add DiagnosticsTestHelper decl (PR #112820)
https://github.com/jsji closed https://github.com/llvm/llvm-project/pull/112820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [NFC] Fix c++ style comment in c file (PR #112814)
@@ -8,7 +8,6 @@ #include "clang-c/Documentation.h" #include "clang-c/Index.h" #include "clang/Config/config.h" -#include "llvm/Support/AutoConvert.h" jsji wrote: Done. Please review. Thanks. https://github.com/llvm/llvm-project/pull/112814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [NFC] Fix c++ style comment in c file (PR #112814)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112814 >From d37014d8da13a3de36a7aaa0ed9a6f72c72d155d Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 04:56:17 +0200 Subject: [PATCH 1/3] [NFC] Fix c++ style comment in c file This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warnings: llvm-project/clang/include/clang-c/Index.h:2983:3: error: C++ style comments are not allowed in ISO C90 [-Werror] 2983 | // HLSL Types --- clang/include/clang-c/Index.h | 2 +- clang/tools/c-index-test/c-index-test.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index 4f99bf4ebe309b..0c5ac80772e2b9 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -2980,7 +2980,7 @@ enum CXTypeKind { CXType_Atomic = 177, CXType_BTFTagAttributed = 178, - // HLSL Types + /* HLSL Types */ CXType_HLSLResource = 179, CXType_HLSLAttributedResource = 180 }; diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index b48f44950ab754..7995203c0925a4 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -8,7 +8,6 @@ #include "clang-c/Documentation.h" #include "clang-c/Index.h" #include "clang/Config/config.h" -#include "llvm/Support/AutoConvert.h" #include #include #include >From d72d0e3d31ec0569a2e8e35df2bbae469bbb1b27 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 08:53:31 -0700 Subject: [PATCH 2/3] convert to c style --- clang/tools/c-index-test/c-index-test.c | 1 + llvm/include/llvm/Support/AutoConvert.h | 33 + 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 7995203c0925a4..b48f44950ab754 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -8,6 +8,7 @@ #include "clang-c/Documentation.h" #include "clang-c/Index.h" #include "clang/Config/config.h" +#include "llvm/Support/AutoConvert.h" #include #include #include diff --git a/llvm/include/llvm/Support/AutoConvert.h b/llvm/include/llvm/Support/AutoConvert.h index 6f45c4683f7775..554ca7a924500d 100644 --- a/llvm/include/llvm/Support/AutoConvert.h +++ b/llvm/include/llvm/Support/AutoConvert.h @@ -1,4 +1,4 @@ -//===- AutoConvert.h - Auto conversion between ASCII/EBCDIC -*- C++ -*-===// +/*===- AutoConvert.h - Auto conversion between ASCII/EBCDIC -*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,7 +9,7 @@ // This file contains functions used for auto conversion between // ASCII/EBCDIC codepages specific to z/OS. // -//===--===// +//===--===*/ #ifndef LLVM_SUPPORT_AUTOCONVERT_H #define LLVM_SUPPORT_AUTOCONVERT_H @@ -18,7 +18,7 @@ #include <_Ccsid.h> #ifdef __cplusplus #include -#endif // __cplusplus +#endif /* __cplusplus */ #define CCSID_IBM_1047 1047 #define CCSID_UTF_8 1208 @@ -26,35 +26,36 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif /* __cplusplus */ int enablezOSAutoConversion(int FD); int disablezOSAutoConversion(int FD); int restorezOSStdHandleAutoConversion(int FD); #ifdef __cplusplus } -#endif // __cplusplus +#endif /* __cplusplus */ #ifdef __cplusplus namespace llvm { -/// \brief Disable the z/OS enhanced ASCII auto-conversion for the file -/// descriptor. +/** \brief Disable the z/OS enhanced ASCII auto-conversion for the file + * descriptor. + */ std::error_code disablezOSAutoConversion(int FD); -/// \brief Query the z/OS enhanced ASCII auto-conversion status of a file -/// descriptor and force the conversion if the file is not tagged with a -/// codepage. +/** \brief Query the z/OS enhanced ASCII auto-conversion status of a file + * descriptor and force the conversion if the file is not tagged with a + */ codepage. std::error_code enablezOSAutoConversion(int FD); -/// Restore the z/OS enhanced ASCII auto-conversion for the std handle. +/** Restore the z/OS enhanced ASCII auto-conversion for the std handle. */ std::error_code restorezOSStdHandleAutoConversion(int FD); -/// \brief Set the tag information for a file descriptor. +/** \brief Set the tag information for a file descriptor. */ std::error_code setzOSFileTag(int FD, int CCSID, bool Text); -} // namespace llvm -#endif // __cplusplus +} /* namespace llvm */ +#endif /* __cplusplus */ -#endif // __MVS__ +#endif /* __MVS__ */ -#endif // LLVM_SUPPORT_AUTOCONVERT_H +#endif /* LLVM_SUPPORT_AUTOCONVERT_H */ >From 2d56069b7c6a86ab2869a27086e3fcca7d6b731d Mon Sep 17 00:00:00 200
[clang] [NFC] add DiagnosticsTestHelper decl (PR #112820)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112820 >From 53683a8543bb6a558a778dc1cc15adb3180df7e4 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:23:19 +0200 Subject: [PATCH 1/5] [NFC] clang add DiagnosticsTestHelper decl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:19:6: error: ‘void clang::DiagnosticsTestHelper(clang::DiagnosticsEngine&)’ has not been declared within ‘clang’ [-Werror] 19 | void clang::DiagnosticsTestHelper(DiagnosticsEngine &diag) { | ^ In file included from /iusers/jinsongj/llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:9: /iusers/jinsongj/llvm-project/clang/include/clang/Basic/Diagnostic.h:567:15: note: only here as a ‘friend’ 567 | friend void DiagnosticsTestHelper(DiagnosticsEngine &); --- clang/include/clang/Basic/Diagnostic.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 3b1efdb12824c7..3f6e85634c3cf5 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1024,6 +1024,8 @@ class DiagnosticsEngine : public RefCountedBase { /// @} }; +void DiagnosticsTestHelper(DiagnosticsEngine &); + /// RAII class that determines when any errors have occurred /// between the time the instance was created and the time it was /// queried. >From 677dab12a67b801dd0406e38f092f89b71045785 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 14:54:56 +0200 Subject: [PATCH 2/5] Add comments --- clang/include/clang/Basic/Diagnostic.h | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 3f6e85634c3cf5..dc7e49beb9a0f4 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1024,6 +1024,7 @@ class DiagnosticsEngine : public RefCountedBase { /// @} }; +/// Declare the friend function for testing to avoid GCC warning. void DiagnosticsTestHelper(DiagnosticsEngine &); /// RAII class that determines when any errors have occurred >From 1154286563d33ffedc4981a1e7c9f72518a1cf6f Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 08:37:38 -0700 Subject: [PATCH 3/5] Revert "Add comments" This reverts commit 677dab12a67b801dd0406e38f092f89b71045785. --- clang/include/clang/Basic/Diagnostic.h | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index dc7e49beb9a0f4..3f6e85634c3cf5 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1024,7 +1024,6 @@ class DiagnosticsEngine : public RefCountedBase { /// @} }; -/// Declare the friend function for testing to avoid GCC warning. void DiagnosticsTestHelper(DiagnosticsEngine &); /// RAII class that determines when any errors have occurred >From a40fb059ae8bb81806cc399361c48ea5caca0336 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 08:37:11 -0700 Subject: [PATCH 4/5] Add the decl in unittest file only --- clang/include/clang/Basic/Diagnostic.h | 2 -- clang/unittests/Basic/DiagnosticTest.cpp | 4 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 3f6e85634c3cf5..3b1efdb12824c7 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1024,8 +1024,6 @@ class DiagnosticsEngine : public RefCountedBase { /// @} }; -void DiagnosticsTestHelper(DiagnosticsEngine &); - /// RAII class that determines when any errors have occurred /// between the time the instance was created and the time it was /// queried. diff --git a/clang/unittests/Basic/DiagnosticTest.cpp b/clang/unittests/Basic/DiagnosticTest.cpp index 691d74f697f278..54b32bc2bb7833 100644 --- a/clang/unittests/Basic/DiagnosticTest.cpp +++ b/clang/unittests/Basic/DiagnosticTest.cpp @@ -16,6 +16,10 @@ using namespace llvm; using namespace clang; +namespace clang { + void DiagnosticsTestHelper(DiagnosticsEngine &diag); +} + void clang::DiagnosticsTestHelper(DiagnosticsEngine &diag) { EXPECT_FALSE(diag.DiagStates.empty()); EXPECT_TRUE(diag.DiagStatesByLoc.empty()); >From b2d1d53bbfc7352fae2d03600168f97099f03e48 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 17:59:25 +0200 Subject: [PATCH 5/5] clangformat and comment --- clang/unittests/Basic/DiagnosticTest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/unittests/Basic/DiagnosticTest.cpp b/clang/unittests/Basic/DiagnosticTest.cpp index 54b32bc2bb7833..d8d23e3b670097 100644 --- a/clang/unittests/Basic/
[clang] [NFC] Fix c++ style comment in c file (PR #112814)
@@ -8,7 +8,6 @@ #include "clang-c/Documentation.h" #include "clang-c/Index.h" #include "clang/Config/config.h" -#include "llvm/Support/AutoConvert.h" jsji wrote: Please update all the comments to use c style instead then? https://github.com/llvm/llvm-project/pull/112814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Clang] Fix enumerated mismatch warning (PR #112816)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112816 >From 6b85331c4927c031fb8a937467cf62c5d0f80e64 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:03:22 +0200 Subject: [PATCH 1/4] [NFC][Clang] Fix enumerated mismatch warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning: llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3153:14: error: enumerated mismatch in conditional expression: ‘clang::diag::’ vs ‘clang::diag::’ [-Werror=enum-compare] 3152 | DS.isFriendSpecified() || NextToken().is(tok::kw_friend) | 3153 | ? diag::err_friend_concept | ^~ 3154 | : diag:: | 3155 | err_concept_decls_may_only_appear_in_global_namespace_scope); --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 78510e61a639fa..cb52629f9c61c7 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,9 +983,6 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; -def err_friend_concept : Error< - "friend declaration cannot be a concept">; - // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 883db838ca0147..d102a45f8c1ed2 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,6 +3020,8 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts +def err_friend_concept : Error< + "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< >From 1733184c9a6fa8a375dec2c10f5456cfb86e9a57 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 14:58:27 +0200 Subject: [PATCH 2/4] cast instead --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 +++ clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 -- clang/lib/Parse/ParseDeclCXX.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index cb52629f9c61c7..78510e61a639fa 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,6 +983,9 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; +def err_friend_concept : Error< + "friend declaration cannot be a concept">; + // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index d102a45f8c1ed2..883db838ca0147 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,8 +3020,6 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts -def err_friend_concept : Error< - "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 6f0f5a0311bc18..fb159eb997ce9d 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -3150,8 +3150,8 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclaration( if (Tok.is(tok::kw_concept)) { Diag(Tok.getLocation(), DS.isFriendSpecified() || NextToken().is(tok::kw_friend) - ? diag::err_friend_concept - : diag:: + ? (unsigned)diag::err_friend_concept + : (unsigned)diag:: err_concept_decls_may_only_appear_in_global_namespace_scope); SkipUntil(tok::semi, tok::r
[clang] [NFC][Sema][OpenMP] Fix free-nonheap-object warning (PR #112942)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112942 >From a01e0d660a1631c7b9a78d1a48dc6dc2080cc19a Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 19:29:43 +0200 Subject: [PATCH] [NFC][Sema][OpenMP] Fix free-nonheap-object warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning In destructor ‘llvm::APInt::~APInt()’, inlined from ‘llvm::APInt::~APInt()’ at llvm-project/llvm/include/llvm/ADT/APInt.h:190:3, inlined from ‘llvm::APSInt::~APSInt()’ at llvm-project/llvm/include/llvm/ADT/APSInt.h:23:21, inlined from ‘bool checkOMPArraySectionConstantForReduction(clang::ASTContext&, const clang::ArraySectionExpr*, bool&, llvm::SmallVectorImpl&)’ at llvm-project/clang/lib/Sema/SemaOpenMP.cpp:18357:45, inlined from ‘bool actOnOMPReductionKindClause(clang::Sema&, {anonymous}::DSAStackTy*, clang::OpenMPClauseKind, llvm::ArrayRef, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::CXXScopeSpec&, const clang::DeclarationNameInfo&, llvm::ArrayRef, {anonymous}::ReductionData&)’ at llvm-project/clang/lib/Sema/SemaOpenMP.cpp:18715:68: llvm-project/llvm/include/llvm/ADT/APInt.h:192:18: error: ‘void operator delete [](void*)’ called on a pointer to an unallocated object ‘1’ [-Werror=free-nonheap-object] 192 | delete[] U.pVal; | ^~~~ --- clang/lib/Sema/SemaOpenMP.cpp | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 0232745b3c19e5..fa81fc42c0ee53 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -18335,7 +18335,8 @@ static bool checkOMPArraySectionConstantForReduction( return false; // This is an array subscript which has implicit length 1! - ArraySizes.push_back(llvm::APSInt::get(1)); + llvm::APSInt ConstantOne = llvm::APSInt::get(1); + ArraySizes.push_back(ConstantOne); } else { Expr::EvalResult Result; if (!Length->EvaluateAsInt(Result, Context)) @@ -18354,7 +18355,8 @@ static bool checkOMPArraySectionConstantForReduction( if (!SingleElement) { while (const auto *TempASE = dyn_cast(Base)) { // Has implicit length 1! - ArraySizes.push_back(llvm::APSInt::get(1)); + llvm::APSInt ConstantOne = llvm::APSInt::get(1); + ArraySizes.push_back(ConstantOne); Base = TempASE->getBase()->IgnoreParenImpCasts(); } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Sema][OpenMP] Fix free-nonheap-object warning (PR #112942)
https://github.com/jsji closed https://github.com/llvm/llvm-project/pull/112942 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Clang] Fix enumerated mismatch warning (PR #112816)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112816 >From 4d79a387c70f4460e7b82df171ba8db68c3a96aa Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:03:22 +0200 Subject: [PATCH 1/6] [NFC][Clang] Fix enumerated mismatch warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning: llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3153:14: error: enumerated mismatch in conditional expression: ‘clang::diag::’ vs ‘clang::diag::’ [-Werror=enum-compare] 3152 | DS.isFriendSpecified() || NextToken().is(tok::kw_friend) | 3153 | ? diag::err_friend_concept | ^~ 3154 | : diag:: | 3155 | err_concept_decls_may_only_appear_in_global_namespace_scope); --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 78510e61a639fa..cb52629f9c61c7 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,9 +983,6 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; -def err_friend_concept : Error< - "friend declaration cannot be a concept">; - // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 883db838ca0147..d102a45f8c1ed2 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,6 +3020,8 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts +def err_friend_concept : Error< + "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< >From ea8950ea3cce2648adb5431efa55ae485403355b Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 14:58:27 +0200 Subject: [PATCH 2/6] cast instead --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 +++ clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 -- clang/lib/Parse/ParseDeclCXX.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index cb52629f9c61c7..78510e61a639fa 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,6 +983,9 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; +def err_friend_concept : Error< + "friend declaration cannot be a concept">; + // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index d102a45f8c1ed2..883db838ca0147 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,8 +3020,6 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts -def err_friend_concept : Error< - "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 6f0f5a0311bc18..fb159eb997ce9d 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -3150,8 +3150,8 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclaration( if (Tok.is(tok::kw_concept)) { Diag(Tok.getLocation(), DS.isFriendSpecified() || NextToken().is(tok::kw_friend) - ? diag::err_friend_concept - : diag:: + ? (unsigned)diag::err_friend_concept + : (unsigned)diag:: err_concept_decls_may_only_appear_in_global_namespace_scope); SkipUntil(tok::semi, tok::r
[clang] [NFC][Clang] Fix enumerated mismatch warning (PR #112816)
jsji wrote: @Sirraide @cor3ntin Updated, can you please have another look? Thanks. https://github.com/llvm/llvm-project/pull/112816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Clang] Fix enumerated mismatch warning (PR #112816)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112816 >From 4d79a387c70f4460e7b82df171ba8db68c3a96aa Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:03:22 +0200 Subject: [PATCH 1/7] [NFC][Clang] Fix enumerated mismatch warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning: llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3153:14: error: enumerated mismatch in conditional expression: ‘clang::diag::’ vs ‘clang::diag::’ [-Werror=enum-compare] 3152 | DS.isFriendSpecified() || NextToken().is(tok::kw_friend) | 3153 | ? diag::err_friend_concept | ^~ 3154 | : diag:: | 3155 | err_concept_decls_may_only_appear_in_global_namespace_scope); --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 78510e61a639fa..cb52629f9c61c7 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,9 +983,6 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; -def err_friend_concept : Error< - "friend declaration cannot be a concept">; - // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 883db838ca0147..d102a45f8c1ed2 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,6 +3020,8 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts +def err_friend_concept : Error< + "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< >From ea8950ea3cce2648adb5431efa55ae485403355b Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 14:58:27 +0200 Subject: [PATCH 2/7] cast instead --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 +++ clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 -- clang/lib/Parse/ParseDeclCXX.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index cb52629f9c61c7..78510e61a639fa 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,6 +983,9 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; +def err_friend_concept : Error< + "friend declaration cannot be a concept">; + // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index d102a45f8c1ed2..883db838ca0147 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,8 +3020,6 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts -def err_friend_concept : Error< - "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 6f0f5a0311bc18..fb159eb997ce9d 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -3150,8 +3150,8 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclaration( if (Tok.is(tok::kw_concept)) { Diag(Tok.getLocation(), DS.isFriendSpecified() || NextToken().is(tok::kw_friend) - ? diag::err_friend_concept - : diag:: + ? (unsigned)diag::err_friend_concept + : (unsigned)diag:: err_concept_decls_may_only_appear_in_global_namespace_scope); SkipUntil(tok::semi, tok::r
[clang] [NFC] Fix c++ style comment in c file (PR #112814)
https://github.com/jsji created https://github.com/llvm/llvm-project/pull/112814 This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warnings: llvm-project/clang/include/clang-c/Index.h:2983:3: error: C++ style comments are not allowed in ISO C90 [-Werror] 2983 | // HLSL Types >From d37014d8da13a3de36a7aaa0ed9a6f72c72d155d Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 04:56:17 +0200 Subject: [PATCH] [NFC] Fix c++ style comment in c file This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warnings: llvm-project/clang/include/clang-c/Index.h:2983:3: error: C++ style comments are not allowed in ISO C90 [-Werror] 2983 | // HLSL Types --- clang/include/clang-c/Index.h | 2 +- clang/tools/c-index-test/c-index-test.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index 4f99bf4ebe309b..0c5ac80772e2b9 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -2980,7 +2980,7 @@ enum CXTypeKind { CXType_Atomic = 177, CXType_BTFTagAttributed = 178, - // HLSL Types + /* HLSL Types */ CXType_HLSLResource = 179, CXType_HLSLAttributedResource = 180 }; diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index b48f44950ab754..7995203c0925a4 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -8,7 +8,6 @@ #include "clang-c/Documentation.h" #include "clang-c/Index.h" #include "clang/Config/config.h" -#include "llvm/Support/AutoConvert.h" #include #include #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Clang] Fix enumerated mismatch warning (PR #112816)
https://github.com/jsji edited https://github.com/llvm/llvm-project/pull/112816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Clang] Fix enumerated mismatch warning (PR #112816)
https://github.com/jsji created https://github.com/llvm/llvm-project/pull/112816 This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning: llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3153:14: error: enumerated mismatch in conditional expression: ‘clang::diag::’ vs ‘clang::diag::’ [-Werror=enum-compare] 3152 | DS.isFriendSpecified() || NextToken().is(tok::kw_friend) | 3153 | ? diag::err_friend_concept | ^~ 3154 | : diag:: | 3155 | err_concept_decls_may_only_appear_in_global_namespace_scope); >From 3eabcb305e4c666b897a084615e4d53fc8052020 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:03:22 +0200 Subject: [PATCH] [NFC][Clang] Fix enumerated mismatch warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning: llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3153:14: error: enumerated mismatch in conditional expression: ‘clang::diag::’ vs ‘clang::diag::’ [-Werror=enum-compare] 3152 | DS.isFriendSpecified() || NextToken().is(tok::kw_friend) | 3153 | ? diag::err_friend_concept | ^~ 3154 | : diag:: | 3155 | err_concept_decls_may_only_appear_in_global_namespace_scope); --- clang/include/clang/Basic/DiagnosticParseKinds.td | 3 --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 78510e61a639fa..cb52629f9c61c7 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -983,9 +983,6 @@ def warn_cxx23_variadic_friends : Warning< "variadic 'friend' declarations are incompatible with C++ standards before C++2c">, DefaultIgnore, InGroup; -def err_friend_concept : Error< - "friend declaration cannot be a concept">; - // C++11 default member initialization def ext_nonstatic_member_init : ExtWarn< "default member initializer for non-static data member is a C++11 " diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 883db838ca0147..d102a45f8c1ed2 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3020,6 +3020,8 @@ def err_c23_constexpr_pointer_not_null : Error< "constexpr pointer initializer is not null">; // C++ Concepts +def err_friend_concept : Error< + "friend declaration cannot be a concept">; def err_concept_decls_may_only_appear_in_global_namespace_scope : Error< "concept declarations may only appear in global or namespace scope">; def err_concept_no_parameters : Error< ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC] clang add DiagnosticsTestHelper decl (PR #112820)
https://github.com/jsji created https://github.com/llvm/llvm-project/pull/112820 This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:19:6: error: ‘void clang::DiagnosticsTestHelper(clang::DiagnosticsEngine&)’ has not been declared within ‘clang’ [-Werror] 19 | void clang::DiagnosticsTestHelper(DiagnosticsEngine &diag) { | ^ In file included from /iusers/jinsongj/llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:9: /iusers/jinsongj/llvm-project/clang/include/clang/Basic/Diagnostic.h:567:15: note: only here as a ‘friend’ 567 | friend void DiagnosticsTestHelper(DiagnosticsEngine &); >From 53683a8543bb6a558a778dc1cc15adb3180df7e4 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:23:19 +0200 Subject: [PATCH] [NFC] clang add DiagnosticsTestHelper decl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warning llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:19:6: error: ‘void clang::DiagnosticsTestHelper(clang::DiagnosticsEngine&)’ has not been declared within ‘clang’ [-Werror] 19 | void clang::DiagnosticsTestHelper(DiagnosticsEngine &diag) { | ^ In file included from /iusers/jinsongj/llvm-project/clang/unittests/Basic/DiagnosticTest.cpp:9: /iusers/jinsongj/llvm-project/clang/include/clang/Basic/Diagnostic.h:567:15: note: only here as a ‘friend’ 567 | friend void DiagnosticsTestHelper(DiagnosticsEngine &); --- clang/include/clang/Basic/Diagnostic.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 3b1efdb12824c7..3f6e85634c3cf5 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1024,6 +1024,8 @@ class DiagnosticsEngine : public RefCountedBase { /// @} }; +void DiagnosticsTestHelper(DiagnosticsEngine &); + /// RAII class that determines when any errors have occurred /// between the time the instance was created and the time it was /// queried. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [NFC] Fix implicit-fallthrough warnings (PR #112825)
https://github.com/jsji created https://github.com/llvm/llvm-project/pull/112825 This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warnings: clang/lib/Sema/SemaFunctionEffects.cpp:1531:5: error: this statement may fall through [-Werror=implicit-fallthrough=] 1531 | switch (DiffKind) { | ^~ >From f8290c6b07de74dfb4aa2c169678e345333b2b46 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 18 Oct 2024 05:30:27 +0200 Subject: [PATCH] [NFC] Fix implicit-fallthrough warnings This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11. Fix warnings: clang/lib/Sema/SemaFunctionEffects.cpp:1531:5: error: this statement may fall through [-Werror=implicit-fallthrough=] 1531 | switch (DiffKind) { | ^~ --- clang/lib/Sema/SemaFunctionEffects.cpp | 4 +++- llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/lib/Sema/SemaFunctionEffects.cpp b/clang/lib/Sema/SemaFunctionEffects.cpp index 70e5d78661a835..3fa326db06ee41 100644 --- a/clang/lib/Sema/SemaFunctionEffects.cpp +++ b/clang/lib/Sema/SemaFunctionEffects.cpp @@ -1540,6 +1540,7 @@ bool Sema::FunctionEffectDiff::shouldDiagnoseConversion( // matching is better. return true; } +break; case FunctionEffect::Kind::Blocking: case FunctionEffect::Kind::Allocating: return false; @@ -1563,6 +1564,7 @@ bool Sema::FunctionEffectDiff::shouldDiagnoseRedeclaration( // All these forms of mismatches are diagnosed. return true; } +break; case FunctionEffect::Kind::Blocking: case FunctionEffect::Kind::Allocating: return false; @@ -1592,7 +1594,7 @@ Sema::FunctionEffectDiff::shouldDiagnoseMethodOverride( case Kind::ConditionMismatch: return OverrideResult::Warn; } - +break; case FunctionEffect::Kind::Blocking: case FunctionEffect::Kind::Allocating: return OverrideResult::NoAction; diff --git a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp index 7f942de74bdcc9..93c2d92ef7c1c8 100644 --- a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp @@ -1028,6 +1028,7 @@ static unsigned int getFenceOp(NVPTX::Ordering O, NVPTX::Scope S, formatv("Unsupported scope \"{}\" for acquire/release/acq_rel fence.", ScopeToString(S))); } +break; } case NVPTX::Ordering::SequentiallyConsistent: { switch (S) { @@ -1046,6 +1047,7 @@ static unsigned int getFenceOp(NVPTX::Ordering O, NVPTX::Scope S, report_fatal_error(formatv("Unsupported scope \"{}\" for seq_cst fence.", ScopeToString(S))); } +break; } case NVPTX::Ordering::NotAtomic: case NVPTX::Ordering::Relaxed: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Clang] Fix enumerated mismatch warning (PR #112816)
https://github.com/jsji closed https://github.com/llvm/llvm-project/pull/112816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Driver] Use InstalledDir instead of Build config as anchor in test (PR #126770)
https://github.com/jsji edited https://github.com/llvm/llvm-project/pull/126770 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Driver] Use InstalledDir instead of Build config as anchor in test (PR #126770)
jsji wrote: Fixed in f574d8235371c4f28cad8e800d99bcb7ad579b7d https://github.com/llvm/llvm-project/pull/126770 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Driver] Use InstalledDir instead of Build config as anchor in test (PR #126770)
https://github.com/jsji closed https://github.com/llvm/llvm-project/pull/126770 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Clang] Use InstalledDir instead of Build config as anchor in test (PR #126770)
https://github.com/jsji created https://github.com/llvm/llvm-project/pull/126770 Build config is optional in build config, use InstalledDir instead to avoid unexpected failures in different build config. >From d8367f6d54b62a94613d38c26c216cb81f2acdae Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Tue, 11 Feb 2025 16:59:05 +0100 Subject: [PATCH] [NFC][Clang] Use InstalledDir instead of Build config as anchor in test Build config is optional in build config, use InstalledDir instead to avoid unexpected failures in different build config. --- clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip b/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip index 79a52f0bc8981..2a3034abb457a 100644 --- a/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip +++ b/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip @@ -1,6 +1,6 @@ // RUN: %clang -### -nogpuinc -nogpulib --offload-arch=gfx1030 --offload-arch=gfx1100 --offload-arch=gfx1101 -MD -MF tmp.d %s 2>&1 | FileCheck %s -// CHECK: Build config: +// CHECK: InstalledDir: // CHECK-NOT: {{.*}}clang{{.*}}"-target-cpu" "gfx1030"{{.*}}"-dependency-file" "tmp.d" // CHECK: {{.*}}lld{{.*}}"-plugin-opt=mcpu=gfx1030" // CHECK-NOT: {{.*}}clang{{.*}}"-target-cpu" "gfx1100"{{.*}}"-dependency-file" "tmp.d" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][AMDGPU] Use size_t to compare with npos (PR #132868)
https://github.com/jsji created https://github.com/llvm/llvm-project/pull/132868 Fix error llvm\clang\tools\amdgpu-arch\AMDGPUArchByHIP.cpp(102,29): error: result of comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare] 102 | StringRef VerStr = (Pos == StringRef::npos) ? S : S.substr(Pos + 1); >From 61cc5cd77b1e890743ad0c479e61c05112c60f90 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Mon, 24 Mar 2025 19:53:12 -0700 Subject: [PATCH] Use size_t to compare with npos Fix error llvm\clang\tools\amdgpu-arch\AMDGPUArchByHIP.cpp(102,29): error: result of comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare] 102 | StringRef VerStr = (Pos == StringRef::npos) ? S : S.substr(Pos + 1); --- clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp b/clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp index 4803f83f55ac7..02431bf909d6d 100644 --- a/clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp +++ b/clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp @@ -98,7 +98,7 @@ static std::vector getSearchPaths() { // Custom comparison function for dll name static bool compareVersions(StringRef A, StringRef B) { auto ParseVersion = [](StringRef S) -> VersionTuple { -unsigned Pos = S.find_last_of('_'); +size_t Pos = S.find_last_of('_'); StringRef VerStr = (Pos == StringRef::npos) ? S : S.substr(Pos + 1); VersionTuple Vt; (void)Vt.tryParse(VerStr); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][AMDGPU] Use size_t to compare with npos (PR #132868)
https://github.com/jsji closed https://github.com/llvm/llvm-project/pull/132868 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Clang] Don't check hardcode op num (PR #135375)
https://github.com/jsji created https://github.com/llvm/llvm-project/pull/135375 The num will change for any downstream customization. >From 5f3c9d4df3aa06cd34593c4f3187b6d9f389a8f3 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Fri, 11 Apr 2025 07:20:20 -0700 Subject: [PATCH] [NFC][Clang] Don't check hardcode op num The num will change for any downstream customization. --- clang/test/Modules/no-external-type-id.cppm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/test/Modules/no-external-type-id.cppm b/clang/test/Modules/no-external-type-id.cppm index d067e574e72e3..2c05769e4f082 100644 --- a/clang/test/Modules/no-external-type-id.cppm +++ b/clang/test/Modules/no-external-type-id.cppm @@ -23,7 +23,7 @@ export module b; import a; export int b(); -// CHECK: https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][c-index-test] factor data len out (PR #129971)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/129971 >From 801d92357366d95bc5bd044125eefc25862b6fee Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Wed, 5 Mar 2025 17:54:48 -0800 Subject: [PATCH 1/2] [NFC][c-index-test] factor data len out --- clang/tools/c-index-test/c-index-test.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 50f32c0a20e5a..1ad2e44aae3f7 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -3554,13 +3554,11 @@ static CXIdxClientContainer makeClientContainer(CXClientData *client_data, clang_indexLoc_getFileLocation(loc, &file, 0, &line, &column, 0); - len = sizeof(IndexDataStringList) + strlen(name) + digitCount(line) + -digitCount(column) + 3; - node = (IndexDataStringList *)malloc(len); + datalen = strlen(name) + digitCount(line) + digitCount(column) + 3; + node = (IndexDataStringList *)malloc(len + sizeof(IndexDataStringList)); assert(node); newStr = node->data; - snprintf(newStr, len - sizeof(IndexDataStringList), "%s:%d:%d", name, line, - column); + snprintf(newStr, datalen, "%s:%d:%d", name, line, column); /* Remember string so it can be freed later. */ index_data = (IndexData *)client_data; >From b0e77d2a6ebe51bf0f35524c9afb337c65881fc9 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Wed, 5 Mar 2025 18:00:25 -0800 Subject: [PATCH 2/2] fix --- clang/tools/c-index-test/c-index-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 1ad2e44aae3f7..d6021036d11ef 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -3546,7 +3546,7 @@ static CXIdxClientContainer makeClientContainer(CXClientData *client_data, char *newStr; CXIdxClientFile file; unsigned line, column; - size_t len; + size_t datalen; name = info->name; if (!name) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][c-index-test] factor data len out (PR #129971)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/129971 >From 801d92357366d95bc5bd044125eefc25862b6fee Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Wed, 5 Mar 2025 17:54:48 -0800 Subject: [PATCH 1/3] [NFC][c-index-test] factor data len out --- clang/tools/c-index-test/c-index-test.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 50f32c0a20e5a..1ad2e44aae3f7 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -3554,13 +3554,11 @@ static CXIdxClientContainer makeClientContainer(CXClientData *client_data, clang_indexLoc_getFileLocation(loc, &file, 0, &line, &column, 0); - len = sizeof(IndexDataStringList) + strlen(name) + digitCount(line) + -digitCount(column) + 3; - node = (IndexDataStringList *)malloc(len); + datalen = strlen(name) + digitCount(line) + digitCount(column) + 3; + node = (IndexDataStringList *)malloc(len + sizeof(IndexDataStringList)); assert(node); newStr = node->data; - snprintf(newStr, len - sizeof(IndexDataStringList), "%s:%d:%d", name, line, - column); + snprintf(newStr, datalen, "%s:%d:%d", name, line, column); /* Remember string so it can be freed later. */ index_data = (IndexData *)client_data; >From b0e77d2a6ebe51bf0f35524c9afb337c65881fc9 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Wed, 5 Mar 2025 18:00:25 -0800 Subject: [PATCH 2/3] fix --- clang/tools/c-index-test/c-index-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 1ad2e44aae3f7..d6021036d11ef 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -3546,7 +3546,7 @@ static CXIdxClientContainer makeClientContainer(CXClientData *client_data, char *newStr; CXIdxClientFile file; unsigned line, column; - size_t len; + size_t datalen; name = info->name; if (!name) >From b48ada578b80a48b2b07e4cdaec5eb39fc950ee0 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Wed, 5 Mar 2025 19:30:21 -0800 Subject: [PATCH 3/3] fix --- clang/tools/c-index-test/c-index-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index d6021036d11ef..7711df3fd9209 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -3555,7 +3555,7 @@ static CXIdxClientContainer makeClientContainer(CXClientData *client_data, clang_indexLoc_getFileLocation(loc, &file, 0, &line, &column, 0); datalen = strlen(name) + digitCount(line) + digitCount(column) + 3; - node = (IndexDataStringList *)malloc(len + sizeof(IndexDataStringList)); + node = (IndexDataStringList *)malloc(datalen + sizeof(IndexDataStringList)); assert(node); newStr = node->data; snprintf(newStr, datalen, "%s:%d:%d", name, line, column); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][c-index-test] factor data len out (PR #129971)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/129971 >From 801d92357366d95bc5bd044125eefc25862b6fee Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Wed, 5 Mar 2025 17:54:48 -0800 Subject: [PATCH 1/2] [NFC][c-index-test] factor data len out --- clang/tools/c-index-test/c-index-test.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 50f32c0a20e5a..1ad2e44aae3f7 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -3554,13 +3554,11 @@ static CXIdxClientContainer makeClientContainer(CXClientData *client_data, clang_indexLoc_getFileLocation(loc, &file, 0, &line, &column, 0); - len = sizeof(IndexDataStringList) + strlen(name) + digitCount(line) + -digitCount(column) + 3; - node = (IndexDataStringList *)malloc(len); + datalen = strlen(name) + digitCount(line) + digitCount(column) + 3; + node = (IndexDataStringList *)malloc(len + sizeof(IndexDataStringList)); assert(node); newStr = node->data; - snprintf(newStr, len - sizeof(IndexDataStringList), "%s:%d:%d", name, line, - column); + snprintf(newStr, datalen, "%s:%d:%d", name, line, column); /* Remember string so it can be freed later. */ index_data = (IndexData *)client_data; >From b0e77d2a6ebe51bf0f35524c9afb337c65881fc9 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Wed, 5 Mar 2025 18:00:25 -0800 Subject: [PATCH 2/2] fix --- clang/tools/c-index-test/c-index-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 1ad2e44aae3f7..d6021036d11ef 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -3546,7 +3546,7 @@ static CXIdxClientContainer makeClientContainer(CXClientData *client_data, char *newStr; CXIdxClientFile file; unsigned line, column; - size_t len; + size_t datalen; name = info->name; if (!name) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][c-index-test] factor data len out (PR #129971)
https://github.com/jsji edited https://github.com/llvm/llvm-project/pull/129971 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][c-index-test] factor data len out (PR #129971)
https://github.com/jsji created https://github.com/llvm/llvm-project/pull/129971 None >From 801d92357366d95bc5bd044125eefc25862b6fee Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Wed, 5 Mar 2025 17:54:48 -0800 Subject: [PATCH] [NFC][c-index-test] factor data len out --- clang/tools/c-index-test/c-index-test.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 50f32c0a20e5a..1ad2e44aae3f7 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -3554,13 +3554,11 @@ static CXIdxClientContainer makeClientContainer(CXClientData *client_data, clang_indexLoc_getFileLocation(loc, &file, 0, &line, &column, 0); - len = sizeof(IndexDataStringList) + strlen(name) + digitCount(line) + -digitCount(column) + 3; - node = (IndexDataStringList *)malloc(len); + datalen = strlen(name) + digitCount(line) + digitCount(column) + 3; + node = (IndexDataStringList *)malloc(len + sizeof(IndexDataStringList)); assert(node); newStr = node->data; - snprintf(newStr, len - sizeof(IndexDataStringList), "%s:%d:%d", name, line, - column); + snprintf(newStr, datalen, "%s:%d:%d", name, line, column); /* Remember string so it can be freed later. */ index_data = (IndexData *)client_data; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][c-index-test] factor data len out (PR #129971)
https://github.com/jsji closed https://github.com/llvm/llvm-project/pull/129971 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c-index-test: fix buffer overflow (PR #129922)
@@ -3555,11 +3555,12 @@ static CXIdxClientContainer makeClientContainer(CXClientData *client_data, clang_indexLoc_getFileLocation(loc, &file, 0, &line, &column, 0); len = sizeof(IndexDataStringList) + strlen(name) + digitCount(line) + -digitCount(column) + 2; +digitCount(column) + 3; node = (IndexDataStringList *)malloc(len); assert(node); newStr = node->data; - snprintf(newStr, len, "%s:%d:%d", name, line, column); + snprintf(newStr, len - sizeof(IndexDataStringList), "%s:%d:%d", name, line, jsji wrote: Will follow up. Thanks. https://github.com/llvm/llvm-project/pull/129922 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c-index-test: fix buffer overflow (PR #129922)
https://github.com/jsji closed https://github.com/llvm/llvm-project/pull/129922 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c-index-test: fix buffer overflow (PR #129922)
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/129922 >From 7d8157357b4b9ba1462e0b4d0fafa7650d7f6b40 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Wed, 5 Mar 2025 11:49:19 -0800 Subject: [PATCH 1/2] c-index-test: fix buffer overflow --- clang/tools/c-index-test/c-index-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 942500f2975e4..eb1d3de09acd0 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -3555,11 +3555,11 @@ static CXIdxClientContainer makeClientContainer(CXClientData *client_data, clang_indexLoc_getFileLocation(loc, &file, 0, &line, &column, 0); len = sizeof(IndexDataStringList) + strlen(name) + digitCount(line) + -digitCount(column) + 2; +digitCount(column) + 3; node = (IndexDataStringList *)malloc(len); assert(node); newStr = node->data; - snprintf(newStr, len, "%s:%d:%d", name, line, column); + snprintf(newStr, len - sizeof(IndexDataStringList) , "%s:%d:%d", name, line, column); /* Remember string so it can be freed later. */ index_data = (IndexData *)client_data; >From 113bb5a51708bdee06b8c6e1d09f743141c637b1 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Wed, 5 Mar 2025 12:12:39 -0800 Subject: [PATCH 2/2] clangformat --- clang/tools/c-index-test/c-index-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index eb1d3de09acd0..50f32c0a20e5a 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -3559,7 +3559,8 @@ static CXIdxClientContainer makeClientContainer(CXClientData *client_data, node = (IndexDataStringList *)malloc(len); assert(node); newStr = node->data; - snprintf(newStr, len - sizeof(IndexDataStringList) , "%s:%d:%d", name, line, column); + snprintf(newStr, len - sizeof(IndexDataStringList), "%s:%d:%d", name, line, + column); /* Remember string so it can be freed later. */ index_data = (IndexData *)client_data; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c-index-test: fix buffer overflow (PR #129922)
https://github.com/jsji created https://github.com/llvm/llvm-project/pull/129922 None >From 7d8157357b4b9ba1462e0b4d0fafa7650d7f6b40 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Wed, 5 Mar 2025 11:49:19 -0800 Subject: [PATCH] c-index-test: fix buffer overflow --- clang/tools/c-index-test/c-index-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 942500f2975e4..eb1d3de09acd0 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -3555,11 +3555,11 @@ static CXIdxClientContainer makeClientContainer(CXClientData *client_data, clang_indexLoc_getFileLocation(loc, &file, 0, &line, &column, 0); len = sizeof(IndexDataStringList) + strlen(name) + digitCount(line) + -digitCount(column) + 2; +digitCount(column) + 3; node = (IndexDataStringList *)malloc(len); assert(node); newStr = node->data; - snprintf(newStr, len, "%s:%d:%d", name, line, column); + snprintf(newStr, len - sizeof(IndexDataStringList) , "%s:%d:%d", name, line, column); /* Remember string so it can be freed later. */ index_data = (IndexData *)client_data; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c-index-test: fix buffer overflow (PR #129922)
https://github.com/jsji edited https://github.com/llvm/llvm-project/pull/129922 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Clang] Don't check hardcode op num (PR #135375)
https://github.com/jsji closed https://github.com/llvm/llvm-project/pull/135375 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [SPIR-V] Only emit __spirv__ when targeting HLSL (PR #142401)
https://github.com/jsji approved this pull request. LGTM. Thanks for prompt fixing. https://github.com/llvm/llvm-project/pull/142401 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [SPIR-V] Only emit __spirv__ when targeting HLSL (PR #142401)
https://github.com/jsji closed https://github.com/llvm/llvm-project/pull/142401 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits