[clang] d285e54 - Delete old broken lit runner

2024-04-25 Thread Luke Drummond via cfe-commits

Author: Luke Drummond
Date: 2024-04-25T16:06:34+01:00
New Revision: d285e54320e9bc42ea91b28a59a831c58627217a

URL: 
https://github.com/llvm/llvm-project/commit/d285e54320e9bc42ea91b28a59a831c58627217a
DIFF: 
https://github.com/llvm/llvm-project/commit/d285e54320e9bc42ea91b28a59a831c58627217a.diff

LOG: Delete old broken lit runner

Last updated before the monorepo was created, this lit wrapper can no
longer work. Since it's been broken for so long, I don't think anyone's
going to miss it.

Added: 


Modified: 


Removed: 
clang/test/TestRunner.sh



diff  --git a/clang/test/TestRunner.sh b/clang/test/TestRunner.sh
deleted file mode 100755
index f96d3d552d2ee6..00
--- a/clang/test/TestRunner.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-#
-# TestRunner.sh - Backward compatible utility for testing an individual file.
-
-# Find where this script is.
-Dir=$(dirname $(which $0))
-AbsDir=$(cd $Dir; pwd)
-
-# Find 'lit', assuming standard layout.
-lit=$AbsDir/../../../utils/lit/lit.py
-
-# Dispatch to lit.
-$lit "$@"



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 2921a09 - Make the argument -Xcuda-ptxas visible to the driver in cl-mode

2024-04-08 Thread Luke Drummond via cfe-commits

Author: Jefferson Le Quellec
Date: 2024-04-08T14:11:43+01:00
New Revision: 2921a0928c71f4ee652a2478283e47ab5ffebf58

URL: 
https://github.com/llvm/llvm-project/commit/2921a0928c71f4ee652a2478283e47ab5ffebf58
DIFF: 
https://github.com/llvm/llvm-project/commit/2921a0928c71f4ee652a2478283e47ab5ffebf58.diff

LOG: Make the argument -Xcuda-ptxas visible to the driver in cl-mode

It has been noticed that the arguments are being passed twice to ptxas.
This also has been fixed by filtering out the arguments before appending
them to the new DAL created by CudaToolChain::TranslateArgs.

github:https://github.com/llvm/llvm-project/pull/86807

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Cuda.cpp
clang/test/Driver/cuda-external-tools.cu

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 827d9d7c0c18e4..f745e573eb2686 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1003,7 +1003,8 @@ def : Joined<["-"], "Xclang=">, Group,
 def Xcuda_fatbinary : Separate<["-"], "Xcuda-fatbinary">,
   HelpText<"Pass  to fatbinary invocation">, MetaVarName<"">;
 def Xcuda_ptxas : Separate<["-"], "Xcuda-ptxas">,
-  HelpText<"Pass  to the ptxas assembler">, MetaVarName<"">;
+  HelpText<"Pass  to the ptxas assembler">, MetaVarName<"">,
+  Visibility<[ClangOption, CLOption]>;
 def Xopenmp_target : Separate<["-"], "Xopenmp-target">, 
Group,
   HelpText<"Pass  to the target offloading toolchain.">, 
MetaVarName<"">;
 def Xopenmp_target_EQ : JoinedAndSeparate<["-"], "Xopenmp-target=">, 
Group,

diff  --git a/clang/lib/Driver/ToolChains/Cuda.cpp 
b/clang/lib/Driver/ToolChains/Cuda.cpp
index 5f0b516e1a1a08..6634e6d818b33e 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -990,7 +990,10 @@ CudaToolChain::TranslateArgs(const 
llvm::opt::DerivedArgList ,
   }
 
   for (Arg *A : Args) {
-DAL->append(A);
+// Make sure flags are not duplicated.
+if (!llvm::is_contained(*DAL, A)) {
+  DAL->append(A);
+}
   }
 
   if (!BoundArch.empty()) {

diff  --git a/clang/test/Driver/cuda-external-tools.cu 
b/clang/test/Driver/cuda-external-tools.cu
index 946e144fce38fb..d9564d026b4faa 100644
--- a/clang/test/Driver/cuda-external-tools.cu
+++ b/clang/test/Driver/cuda-external-tools.cu
@@ -86,6 +86,12 @@
 // RUN:   -Xcuda-fatbinary -bar1 -Xcuda-ptxas -foo2 -Xcuda-fatbinary -bar2 %s 
2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,SM35,PTXAS-EXTRA,FATBINARY-EXTRA %s
 
+// Check -Xcuda-ptxas with clang-cl
+// RUN: %clang_cl -### -c -Xcuda-ptxas -foo1 \
+// RUN:   --offload-arch=sm_35 --cuda-path=%S/Inputs/CUDA/usr/local/cuda \
+// RUN:   -Xcuda-ptxas -foo2 %s 2>&1 \
+// RUN: | FileCheck -check-prefixes=CHECK,SM35,PTXAS-EXTRA %s
+
 // MacOS spot-checks
 // RUN: %clang -### --target=x86_64-apple-macosx -O0 -c %s 2>&1 \
 // RUN:   --offload-arch=sm_35 --cuda-path=%S/Inputs/CUDA/usr/local/cuda \
@@ -140,6 +146,8 @@
 // CHECK-SAME: "[[PTXFILE]]"
 // PTXAS-EXTRA-SAME: "-foo1"
 // PTXAS-EXTRA-SAME: "-foo2"
+// CHECK-NOT: "-foo1"
+// CHECK-NOT: "-foo2"
 // RDC-SAME: "-c"
 // CHECK-NOT: "-c"
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] b781c7a - Fixed some wmma store builtins that had non-const src param

2023-10-19 Thread Luke Drummond via cfe-commits

Author: JackAKirk
Date: 2023-10-19T15:38:50+01:00
New Revision: b781c7ab574f54f54e1b32421398c723f3690f05

URL: 
https://github.com/llvm/llvm-project/commit/b781c7ab574f54f54e1b32421398c723f3690f05
DIFF: 
https://github.com/llvm/llvm-project/commit/b781c7ab574f54f54e1b32421398c723f3690f05.diff

LOG: Fixed some wmma store builtins that had non-const src param

Now all wmma store builtins have src param marked const.

Reviewers: Tra

Added: 


Modified: 
clang/include/clang/Basic/BuiltinsNVPTX.def

Removed: 




diff  --git a/clang/include/clang/Basic/BuiltinsNVPTX.def 
b/clang/include/clang/Basic/BuiltinsNVPTX.def
index f645ad25cbd86da..d74a7d1e55dd281 100644
--- a/clang/include/clang/Basic/BuiltinsNVPTX.def
+++ b/clang/include/clang/Basic/BuiltinsNVPTX.def
@@ -920,22 +920,22 @@ TARGET_BUILTIN(__hmma_m16n16k16_ld_a, "vi*iC*UiIi", "", 
AND(SM_70,PTX60))
 TARGET_BUILTIN(__hmma_m16n16k16_ld_b, "vi*iC*UiIi", "", AND(SM_70,PTX60))
 TARGET_BUILTIN(__hmma_m16n16k16_ld_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX60))
 TARGET_BUILTIN(__hmma_m16n16k16_ld_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX60))
-TARGET_BUILTIN(__hmma_m16n16k16_st_c_f16, "vi*i*UiIi", "", AND(SM_70,PTX60))
-TARGET_BUILTIN(__hmma_m16n16k16_st_c_f32, "vf*f*UiIi", "", AND(SM_70,PTX60))
+TARGET_BUILTIN(__hmma_m16n16k16_st_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX60))
+TARGET_BUILTIN(__hmma_m16n16k16_st_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX60))
 
 TARGET_BUILTIN(__hmma_m32n8k16_ld_a, "vi*iC*UiIi", "", AND(SM_70,PTX61))
 TARGET_BUILTIN(__hmma_m32n8k16_ld_b, "vi*iC*UiIi", "", AND(SM_70,PTX61))
 TARGET_BUILTIN(__hmma_m32n8k16_ld_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX61))
 TARGET_BUILTIN(__hmma_m32n8k16_ld_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX61))
-TARGET_BUILTIN(__hmma_m32n8k16_st_c_f16, "vi*i*UiIi", "", AND(SM_70,PTX61))
-TARGET_BUILTIN(__hmma_m32n8k16_st_c_f32, "vf*f*UiIi", "", AND(SM_70,PTX61))
+TARGET_BUILTIN(__hmma_m32n8k16_st_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX61))
+TARGET_BUILTIN(__hmma_m32n8k16_st_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX61))
 
 TARGET_BUILTIN(__hmma_m8n32k16_ld_a, "vi*iC*UiIi", "", AND(SM_70,PTX61))
 TARGET_BUILTIN(__hmma_m8n32k16_ld_b, "vi*iC*UiIi", "", AND(SM_70,PTX61))
 TARGET_BUILTIN(__hmma_m8n32k16_ld_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX61))
 TARGET_BUILTIN(__hmma_m8n32k16_ld_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX61))
-TARGET_BUILTIN(__hmma_m8n32k16_st_c_f16, "vi*i*UiIi", "", AND(SM_70,PTX61))
-TARGET_BUILTIN(__hmma_m8n32k16_st_c_f32, "vf*f*UiIi", "", AND(SM_70,PTX61))
+TARGET_BUILTIN(__hmma_m8n32k16_st_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX61))
+TARGET_BUILTIN(__hmma_m8n32k16_st_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX61))
 
 TARGET_BUILTIN(__hmma_m16n16k16_mma_f16f16, "vi*iC*iC*iC*IiIi", "", 
AND(SM_70,PTX60))
 TARGET_BUILTIN(__hmma_m16n16k16_mma_f32f16, "vf*iC*iC*iC*IiIi", "", 
AND(SM_70,PTX60))



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] e3fbede - [HIP] Add missing __hip_atomic_fetch_sub support

2023-05-30 Thread Luke Drummond via cfe-commits

Author: Luke Drummond
Date: 2023-05-30T22:22:43+01:00
New Revision: e3fbede7f3fd7693d5a15a8cfa0b62d9a4f84877

URL: 
https://github.com/llvm/llvm-project/commit/e3fbede7f3fd7693d5a15a8cfa0b62d9a4f84877
DIFF: 
https://github.com/llvm/llvm-project/commit/e3fbede7f3fd7693d5a15a8cfa0b62d9a4f84877.diff

LOG: [HIP] Add missing __hip_atomic_fetch_sub support

The rest of the fetch/op intrinsics were added in e13246a2ec3 but sub
was conspicuous by its absence.

Reviewed By: yaxunl

Differential Revision: https://reviews.llvm.org/D151701

Added: 


Modified: 
clang/include/clang/Basic/Builtins.def
clang/lib/AST/Expr.cpp
clang/lib/CodeGen/CGAtomic.cpp
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGenCUDA/atomic-ops.cu

Removed: 




diff  --git a/clang/include/clang/Basic/Builtins.def 
b/clang/include/clang/Basic/Builtins.def
index 15c69c2786476..e8cd200257c2a 100644
--- a/clang/include/clang/Basic/Builtins.def
+++ b/clang/include/clang/Basic/Builtins.def
@@ -910,6 +910,7 @@ ATOMIC_BUILTIN(__hip_atomic_compare_exchange_weak, "v.", 
"t")
 ATOMIC_BUILTIN(__hip_atomic_compare_exchange_strong, "v.", "t")
 ATOMIC_BUILTIN(__hip_atomic_exchange, "v.", "t")
 ATOMIC_BUILTIN(__hip_atomic_fetch_add, "v.", "t")
+ATOMIC_BUILTIN(__hip_atomic_fetch_sub, "v.", "t")
 ATOMIC_BUILTIN(__hip_atomic_fetch_and, "v.", "t")
 ATOMIC_BUILTIN(__hip_atomic_fetch_or, "v.", "t")
 ATOMIC_BUILTIN(__hip_atomic_fetch_xor, "v.", "t")

diff  --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 958f4e9042319..c3c00932cee4e 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -4857,6 +4857,7 @@ unsigned AtomicExpr::getNumSubExprs(AtomicOp Op) {
 
   case AO__hip_atomic_exchange:
   case AO__hip_atomic_fetch_add:
+  case AO__hip_atomic_fetch_sub:
   case AO__hip_atomic_fetch_and:
   case AO__hip_atomic_fetch_or:
   case AO__hip_atomic_fetch_xor:

diff  --git a/clang/lib/CodeGen/CGAtomic.cpp b/clang/lib/CodeGen/CGAtomic.cpp
index 8ef95bb808468..0e7eb9723b49e 100644
--- a/clang/lib/CodeGen/CGAtomic.cpp
+++ b/clang/lib/CodeGen/CGAtomic.cpp
@@ -623,6 +623,7 @@ static void EmitAtomicOp(CodeGenFunction , AtomicExpr 
*E, Address Dest,
  : llvm::Instruction::Sub;
 [[fallthrough]];
   case AtomicExpr::AO__c11_atomic_fetch_sub:
+  case AtomicExpr::AO__hip_atomic_fetch_sub:
   case AtomicExpr::AO__opencl_atomic_fetch_sub:
   case AtomicExpr::AO__atomic_fetch_sub:
 Op = E->getValueType()->isFloatingType() ? llvm::AtomicRMWInst::FSub
@@ -897,6 +898,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
   case AtomicExpr::AO__c11_atomic_fetch_add:
   case AtomicExpr::AO__c11_atomic_fetch_sub:
   case AtomicExpr::AO__hip_atomic_fetch_add:
+  case AtomicExpr::AO__hip_atomic_fetch_sub:
   case AtomicExpr::AO__opencl_atomic_fetch_add:
   case AtomicExpr::AO__opencl_atomic_fetch_sub:
 if (MemTy->isPointerType()) {
@@ -1013,6 +1015,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
 case AtomicExpr::AO__c11_atomic_fetch_sub:
 case AtomicExpr::AO__opencl_atomic_fetch_sub:
 case AtomicExpr::AO__atomic_fetch_sub:
+case AtomicExpr::AO__hip_atomic_fetch_sub:
 case AtomicExpr::AO__c11_atomic_fetch_xor:
 case AtomicExpr::AO__opencl_atomic_fetch_xor:
 case AtomicExpr::AO__opencl_atomic_fetch_min:
@@ -1218,6 +1221,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
   [[fallthrough]];
 case AtomicExpr::AO__c11_atomic_fetch_sub:
 case AtomicExpr::AO__opencl_atomic_fetch_sub:
+case AtomicExpr::AO__hip_atomic_fetch_sub:
 case AtomicExpr::AO__atomic_fetch_sub:
   LibCallName = "__atomic_fetch_sub";
   AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),

diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index d94e1d0beeaef..c8ebd51a4b3ef 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6438,6 +6438,7 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, 
SourceRange ExprRange,
 Form = Copy;
 break;
   case AtomicExpr::AO__hip_atomic_fetch_add:
+  case AtomicExpr::AO__hip_atomic_fetch_sub:
   case AtomicExpr::AO__hip_atomic_fetch_min:
   case AtomicExpr::AO__hip_atomic_fetch_max:
   case AtomicExpr::AO__c11_atomic_fetch_add:

diff  --git a/clang/test/CodeGenCUDA/atomic-ops.cu 
b/clang/test/CodeGenCUDA/atomic-ops.cu
index 13f4a015386cb..fbc042caa809f 100644
--- a/clang/test/CodeGenCUDA/atomic-ops.cu
+++ b/clang/test/CodeGenCUDA/atomic-ops.cu
@@ -6,6 +6,7 @@
 // CHECK: cmpxchg weak ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} 
syncscope("singlethread-one-as") monotonic monotonic, align 4
 // CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}} 
syncscope("singlethread-one-as")
 // CHECK: atomicrmw add ptr {{%[0-9]+}}, i32 {{%[0-9]+}} 
syncscope("singlethread-one-as")
+// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i32 

[clang] 108766f - Fix typos

2023-01-05 Thread Luke Drummond via cfe-commits

Author: Luke Drummond
Date: 2023-01-05T18:49:23Z
New Revision: 108766fc7ef83724ff4f66235bd561b217df0ff7

URL: 
https://github.com/llvm/llvm-project/commit/108766fc7ef83724ff4f66235bd561b217df0ff7
DIFF: 
https://github.com/llvm/llvm-project/commit/108766fc7ef83724ff4f66235bd561b217df0ff7.diff

LOG: Fix typos

I found one typo of "implemnt", then some more.
s/implemnt/implement/g

Added: 


Modified: 
clang/lib/CodeGen/CGBuiltin.cpp
llvm/lib/CodeGen/MIRParser/MIParser.cpp
llvm/lib/MC/MCWin64EH.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h
llvm/test/CodeGen/PowerPC/aix-alias.ll

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index b1e8517460ce8..0afa25da7aee3 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -7999,7 +7999,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned 
BuiltinID,
 Value *Arg0 = EmitScalarExpr(E->getArg(0));
 Value *Arg1 = EmitScalarExpr(E->getArg(1));
 
-// crc32{c,}d intrinsics are implemnted as two calls to crc32{c,}w
+// crc32{c,}d intrinsics are implemented as two calls to crc32{c,}w
 // intrinsics, hence we need 
diff erent codegen for these cases.
 if (BuiltinID == clang::ARM::BI__builtin_arm_crc32d ||
 BuiltinID == clang::ARM::BI__builtin_arm_crc32cd) {

diff  --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp 
b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index 56c5c58142388..8b27edee45fe5 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -1847,7 +1847,7 @@ bool MIParser::parseIRConstant(StringRef::iterator Loc, 
const Constant *) {
   return false;
 }
 
-// See LLT implemntation for bit size limits.
+// See LLT implementation for bit size limits.
 static bool verifyScalarSize(uint64_t Size) {
   return Size != 0 && isUInt<16>(Size);
 }

diff  --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp
index 4b20959ee5d6c..1a55722133ccd 100644
--- a/llvm/lib/MC/MCWin64EH.cpp
+++ b/llvm/lib/MC/MCWin64EH.cpp
@@ -1282,9 +1282,9 @@ static void ARM64EmitUnwindInfoForSegment(MCStreamer 
,
 // FIXME: We should be able to split unwind info into multiple sections.
 if (CodeWords > 0xFF || EpilogCount > 0x)
   report_fatal_error(
-  "SEH unwind data splitting is only implemnted for large functions, "
-  "cases of too many code words or too many epilogs will be done later"
-  );
+  "SEH unwind data splitting is only implemented for large functions, "
+  "cases of too many code words or too many epilogs will be done "
+  "later");
 uint32_t row2 = 0x0;
 row2 |= (CodeWords & 0xFF) << 16;
 row2 |= (EpilogCount & 0x);

diff  --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h 
b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h
index acb03f349e863..b3bce9960772e 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h
@@ -30,7 +30,7 @@ class AArch64TargetStreamer : public MCTargetStreamer {
   /// MCExpr that can be used to refer to the constant pool location.
   const MCExpr *addConstantPoolEntry(const MCExpr *, unsigned Size, SMLoc Loc);
 
-  /// Callback used to implemnt the .ltorg directive.
+  /// Callback used to implement the .ltorg directive.
   /// Emit contents of constant pool for the current section.
   void emitCurrentConstantPool();
 

diff  --git a/llvm/test/CodeGen/PowerPC/aix-alias.ll 
b/llvm/test/CodeGen/PowerPC/aix-alias.ll
index a3f6d87ca85ff..0ec2118beb7aa 100644
--- a/llvm/test/CodeGen/PowerPC/aix-alias.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-alias.ll
@@ -1,5 +1,5 @@
 ; TODO: Add object generation test when visibility for object generation
-;   is implemnted.
+;   is implemented.
 
 ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
 ; RUN: -mattr=-altivec -data-sections=false -xcoff-traceback-table=false < 
%s | \



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 8f4e6cf - [clang-format] Use utf-8 for JSON object load

2022-09-05 Thread Luke Drummond via cfe-commits

Author: Amy Wang
Date: 2022-09-05T15:40:47+01:00
New Revision: 8f4e6cfe73d803697470e817845d9b94c4530ca3

URL: 
https://github.com/llvm/llvm-project/commit/8f4e6cfe73d803697470e817845d9b94c4530ca3
DIFF: 
https://github.com/llvm/llvm-project/commit/8f4e6cfe73d803697470e817845d9b94c4530ca3.diff

LOG: [clang-format] Use utf-8 for JSON object load

>From Python 3.6 and above, it should be able to automatically select a
decoding for json.loads. However, with a vim encoding that defaults
to utf-8, clang-format.py runs into the following error

TypeError: the JSON object must be str, not 'bytes'

This patch explicitly specifies utf-8 decoding for the header.

Reviewed by: ldrumm, sammcall

Differential Revision: https://reviews.llvm.org/D133236

Added: 


Modified: 
clang/tools/clang-format/clang-format.py

Removed: 




diff  --git a/clang/tools/clang-format/clang-format.py 
b/clang/tools/clang-format/clang-format.py
index 76fedb6481474..5bc108bfc713b 100644
--- a/clang/tools/clang-format/clang-format.py
+++ b/clang/tools/clang-format/clang-format.py
@@ -10,9 +10,9 @@
 # imap  :py3f /clang-format.py
 #   endif
 #
-# The if-elseif-endif conditional should pick either the python3 or python2 
+# The if-elseif-endif conditional should pick either the python3 or python2
 # integration depending on your vim setup.
-# 
+#
 # The first mapping enables clang-format for NORMAL and VISUAL mode, the second
 # mapping adds support for INSERT mode. Change "C-I" to another binding if you
 # need clang-format on a 
diff erent key (C-I stands for Ctrl+i).
@@ -134,7 +134,7 @@ def main():
 )
   else:
 header, content = stdout.split(b'\n', 1)
-header = json.loads(header)
+header = json.loads(header.decode('utf-8'))
 # Strip off the trailing newline (added above).
 # This maintains trailing empty lines present in the buffer if
 # the -lines specification requests them to remain unchanged.



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6283d46 - Workaround build error for mingw-g++

2021-10-07 Thread Luke Drummond via cfe-commits

Author: Luke Drummond
Date: 2021-10-07T18:34:16+01:00
New Revision: 6283d468e28b35e2731dda1a9e0efcb3d9acf557

URL: 
https://github.com/llvm/llvm-project/commit/6283d468e28b35e2731dda1a9e0efcb3d9acf557
DIFF: 
https://github.com/llvm/llvm-project/commit/6283d468e28b35e2731dda1a9e0efcb3d9acf557.diff

LOG: Workaround build error for mingw-g++

mingw-g++ does not correctly support the full `std::errc` namespace as
worded in the standard[1]. As such, we cannot reliably use all names
therein. This patch changes the use of
`std::errc::state_not_recoverable`, to use portable error codes from the
`llvm::errc` equivalent.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71444

Reviewed by v.g.vassilev
Differential Revision: https://reviews.llvm.org/D111315

Added: 


Modified: 
clang/lib/Interpreter/Interpreter.cpp

Removed: 




diff  --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 3e8d3884049ba..28c6c4f4e80f8 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -30,6 +30,7 @@
 #include "clang/Lex/PreprocessorOptions.h"
 
 #include "llvm/IR/Module.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/Host.h"
 
 using namespace clang;
@@ -47,14 +48,14 @@ GetCC1Arguments(DiagnosticsEngine *Diagnostics,
   // failed. Extract that job from the Compilation.
   const driver::JobList  = Compilation->getJobs();
   if (!Jobs.size() || !isa(*Jobs.begin()))
-return llvm::createStringError(std::errc::state_not_recoverable,
+return llvm::createStringError(llvm::errc::not_supported,
"Driver initialization failed. "
"Unable to create a driver job");
 
   // The one job we find should be to invoke clang again.
   const driver::Command *Cmd = cast(&(*Jobs.begin()));
   if (llvm::StringRef(Cmd->getCreator().getName()) != "clang")
-return llvm::createStringError(std::errc::state_not_recoverable,
+return llvm::createStringError(llvm::errc::not_supported,
"Driver initialization failed");
 
   return >getArguments();
@@ -89,13 +90,13 @@ CreateCI(const llvm::opt::ArgStringList ) {
   // Create the actual diagnostics engine.
   Clang->createDiagnostics();
   if (!Clang->hasDiagnostics())
-return llvm::createStringError(std::errc::state_not_recoverable,
+return llvm::createStringError(llvm::errc::not_supported,
"Initialization failed. "
"Unable to create diagnostics engine");
 
   DiagsBuffer->FlushDiagnostics(Clang->getDiagnostics());
   if (!Success)
-return llvm::createStringError(std::errc::state_not_recoverable,
+return llvm::createStringError(llvm::errc::not_supported,
"Initialization failed. "
"Unable to flush diagnostics");
 
@@ -106,7 +107,7 @@ CreateCI(const llvm::opt::ArgStringList ) {
   Clang->setTarget(TargetInfo::CreateTargetInfo(
   Clang->getDiagnostics(), Clang->getInvocation().TargetOpts));
   if (!Clang->hasTarget())
-return llvm::createStringError(std::errc::state_not_recoverable,
+return llvm::createStringError(llvm::errc::not_supported,
"Initialization failed. "
"Target is missing");
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 440f6bd - [OpenCL][NFCI] Prefer CodeGenFunction::EmitRuntimeCall

2021-03-16 Thread Luke Drummond via cfe-commits

Author: Luke Drummond
Date: 2021-03-16T16:22:19Z
New Revision: 440f6bdf34f4ce3ac3435d650f5296dcc0102488

URL: 
https://github.com/llvm/llvm-project/commit/440f6bdf34f4ce3ac3435d650f5296dcc0102488
DIFF: 
https://github.com/llvm/llvm-project/commit/440f6bdf34f4ce3ac3435d650f5296dcc0102488.diff

LOG: [OpenCL][NFCI] Prefer CodeGenFunction::EmitRuntimeCall

`CodeGenFunction::EmitRuntimeCall` automatically sets the right calling
convention for the callee so we can avoid setting it ourselves.

As requested in https://reviews.llvm.org/D98411

Reviewed by: anastasia
Differential Revision: https://reviews.llvm.org/D98705

Added: 


Modified: 
clang/lib/CodeGen/CodeGenModule.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index 75854f69b110..f3a73f8783dc 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -6265,9 +6265,8 @@ CodeGenModule::createOpenCLIntToSamplerConversion(const 
Expr *E,
   llvm::Constant *C = ConstantEmitter(CGF).emitAbstract(E, E->getType());
   auto *SamplerT = 
getOpenCLRuntime().getSamplerType(E->getType().getTypePtr());
   auto *FTy = llvm::FunctionType::get(SamplerT, {C->getType()}, false);
-  auto *Call = CGF.Builder.CreateCall(
+  auto *Call = CGF.EmitRuntimeCall(
   CreateRuntimeFunction(FTy, "__translate_sampler_initializer"), {C});
-  Call->setCallingConv(Call->getCalledFunction()->getCallingConv());
   return Call;
 }
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r280240 - [clang-format-vim] Support vim linked against py3

2016-08-31 Thread Luke Drummond via cfe-commits
Author: ldrumm
Date: Wed Aug 31 08:36:36 2016
New Revision: 280240

URL: http://llvm.org/viewvc/llvm-project?rev=280240=rev
Log:
[clang-format-vim] Support vim linked against py3

clang-format.py previously only worked in vim compiled against python2.

This patch adds the necessary syntax changes to make this work with vim
linked against python3, which is now shipped by default for at least Ubuntu16 
and Arch.

Differential Revision: https://reviews.llvm.org/D23319

Subscribers: cfe-commits

Modified:
cfe/trunk/tools/clang-format/clang-format.py

Modified: cfe/trunk/tools/clang-format/clang-format.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/clang-format.py?rev=280240=280239=280240=diff
==
--- cfe/trunk/tools/clang-format/clang-format.py (original)
+++ cfe/trunk/tools/clang-format/clang-format.py Wed Aug 31 08:36:36 2016
@@ -25,6 +25,7 @@
 #
 # It operates on the current, potentially unsaved buffer and does not create
 # or save any files. To revert a formatting, just undo.
+from __future__ import print_function
 
 import difflib
 import json
@@ -49,6 +50,7 @@ if vim.eval('exists("g:clang_format_fall
 
 def main():
   # Get the current text.
+  encoding = vim.eval("")
   buf = vim.current.buffer
   text = '\n'.join(buf)
 
@@ -61,7 +63,7 @@ def main():
   # Determine the cursor position.
   cursor = int(vim.eval('line2byte(line("."))+col(".")')) - 2
   if cursor < 0:
-print 'Couldn\'t determine cursor position. Is your file empty?'
+print('Couldn\'t determine cursor position. Is your file empty?')
 return
 
   # Avoid flashing an ugly, ugly cmd prompt on Windows when invoking 
clang-format.
@@ -82,17 +84,19 @@ def main():
   p = subprocess.Popen(command,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
stdin=subprocess.PIPE, startupinfo=startupinfo)
-  stdout, stderr = p.communicate(input=text)
+  stdout, stderr = p.communicate(input=text.encode(encoding))
 
   # If successful, replace buffer contents.
   if stderr:
-print stderr
+print(stderr)
 
   if not stdout:
-print ('No output from clang-format (crashed?).\n' +
-'Please report to bugs.llvm.org.')
+print(
+'No output from clang-format (crashed?).\n'
+'Please report to bugs.llvm.org.'
+)
   else:
-lines = stdout.split('\n')
+lines = stdout.decode(encoding).split('\n')
 output = json.loads(lines[0])
 lines = lines[1:]
 sequence = difflib.SequenceMatcher(None, vim.current.buffer, lines)
@@ -100,7 +104,7 @@ def main():
   if op[0] is not 'equal':
 vim.current.buffer[op[1]:op[2]] = lines[op[3]:op[4]]
 if output.get('IncompleteFormat'):
-  print 'clang-format: incomplete (syntax errors)'
+  print('clang-format: incomplete (syntax errors)')
 vim.command('goto %d' % (output['Cursor'] + 1))
 
 main()


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits