[PATCH] D109260: [RISCV] Add SiFive cores E and S series

2021-09-03 Thread Alexander Pivovarov via Phabricator via cfe-commits
apivovarov updated this revision to Diff 370692.
apivovarov added a comment.

fix double space issue. Fri...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109260/new/

https://reviews.llvm.org/D109260

Files:
  clang/docs/ReleaseNotes.rst
  clang/test/Driver/riscv-cpus.c
  clang/test/Misc/target-invalid-cpu-note.c
  llvm/include/llvm/Support/RISCVTargetParser.def
  llvm/lib/Target/RISCV/RISCV.td

Index: llvm/lib/Target/RISCV/RISCV.td
===
--- llvm/lib/Target/RISCV/RISCV.td
+++ llvm/lib/Target/RISCV/RISCV.td
@@ -250,27 +250,63 @@
 def : ProcessorModel<"sifive-7-rv32", SiFive7Model, []>;
 def : ProcessorModel<"sifive-7-rv64", SiFive7Model, [Feature64Bit]>;
 
+def : ProcessorModel<"sifive-e20", RocketModel, [FeatureStdExtM,
+ FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-e21", RocketModel, [FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-e24", RocketModel, [FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtF,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-e31", RocketModel, [FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtC]>;
 
+def : ProcessorModel<"sifive-e34", RocketModel, [FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtF,
+ FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-e76", SiFive7Model, [FeatureStdExtM,
+  FeatureStdExtA,
+  FeatureStdExtF,
+  FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-s21", RocketModel, [Feature64Bit,
+ FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-s51", RocketModel, [Feature64Bit,
  FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtC]>;
 
-def : ProcessorModel<"sifive-u54", RocketModel, [Feature64Bit,
+def : ProcessorModel<"sifive-s54", RocketModel, [Feature64Bit,
  FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtF,
  FeatureStdExtD,
  FeatureStdExtC]>;
 
-def : ProcessorModel<"sifive-e76", SiFive7Model, [FeatureStdExtM,
+def : ProcessorModel<"sifive-s76", SiFive7Model, [Feature64Bit,
+  FeatureStdExtM,
   FeatureStdExtA,
   FeatureStdExtF,
+  FeatureStdExtD,
   FeatureStdExtC]>;
 
+def : ProcessorModel<"sifive-u54", RocketModel, [Feature64Bit,
+ FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtF,
+ FeatureStdExtD,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-u74", SiFive7Model, [Feature64Bit,
   FeatureStdExtM,
   FeatureStdExtA,
Index: llvm/include/llvm/Support/RISCVTargetParser.def
===
--- llvm/include/llvm/Support/RISCVTargetParser.def
+++ llvm/include/llvm/Support/RISCVTargetParser.def
@@ -19,10 +19,17 @@
 PROC(ROCKET_RV64, {"rocket-rv64"}, FK_64BIT, {""})
 PROC(SIFIVE_732, {"sifive-7-rv32"}, FK_NONE, {""})
 PROC(SIFIVE_764, {"sifive-7-rv64"}, FK_64BIT, {""})
+PROC(SIFIVE_E20, {"sifive-e20"}, FK_NONE, {"rv32imc"})
+PROC(SIFIVE_E21, {"sifive-e21"}, FK_NONE, {"rv32imac"})
+PROC(SIFIVE_E24, {"sifive-e24"}, FK_NONE, {"rv32imafc"})
 PROC(SIFIVE_E31, {"sifive-e31"}, FK_NONE, {"rv32imac"})
+PROC(SIFIVE_E34, {"sifive-e34"}, FK_NONE, {"rv32imafc"})
+PROC(SIFIVE_E76, {"sifive-e76"}, FK_NONE, {"rv32imafc"})
+PROC(SIFIVE_S21, {"sifive-s21"}, FK_64BIT, {"rv64imac"})
 

[PATCH] D109260: [RISCV] Add SiFive cores E and S series

2021-09-03 Thread Alexander Pivovarov via Phabricator via cfe-commits
apivovarov updated this revision to Diff 370691.
apivovarov marked an inline comment as done.
apivovarov added a comment.

main branch is unstable. pulling the hot fixes again


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109260/new/

https://reviews.llvm.org/D109260

Files:
  clang/docs/ReleaseNotes.rst
  clang/test/Driver/riscv-cpus.c
  clang/test/Misc/target-invalid-cpu-note.c
  llvm/include/llvm/Support/RISCVTargetParser.def
  llvm/lib/Target/RISCV/RISCV.td

Index: llvm/lib/Target/RISCV/RISCV.td
===
--- llvm/lib/Target/RISCV/RISCV.td
+++ llvm/lib/Target/RISCV/RISCV.td
@@ -250,27 +250,63 @@
 def : ProcessorModel<"sifive-7-rv32", SiFive7Model, []>;
 def : ProcessorModel<"sifive-7-rv64", SiFive7Model, [Feature64Bit]>;
 
+def : ProcessorModel<"sifive-e20", RocketModel, [FeatureStdExtM,
+ FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-e21", RocketModel, [FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-e24", RocketModel, [FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtF,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-e31", RocketModel, [FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtC]>;
 
+def : ProcessorModel<"sifive-e34", RocketModel, [FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtF,
+ FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-e76", SiFive7Model, [FeatureStdExtM,
+  FeatureStdExtA,
+  FeatureStdExtF,
+  FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-s21", RocketModel, [Feature64Bit,
+ FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-s51", RocketModel, [Feature64Bit,
  FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtC]>;
 
-def : ProcessorModel<"sifive-u54", RocketModel, [Feature64Bit,
+def : ProcessorModel<"sifive-s54", RocketModel, [Feature64Bit,
  FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtF,
  FeatureStdExtD,
  FeatureStdExtC]>;
 
-def : ProcessorModel<"sifive-e76", SiFive7Model, [FeatureStdExtM,
+def : ProcessorModel<"sifive-s76", SiFive7Model, [Feature64Bit,
+  FeatureStdExtM,
   FeatureStdExtA,
   FeatureStdExtF,
+  FeatureStdExtD,
   FeatureStdExtC]>;
 
+def : ProcessorModel<"sifive-u54", RocketModel, [Feature64Bit,
+ FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtF,
+ FeatureStdExtD,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-u74", SiFive7Model, [Feature64Bit,
   FeatureStdExtM,
   FeatureStdExtA,
Index: llvm/include/llvm/Support/RISCVTargetParser.def
===
--- llvm/include/llvm/Support/RISCVTargetParser.def
+++ llvm/include/llvm/Support/RISCVTargetParser.def
@@ -19,10 +19,17 @@
 PROC(ROCKET_RV64, {"rocket-rv64"}, FK_64BIT, {""})
 PROC(SIFIVE_732, {"sifive-7-rv32"}, FK_NONE, {""})
 PROC(SIFIVE_764, {"sifive-7-rv64"}, FK_64BIT, {""})
+PROC(SIFIVE_E20, {"sifive-e20"}, FK_NONE, {"rv32imc"})
+PROC(SIFIVE_E21, {"sifive-e21"}, FK_NONE, {"rv32imac"})
+PROC(SIFIVE_E24, {"sifive-e24"}, FK_NONE, {"rv32imafc"})
 PROC(SIFIVE_E31, {"sifive-e31"}, FK_NONE, {"rv32imac"})
+PROC(SIFIVE_E34, {"sifive-e34"}, FK_NONE, {"rv32imafc"})
+PROC(SIFIVE_E76, {"sifive-e76"}, FK_NONE, {"rv32imafc"})
+PROC(SIFIVE_S21, 

[PATCH] D109265: [X86][mingw] Modify the alignment of __m128/__m256/__m512 vector type for mingw

2021-09-03 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei created this revision.
pengfei added reviewers: rnk, mstorsjo, LiuChen3, LuoYuanke.
pengfei requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This is a follow up patch after D78564  and 
D108887 .

Martin helped to confirm the alignment in GCC mingw is the same as the
size of vector. https://reviews.llvm.org/D108887#inline-1040893


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109265

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGen/x86_32-align-linux.c


Index: clang/test/CodeGen/x86_32-align-linux.c
===
--- clang/test/CodeGen/x86_32-align-linux.c
+++ clang/test/CodeGen/x86_32-align-linux.c
@@ -1,6 +1,9 @@
 // RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-gnu 
-emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-gnu 
-target-feature +avx -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-gnu 
-target-feature +avx512f -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-mingw 
-emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-mingw 
-target-feature +avx -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-mingw 
-target-feature +avx512f -emit-llvm -o - %s | FileCheck %s
 
 #include 
 
Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -1170,7 +1170,8 @@
   IsRetSmallStructInRegABI(RetSmallStructInRegABI),
   IsWin32StructABI(Win32StructABI), IsSoftFloatABI(SoftFloatABI),
   IsMCUABI(CGT.getTarget().getTriple().isOSIAMCU()),
-  IsLinuxABI(CGT.getTarget().getTriple().isOSLinux()),
+  IsLinuxABI(CGT.getTarget().getTriple().isOSLinux() ||
+ CGT.getTarget().getTriple().isOSCygMing()),
   DefaultNumRegisterParameters(NumRegisterParameters) {}
 
   bool shouldPassIndirectlyForSwift(ArrayRef scalars,


Index: clang/test/CodeGen/x86_32-align-linux.c
===
--- clang/test/CodeGen/x86_32-align-linux.c
+++ clang/test/CodeGen/x86_32-align-linux.c
@@ -1,6 +1,9 @@
 // RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-gnu -target-feature +avx -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-gnu -target-feature +avx512f -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-mingw -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-mingw -target-feature +avx -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-mingw -target-feature +avx512f -emit-llvm -o - %s | FileCheck %s
 
 #include 
 
Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -1170,7 +1170,8 @@
   IsRetSmallStructInRegABI(RetSmallStructInRegABI),
   IsWin32StructABI(Win32StructABI), IsSoftFloatABI(SoftFloatABI),
   IsMCUABI(CGT.getTarget().getTriple().isOSIAMCU()),
-  IsLinuxABI(CGT.getTarget().getTriple().isOSLinux()),
+  IsLinuxABI(CGT.getTarget().getTriple().isOSLinux() ||
+ CGT.getTarget().getTriple().isOSCygMing()),
   DefaultNumRegisterParameters(NumRegisterParameters) {}
 
   bool shouldPassIndirectlyForSwift(ArrayRef scalars,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109260: [RISCV] Add SiFive cores E and S series

2021-09-03 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/test/Misc/target-invalid-cpu-note.c:195
 // RISCV32: error: unknown target CPU 'not-a-cpu'
-// RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, 
sifive-7-rv32, sifive-e31, sifive-e76
+// RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, 
sifive-7-rv32, sifive-e20,  sifive-e21,  sifive-e24, sifive-e31, sifive-e34, 
sifive-e76
 

Why 2 spaces after commas here?



Comment at: llvm/lib/Target/RISCV/RISCV.td:279
+
+def : ProcessorModel<"sifive-s21", RocketModel, [Feature64Bit,
+ FeatureStdExtM,

apivovarov wrote:
> craig.topper wrote:
> > Can we sort these by leading digit, then by letter? That will keep most of 
> > the SiFive7Models together.
> Well, it is sorted by `core_type + number` in all other places in LLVM 
> codebase (including error messages). GCC also sorts them as [[ 
> https://github.com/gcc-mirror/gcc/blob/master/gcc/config/riscv/riscv-cores.def
>  | E-S-U ]]. As well as [[ https://www.sifive.com/risc-v-core-ip | sifive.com 
> ]]
Ok. I was basing that request on our internal codebase where we have them 
sorted the other way. But it doesn't matter a lot to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109260/new/

https://reviews.llvm.org/D109260

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


[PATCH] D109260: [RISCV] Add SiFive cores E and S series

2021-09-03 Thread Alexander Pivovarov via Phabricator via cfe-commits
apivovarov marked 4 inline comments as done.
apivovarov added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCV.td:279
+
+def : ProcessorModel<"sifive-s21", RocketModel, [Feature64Bit,
+ FeatureStdExtM,

craig.topper wrote:
> Can we sort these by leading digit, then by letter? That will keep most of 
> the SiFive7Models together.
Well, it is sorted by `core_type + number` in all other places in LLVM codebase 
(including error messages). GCC also sorts them as [[ 
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/riscv/riscv-cores.def 
| E-S-U ]]. As well as [[ https://www.sifive.com/risc-v-core-ip | sifive.com ]]


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109260/new/

https://reviews.llvm.org/D109260

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


[clang] bce178a - Fix for commit d8cd7806310c51af912a647a6ca46de62ff13214.

2021-09-03 Thread Brad Smith via cfe-commits

Author: Brad Smith
Date: 2021-09-03T21:20:37-04:00
New Revision: bce178a5ecf10df762cbda59c7f60cca8e52ce3a

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

LOG: Fix for commit d8cd7806310c51af912a647a6ca46de62ff13214.

Added: 


Modified: 
clang/lib/Basic/Targets/OSTargets.h

Removed: 




diff  --git a/clang/lib/Basic/Targets/OSTargets.h 
b/clang/lib/Basic/Targets/OSTargets.h
index 3d33eabcab44..02a0957be5b9 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -460,11 +460,11 @@ class LLVM_LIBRARY_VISIBILITY OpenBSDTargetInfo : public 
OSTargetInfo {
   Builder.defineMacro("_REENTRANT");
 if (this->HasFloat128)
   Builder.defineMacro("__FLOAT128__");
-  }
 
-  if (Opts.C11) {
-Builder.defineMacro("__STDC_NO_ATOMICS__");
-Builder.defineMacro("__STDC_NO_THREADS__");
+if (Opts.C11) {
+  Builder.defineMacro("__STDC_NO_ATOMICS__");
+  Builder.defineMacro("__STDC_NO_THREADS__");
+}
   }
 
 public:



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


[PATCH] D109260: [RISCV] Add SiFive cores E and S series

2021-09-03 Thread Alexander Pivovarov via Phabricator via cfe-commits
apivovarov updated this revision to Diff 370687.
apivovarov added a comment.

fix typos


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109260/new/

https://reviews.llvm.org/D109260

Files:
  clang/docs/ReleaseNotes.rst
  clang/test/Driver/riscv-cpus.c
  clang/test/Misc/target-invalid-cpu-note.c
  llvm/include/llvm/Support/RISCVTargetParser.def
  llvm/lib/Target/RISCV/RISCV.td

Index: llvm/lib/Target/RISCV/RISCV.td
===
--- llvm/lib/Target/RISCV/RISCV.td
+++ llvm/lib/Target/RISCV/RISCV.td
@@ -250,27 +250,63 @@
 def : ProcessorModel<"sifive-7-rv32", SiFive7Model, []>;
 def : ProcessorModel<"sifive-7-rv64", SiFive7Model, [Feature64Bit]>;
 
+def : ProcessorModel<"sifive-e20", RocketModel, [FeatureStdExtM,
+ FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-e21", RocketModel, [FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-e24", RocketModel, [FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtF,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-e31", RocketModel, [FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtC]>;
 
+def : ProcessorModel<"sifive-e34", RocketModel, [FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtF,
+ FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-e76", SiFive7Model, [FeatureStdExtM,
+  FeatureStdExtA,
+  FeatureStdExtF,
+  FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-s21", RocketModel, [Feature64Bit,
+ FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-s51", RocketModel, [Feature64Bit,
  FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtC]>;
 
-def : ProcessorModel<"sifive-u54", RocketModel, [Feature64Bit,
+def : ProcessorModel<"sifive-s54", RocketModel, [Feature64Bit,
  FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtF,
  FeatureStdExtD,
  FeatureStdExtC]>;
 
-def : ProcessorModel<"sifive-e76", SiFive7Model, [FeatureStdExtM,
+def : ProcessorModel<"sifive-s76", SiFive7Model, [Feature64Bit,
+  FeatureStdExtM,
   FeatureStdExtA,
   FeatureStdExtF,
+  FeatureStdExtD,
   FeatureStdExtC]>;
 
+def : ProcessorModel<"sifive-u54", RocketModel, [Feature64Bit,
+ FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtF,
+ FeatureStdExtD,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-u74", SiFive7Model, [Feature64Bit,
   FeatureStdExtM,
   FeatureStdExtA,
Index: llvm/include/llvm/Support/RISCVTargetParser.def
===
--- llvm/include/llvm/Support/RISCVTargetParser.def
+++ llvm/include/llvm/Support/RISCVTargetParser.def
@@ -19,10 +19,17 @@
 PROC(ROCKET_RV64, {"rocket-rv64"}, FK_64BIT, {""})
 PROC(SIFIVE_732, {"sifive-7-rv32"}, FK_NONE, {""})
 PROC(SIFIVE_764, {"sifive-7-rv64"}, FK_64BIT, {""})
+PROC(SIFIVE_E20, {"sifive-e20"}, FK_NONE, {"rv32imc"})
+PROC(SIFIVE_E21, {"sifive-e21"}, FK_NONE, {"rv32imac"})
+PROC(SIFIVE_E24, {"sifive-e24"}, FK_NONE, {"rv32imafc"})
 PROC(SIFIVE_E31, {"sifive-e31"}, FK_NONE, {"rv32imac"})
+PROC(SIFIVE_E34, {"sifive-e34"}, FK_NONE, {"rv32imafc"})
+PROC(SIFIVE_E76, {"sifive-e76"}, FK_NONE, {"rv32imafc"})
+PROC(SIFIVE_S21, {"sifive-s21"}, FK_64BIT, {"rv64imac"})
 PROC(SIFIVE_S51, 

[clang] d8cd780 - [clang] OpenBSD does not support C11 atomics or threads.

2021-09-03 Thread Brad Smith via cfe-commits

Author: Brad Smith
Date: 2021-09-03T21:13:55-04:00
New Revision: d8cd7806310c51af912a647a6ca46de62ff13214

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

LOG: [clang] OpenBSD does not support C11 atomics or threads.

Added: 


Modified: 
clang/lib/Basic/Targets/OSTargets.h
clang/test/Preprocessor/init.c

Removed: 




diff  --git a/clang/lib/Basic/Targets/OSTargets.h 
b/clang/lib/Basic/Targets/OSTargets.h
index 8004bc0f62f01..3d33eabcab44e 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -462,6 +462,11 @@ class LLVM_LIBRARY_VISIBILITY OpenBSDTargetInfo : public 
OSTargetInfo {
   Builder.defineMacro("__FLOAT128__");
   }
 
+  if (Opts.C11) {
+Builder.defineMacro("__STDC_NO_ATOMICS__");
+Builder.defineMacro("__STDC_NO_THREADS__");
+  }
+
 public:
   OpenBSDTargetInfo(const llvm::Triple , const TargetOptions )
   : OSTargetInfo(Triple, Opts) {

diff  --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
index 4e46405dce6a5..6a3cb9b8ff6a9 100644
--- a/clang/test/Preprocessor/init.c
+++ b/clang/test/Preprocessor/init.c
@@ -1464,6 +1464,16 @@
 // OPENBSD:#define __WCHAR_TYPE__ int
 // OPENBSD:#define __WINT_TYPE__ int
 //
+// RUN: %clang_cc1 -x c -std=c11 -E -dM -ffreestanding 
-triple=amd64-unknown-openbsd < /dev/null | FileCheck -match-full-lines 
-check-prefix OPENBSD-STDC %s
+// RUN: %clang_cc1 -x c -std=gnu11 -E -dM -ffreestanding 
-triple=amd64-unknown-openbsd < /dev/null | FileCheck -match-full-lines 
-check-prefix OPENBSD-STDC %s
+// RUN: %clang_cc1 -x c -std=c17 -E -dM -ffreestanding 
-triple=amd64-unknown-openbsd < /dev/null | FileCheck -match-full-lines 
-check-prefix OPENBSD-STDC %s
+// OPENBSD-STDC:#define __STDC_NO_ATOMICS__ 1
+// OPENBSD-STDC:#define __STDC_NO_THREADS__ 1
+//
+// RUN: %clang_cc1 -x c -std=c99 -E -dM -ffreestanding 
-triple=amd64-unknown-openbsd < /dev/null | FileCheck -match-full-lines 
-check-prefix OPENBSD-STDC-N %s
+// OPENBSD-STDC-N-NOT:#define __STDC_NO_ATOMICS__ 1
+// OPENBSD-STDC-N-NOT:#define __STDC_NO_THREADS__ 1
+//
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=xcore-none-none < /dev/null | 
FileCheck -match-full-lines -check-prefix XCORE %s
 // XCORE:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
 // XCORE:#define __LITTLE_ENDIAN__ 1



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


[PATCH] D109260: [RISCV] Add SiFive cores E and S series

2021-09-03 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: llvm/include/llvm/Support/RISCVTargetParser.def:24
+PROC(SIFIVE_E21, {"sifive-e21"}, FK_NONE, {"rv32imac"})
+PROC(SIFIVE_E34, {"sifive-e24"}, FK_NONE, {"rv32imafc"})
 PROC(SIFIVE_E31, {"sifive-e31"}, FK_NONE, {"rv32imac"})

craig.topper wrote:
> Should SIFIVE_E34 be SIFIVE_E24?
This duplication should fail the build I think?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109260/new/

https://reviews.llvm.org/D109260

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


[PATCH] D109260: [RISCV] Add SiFive cores E and S series

2021-09-03 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: llvm/include/llvm/Support/RISCVTargetParser.def:24
+PROC(SIFIVE_E21, {"sifive-e21"}, FK_NONE, {"rv32imac"})
+PROC(SIFIVE_E34, {"sifive-e24"}, FK_NONE, {"rv32imafc"})
 PROC(SIFIVE_E31, {"sifive-e31"}, FK_NONE, {"rv32imac"})

Should SIFIVE_E34 be SIFIVE_E24?



Comment at: llvm/include/llvm/Support/RISCVTargetParser.def:31
+PROC(SIFIVE_S54, {"sifive-s54"}, FK_64BIT, {"rv64gc"})
+PROC(SIFIVE_U74, {"sifive-s76"}, FK_64BIT, {"rv64gc"})
 PROC(SIFIVE_U54, {"sifive-u54"}, FK_64BIT, {"rv64gc"})

Should SIFIVE_U74 be SIFIVE_S76?



Comment at: llvm/lib/Target/RISCV/RISCV.td:279
+
+def : ProcessorModel<"sifive-s21", RocketModel, [Feature64Bit,
+ FeatureStdExtM,

Can we sort these by leading digit, then by letter? That will keep most of the 
SiFive7Models together.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109260/new/

https://reviews.llvm.org/D109260

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


[PATCH] D109260: [RISCV] Add SiFive cores E and S series

2021-09-03 Thread Alexander Pivovarov via Phabricator via cfe-commits
apivovarov updated this revision to Diff 370683.
apivovarov retitled this revision from "[RISCV] Add SiFive core E20" to 
"[RISCV] Add SiFive cores E and S series".
apivovarov edited the summary of this revision.
apivovarov added a comment.

Added SiFive cores E20, E21, E24, E34, S21, S54 and S76


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109260/new/

https://reviews.llvm.org/D109260

Files:
  clang/docs/ReleaseNotes.rst
  clang/test/Driver/riscv-cpus.c
  clang/test/Misc/target-invalid-cpu-note.c
  llvm/include/llvm/Support/RISCVTargetParser.def
  llvm/lib/Target/RISCV/RISCV.td

Index: llvm/lib/Target/RISCV/RISCV.td
===
--- llvm/lib/Target/RISCV/RISCV.td
+++ llvm/lib/Target/RISCV/RISCV.td
@@ -250,27 +250,63 @@
 def : ProcessorModel<"sifive-7-rv32", SiFive7Model, []>;
 def : ProcessorModel<"sifive-7-rv64", SiFive7Model, [Feature64Bit]>;
 
+def : ProcessorModel<"sifive-e20", RocketModel, [FeatureStdExtM,
+ FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-e21", RocketModel, [FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-e24", RocketModel, [FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtF,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-e31", RocketModel, [FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtC]>;
 
+def : ProcessorModel<"sifive-e34", RocketModel, [FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtF,
+ FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-e76", SiFive7Model, [FeatureStdExtM,
+  FeatureStdExtA,
+  FeatureStdExtF,
+  FeatureStdExtC]>;
+
+def : ProcessorModel<"sifive-s21", RocketModel, [Feature64Bit,
+ FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-s51", RocketModel, [Feature64Bit,
  FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtC]>;
 
-def : ProcessorModel<"sifive-u54", RocketModel, [Feature64Bit,
+def : ProcessorModel<"sifive-s54", RocketModel, [Feature64Bit,
  FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtF,
  FeatureStdExtD,
  FeatureStdExtC]>;
 
-def : ProcessorModel<"sifive-e76", SiFive7Model, [FeatureStdExtM,
+def : ProcessorModel<"sifive-s76", SiFive7Model, [Feature64Bit,
+  FeatureStdExtM,
   FeatureStdExtA,
   FeatureStdExtF,
+  FeatureStdExtD,
   FeatureStdExtC]>;
 
+def : ProcessorModel<"sifive-u54", RocketModel, [Feature64Bit,
+ FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtF,
+ FeatureStdExtD,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-u74", SiFive7Model, [Feature64Bit,
   FeatureStdExtM,
   FeatureStdExtA,
Index: llvm/include/llvm/Support/RISCVTargetParser.def
===
--- llvm/include/llvm/Support/RISCVTargetParser.def
+++ llvm/include/llvm/Support/RISCVTargetParser.def
@@ -19,10 +19,17 @@
 PROC(ROCKET_RV64, {"rocket-rv64"}, FK_64BIT, {""})
 PROC(SIFIVE_732, {"sifive-7-rv32"}, FK_NONE, {""})
 PROC(SIFIVE_764, {"sifive-7-rv64"}, FK_64BIT, {""})
+PROC(SIFIVE_E20, {"sifive-e20"}, FK_NONE, {"rv32imc"})
+PROC(SIFIVE_E21, {"sifive-e21"}, FK_NONE, {"rv32imac"})
+PROC(SIFIVE_E34, {"sifive-e24"}, FK_NONE, {"rv32imafc"})
 PROC(SIFIVE_E31, {"sifive-e31"}, FK_NONE, 

[clang] 775ab78 - Support linking against OpenMP runtime on OpenBSD.

2021-09-03 Thread Brad Smith via cfe-commits

Author: Brad Smith
Date: 2021-09-03T19:33:09-04:00
New Revision: 775ab780fd2a23cfc80ace571938ddd21d080173

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

LOG: Support linking against OpenMP runtime on OpenBSD.

Added: 


Modified: 
clang/lib/Driver/ToolChains/OpenBSD.cpp
clang/test/Driver/fopenmp.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp 
b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index 402ac23521fee..451975d0b4e69 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -176,6 +176,11 @@ void openbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
+// Use the static OpenMP runtime with -static-openmp
+bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
+!Args.hasArg(options::OPT_static);
+addOpenMPRuntime(CmdArgs, ToolChain, Args, StaticOpenMP);
+
 if (D.CCCIsCXX()) {
   if (ToolChain.ShouldLinkCXXStdlib(Args))
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);

diff  --git a/clang/test/Driver/fopenmp.c b/clang/test/Driver/fopenmp.c
index b467fbed93e26..aadade101125e 100644
--- a/clang/test/Driver/fopenmp.c
+++ b/clang/test/Driver/fopenmp.c
@@ -10,6 +10,9 @@
 // RUN: %clang -target x86_64-netbsd -fopenmp=libomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
 // RUN: %clang -target x86_64-netbsd -fopenmp=libgomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
 // RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
+// RUN: %clang -target x86_64-openbsd -fopenmp=libomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
+// RUN: %clang -target x86_64-openbsd -fopenmp=libgomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
+// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
 // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
 // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
 // RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
@@ -74,6 +77,19 @@
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
 //
+// RUN: %clang -target x86_64-openbsd -fopenmp=libomp %s -o %t -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-LD-OMP
+// RUN: %clang -target x86_64-openbsd -fopenmp=libgomp %s -o %t -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
+// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-LD-IOMP5
+//
+// RUN: %clang -target x86_64-openbsd -fopenmp=libomp -static-openmp %s -o %t 
-### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-openbsd -fopenmp=libgomp -static-openmp %s -o %t 
-### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP 
--check-prefix=CHECK-LD-STATIC-GOMP-NO-RT
+// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 -static-openmp %s -o 
%t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 -static -static-openmp 
%s -o %t -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC
+//
+// RUN: %clang -nostdlib -target x86_64-openbsd -fopenmp=libomp %s -o %t -### 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
+// RUN: %clang -nostdlib -target x86_64-openbsd -fopenmp=libgomp %s -o %t -### 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
+// RUN: %clang -nostdlib -target x86_64-openbsd -fopenmp=libiomp5 %s -o %t 
-### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
+//
 // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-LD-OMP
 // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 
| FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
 // RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 
| FileCheck %s --check-prefix=CHECK-LD-IOMP5MD
@@ -120,7 +136,7 @@
 // CHECK-LD-STATIC-IOMP5: "-Bstatic" "-liomp5" "-Bdynamic"
 //
 // CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC: "{{.*}}ld{{(.exe)?}}"
-// For x86 Gnu, the driver passes -static, 

[PATCH] D109210: [clang-tidy] Attach fixit to warning, not note, in add_new_check.py example

2021-09-03 Thread Matt Beardsley via Phabricator via cfe-commits
mattbeardsley added a comment.

Ah, and to your direct question:

> BTW, the test wasn't checking for the note's message at all?"

Right, the generated test file does not ever do `// CHECK-MESSAGES: :Row:Col: 
note: insert 'awesome'` (nor does the LIT setup here enforce that notes need to 
be checked - it enforces that all warning and error diagnostics must be 
checked, but it looks like it leaves out note diagnostics)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109210/new/

https://reviews.llvm.org/D109210

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


[PATCH] D109210: [clang-tidy] Attach fixit to warning, not note, in add_new_check.py example

2021-09-03 Thread Matt Beardsley via Phabricator via cfe-commits
mattbeardsley added a comment.

In D109210#2981912 , @whisperity 
wrote:

> Uuuh.. I get the sentiment, but this change breaks the very essence of the 
> joke that the default generated code wants to pass on. It also does not 
> showcase that we can emit notes, not just warnings.
>
> How about `function %0 is insufficiently awesome, mark it as 'awesome_'!` in 
> the warning text? (Note how the fix and the note's text diverged already.)
>
> And so we should come up with a joke for the Note tag.
>
> BTW, the test wasn't checking for the note's message at all?

I'm certainly not trying to be a buzzkill on the joke :)
Yes, I did notice that the printed diagnostic text changed from its original, 
but I'll add some background investigation that I should have written in the 
original review text, sorry about laying out quite an incomplete thought 
process. 
At least, I'm hoping I can show there's some extent of due diligence 
behind-the-scenes, and that I'm not just trying to change this willy-nilly!

I read/grepped/etc through several (but certainly not all) existing checks to 
try to identify what the "canonical" diagnostic-and-fix pattern looks like. 
I was thinking that a decent goal would be that, if someone takes the files 
generated by add_new_check.py as their starting point and runs with it, they'll 
end up with check behavior that's reasonably consistent with a "typical" 
existing check.

Here are my observations w.r.t "note" diagnostic usage and diagnostic message 
wording:

1. < ~15% of existing checks use "note" diagnostics

  $ cd clang-tools-extra/clang-tidy
  
  # 40 checks use notes
  $ find . -name '*Check.cpp' | xargs grep -nl 'DiagnosticIDs::Note' | wc -l
  40
  
  # out of 265 calling diag directly
  # (there are 287 total *Check.cpp - most of the remaining 22 are 
android/Cloexec*.cpp which call "CloexecCheck::replaceFunc", which also doesn't 
use DiagnosticIDs::Note)
  $ find . -name '*Check.cpp' | xargs grep -nl 'diag(' | wc -l
  265

2. Out of several messages that I skimmed through arbitrarily (subject to 
potentially being a misrepresentative sample, but hopefully not), the general 
pattern seems to be to state the problem, but not the fix in the handwritten 
diagnostic message text. Here are some examples from the readability module:
  - `readability-redundant-string-init` warns "redundant string 
initialization", but doesn't state "remove the initialization"
  - `readability-redundant-string-cstr` warns "redundant call to %0", but 
doesn't state "remove the call"
  - `readability-named-parameter` warns "all parameters should be named in a 
function", but doesn't state "insert the commented parameter name"
  - `readability-implicit-bool-conversion` warns "implicit conversion bool -> 
%0", but doesn't state the various insertions and removals it's going to do
  - `readability-braces-around-statements` warns "statement should be inside 
braces", but doesn't state "insert statements"

The typical pattern appeared to be to state the issue, then let the FixItHint 
display the suggested conversion, without writing text describing that 
conversion explicitly.
So I aimed to adjust the add_new_check.py script so that it would produce an 
example that's consistent with those observed best practices from the live 
code, so that a new check based on add_new_check.py would look reasonably 
similar to surrounding checks. 
My interpretation of that was to state the issue ("insufficiently awesome"), 
but not describe the insertion - leaving that to the FixItHint::CreateInsertion 
to emit as it sees fit.

Then, since a relatively small percentage of checks use Note diagnostics, my 
take on it was that including the Note example would lead a newcomer to 
unnecessarily start adding Note diagnostics. 
This is anecdotal evidence obviously, but after a couple years spent (on & off) 
writing about 40 clang-tidy checks in my organization, I only just learned 
yesterday from a git bisect that I'd been incorrectly using note diagnostics! 
("why did all my tests start failing after pulling from upstream!"). 
And I'd been using Note diagnostics that way all along because my impression 
from the add_new_check.py example was that streaming the FixItHints into Note 
diagnostics was the right thing to do for the "standard" fix in a clang-tidy 
check.

Last - given relatively few (~15%) checks actually use Note diagnostics at all, 
it didn't seem like Note diagnostics had "earned" their place in the generated 
example code, and could be left as a slightly more "advanced maneuver" instead
Slightly more (42, still about 15%) Check.cpp files (using similar find/grep as 
above methodology) use "Lexer::getSourceText," but that's not part of the 
add_new_check.py example. 
So I guess I'm left wondering - what drives Note diagnostics to be a crucial 
piece to keep as a demo in add_new_check.py, as opposed to showcasing a 
different maneuver? Is there something else that would be 

[PATCH] D109260: [RISCV] Add SiFive core E20

2021-09-03 Thread Alexander Pivovarov via Phabricator via cfe-commits
apivovarov added a comment.

Another missing combination is:

- e24 and e34 (rocket, rv32imafc)

I can also add several cores which are similar to existing cores:

- e21 (same as existing e31 - rocket, rv32imac)
- s21 (same as existing s51 - rocket, rv64imac)
- s54 (same as existing u54 - rocket, rv64imafdc)
- s76  (same as existing u74 - SiFive7, rv64imafdc)

To match gcc cores definition - 
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/riscv/riscv-cores.def#L34


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109260/new/

https://reviews.llvm.org/D109260

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


[clang] b989662 - OpenBSD also needs execinfo

2021-09-03 Thread Brad Smith via cfe-commits

Author: Brad Smith
Date: 2021-09-03T17:33:48-04:00
New Revision: b989662eb000efb54b91b8c82d2b2713e2da20fc

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

LOG: OpenBSD also needs execinfo

Added: 


Modified: 
clang/lib/Driver/ToolChains/CommonArgs.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 412d41dbee61b..ca426955b7f9a 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -779,7 +779,8 @@ void tools::linkSanitizerRuntimeDeps(const ToolChain ,
 CmdArgs.push_back("-ldl");
   // Required for backtrace on some OSes
   if (TC.getTriple().isOSFreeBSD() ||
-  TC.getTriple().isOSNetBSD())
+  TC.getTriple().isOSNetBSD() ||
+  TC.getTriple().isOSOpenBSD())
 CmdArgs.push_back("-lexecinfo");
 }
 



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


[PATCH] D109260: [RISCV] Add SiFive core E20

2021-09-03 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

Are you planning to add more CPUs? I think I'd be willing to accept them all as 
one patch instead of one small patch for each CPU.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109260/new/

https://reviews.llvm.org/D109260

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


[PATCH] D109260: [RISCV] Add SiFive core E20

2021-09-03 Thread Alexander Pivovarov via Phabricator via cfe-commits
apivovarov created this revision.
apivovarov added reviewers: MaskRay, evandro.
Herald added subscribers: vkmr, frasercrmck, luismarques, apazos, 
sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, 
brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, 
kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
apivovarov requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Add RISC-V sifive-e20 cpu (rv32imc)

sifive-e20 spec: https://www.sifive.com/cores/e20
gcc: 
https://github.com/riscv/riscv-gcc/blob/c3911e6425f35e0722129cb30cc5ccaf3390cd75/gcc/config/riscv/riscv-cores.def#L34


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109260

Files:
  clang/docs/ReleaseNotes.rst
  clang/test/Driver/riscv-cpus.c
  clang/test/Misc/target-invalid-cpu-note.c
  llvm/include/llvm/Support/RISCVTargetParser.def
  llvm/lib/Target/RISCV/RISCV.td


Index: llvm/lib/Target/RISCV/RISCV.td
===
--- llvm/lib/Target/RISCV/RISCV.td
+++ llvm/lib/Target/RISCV/RISCV.td
@@ -250,6 +250,9 @@
 def : ProcessorModel<"sifive-7-rv32", SiFive7Model, []>;
 def : ProcessorModel<"sifive-7-rv64", SiFive7Model, [Feature64Bit]>;
 
+def : ProcessorModel<"sifive-e20", RocketModel, [FeatureStdExtM,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-e31", RocketModel, [FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtC]>;
Index: llvm/include/llvm/Support/RISCVTargetParser.def
===
--- llvm/include/llvm/Support/RISCVTargetParser.def
+++ llvm/include/llvm/Support/RISCVTargetParser.def
@@ -19,6 +19,7 @@
 PROC(ROCKET_RV64, {"rocket-rv64"}, FK_64BIT, {""})
 PROC(SIFIVE_732, {"sifive-7-rv32"}, FK_NONE, {""})
 PROC(SIFIVE_764, {"sifive-7-rv64"}, FK_64BIT, {""})
+PROC(SIFIVE_E20, {"sifive-e20"}, FK_NONE, {"rv32imc"})
 PROC(SIFIVE_E31, {"sifive-e31"}, FK_NONE, {"rv32imac"})
 PROC(SIFIVE_S51, {"sifive-s51"}, FK_64BIT, {"rv64imac"})
 PROC(SIFIVE_U54, {"sifive-u54"}, FK_64BIT, {"rv64gc"})
Index: clang/test/Misc/target-invalid-cpu-note.c
===
--- clang/test/Misc/target-invalid-cpu-note.c
+++ clang/test/Misc/target-invalid-cpu-note.c
@@ -192,7 +192,7 @@
 
 // RUN: not %clang_cc1 -triple riscv32 -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix RISCV32
 // RISCV32: error: unknown target CPU 'not-a-cpu'
-// RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, 
sifive-7-rv32, sifive-e31, sifive-e76
+// RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, 
sifive-7-rv32, sifive-e20, sifive-e31, sifive-e76
 
 // RUN: not %clang_cc1 -triple riscv64 -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix RISCV64
 // RISCV64: error: unknown target CPU 'not-a-cpu'
@@ -200,7 +200,7 @@
 
 // RUN: not %clang_cc1 -triple riscv32 -tune-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix TUNE-RISCV32
 // TUNE-RISCV32: error: unknown target CPU 'not-a-cpu'
-// TUNE-RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, 
sifive-7-rv32, sifive-e31, sifive-e76, generic, rocket, sifive-7-series
+// TUNE-RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, 
sifive-7-rv32, sifive-e20, sifive-e31, sifive-e76, generic, rocket, 
sifive-7-series
 
 // RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix TUNE-RISCV64
 // TUNE-RISCV64: error: unknown target CPU 'not-a-cpu'
Index: clang/test/Driver/riscv-cpus.c
===
--- clang/test/Driver/riscv-cpus.c
+++ clang/test/Driver/riscv-cpus.c
@@ -45,6 +45,12 @@
 // RUN: %clang -target riscv64 -### -c %s 2>&1 -mtune=sifive-7-series | 
FileCheck -check-prefix=MTUNE-SIFIVE7-SERIES-64 %s
 // MTUNE-SIFIVE7-SERIES-64: "-tune-cpu" "sifive-7-rv64"
 
+// mcpu with mabi option
+// RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-e20 -mabi=ilp32 | 
FileCheck -check-prefix=MCPU-ABI-SIFIVE-E20 %s
+// MCPU-ABI-SIFIVE-E20: "-nostdsysteminc" "-target-cpu" "sifive-e20"
+// MCPU-ABI-SIFIVE-E20: "-target-feature" "+m" "-target-feature" "+c"
+// MCPU-ABI-SIFIVE-E20: "-target-abi" "ilp32"
+
 // mcpu with mabi option
 // RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-s51 -mabi=lp64 | 
FileCheck -check-prefix=MCPU-ABI-SIFIVE-S51 %s
 // MCPU-ABI-SIFIVE-S51: "-nostdsysteminc" "-target-cpu" "sifive-s51"
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -73,6 +73,7 @@
 
 - Support has been added for the following processors 

[PATCH] D109244: [clang] Allow the OpenBSD driver to link the libclang_rt.profile library.

2021-09-03 Thread Brad Smith via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG466451c66162: [clang] Allow the OpenBSD driver to link the 
libclang_rt.profile library. (authored by fcambus, committed by brad).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109244/new/

https://reviews.llvm.org/D109244

Files:
  clang/lib/Driver/ToolChains/OpenBSD.cpp


Index: clang/lib/Driver/ToolChains/OpenBSD.cpp
===
--- clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -223,6 +223,8 @@
 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend)));
   }
 
+  ToolChain.addProfileRTLibs(Args, CmdArgs);
+
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
   C.addCommand(std::make_unique(JA, *this,
  ResponseFileSupport::AtFileCurCP(),


Index: clang/lib/Driver/ToolChains/OpenBSD.cpp
===
--- clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -223,6 +223,8 @@
 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend)));
   }
 
+  ToolChain.addProfileRTLibs(Args, CmdArgs);
+
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
   C.addCommand(std::make_unique(JA, *this,
  ResponseFileSupport::AtFileCurCP(),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 466451c - [clang] Allow the OpenBSD driver to link the libclang_rt.profile library.

2021-09-03 Thread Brad Smith via cfe-commits

Author: Frederic Cambus
Date: 2021-09-03T17:18:40-04:00
New Revision: 466451c6616272d8c779618b92b0ae80f394a795

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

LOG: [clang] Allow the OpenBSD driver to link the libclang_rt.profile library.

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/OpenBSD.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp 
b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index 1443d842347b..402ac23521fe 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -223,6 +223,8 @@ void openbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend)));
   }
 
+  ToolChain.addProfileRTLibs(Args, CmdArgs);
+
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
   C.addCommand(std::make_unique(JA, *this,
  ResponseFileSupport::AtFileCurCP(),



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


[PATCH] D105092: [RISCV] Add the tail policy argument to builtins/intrinsics.

2021-09-03 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td:2288
+   (mask_type V0),
+   VLOpFrag, (XLenVT GPR:$policy))),
+   (!cast(inst#"_"#kind#"_"#vlmul.MX#"_MASK")

I think this should be timm:$policy


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105092/new/

https://reviews.llvm.org/D105092

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


[PATCH] D109255: [NFC][OpenMP] Use clang_cc1 to driver tests

2021-09-03 Thread Jinsong Ji via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd364eccdd5a9: [NFC][OpenMP] Use clang_cc1 to driver tests 
(authored by jsji).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

Files:
  clang/test/OpenMP/driver-fopenmp-extensions.c
  clang/test/OpenMP/fopenmp-extensions.c


Index: clang/test/OpenMP/fopenmp-extensions.c
===
--- /dev/null
+++ 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)
+  ;
+}
Index: clang/test/OpenMP/driver-fopenmp-extensions.c
===
--- 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)
-  ;
-}


Index: clang/test/OpenMP/fopenmp-extensions.c
===
--- /dev/null
+++ 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)
+  ;
+}
Index: clang/test/OpenMP/driver-fopenmp-extensions.c
===
--- 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 \
-// 

[clang] d364ecc - [NFC][OpenMP] Use clang_cc1 to driver tests

2021-09-03 Thread Jinsong Ji via cfe-commits

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny accepted this revision.
jdenny added a comment.

LGTM.  Thanks for the fix.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

> I probably won't get to it today, but I can work on it later.

Sure, take your time. Thank you!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny added a comment.

In D109255#2983063 , @jsji wrote:

> In D109255#2983052 , @ABataev wrote:
>
>> In D109255#2983017 , @jdenny wrote:
>>
>>> This test is meant to check that the driver processes these options 
>>> correctly.  -cc1 isn't the driver and often ignores either the positive or 
>>> negative version of an option.
>>
>> Better not to do such checks, just need to check that driver correctly 
>> translates driver options to the frontend options (using `-###`), better to 
>> use `-verify` only with the frontend tests. Suggest to rework this test.
>
> Make sense to me. How about we use `_cc1` as Alexey suggested here (and 
> rename the file to remove `driver-` prefix).

OK.

> Maybe Joel can add another test to test the driver correctly translates 
> driver options to the frontend options (using `-###`) in `test/Driver` dir?

I probably won't get to it today, but I can work on it later.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Jinsong Ji via Phabricator via cfe-commits
jsji updated this revision to Diff 370663.
jsji added a comment.

use `_cc1` for now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

Files:
  clang/test/OpenMP/driver-fopenmp-extensions.c
  clang/test/OpenMP/fopenmp-extensions.c


Index: clang/test/OpenMP/fopenmp-extensions.c
===
--- /dev/null
+++ 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)
+  ;
+}
Index: clang/test/OpenMP/driver-fopenmp-extensions.c
===
--- 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)
-  ;
-}


Index: clang/test/OpenMP/fopenmp-extensions.c
===
--- /dev/null
+++ 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)
+  ;
+}
Index: clang/test/OpenMP/driver-fopenmp-extensions.c
===
--- 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 

[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

In D109255#2983052 , @ABataev wrote:

> In D109255#2983017 , @jdenny wrote:
>
>> This test is meant to check that the driver processes these options 
>> correctly.  -cc1 isn't the driver and often ignores either the positive or 
>> negative version of an option.
>
> Better not to do such checks, just need to check that driver correctly 
> translates driver options to the frontend options (using `-###`), better to 
> use `-verify` only with the frontend tests. Suggest to rework this test.

Make sense to me. How about we use `_cc1` as Alexey suggested here. Maybe Joel 
can add another test to test the driver correctly translates driver options to 
the frontend options (using `-###`) in `test/Driver` dir?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

@ABataev Is this still OK for you?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D109255#2983017 , @jdenny wrote:

> This test is meant to check that the driver processes these options 
> correctly.  -cc1 isn't the driver and often ignores either the positive or 
> negative version of an option.

Better not to do such checks, just need to check that driver correctly 
translates driver options to the frontend options (using `-###`), better to use 
`-verify` only with the frontend tests. Suggest to rework this test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Jinsong Ji via Phabricator via cfe-commits
jsji updated this revision to Diff 370658.
jsji added a comment.

Use driver + -fsyntax-only.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

Files:
  clang/test/OpenMP/driver-fopenmp-extensions.c


Index: clang/test/OpenMP/driver-fopenmp-extensions.c
===
--- clang/test/OpenMP/driver-fopenmp-extensions.c
+++ clang/test/OpenMP/driver-fopenmp-extensions.c
@@ -1,20 +1,20 @@
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp %s
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd %s
+// RUN: %clang -c -fsyntax-only -Xclang  -verify=ompx -fopenmp %s
+// RUN: %clang -c -fsyntax-only -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 -fsyntax-only -Xclang  -verify=ompx -fopenmp 
-fopenmp-extensions %s
+// RUN: %clang -c -fsyntax-only -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 -fsyntax-only -Xclang  -verify=omp -fopenmp 
-fno-openmp-extensions %s
+// RUN: %clang -c -fsyntax-only -Xclang  -verify=omp -fopenmp-simd 
-fno-openmp-extensions %s
 
-// RUN: %clang -c -Xclang -verify=omp -fopenmp \
+// RUN: %clang -c -fsyntax-only -Xclang  -verify=omp -fopenmp \
 // RUN: -fopenmp-extensions -fno-openmp-extensions %s
-// RUN: %clang -c -Xclang -verify=omp -fopenmp-simd \
+// RUN: %clang -c -fsyntax-only -Xclang  -verify=omp -fopenmp-simd \
 // RUN: -fopenmp-extensions -fno-openmp-extensions %s
 
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp \
+// RUN: %clang -c -fsyntax-only -Xclang  -verify=ompx -fopenmp \
 // RUN: -fno-openmp-extensions -fopenmp-extensions %s
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd \
+// RUN: %clang -c -fsyntax-only -Xclang  -verify=ompx -fopenmp-simd \
 // RUN: -fno-openmp-extensions -fopenmp-extensions %s
 
 void foo() {


Index: clang/test/OpenMP/driver-fopenmp-extensions.c
===
--- clang/test/OpenMP/driver-fopenmp-extensions.c
+++ clang/test/OpenMP/driver-fopenmp-extensions.c
@@ -1,20 +1,20 @@
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp %s
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd %s
+// RUN: %clang -c -fsyntax-only -Xclang  -verify=ompx -fopenmp %s
+// RUN: %clang -c -fsyntax-only -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 -fsyntax-only -Xclang  -verify=ompx -fopenmp -fopenmp-extensions %s
+// RUN: %clang -c -fsyntax-only -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 -fsyntax-only -Xclang  -verify=omp -fopenmp -fno-openmp-extensions %s
+// RUN: %clang -c -fsyntax-only -Xclang  -verify=omp -fopenmp-simd -fno-openmp-extensions %s
 
-// RUN: %clang -c -Xclang -verify=omp -fopenmp \
+// RUN: %clang -c -fsyntax-only -Xclang  -verify=omp -fopenmp \
 // RUN: -fopenmp-extensions -fno-openmp-extensions %s
-// RUN: %clang -c -Xclang -verify=omp -fopenmp-simd \
+// RUN: %clang -c -fsyntax-only -Xclang  -verify=omp -fopenmp-simd \
 // RUN: -fopenmp-extensions -fno-openmp-extensions %s
 
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp \
+// RUN: %clang -c -fsyntax-only -Xclang  -verify=ompx -fopenmp \
 // RUN: -fno-openmp-extensions -fopenmp-extensions %s
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd \
+// RUN: %clang -c -fsyntax-only -Xclang  -verify=ompx -fopenmp-simd \
 // RUN: -fno-openmp-extensions -fopenmp-extensions %s
 
 void foo() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108696: [Coroutines] [Frontend] Lookup in std namespace first

2021-09-03 Thread Louis Dionne via Phabricator via cfe-commits
ldionne reopened this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

(woops, this closed the rev when I committed the revert)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108696/new/

https://reviews.llvm.org/D108696

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


[PATCH] D108696: [Coroutines] [Frontend] Lookup in std namespace first

2021-09-03 Thread Louis Dionne via Phabricator via cfe-commits
ldionne reopened this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

Based on the commit description, I don't understand this change at all. Why do 
we want to tweak the name lookup just for `std::coroutine`? Yes, we do have an 
action item to finish coroutines in libc++ already, and I'd love to see a patch 
that does that, but I don't think that mandates changing Clang.

The rollout plan for coroutines should be:

1. Make sure we implement coroutines fully
2. Duplicate it all into namespace `std`
3. In two LLVM releases, remove all the coroutines stuff in `std::experimental`.

I'm going to revert this for now on the basis that it breaks libc++ CI. Let's 
have a discussion about the above if you think I'm mistaken or if I'm 
misunderstanding what this patch does.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108696/new/

https://reviews.llvm.org/D108696

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny added a comment.

In D109255#2983018 , @jsji wrote:

> In D109255#2983017 , @jdenny wrote:
>
>> This test is meant to check that the driver processes these options 
>> correctly.  -cc1 isn't the driver and often ignores either the positive or 
>> negative version of an option.
>
> OK, I can revert to driver + fsyntax-only if that is preferred?

That would be my preference.  Otherwise, we never test the interface exposed to 
the user, and the test is misnamed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

In D109255#2983017 , @jdenny wrote:

> This test is meant to check that the driver processes these options 
> correctly.  -cc1 isn't the driver and often ignores either the positive or 
> negative version of an option.

OK, I can revert to driver + fsyntax-only if that is preferred?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Joel E. Denny via Phabricator via cfe-commits
jdenny added a comment.

This test is meant to check that the driver processes these options correctly.  
-cc1 isn't the driver and often ignores either the positive or negative version 
of an option.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

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


[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-09-03 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

I'm realizing more now that these changes break the original intent of 
rG0be9ca7c0f9a733f846bb6bc4e8e36d46b518162 
 as well, 
given that it seems like the core canonicalization of the path before passing 
it down was the intent, but that's also the part that appears to be causing the 
issue. @JDevlieghere I would definitely appreciate some advice here, I'm still 
trying to see if I can satisfy the new test case without breaking the tests you 
changed, but I think they might fundamentally be at odds


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109128/new/

https://reviews.llvm.org/D109128

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

In D109255#2983002 , @ABataev wrote:

> I think we can use just `clang_cc1` here instead of `%clang -c`

Good idea.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Jinsong Ji via Phabricator via cfe-commits
jsji updated this revision to Diff 370653.
jsji added a comment.

Use clang_cc1 instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

Files:
  clang/test/OpenMP/driver-fopenmp-extensions.c


Index: clang/test/OpenMP/driver-fopenmp-extensions.c
===
--- clang/test/OpenMP/driver-fopenmp-extensions.c
+++ clang/test/OpenMP/driver-fopenmp-extensions.c
@@ -1,20 +1,20 @@
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp %s
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd %s
+// RUN: %clang_cc1  -verify=ompx -fopenmp %s
+// RUN: %clang_cc1  -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_cc1  -verify=ompx -fopenmp -fopenmp-extensions %s
+// RUN: %clang_cc1  -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_cc1  -verify=omp -fopenmp -fno-openmp-extensions %s
+// RUN: %clang_cc1  -verify=omp -fopenmp-simd -fno-openmp-extensions %s
 
-// RUN: %clang -c -Xclang -verify=omp -fopenmp \
+// RUN: %clang_cc1  -verify=omp -fopenmp \
 // RUN: -fopenmp-extensions -fno-openmp-extensions %s
-// RUN: %clang -c -Xclang -verify=omp -fopenmp-simd \
+// RUN: %clang_cc1  -verify=omp -fopenmp-simd \
 // RUN: -fopenmp-extensions -fno-openmp-extensions %s
 
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp \
+// RUN: %clang_cc1  -verify=ompx -fopenmp \
 // RUN: -fno-openmp-extensions -fopenmp-extensions %s
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd \
+// RUN: %clang_cc1  -verify=ompx -fopenmp-simd \
 // RUN: -fno-openmp-extensions -fopenmp-extensions %s
 
 void foo() {


Index: clang/test/OpenMP/driver-fopenmp-extensions.c
===
--- clang/test/OpenMP/driver-fopenmp-extensions.c
+++ clang/test/OpenMP/driver-fopenmp-extensions.c
@@ -1,20 +1,20 @@
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp %s
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd %s
+// RUN: %clang_cc1  -verify=ompx -fopenmp %s
+// RUN: %clang_cc1  -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_cc1  -verify=ompx -fopenmp -fopenmp-extensions %s
+// RUN: %clang_cc1  -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_cc1  -verify=omp -fopenmp -fno-openmp-extensions %s
+// RUN: %clang_cc1  -verify=omp -fopenmp-simd -fno-openmp-extensions %s
 
-// RUN: %clang -c -Xclang -verify=omp -fopenmp \
+// RUN: %clang_cc1  -verify=omp -fopenmp \
 // RUN: -fopenmp-extensions -fno-openmp-extensions %s
-// RUN: %clang -c -Xclang -verify=omp -fopenmp-simd \
+// RUN: %clang_cc1  -verify=omp -fopenmp-simd \
 // RUN: -fopenmp-extensions -fno-openmp-extensions %s
 
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp \
+// RUN: %clang_cc1  -verify=ompx -fopenmp \
 // RUN: -fno-openmp-extensions -fopenmp-extensions %s
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd \
+// RUN: %clang_cc1  -verify=ompx -fopenmp-simd \
 // RUN: -fno-openmp-extensions -fopenmp-extensions %s
 
 void foo() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

I think we can use just `clang_cc1` here instead of `%clang -c`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109255/new/

https://reviews.llvm.org/D109255

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


[PATCH] D109255: [NFC][OpenMP] Add fsyntax-only to driver tests

2021-09-03 Thread Jinsong Ji via Phabricator via cfe-commits
jsji created this revision.
jsji added reviewers: jdenny, ABataev, jdoerfert.
Herald added subscribers: guansong, yaxunl.
jsji requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

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 I think we should add -fsyntax-only to the test similar to other diag
tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109255

Files:
  clang/test/OpenMP/driver-fopenmp-extensions.c


Index: clang/test/OpenMP/driver-fopenmp-extensions.c
===
--- clang/test/OpenMP/driver-fopenmp-extensions.c
+++ clang/test/OpenMP/driver-fopenmp-extensions.c
@@ -1,20 +1,20 @@
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp %s
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd %s
+// RUN: %clang -c -fsyntax-only -Xclang -verify=ompx -fopenmp %s
+// RUN: %clang -c -fsyntax-only -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 -fsyntax-only -Xclang -verify=ompx -fopenmp 
-fopenmp-extensions %s
+// RUN: %clang -c -fsyntax-only -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 -fsyntax-only -Xclang -verify=omp -fopenmp 
-fno-openmp-extensions %s
+// RUN: %clang -c -fsyntax-only -Xclang -verify=omp -fopenmp-simd 
-fno-openmp-extensions %s
 
-// RUN: %clang -c -Xclang -verify=omp -fopenmp \
+// RUN: %clang -c -fsyntax-only -Xclang -verify=omp -fopenmp \
 // RUN: -fopenmp-extensions -fno-openmp-extensions %s
-// RUN: %clang -c -Xclang -verify=omp -fopenmp-simd \
+// RUN: %clang -c -fsyntax-only -Xclang -verify=omp -fopenmp-simd \
 // RUN: -fopenmp-extensions -fno-openmp-extensions %s
 
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp \
+// RUN: %clang -c -fsyntax-only -Xclang -verify=ompx -fopenmp \
 // RUN: -fno-openmp-extensions -fopenmp-extensions %s
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd \
+// RUN: %clang -c -fsyntax-only -Xclang -verify=ompx -fopenmp-simd \
 // RUN: -fno-openmp-extensions -fopenmp-extensions %s
 
 void foo() {


Index: clang/test/OpenMP/driver-fopenmp-extensions.c
===
--- clang/test/OpenMP/driver-fopenmp-extensions.c
+++ clang/test/OpenMP/driver-fopenmp-extensions.c
@@ -1,20 +1,20 @@
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp %s
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd %s
+// RUN: %clang -c -fsyntax-only -Xclang -verify=ompx -fopenmp %s
+// RUN: %clang -c -fsyntax-only -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 -fsyntax-only -Xclang -verify=ompx -fopenmp -fopenmp-extensions %s
+// RUN: %clang -c -fsyntax-only -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 -fsyntax-only -Xclang -verify=omp -fopenmp -fno-openmp-extensions %s
+// RUN: %clang -c -fsyntax-only -Xclang -verify=omp -fopenmp-simd -fno-openmp-extensions %s
 
-// RUN: %clang -c -Xclang -verify=omp -fopenmp \
+// RUN: %clang -c -fsyntax-only -Xclang -verify=omp -fopenmp \
 // RUN: -fopenmp-extensions -fno-openmp-extensions %s
-// RUN: %clang -c -Xclang -verify=omp -fopenmp-simd \
+// RUN: %clang -c -fsyntax-only -Xclang -verify=omp -fopenmp-simd \
 // RUN: -fopenmp-extensions -fno-openmp-extensions %s
 
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp \
+// RUN: %clang -c -fsyntax-only -Xclang -verify=ompx -fopenmp \
 // RUN: -fno-openmp-extensions -fopenmp-extensions %s
-// RUN: %clang -c -Xclang -verify=ompx -fopenmp-simd \
+// RUN: %clang -c -fsyntax-only -Xclang -verify=ompx -fopenmp-simd \
 // RUN: -fno-openmp-extensions -fopenmp-extensions %s
 
 void foo() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-09-03 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

I think I might have to apply this same logic to the other functions changed in 
the original commit as well, this seems to solve this isolated case, but I 
think there are some more cases that aren't currently fixed by this


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109128/new/

https://reviews.llvm.org/D109128

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


[PATCH] D109191: [clang] fix error recovery ICE on copy elision when returing invalid variable

2021-09-03 Thread Matheus Izvekov via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd98c34f4d795: [clang] fix error recovery ICE on copy elision 
when returing invalid variable (authored by mizvekov).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109191/new/

https://reviews.llvm.org/D109191

Files:
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/CXX/class/class.init/class.copy.elision/p3.cpp


Index: clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
===
--- clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
+++ clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
@@ -518,3 +518,37 @@
 template X test_dependent_invalid_decl(); // expected-note 
{{requested here}}
 
 } // namespace test_auto_variables
+
+namespace PR51708 {
+
+class a1;  // expected-note 4 {{forward declaration of 
'PR51708::a1'}}
+template  class A2; // expected-note 4 {{template is declared here}}
+using a2 = A2;
+
+template  b f() {
+  // expected-error@-1 {{incomplete result type 'PR51708::a1' in function 
definition}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  b d;
+  // expected-error@-1 {{variable has incomplete type 'PR51708::a1'}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  return d;
+}
+template a1 f(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+template a2 f(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+
+template  b g() {
+  // expected-error@-1 {{incomplete result type 'PR51708::a1' in function 
definition}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  b d __attribute__((aligned(1)));
+  // expected-error@-1 {{variable has incomplete type 'PR51708::a1'}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  return d;
+}
+template a1 g(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+template a2 g(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+
+} // namespace PR51708
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1087,7 +1087,7 @@
 
   SemaRef.BuildVariableInstantiation(Var, D, TemplateArgs, LateAttrs, Owner,
  StartingScope, InstantiatingVarTemplate);
-  if (D->isNRVOVariable()) {
+  if (D->isNRVOVariable() && !Var->isInvalidDecl()) {
 QualType RT;
 if (auto *F = dyn_cast(DC))
   RT = F->getReturnType();


Index: clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
===
--- clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
+++ clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
@@ -518,3 +518,37 @@
 template X test_dependent_invalid_decl(); // expected-note {{requested here}}
 
 } // namespace test_auto_variables
+
+namespace PR51708 {
+
+class a1;  // expected-note 4 {{forward declaration of 'PR51708::a1'}}
+template  class A2; // expected-note 4 {{template is declared here}}
+using a2 = A2;
+
+template  b f() {
+  // expected-error@-1 {{incomplete result type 'PR51708::a1' in function definition}}
+  // expected-error@-2 {{implicit instantiation of undefined template 'PR51708::A2}}
+
+  b d;
+  // expected-error@-1 {{variable has incomplete type 'PR51708::a1'}}
+  // expected-error@-2 {{implicit instantiation of undefined template 'PR51708::A2}}
+
+  return d;
+}
+template a1 f(); // expected-note-re {{in instantiation {{.*}} requested here}}
+template a2 f(); // expected-note-re {{in instantiation {{.*}} requested here}}
+
+template  b g() {
+  // expected-error@-1 {{incomplete result type 'PR51708::a1' in function definition}}
+  // expected-error@-2 {{implicit instantiation of undefined template 'PR51708::A2}}
+
+  b d __attribute__((aligned(1)));
+  // expected-error@-1 {{variable has incomplete type 'PR51708::a1'}}
+  // expected-error@-2 {{implicit instantiation of undefined template 'PR51708::A2}}
+
+  return d;
+}
+template a1 g(); // expected-note-re {{in instantiation {{.*}} requested here}}
+template a2 g(); // expected-note-re {{in instantiation {{.*}} requested here}}
+
+} // namespace PR51708
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1087,7 +1087,7 @@
 
   SemaRef.BuildVariableInstantiation(Var, D, TemplateArgs, LateAttrs, Owner,
  StartingScope, InstantiatingVarTemplate);
-  if 

[clang] d98c34f - [clang] fix error recovery ICE on copy elision when returing invalid variable

2021-09-03 Thread Matheus Izvekov via cfe-commits

Author: Matheus Izvekov
Date: 2021-09-03T20:34:08+02:00
New Revision: d98c34f4d7950f531661ba3f498222ccf6239a0f

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

LOG: [clang] fix error recovery ICE on copy elision when returing invalid 
variable

See PR51708.

Attempting copy elision in dependent contexts with invalid variable,
such as a variable with incomplete type, would cause a crash when attempting
to calculate it's alignment.

The fix is to just skip this optimization on invalid VarDecl, as otherwise this
provides no benefit to error recovery: This functionality does not try to
diagnose anything, it only calculates a flag which will affect where the
variable will be allocated during codegen.

Signed-off-by: Matheus Izvekov 

Reviewed By: rtrieu

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

Added: 


Modified: 
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/CXX/class/class.init/class.copy.elision/p3.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp 
b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index d33c2545b4844..54ba12e0e644f 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1087,7 +1087,7 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D,
 
   SemaRef.BuildVariableInstantiation(Var, D, TemplateArgs, LateAttrs, Owner,
  StartingScope, InstantiatingVarTemplate);
-  if (D->isNRVOVariable()) {
+  if (D->isNRVOVariable() && !Var->isInvalidDecl()) {
 QualType RT;
 if (auto *F = dyn_cast(DC))
   RT = F->getReturnType();

diff  --git a/clang/test/CXX/class/class.init/class.copy.elision/p3.cpp 
b/clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
index cd981264c9b69..7055acad6ccf9 100644
--- a/clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
+++ b/clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
@@ -518,3 +518,37 @@ template  X test_dependent_invalid_decl() {
 template X test_dependent_invalid_decl(); // expected-note 
{{requested here}}
 
 } // namespace test_auto_variables
+
+namespace PR51708 {
+
+class a1;  // expected-note 4 {{forward declaration of 
'PR51708::a1'}}
+template  class A2; // expected-note 4 {{template is declared here}}
+using a2 = A2;
+
+template  b f() {
+  // expected-error@-1 {{incomplete result type 'PR51708::a1' in function 
definition}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  b d;
+  // expected-error@-1 {{variable has incomplete type 'PR51708::a1'}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  return d;
+}
+template a1 f(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+template a2 f(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+
+template  b g() {
+  // expected-error@-1 {{incomplete result type 'PR51708::a1' in function 
definition}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  b d __attribute__((aligned(1)));
+  // expected-error@-1 {{variable has incomplete type 'PR51708::a1'}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  return d;
+}
+template a1 g(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+template a2 g(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+
+} // namespace PR51708



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


[PATCH] D109175: [openmp] Add clang cc1 option -fopenmp-skip-deferred-diags

2021-09-03 Thread Wei Wang via Phabricator via cfe-commits
weiwang updated this revision to Diff 370630.
weiwang added a comment.

update


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109175/new/

https://reviews.llvm.org/D109175

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/OpenMP/declare_target_messages.cpp
  clang/test/SemaCUDA/openmp-target.cu


Index: clang/test/SemaCUDA/openmp-target.cu
===
--- clang/test/SemaCUDA/openmp-target.cu
+++ clang/test/SemaCUDA/openmp-target.cu
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -triple x86_64 -verify=expected,dev \
 // RUN:-verify-ignore-unexpected=note \
-// RUN:-fopenmp -fopenmp-version=50 -o - %s
+// RUN:-fopenmp -fopenmp-version=50 
-fopenmp-targets=amdgcn-amd-amdhsa -o - %s
 // RUN: %clang_cc1 -triple x86_64 -verify -verify-ignore-unexpected=note\
-// RUN:-fopenmp -fopenmp-version=50 -o - -x c++ %s
+// RUN:-fopenmp -fopenmp-version=50 
-fopenmp-targets=amdgcn-amd-amdhsa -o - -x c++ %s
 // RUN: %clang_cc1 -triple x86_64 -verify=dev -verify-ignore-unexpected=note\
 // RUN:-fcuda-is-device -o - %s
 
Index: clang/test/OpenMP/declare_target_messages.cpp
===
--- clang/test/OpenMP/declare_target_messages.cpp
+++ clang/test/OpenMP/declare_target_messages.cpp
@@ -1,11 +1,12 @@
 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp45 
-fopenmp -fopenmp-version=45 -fnoopenmp-use-tls -ferror-limit 100 -o - %s
-// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 
-verify=expected,omp5,host5 -fopenmp -fnoopenmp-use-tls -ferror-limit 100 -o - 
%s
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 
-verify=expected,omp5,host5 -fopenmp -fopenmp-targets=x86_64-apple-macos10.7.0 
-fnoopenmp-use-tls -ferror-limit 100 -o - %s
 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp5,dev5 
-fopenmp -fopenmp-is-device -fopenmp-targets=x86_64-apple-macos10.7.0 
-aux-triple x86_64-apple-macos10.7.0 -fnoopenmp-use-tls -ferror-limit 100 -o - 
%s
 
-// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 
-verify=expected,omp5,host5 -fopenmp-simd -fnoopenmp-use-tls -ferror-limit 100 
-o - %s
-// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 
-verify=expected,omp5,host5 -fopenmp-simd -fopenmp-is-device -fnoopenmp-use-tls 
-ferror-limit 100 -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 
-verify=expected,omp5,host5 -fopenmp-simd 
-fopenmp-targets=x86_64-apple-macos10.7.0 -fnoopenmp-use-tls -ferror-limit 100 
-o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 
-verify=expected,omp5,host5 -fopenmp-simd -fopenmp-is-device 
-fopenmp-targets=x86_64-apple-macos10.7.0 -fnoopenmp-use-tls -ferror-limit 100 
-o - %s
 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp45 
-fopenmp-version=45 -fopenmp-simd -fnoopenmp-use-tls -ferror-limit 100 -o - %s
 
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp5 
-fopenmp -fnoopenmp-use-tls -ferror-limit 100 -o - %s
 #pragma omp end declare target // expected-error {{unexpected OpenMP directive 
'#pragma omp end declare target'}}
 
 int a, b, z; // omp5-error {{variable captured in declare target region must 
appear in a to clause}}
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -12609,7 +12609,9 @@
 VDecl->setInitStyle(VarDecl::ListInit);
   }
 
-  if (LangOpts.OpenMP && VDecl->isFileVarDecl())
+  if (LangOpts.OpenMP &&
+  (LangOpts.OpenMPIsDevice || !LangOpts.OMPTargetTriples.empty()) &&
+  VDecl->isFileVarDecl())
 DeclsToCheckForDeferredDiags.insert(VDecl);
   CheckCompleteVariableDeclaration(VDecl);
 }
@@ -14839,7 +14841,9 @@
 DiscardCleanupsInEvaluationContext();
   }
 
-  if (FD && (LangOpts.OpenMP || LangOpts.CUDA || LangOpts.SYCLIsDevice)) {
+  if (FD && ((LangOpts.OpenMP && (LangOpts.OpenMPIsDevice ||
+  !LangOpts.OMPTargetTriples.empty())) ||
+ LangOpts.CUDA || LangOpts.SYCLIsDevice)) {
 auto ES = getEmissionStatus(FD);
 if (ES == Sema::FunctionEmissionStatus::Emitted ||
 ES == Sema::FunctionEmissionStatus::Unknown)


Index: clang/test/SemaCUDA/openmp-target.cu
===
--- clang/test/SemaCUDA/openmp-target.cu
+++ clang/test/SemaCUDA/openmp-target.cu
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -triple x86_64 -verify=expected,dev \
 // RUN:-verify-ignore-unexpected=note \
-// RUN:-fopenmp -fopenmp-version=50 -o - %s
+// RUN:-fopenmp -fopenmp-version=50 -fopenmp-targets=amdgcn-amd-amdhsa -o - %s
 // RUN: %clang_cc1 -triple x86_64 -verify -verify-ignore-unexpected=note\
-// RUN:-fopenmp -fopenmp-version=50 -o - -x c++ %s
+// RUN:-fopenmp -fopenmp-version=50 

[PATCH] D102943: [modules] Use `HashBuilder` and `MD5` for the module hash.

2021-09-03 Thread Alexandre Rames via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG655bea4226b4: [modules] Use `HashBuilder` and `MD5` for the 
module hash. (authored by arames).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102943/new/

https://reviews.llvm.org/D102943

Files:
  clang/include/clang/Basic/ObjCRuntime.h
  clang/include/clang/Basic/Sanitizers.h
  clang/include/clang/Lex/HeaderSearchOptions.h
  clang/include/clang/Serialization/ModuleFileExtension.h
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Frontend/TestModuleFileExtension.cpp
  clang/lib/Frontend/TestModuleFileExtension.h
  clang/lib/Serialization/ModuleFileExtension.cpp
  clang/unittests/Frontend/CompilerInvocationTest.cpp
  llvm/include/llvm/Support/VersionTuple.h

Index: llvm/include/llvm/Support/VersionTuple.h
===
--- llvm/include/llvm/Support/VersionTuple.h
+++ llvm/include/llvm/Support/VersionTuple.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/Optional.h"
+#include "llvm/Support/HashBuilder.h"
 #include 
 #include 
 
@@ -164,6 +165,12 @@
 return llvm::hash_combine(VT.Major, VT.Minor, VT.Subminor, VT.Build);
   }
 
+  template 
+  friend void addHash(HashBuilderImpl ,
+  const VersionTuple ) {
+HBuilder.add(VT.Major, VT.Minor, VT.Subminor, VT.Build);
+  }
+
   /// Retrieve a string representation of the version number.
   std::string getAsString() const;
 
Index: clang/unittests/Frontend/CompilerInvocationTest.cpp
===
--- clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -860,9 +860,7 @@
 return {};
   };
 
-  llvm::hash_code hashExtension(llvm::hash_code Code) const override {
-return {};
-  }
+  void hashExtension(ExtensionHashBuilder ) const override {}
 
   std::unique_ptr
   createExtensionWriter(ASTWriter ) override {
Index: clang/lib/Serialization/ModuleFileExtension.cpp
===
--- clang/lib/Serialization/ModuleFileExtension.cpp
+++ clang/lib/Serialization/ModuleFileExtension.cpp
@@ -11,12 +11,10 @@
 
 char ModuleFileExtension::ID = 0;
 
-ModuleFileExtension::~ModuleFileExtension() { }
+ModuleFileExtension::~ModuleFileExtension() {}
 
-llvm::hash_code ModuleFileExtension::hashExtension(llvm::hash_code Code) const {
-  return Code;
-}
+void ModuleFileExtension::hashExtension(ExtensionHashBuilder ) const {}
 
-ModuleFileExtensionWriter::~ModuleFileExtensionWriter() { }
+ModuleFileExtensionWriter::~ModuleFileExtensionWriter() {}
 
-ModuleFileExtensionReader::~ModuleFileExtensionReader() { }
+ModuleFileExtensionReader::~ModuleFileExtensionReader() {}
Index: clang/lib/Frontend/TestModuleFileExtension.h
===
--- clang/lib/Frontend/TestModuleFileExtension.h
+++ clang/lib/Frontend/TestModuleFileExtension.h
@@ -55,7 +55,7 @@
 
   ModuleFileExtensionMetadata getExtensionMetadata() const override;
 
-  llvm::hash_code hashExtension(llvm::hash_code Code) const override;
+  void hashExtension(ExtensionHashBuilder ) const override;
 
   std::unique_ptr
   createExtensionWriter(ASTWriter ) override;
Index: clang/lib/Frontend/TestModuleFileExtension.cpp
===
--- clang/lib/Frontend/TestModuleFileExtension.cpp
+++ clang/lib/Frontend/TestModuleFileExtension.cpp
@@ -93,16 +93,14 @@
   return { BlockName, MajorVersion, MinorVersion, UserInfo };
 }
 
-llvm::hash_code TestModuleFileExtension::hashExtension(
-  llvm::hash_code Code) const {
+void TestModuleFileExtension::hashExtension(
+ExtensionHashBuilder ) const {
   if (Hashed) {
-Code = llvm::hash_combine(Code, BlockName);
-Code = llvm::hash_combine(Code, MajorVersion);
-Code = llvm::hash_combine(Code, MinorVersion);
-Code = llvm::hash_combine(Code, UserInfo);
+HBuilder.add(BlockName);
+HBuilder.add(MajorVersion);
+HBuilder.add(MinorVersion);
+HBuilder.add(UserInfo);
   }
-
-  return Code;
 }
 
 std::unique_ptr
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -78,6 +78,7 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/HashBuilder.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -4476,116 +4477,99 @@
 }
 
 std::string CompilerInvocation::getModuleHash() const {
+  // FIXME: Consider using SHA1 instead of MD5.
+  llvm::HashBuilder HBuilder;
+
   // Note: For QoI reasons, the things we use as a 

[clang] 655bea4 - [modules] Use `HashBuilder` and `MD5` for the module hash.

2021-09-03 Thread Alexandre Rames via cfe-commits

Author: Alexandre Rames
Date: 2021-09-03T11:13:36-07:00
New Revision: 655bea4226b401a11164f99c6344e38d8742b8e4

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

LOG: [modules] Use `HashBuilder` and `MD5` for the module hash.

Per the comments, `hash_code` values "are not stable to save or
persist", so are unsuitable for the module hash, which must persist
across compilations for the implicit module hashes to match. Note that
in practice, today, `hash_code` are stable. But this is an
implementation detail, with a clear `FIXME` indicating we should switch
to a per-execution seed.

The stability of `MD5` also allows modules cross-compilation use-cases.
The `size_t` underlying storage for `hash_code` varying across platforms
could cause mismatching hashes when cross-compiling from a 64bit
target to a 32bit target.

Note that native endianness is still used for the hash computation. So hashes
will differ between platforms of different endianness.

Reviewed By: jansvoboda11

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

Added: 


Modified: 
clang/include/clang/Basic/ObjCRuntime.h
clang/include/clang/Basic/Sanitizers.h
clang/include/clang/Lex/HeaderSearchOptions.h
clang/include/clang/Serialization/ModuleFileExtension.h
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Frontend/TestModuleFileExtension.cpp
clang/lib/Frontend/TestModuleFileExtension.h
clang/lib/Serialization/ModuleFileExtension.cpp
clang/unittests/Frontend/CompilerInvocationTest.cpp
llvm/include/llvm/Support/VersionTuple.h

Removed: 




diff  --git a/clang/include/clang/Basic/ObjCRuntime.h 
b/clang/include/clang/Basic/ObjCRuntime.h
index 26403bfa98c9d..30a5fde407541 100644
--- a/clang/include/clang/Basic/ObjCRuntime.h
+++ b/clang/include/clang/Basic/ObjCRuntime.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Triple.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/HashBuilder.h"
 #include "llvm/Support/VersionTuple.h"
 #include 
 
@@ -480,6 +481,12 @@ class ObjCRuntime {
   friend llvm::hash_code hash_value(const ObjCRuntime ) {
 return llvm::hash_combine(OCR.getKind(), OCR.getVersion());
   }
+
+  template 
+  friend void addHash(llvm::HashBuilderImpl ,
+  const ObjCRuntime ) {
+HBuilder.add(OCR.getKind(), OCR.getVersion());
+  }
 };
 
 raw_ostream <<(raw_ostream , const ObjCRuntime );

diff  --git a/clang/include/clang/Basic/Sanitizers.h 
b/clang/include/clang/Basic/Sanitizers.h
index b12a3b7821d7a..db53010645ae3 100644
--- a/clang/include/clang/Basic/Sanitizers.h
+++ b/clang/include/clang/Basic/Sanitizers.h
@@ -16,6 +16,7 @@
 
 #include "clang/Basic/LLVM.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/HashBuilder.h"
 #include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h"
 #include 
 #include 
@@ -72,6 +73,12 @@ class SanitizerMask {
 
   llvm::hash_code hash_value() const;
 
+  template 
+  friend void addHash(llvm::HashBuilderImpl ,
+  const SanitizerMask ) {
+HBuilder.addRange([0], [kNumElem]);
+  }
+
   constexpr explicit operator bool() const {
 return maskLoToHigh[0] || maskLoToHigh[1];
   }

diff  --git a/clang/include/clang/Lex/HeaderSearchOptions.h 
b/clang/include/clang/Lex/HeaderSearchOptions.h
index 42f3cff8c57ae..4efdfc26c3c67 100644
--- a/clang/include/clang/Lex/HeaderSearchOptions.h
+++ b/clang/include/clang/Lex/HeaderSearchOptions.h
@@ -14,10 +14,11 @@
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/HashBuilder.h"
 #include 
+#include 
 #include 
 #include 
-#include 
 
 namespace clang {
 
@@ -256,11 +257,23 @@ inline llvm::hash_code hash_value(const 
HeaderSearchOptions::Entry ) {
   return llvm::hash_combine(E.Path, E.Group, E.IsFramework, E.IgnoreSysRoot);
 }
 
+template 
+inline void addHash(llvm::HashBuilderImpl ,
+const HeaderSearchOptions::Entry ) {
+  HBuilder.add(E.Path, E.Group, E.IsFramework, E.IgnoreSysRoot);
+}
+
 inline llvm::hash_code
 hash_value(const HeaderSearchOptions::SystemHeaderPrefix ) {
   return llvm::hash_combine(SHP.Prefix, SHP.IsSystemHeader);
 }
 
+template 
+inline void addHash(llvm::HashBuilderImpl ,
+const HeaderSearchOptions::SystemHeaderPrefix ) {
+  HBuilder.add(SHP.Prefix, SHP.IsSystemHeader);
+}
+
 } // namespace clang
 
 #endif // LLVM_CLANG_LEX_HEADERSEARCHOPTIONS_H

diff  --git a/clang/include/clang/Serialization/ModuleFileExtension.h 
b/clang/include/clang/Serialization/ModuleFileExtension.h
index 34ea870724a4c..3e84a65c4b805 100644
--- a/clang/include/clang/Serialization/ModuleFileExtension.h
+++ b/clang/include/clang/Serialization/ModuleFileExtension.h
@@ -11,13 +11,14 @@
 
 

[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-09-03 Thread Keith Smiley via Phabricator via cfe-commits
keith added a comment.

In D109128#2982780 , @JDevlieghere 
wrote:

> I'm sure I'm missing something, but after rereading the patch several times I 
> still don't see the functional change. It just looks like it's renaming every 
> instance of `Path` to `CanonicalPath` and `Path_` to `Path`?

The functional change is not changing line 2016 and 2029 to use the newly named 
`CanonicalPath` when they did before. This was a bit more clear before I 
changed that variable name (but this is overall better IMO)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109128/new/

https://reviews.llvm.org/D109128

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


[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-09-03 Thread Jonas Devlieghere via Phabricator via cfe-commits
JDevlieghere added a comment.

I'm sure I'm missing something, but after rereading the patch several times I 
still don't see the functional change. It just looks like it's renaming every 
instance of `Path` to `CanonicalPath` and `Path_` to `Path`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109128/new/

https://reviews.llvm.org/D109128

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


[PATCH] D108972: [clangd] Omit type hints that are too long

2021-09-03 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

In D108972#2981893 , @kadircet wrote:

> A stepping stone would be to just truncate all the template arguments (e.g. 
> `tuple, foo>` becomes `tuple<...>` even if `tuple, 
> foo<...>>` could fit under the limit).

I was thinking the same thing :) I will write a patch to do this as a follow-up.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108972/new/

https://reviews.llvm.org/D108972

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-03 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc added inline comments.



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:25
 
 // Checks if loop unroll is invoked by normal compile, but not thinlto compile.
 // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll

tejohnson wrote:
> It seems this test is explicitly checking for loop unrolling, so I'm not sure 
> if it will fundamentally work the same if loop unrolling is off. Do you know 
> why the below checking that "loop unroll is invoked by normal compile, but 
> not thinlto compile" is not failing due to your target's change?
> 
> I wonder if this test should be converted somehow to an LLVM test.
Thats a good question. I guess I was too focused on the failing test below.

In the above file `samplepgo_nounroll.ll` I had ran this test on just the x86 
backend without thinlto and with loop unrolling disabled in clang, but the loop 
still unrolled and the test passed. (Same story with the custom backend I am 
working on)

After changing the loop iterations from 2 to 3 then the test was failing which 
should have been the correct behavior with loop unrolling disabled. Not 100% 
sure on this but it looks as if a SimplifyCFG pass was unrolling the loop when 
it was 2 iterations, but not 3. So it looks like this needs to be changed if 
testing whether the loop-unroll pass was used.

Knowing this, I'm not sure what the next step would be. I dont know if any of 
the upstream backends had disabled loop unrolling, or how this could be tested 
in a target-independent way. (I'm quite new to LLVM)



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109234/new/

https://reviews.llvm.org/D109234

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


[PATCH] D108695: [analyzer][NFCI] Allow clients of NoStateChangeFuncVisitor to check entire function calls, rather than each ExplodedNode in it

2021-09-03 Thread Jessica Paquette via Phabricator via cfe-commits
paquette added a comment.

I just reverted this again because of a bot failure here:

https://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/23380/consoleFull

Please fix and recommit!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108695/new/

https://reviews.llvm.org/D108695

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


[clang] b9e57e0 - Revert "[analyzer][NFCI] Allow clients of NoStateChangeFuncVisitor to check entire function calls, rather than each ExplodedNode in it"

2021-09-03 Thread Jessica Paquette via cfe-commits

Author: Jessica Paquette
Date: 2021-09-03T10:28:07-07:00
New Revision: b9e57e030560fef9ddc51caca8bacfefccdf8a62

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

LOG: Revert "[analyzer][NFCI] Allow clients of NoStateChangeFuncVisitor to 
check entire function calls, rather than each ExplodedNode in it"

This reverts commit a375bfb5b729e0f3ca8d5e001f423fa89e74de87.

This was causing a bot to crash:

https://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/23380/

Added: 


Modified: 
clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
clang/unittests/StaticAnalyzer/CMakeLists.txt
clang/unittests/StaticAnalyzer/CallEventTest.cpp
clang/unittests/StaticAnalyzer/CheckerRegistration.h
clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp
clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp

Removed: 
clang/unittests/StaticAnalyzer/NoStateChangeFuncVisitorTest.cpp



diff  --git 
a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h 
b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
index c42521376af92..139b0dcd51704 100644
--- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
+++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
@@ -633,9 +633,6 @@ class CXXConstructorCall;
 /// Descendants can define what a "state change is", like a change of value
 /// to a memory region, liveness, etc. For function calls where the state did
 /// not change as defined, a custom note may be constructed.
-///
-/// For a minimal example, check out
-/// clang/unittests/StaticAnalyzer/NoStateChangeFuncVisitorTest.cpp.
 class NoStateChangeFuncVisitor : public BugReporterVisitor {
 private:
   /// Frames modifying the state as defined in \c wasModifiedBeforeCallExit.
@@ -646,8 +643,6 @@ class NoStateChangeFuncVisitor : public BugReporterVisitor {
   /// many times (going up the path for each node and checking whether the
   /// region was written into) we instead lazily compute the stack frames
   /// along the path.
-  // TODO: Can't we just use a map instead? This is likely not as cheap as it
-  // makes the code 
diff icult to read.
   llvm::SmallPtrSet FramesModifying;
   llvm::SmallPtrSet FramesModifyingCalculated;
 
@@ -656,8 +651,6 @@ class NoStateChangeFuncVisitor : public BugReporterVisitor {
   /// The calculation is cached in FramesModifying.
   bool isModifiedInFrame(const ExplodedNode *CallExitBeginN);
 
-  void markFrameAsModifying(const StackFrameContext *SCtx);
-
   /// Write to \c FramesModifying all stack frames along the path in the 
current
   /// stack frame which modifies the state.
   void findModifyingFrames(const ExplodedNode *const CallExitBeginN);
@@ -665,37 +658,11 @@ class NoStateChangeFuncVisitor : public 
BugReporterVisitor {
 protected:
   bugreporter::TrackingKind TKind;
 
-  /// \return Whether the state was modified from the current node, \p CurrN, 
to
-  /// the end of the stack frame, at \p CallExitBeginN. \p CurrN and
-  /// \p CallExitBeginN are always in the same stack frame.
-  /// Clients should override this callback when a state change is important
-  /// not only on the entire function call, but inside of it as well.
-  /// Example: we may want to leave a note about the lack of locking/unlocking
-  /// on a particular mutex, but not if inside the function its state was
-  /// changed, but also restored. wasModifiedInFunction() wouldn't know of this
-  /// change.
-  virtual bool wasModifiedBeforeCallExit(const ExplodedNode *CurrN,
- const ExplodedNode *CallExitBeginN) {
-return false;
-  }
-
-  /// \return Whether the state was modified in the inlined function call in
-  /// between \p CallEnterN and \p CallExitEndN. Mind that the stack frame
-  /// retrieved from a CallEnterN and CallExitEndN is the *caller's* stack
-  /// frame! The inlined function's stack should be retrieved from either the
-  /// immediate successor to \p CallEnterN or immediate predecessor to
-  /// \p CallExitEndN.
-  /// Clients should override this function if a state changes local to the
-  /// inlined function are not interesting, only the change occuring as a
-  /// result of it.
-  /// Example: we want to leave a not about a leaked resource object not being
-  /// deallocated / its ownership changed inside a function, and we don't care
-  /// if it was assigned to a local variable (its change in ownership is
-  /// inconsequential).
-  virtual bool wasModifiedInFunction(const ExplodedNode *CallEnterN,
- const 

[PATCH] D108696: [Coroutines] [Frontend] Lookup in std namespace first

2021-09-03 Thread Gulfem Savrun Yeniceri via Phabricator via cfe-commits
gulfem added a comment.

We started seeing the following test failures in our Fuchsia builds after this 
patch:

  Failed Tests (10):
libc++ :: 
libcxx/experimental/language.support/support.coroutines/dialect_support.pass.cpp
libc++ :: 
std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp
libc++ :: 
std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp
libc++ :: 
std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp
libc++ :: 
std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp
libc++ :: 
std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp
libc++ :: 
std/experimental/language.support/support.coroutines/end.to.end/generator.pass.cpp
libc++ :: 
std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp
libc++ :: 
std/experimental/language.support/support.coroutines/end.to.end/multishot_func.pass.cpp
libc++ :: 
std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp

https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8837144494402864417/+/u/clang/test/stdout

Do you have any idea what might be going wrong?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108696/new/

https://reviews.llvm.org/D108696

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


[PATCH] D107339: [analyzer] Retrieve a character from StringLiteral as an initializer for constant arrays.

2021-09-03 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 370611.
ASDenysPetrov edited the summary of this revision.
ASDenysPetrov added a comment.

Adjusted the patch according to changes in the parent revision D104285 
.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107339/new/

https://reviews.llvm.org/D107339

Files:
  clang/lib/StaticAnalyzer/Core/RegionStore.cpp
  clang/test/Analysis/initialization.cpp

Index: clang/test/Analysis/initialization.cpp
===
--- clang/test/Analysis/initialization.cpp
+++ clang/test/Analysis/initialization.cpp
@@ -128,3 +128,39 @@
   // FIXME: Should warn {{garbage or undefined}}.
   auto x = ptr[idx]; // // no-warning
 }
+
+char const glob_arr6[5] = "123";
+void glob_array_index4() {
+  clang_analyzer_eval(glob_arr6[0] == '1');  // expected-warning{{TRUE}}
+  clang_analyzer_eval(glob_arr6[1] == '2');  // expected-warning{{TRUE}}
+  clang_analyzer_eval(glob_arr6[2] == '3');  // expected-warning{{TRUE}}
+  clang_analyzer_eval(glob_arr6[3] == '\0'); // expected-warning{{TRUE}}
+  clang_analyzer_eval(glob_arr6[4] == '\0'); // expected-warning{{TRUE}}
+}
+
+void glob_ptr_index3() {
+  char const *ptr = glob_arr6;
+  clang_analyzer_eval(ptr[-42] == '\0'); // expected-warning{{UNDEFINED}}
+  clang_analyzer_eval(ptr[0] == '1');// expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[1] == '2');// expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[2] == '3');// expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[3] == '\0');   // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[4] == '\0');   // expected-warning{{TRUE}}
+  // FIXME: Should be UNDEFINED.
+  clang_analyzer_eval(ptr[5] == '\0'); // expected-warning{{TRUE}}
+  // FIXME: Should be UNDEFINED.
+  clang_analyzer_eval(ptr[6] == '\0'); // expected-warning{{TRUE}}
+}
+
+void glob_invalid_index7() {
+  int idx = -42;
+  auto x = glob_arr6[idx]; // expected-warning{{garbage or undefined}}
+}
+
+// TODO: Support multidimensional array.
+void glob_invalid_index8() {
+  const char *ptr = glob_arr6;
+  int idx = 42;
+  // FIXME: Should warn {{garbage or undefined}}.
+  auto x = ptr[idx]; // no-warning
+}
Index: clang/lib/StaticAnalyzer/Core/RegionStore.cpp
===
--- clang/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ clang/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -573,6 +573,8 @@
   SVal getBindingForFieldOrElementCommon(RegionBindingsConstRef B,
  const TypedValueRegion *R,
  QualType Ty);
+  SVal getSValFromStringLiteralByIndex(const StringLiteral *SL,
+   const llvm::APSInt , QualType ElemT);
 
   SVal getLazyBinding(const SubRegion *LazyBindingRegion,
   RegionBindingsRef LazyBinding);
@@ -1625,6 +1627,23 @@
   return Result;
 }
 
+SVal RegionStoreManager::getSValFromStringLiteralByIndex(
+const StringLiteral *SL, const llvm::APSInt , QualType ElemT) {
+  assert(SL && "StringLiteral should not be null");
+  // If index is out of bounds, return Undef.
+  if (Idx < 0)
+return UndefinedVal();
+  // Technically, only i == length is guaranteed to be null.
+  // However, such overflows should be caught before reaching this point;
+  // the only time such an access would be made is if a string literal was
+  // used to initialize a larger array.
+  // FIXME: Take array dimension into account to prevent exceeding its size.
+  const int64_t I = Idx.getExtValue();
+  uint32_t Code =
+  (static_cast(I) >= SL->getLength()) ? 0 : SL->getCodeUnit(I);
+  return svalBuilder.makeIntVal(Code, ElemT);
+}
+
 SVal RegionStoreManager::getBindingForElement(RegionBindingsConstRef B,
   const ElementRegion* R) {
   // Check if the region has a binding.
@@ -1636,26 +1655,16 @@
   // Check if the region is an element region of a string literal.
   if (const StringRegion *StrR = dyn_cast(superR)) {
 // FIXME: Handle loads from strings where the literal is treated as
-// an integer, e.g., *((unsigned int*)"hello")
+// an integer, e.g., *((unsigned int*)"hello"). Such loads are UB according
+// to C++20 7.2.1.11 [basic.lval].
 QualType T = Ctx.getAsArrayType(StrR->getValueType())->getElementType();
 if (!Ctx.hasSameUnqualifiedType(T, R->getElementType()))
   return UnknownVal();
 
-const StringLiteral *Str = StrR->getStringLiteral();
 SVal Idx = R->getIndex();
 if (Optional CI = Idx.getAs()) {
-  int64_t i = CI->getValue().getSExtValue();
-  // Abort on string underrun.  This can be possible by arbitrary
-  // clients of getBindingForElement().
-  if (i < 0)
-return UndefinedVal();
-  int64_t length = Str->getLength();
-  // Technically, only i == length is guaranteed to be null.
-  // However, such overflows should be caught 

[PATCH] D108556: [clangd] Don't highlight ObjC `id` and `instancetype`

2021-09-03 Thread David Goldman via Phabricator via cfe-commits
dgoldman added a comment.

In D108556#2981712 , @kadircet wrote:

> Hmm, it sounds like you want them to be treated one way during semantic 
> highlighting and another during other features, which is fine but somewhat 
> confusing. (e.g. we want to surface hover/goto on these identifiers, but 
> we're making them less visible by encouraging editors to highlight them as 
> keywords).

I went ahead and just ignored them in FindTarget (LMK if that's right) - I 
think you're right that it's unlikely to provide any real value so we might as 
well not support it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108556/new/

https://reviews.llvm.org/D108556

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


[PATCH] D108556: [clangd] Don't highlight ObjC `id` and `instancetype`

2021-09-03 Thread David Goldman via Phabricator via cfe-commits
dgoldman updated this revision to Diff 370609.
dgoldman added a comment.

Swap to ignore in FindTarget


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108556/new/

https://reviews.llvm.org/D108556

Files:
  clang-tools-extra/clangd/FindTarget.cpp
  clang-tools-extra/clangd/unittests/FindTargetTests.cpp
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp


Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -661,13 +661,15 @@
 @interface $Class_decl[[Foo]]
 @end
 @interface $Class_decl[[Bar]] : $Class[[Foo]]
--($Class[[id]]) $Method_decl[[x]]:(int)$Parameter_decl[[a]] 
$Method_decl[[y]]:(int)$Parameter_decl[[b]];
+-(id) $Method_decl[[x]]:(int)$Parameter_decl[[a]] 
$Method_decl[[y]]:(int)$Parameter_decl[[b]];
++(instancetype)$StaticMethod_decl_static[[sharedInstance]];
 +(void) $StaticMethod_decl_static[[explode]];
 @end
 @implementation $Class_decl[[Bar]]
--($Class[[id]]) $Method_decl[[x]]:(int)$Parameter_decl[[a]] 
$Method_decl[[y]]:(int)$Parameter_decl[[b]] {
+-(id) $Method_decl[[x]]:(int)$Parameter_decl[[a]] 
$Method_decl[[y]]:(int)$Parameter_decl[[b]] {
   return self;
 }
++(instancetype)$StaticMethod_decl_static[[sharedInstance]] { return 0; 
}
 +(void) $StaticMethod_decl_static[[explode]] {}
 @end
 
Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -995,6 +995,20 @@
 }
   )cpp";
   EXPECT_DECLS("ObjCPropertyRefExpr", "+ (id)sharedInstance");
+
+  Code = R"cpp(
+@interface Foo
++ ([[id]])sharedInstance;
+@end
+  )cpp";
+  EXPECT_DECLS("TypedefTypeLoc");
+
+  Code = R"cpp(
+@interface Foo
++ ([[instancetype]])sharedInstance;
+@end
+  )cpp";
+  EXPECT_DECLS("TypedefTypeLoc");
 }
 
 class FindExplicitReferencesTest : public ::testing::Test {
Index: clang-tools-extra/clangd/FindTarget.cpp
===
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -94,6 +94,17 @@
   return nullptr;
 }
 
+// Returns true if the `TypedefNameDecl` should not be reported.
+bool shouldSkipTypedef(const TypedefNameDecl *TD) {
+  // Even though ObjC `id` and `instancetype` are *implemented* via typedefs, 
we
+  // don't want to treat them like typedefs - instead let the editor treat
+  // them like keywords.
+  if (TD == TD->getASTContext().getObjCInstanceTypeDecl() ||
+  TD == TD->getASTContext().getObjCIdDecl())
+return true;
+  return false;
+}
+
 // TargetFinder locates the entities that an AST node refers to.
 //
 // Typically this is (possibly) one declaration and (possibly) one type, but
@@ -174,6 +185,8 @@
   D = UDD->getNominatedNamespaceAsWritten();
 
 if (const TypedefNameDecl *TND = dyn_cast(D)) {
+  if (shouldSkipTypedef(TND))
+return;
   add(TND->getUnderlyingType(), Flags | Rel::Underlying);
   Flags |= Rel::Alias; // continue with the alias.
 } else if (const UsingDecl *UD = dyn_cast(D)) {
@@ -395,6 +408,8 @@
 }
   }
   void VisitTypedefType(const TypedefType *TT) {
+if (shouldSkipTypedef(TT->getDecl()))
+  return;
 Outer.add(TT->getDecl(), Flags);
   }
   void
@@ -903,6 +918,8 @@
 }
 
 void VisitTypedefTypeLoc(TypedefTypeLoc L) {
+  if (shouldSkipTypedef(L.getTypedefNameDecl()))
+return;
   Refs.push_back(ReferenceLoc{NestedNameSpecifierLoc(),
   L.getNameLoc(),
   /*IsDecl=*/false,


Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -661,13 +661,15 @@
 @interface $Class_decl[[Foo]]
 @end
 @interface $Class_decl[[Bar]] : $Class[[Foo]]
--($Class[[id]]) $Method_decl[[x]]:(int)$Parameter_decl[[a]] $Method_decl[[y]]:(int)$Parameter_decl[[b]];
+-(id) $Method_decl[[x]]:(int)$Parameter_decl[[a]] $Method_decl[[y]]:(int)$Parameter_decl[[b]];
++(instancetype)$StaticMethod_decl_static[[sharedInstance]];
 +(void) $StaticMethod_decl_static[[explode]];
 @end
 @implementation $Class_decl[[Bar]]
--($Class[[id]]) $Method_decl[[x]]:(int)$Parameter_decl[[a]] $Method_decl[[y]]:(int)$Parameter_decl[[b]] {
+-(id) 

[PATCH] D109244: [clang] Allow the OpenBSD driver to link the libclang_rt.profile library.

2021-09-03 Thread Frederic Cambus via Phabricator via cfe-commits
fcambus created this revision.
fcambus added a reviewer: brad.
fcambus requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

With this change, passing -fprofile-instr-generate -fcoverage-mapping
when building programs will attempt linking against libclang_rt.profile.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109244

Files:
  clang/lib/Driver/ToolChains/OpenBSD.cpp


Index: clang/lib/Driver/ToolChains/OpenBSD.cpp
===
--- clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -223,6 +223,8 @@
 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend)));
   }
 
+  ToolChain.addProfileRTLibs(Args, CmdArgs);
+
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
   C.addCommand(std::make_unique(JA, *this,
  ResponseFileSupport::AtFileCurCP(),


Index: clang/lib/Driver/ToolChains/OpenBSD.cpp
===
--- clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -223,6 +223,8 @@
 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend)));
   }
 
+  ToolChain.addProfileRTLibs(Args, CmdArgs);
+
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
   C.addCommand(std::make_unique(JA, *this,
  ResponseFileSupport::AtFileCurCP(),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108424: [NFC][clang] Move multiversion resolver code generation to llvm/ subdirectory

2021-09-03 Thread Andrei Elovikov via Phabricator via cfe-commits
a.elovikov added a comment.

ping.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108424/new/

https://reviews.llvm.org/D108424

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


[PATCH] D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled

2021-09-03 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added inline comments.



Comment at: clang/test/CodeGen/pgo-sample-thinlto-summary.c:25
 
 // Checks if loop unroll is invoked by normal compile, but not thinlto compile.
 // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @unroll

It seems this test is explicitly checking for loop unrolling, so I'm not sure 
if it will fundamentally work the same if loop unrolling is off. Do you know 
why the below checking that "loop unroll is invoked by normal compile, but not 
thinlto compile" is not failing due to your target's change?

I wonder if this test should be converted somehow to an LLVM test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109234/new/

https://reviews.llvm.org/D109234

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


[PATCH] D108584: [clangd] Use the active file's language for hover code blocks

2021-09-03 Thread David Goldman via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2982bd9e9b58: [clangd] Use the active files language 
for hover code blocks (authored by dgoldman).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108584/new/

https://reviews.llvm.org/D108584

Files:
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp


Index: clang-tools-extra/clangd/unittests/HoverTests.cpp
===
--- clang-tools-extra/clangd/unittests/HoverTests.cpp
+++ clang-tools-extra/clangd/unittests/HoverTests.cpp
@@ -939,6 +939,39 @@
   }
 }
 
+TEST(Hover, DefinitionLanuage) {
+  struct {
+const char *const Code;
+const std::string ClangLanguageFlag;
+const char *const ExpectedDefinitionLanguage;
+  } Cases[] = {{R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"", "cpp"},
+   {R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"-xobjective-c++", "objective-cpp"},
+   {R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"-xobjective-c", "objective-c"}};
+  for (const auto  : Cases) {
+SCOPED_TRACE(Case.Code);
+
+Annotations T(Case.Code);
+TestTU TU = TestTU::withCode(T.code());
+if (!Case.ClangLanguageFlag.empty())
+  TU.ExtraArgs.push_back(Case.ClangLanguageFlag);
+auto AST = TU.build();
+
+auto H = getHover(AST, T.point(), format::getLLVMStyle(), nullptr);
+ASSERT_TRUE(H);
+
+EXPECT_STREQ(H->DefinitionLanguage, Case.ExpectedDefinitionLanguage);
+  }
+}
+
 TEST(Hover, CallPassType) {
   const llvm::StringRef CodePrefix = R"cpp(
 class Base {};
Index: clang-tools-extra/clangd/Hover.cpp
===
--- clang-tools-extra/clangd/Hover.cpp
+++ clang-tools-extra/clangd/Hover.cpp
@@ -131,6 +131,13 @@
   return Definition;
 }
 
+const char *getMarkdownLanguage(const ASTContext ) {
+  const auto  = Ctx.getLangOpts();
+  if (LangOpts.ObjC && LangOpts.CPlusPlus)
+return "objective-cpp";
+  return LangOpts.ObjC ? "objective-c" : "cpp";
+}
+
 std::string printType(QualType QT, const PrintingPolicy ) {
   // TypePrinter doesn't resolve decltypes, so resolve them here.
   // FIXME: This doesn't handle composite types that contain a decltype in 
them.
@@ -1007,6 +1014,7 @@
   if (auto Formatted =
   tooling::applyAllReplacements(HI->Definition, Replacements))
 HI->Definition = *Formatted;
+  HI->DefinitionLanguage = getMarkdownLanguage(AST.getASTContext());
   HI->SymRange = halfOpenToRange(SM, HighlightRange);
 
   return HI;


Index: clang-tools-extra/clangd/unittests/HoverTests.cpp
===
--- clang-tools-extra/clangd/unittests/HoverTests.cpp
+++ clang-tools-extra/clangd/unittests/HoverTests.cpp
@@ -939,6 +939,39 @@
   }
 }
 
+TEST(Hover, DefinitionLanuage) {
+  struct {
+const char *const Code;
+const std::string ClangLanguageFlag;
+const char *const ExpectedDefinitionLanguage;
+  } Cases[] = {{R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"", "cpp"},
+   {R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"-xobjective-c++", "objective-cpp"},
+   {R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"-xobjective-c", "objective-c"}};
+  for (const auto  : Cases) {
+SCOPED_TRACE(Case.Code);
+
+Annotations T(Case.Code);
+TestTU TU = TestTU::withCode(T.code());
+if (!Case.ClangLanguageFlag.empty())
+  TU.ExtraArgs.push_back(Case.ClangLanguageFlag);
+auto AST = TU.build();
+
+auto H = getHover(AST, T.point(), format::getLLVMStyle(), nullptr);
+ASSERT_TRUE(H);
+
+EXPECT_STREQ(H->DefinitionLanguage, Case.ExpectedDefinitionLanguage);
+  }
+}
+
 TEST(Hover, CallPassType) {
   const llvm::StringRef CodePrefix = R"cpp(
 class Base {};
Index: clang-tools-extra/clangd/Hover.cpp
===
--- clang-tools-extra/clangd/Hover.cpp
+++ clang-tools-extra/clangd/Hover.cpp
@@ -131,6 +131,13 @@
   return Definition;
 }
 
+const char *getMarkdownLanguage(const ASTContext ) {
+  const auto  = Ctx.getLangOpts();
+  if (LangOpts.ObjC && LangOpts.CPlusPlus)
+return "objective-cpp";
+  return LangOpts.ObjC ? "objective-c" : "cpp";
+}
+
 std::string printType(QualType QT, const PrintingPolicy ) {
   // TypePrinter doesn't resolve decltypes, so resolve them here.
   // FIXME: This doesn't handle composite types that contain a decltype in them.
@@ -1007,6 +1014,7 @@
   if (auto Formatted =
   tooling::applyAllReplacements(HI->Definition, Replacements))
 HI->Definition = *Formatted;
+  HI->DefinitionLanguage = 

[clang-tools-extra] 2982bd9 - [clangd] Use the active file's language for hover code blocks

2021-09-03 Thread David Goldman via cfe-commits

Author: David Goldman
Date: 2021-09-03T11:38:27-04:00
New Revision: 2982bd9e9b58ea17bc047ffb9b28df6f92531287

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

LOG: [clangd] Use the active file's language for hover code blocks

This helps improve the syntax highlighting for Objective-C code,
although it currently doesn't work well in VS Code with
methods/properties/ivars since we don't currently include the proper
decl context (e.g. class).

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

Added: 


Modified: 
clang-tools-extra/clangd/Hover.cpp
clang-tools-extra/clangd/unittests/HoverTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/Hover.cpp 
b/clang-tools-extra/clangd/Hover.cpp
index 763125cd10f5f..8ef7d20c1d535 100644
--- a/clang-tools-extra/clangd/Hover.cpp
+++ b/clang-tools-extra/clangd/Hover.cpp
@@ -131,6 +131,13 @@ std::string printDefinition(const Decl *D, const 
PrintingPolicy ) {
   return Definition;
 }
 
+const char *getMarkdownLanguage(const ASTContext ) {
+  const auto  = Ctx.getLangOpts();
+  if (LangOpts.ObjC && LangOpts.CPlusPlus)
+return "objective-cpp";
+  return LangOpts.ObjC ? "objective-c" : "cpp";
+}
+
 std::string printType(QualType QT, const PrintingPolicy ) {
   // TypePrinter doesn't resolve decltypes, so resolve them here.
   // FIXME: This doesn't handle composite types that contain a decltype in 
them.
@@ -1007,6 +1014,7 @@ llvm::Optional getHover(ParsedAST , 
Position Pos,
   if (auto Formatted =
   tooling::applyAllReplacements(HI->Definition, Replacements))
 HI->Definition = *Formatted;
+  HI->DefinitionLanguage = getMarkdownLanguage(AST.getASTContext());
   HI->SymRange = halfOpenToRange(SM, HighlightRange);
 
   return HI;

diff  --git a/clang-tools-extra/clangd/unittests/HoverTests.cpp 
b/clang-tools-extra/clangd/unittests/HoverTests.cpp
index 457cc55dd19a0..72efe5ab6ad87 100644
--- a/clang-tools-extra/clangd/unittests/HoverTests.cpp
+++ b/clang-tools-extra/clangd/unittests/HoverTests.cpp
@@ -939,6 +939,39 @@ class Foo {})cpp";
   }
 }
 
+TEST(Hover, DefinitionLanuage) {
+  struct {
+const char *const Code;
+const std::string ClangLanguageFlag;
+const char *const ExpectedDefinitionLanguage;
+  } Cases[] = {{R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"", "cpp"},
+   {R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"-xobjective-c++", "objective-cpp"},
+   {R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"-xobjective-c", "objective-c"}};
+  for (const auto  : Cases) {
+SCOPED_TRACE(Case.Code);
+
+Annotations T(Case.Code);
+TestTU TU = TestTU::withCode(T.code());
+if (!Case.ClangLanguageFlag.empty())
+  TU.ExtraArgs.push_back(Case.ClangLanguageFlag);
+auto AST = TU.build();
+
+auto H = getHover(AST, T.point(), format::getLLVMStyle(), nullptr);
+ASSERT_TRUE(H);
+
+EXPECT_STREQ(H->DefinitionLanguage, Case.ExpectedDefinitionLanguage);
+  }
+}
+
 TEST(Hover, CallPassType) {
   const llvm::StringRef CodePrefix = R"cpp(
 class Base {};



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


[PATCH] D108584: [clangd] Use the active file's language for hover code blocks

2021-09-03 Thread David Goldman via Phabricator via cfe-commits
dgoldman updated this revision to Diff 370590.
dgoldman added a comment.

Remove unnecessary build flag


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108584/new/

https://reviews.llvm.org/D108584

Files:
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp


Index: clang-tools-extra/clangd/unittests/HoverTests.cpp
===
--- clang-tools-extra/clangd/unittests/HoverTests.cpp
+++ clang-tools-extra/clangd/unittests/HoverTests.cpp
@@ -939,6 +939,39 @@
   }
 }
 
+TEST(Hover, DefinitionLanuage) {
+  struct {
+const char *const Code;
+const std::string ClangLanguageFlag;
+const char *const ExpectedDefinitionLanguage;
+  } Cases[] = {{R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"", "cpp"},
+   {R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"-xobjective-c++", "objective-cpp"},
+   {R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"-xobjective-c", "objective-c"}};
+  for (const auto  : Cases) {
+SCOPED_TRACE(Case.Code);
+
+Annotations T(Case.Code);
+TestTU TU = TestTU::withCode(T.code());
+if (!Case.ClangLanguageFlag.empty())
+  TU.ExtraArgs.push_back(Case.ClangLanguageFlag);
+auto AST = TU.build();
+
+auto H = getHover(AST, T.point(), format::getLLVMStyle(), nullptr);
+ASSERT_TRUE(H);
+
+EXPECT_STREQ(H->DefinitionLanguage, Case.ExpectedDefinitionLanguage);
+  }
+}
+
 TEST(Hover, CallPassType) {
   const llvm::StringRef CodePrefix = R"cpp(
 class Base {};
Index: clang-tools-extra/clangd/Hover.cpp
===
--- clang-tools-extra/clangd/Hover.cpp
+++ clang-tools-extra/clangd/Hover.cpp
@@ -131,6 +131,13 @@
   return Definition;
 }
 
+const char *getMarkdownLanguage(const ASTContext ) {
+  const auto  = Ctx.getLangOpts();
+  if (LangOpts.ObjC && LangOpts.CPlusPlus)
+return "objective-cpp";
+  return LangOpts.ObjC ? "objective-c" : "cpp";
+}
+
 std::string printType(QualType QT, const PrintingPolicy ) {
   // TypePrinter doesn't resolve decltypes, so resolve them here.
   // FIXME: This doesn't handle composite types that contain a decltype in 
them.
@@ -1007,6 +1014,7 @@
   if (auto Formatted =
   tooling::applyAllReplacements(HI->Definition, Replacements))
 HI->Definition = *Formatted;
+  HI->DefinitionLanguage = getMarkdownLanguage(AST.getASTContext());
   HI->SymRange = halfOpenToRange(SM, HighlightRange);
 
   return HI;


Index: clang-tools-extra/clangd/unittests/HoverTests.cpp
===
--- clang-tools-extra/clangd/unittests/HoverTests.cpp
+++ clang-tools-extra/clangd/unittests/HoverTests.cpp
@@ -939,6 +939,39 @@
   }
 }
 
+TEST(Hover, DefinitionLanuage) {
+  struct {
+const char *const Code;
+const std::string ClangLanguageFlag;
+const char *const ExpectedDefinitionLanguage;
+  } Cases[] = {{R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"", "cpp"},
+   {R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"-xobjective-c++", "objective-cpp"},
+   {R"cpp(
+  void [[some^Global]]() {}
+  )cpp",
+"-xobjective-c", "objective-c"}};
+  for (const auto  : Cases) {
+SCOPED_TRACE(Case.Code);
+
+Annotations T(Case.Code);
+TestTU TU = TestTU::withCode(T.code());
+if (!Case.ClangLanguageFlag.empty())
+  TU.ExtraArgs.push_back(Case.ClangLanguageFlag);
+auto AST = TU.build();
+
+auto H = getHover(AST, T.point(), format::getLLVMStyle(), nullptr);
+ASSERT_TRUE(H);
+
+EXPECT_STREQ(H->DefinitionLanguage, Case.ExpectedDefinitionLanguage);
+  }
+}
+
 TEST(Hover, CallPassType) {
   const llvm::StringRef CodePrefix = R"cpp(
 class Base {};
Index: clang-tools-extra/clangd/Hover.cpp
===
--- clang-tools-extra/clangd/Hover.cpp
+++ clang-tools-extra/clangd/Hover.cpp
@@ -131,6 +131,13 @@
   return Definition;
 }
 
+const char *getMarkdownLanguage(const ASTContext ) {
+  const auto  = Ctx.getLangOpts();
+  if (LangOpts.ObjC && LangOpts.CPlusPlus)
+return "objective-cpp";
+  return LangOpts.ObjC ? "objective-c" : "cpp";
+}
+
 std::string printType(QualType QT, const PrintingPolicy ) {
   // TypePrinter doesn't resolve decltypes, so resolve them here.
   // FIXME: This doesn't handle composite types that contain a decltype in them.
@@ -1007,6 +1014,7 @@
   if (auto Formatted =
   tooling::applyAllReplacements(HI->Definition, Replacements))
 HI->Definition = *Formatted;
+  HI->DefinitionLanguage = getMarkdownLanguage(AST.getASTContext());
   HI->SymRange = halfOpenToRange(SM, HighlightRange);
 
   return HI;
___
cfe-commits 

[PATCH] D108753: [analyzer] MallocChecker: Add notes from NoOwnershipChangeVisitor only when a function "intents", but doesn't change ownership, enable by default

2021-09-03 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision.
martong added a comment.
This revision is now accepted and ready to land.

Okay, LGTM! Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108753/new/

https://reviews.llvm.org/D108753

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


[PATCH] D109232: [CUDA][NFC] Fix a wrong assert message

2021-09-03 Thread Ben Shi via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG12fee64daf57: [CUDA][NFC] Fix wrong assert information 
(authored by benshi001).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109232/new/

https://reviews.llvm.org/D109232

Files:
  clang/lib/Driver/Driver.cpp


Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -2635,7 +2635,7 @@
   assert(CudaDeviceActions.size() == GpuArchList.size() &&
  "Expecting one action per GPU architecture.");
   assert(ToolChains.size() == 1 &&
- "Expecting to have a sing CUDA toolchain.");
+ "Expecting to have a single CUDA toolchain.");
   for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I)
 AddTopLevel(CudaDeviceActions[I], GpuArchList[I]);
 


Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -2635,7 +2635,7 @@
   assert(CudaDeviceActions.size() == GpuArchList.size() &&
  "Expecting one action per GPU architecture.");
   assert(ToolChains.size() == 1 &&
- "Expecting to have a sing CUDA toolchain.");
+ "Expecting to have a single CUDA toolchain.");
   for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I)
 AddTopLevel(CudaDeviceActions[I], GpuArchList[I]);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 12fee64 - [CUDA][NFC] Fix wrong assert information

2021-09-03 Thread Ben Shi via cfe-commits

Author: Ben Shi
Date: 2021-09-03T22:35:42+08:00
New Revision: 12fee64daf576c9f4a91fab8ddd5eb512fa14307

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

LOG: [CUDA][NFC] Fix wrong assert information

Reviewed By: fodinabor

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

Added: 


Modified: 
clang/lib/Driver/Driver.cpp

Removed: 




diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 82eacf27dcd7b..4b56a97da717b 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -2635,7 +2635,7 @@ class OffloadingActionBuilder final {
   assert(CudaDeviceActions.size() == GpuArchList.size() &&
  "Expecting one action per GPU architecture.");
   assert(ToolChains.size() == 1 &&
- "Expecting to have a sing CUDA toolchain.");
+ "Expecting to have a single CUDA toolchain.");
   for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I)
 AddTopLevel(CudaDeviceActions[I], GpuArchList[I]);
 



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


[PATCH] D109178: [PowerPC] Disable vector types when not supported by subtarget features

2021-09-03 Thread Victor Huang via Phabricator via cfe-commits
NeHuang added inline comments.



Comment at: clang/test/CodeGen/builtins-ppc-int128.c:4
+// RUN:   -triple powerpc64-unknown-unknown -target-cpu pwr8 \
+// RUN:  -emit-llvm %s -o - -U__XL_COMPAT_ALTIVEC__ | FileCheck %s
+// RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \

nit: indentation 



Comment at: clang/test/Parser/altivec.c:92
 // These should have errors.
+#ifndef __VSX__
 __vector double vv_d1;   // expected-error {{use of 'double' with 
'__vector' requires VSX support to be enabled (available on POWER7 or later)}}

Will this patch also impact `vector double`?   If not, can we move `#ifndef 
__VSX__` down below `vector double v_d2;`?  



Comment at: clang/test/Parser/cxx-altivec.cpp:91
 
-// These should have errors.
+#ifndef __VSX__
+// These should have errors for non pwr7 vsx builds.

same as above.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109178/new/

https://reviews.llvm.org/D109178

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


[PATCH] D109232: [CUDA][NFC] Fix a wrong assert message

2021-09-03 Thread Joachim Meyer via Phabricator via cfe-commits
fodinabor accepted this revision.
fodinabor added a comment.
This revision is now accepted and ready to land.

LGTM, guess this can be commited right away.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109232/new/

https://reviews.llvm.org/D109232

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


[PATCH] D109234: Change ThinLTO test for targets with loop unrolling disabled

2021-09-03 Thread Sherwin via Phabricator via cfe-commits
sherwin-dc created this revision.
Herald added subscribers: ormris, wenlei, pengfei, steven_wu, hiraditya, 
inglorion.
sherwin-dc requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

I am working on a target in a downstream LLVM repo, and it seems that if a 
target backend chooses to disable loop unrolling this test would fail. A 
solution would be to modify the test to search for a different string instead.

The specific test checks for `if.true.direct_targ` which appears in the output 
when thinlto is not used (ie samplepgo). The same is true for 
`if.false.orig_indirect`.

However, if a target disables loop unrolling in the backend, the test fails as  
`if.true.direct_targ` no longer appears, though `if.false.orig_indirect` still 
does. This can be seen by using a clang pragma to disable loop unrolling in the 
`unroll()` function.

For reference, the following files are the outputs of the last 2 test functions 
being compiled as the test case does, with and without thinlto, and with and 
without loop unrolling on the latest x86 clang build. The loop unrolling pragma 
was used to simulate the loop unrolling being disabled in a backend.

  // RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
out.ll
  // RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o out.ll

F18832230: samplepgo_unroll.ll 

F18832229: thinlto_unroll.ll 

F18832228: thinlto_nounroll.ll 

F18832227: samplepgo_nounroll.ll 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109234

Files:
  clang/test/CodeGen/pgo-sample-thinlto-summary.c


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -37,10 +37,10 @@
 // Checks that icp is not invoked for ThinLTO, but invoked for normal 
samplepgo.
 // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp
 // THINLTO-LABEL: define {{(dso_local )?}}void @icp
-// SAMPLEPGO: if.true.direct_targ
+// SAMPLEPGO: if.false.orig_indirect
 // FIXME: the following condition needs to be reversed once
 //LTOPreLinkDefaultPipeline is customized.
-// THINLTO-NOT: if.true.direct_targ
+// THINLTO-NOT: if.false.orig_indirect
 void icp(void (*p)()) {
   p();
 }


Index: clang/test/CodeGen/pgo-sample-thinlto-summary.c
===
--- clang/test/CodeGen/pgo-sample-thinlto-summary.c
+++ clang/test/CodeGen/pgo-sample-thinlto-summary.c
@@ -37,10 +37,10 @@
 // Checks that icp is not invoked for ThinLTO, but invoked for normal samplepgo.
 // SAMPLEPGO-LABEL: define {{(dso_local )?}}void @icp
 // THINLTO-LABEL: define {{(dso_local )?}}void @icp
-// SAMPLEPGO: if.true.direct_targ
+// SAMPLEPGO: if.false.orig_indirect
 // FIXME: the following condition needs to be reversed once
 //LTOPreLinkDefaultPipeline is customized.
-// THINLTO-NOT: if.true.direct_targ
+// THINLTO-NOT: if.false.orig_indirect
 void icp(void (*p)()) {
   p();
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108912: [release][analyzer] Add 13.0.0 release notes

2021-09-03 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment.

In D108912#2982201 , @Szelethus wrote:

> In D108912#2982169 , @RedDocMD 
> wrote:
>
>> I suppose that the `SmartPtrModelling` patches from GSoC this year shouldn't 
>> be added since they only involve an alpha checker.
>
> Actually, you also patched the enabled-by-default modeling part of smart 
> pointers, haven't you? Those definitely deserve their mention!

Well, a part of it is in `0cd98bef1b6f [analyzer] Handle std::swap for 
std::unique_ptr`.
The other major portion is in destructor modelling 
, and this patch hasn't landed yet.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108912/new/

https://reviews.llvm.org/D108912

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


[PATCH] D107049: [clang-repl] Re-implement clang-interpreter as a test case.

2021-09-03 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment.

In D107049#2982224 , @thakis wrote:

> Thanks for fixing! Intel macs are happy now.
>
> But the test is still failing on arm macs: 
> http://45.33.8.238/macm1/17292/step_7.txt
>
>   FAIL: Clang-Unit :: 
> Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests/InterpreterTest.CatchException
>  (28440 of 28440)
>    TEST 'Clang-Unit :: 
> Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests/InterpreterTest.CatchException'
>  FAILED 
>   Script:
>   --
>   
> /Users/thakis/src/llvm-project/out/gn/obj/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests
>  --gtest_filter=InterpreterTest.CatchException
>   --
>   Note: Google Test filter = InterpreterTest.CatchException
>   [==] Running 1 test from 1 test suite.
>   [--] Global test environment set-up.
>   [--] 1 test from InterpreterTest
>   [ RUN  ] InterpreterTest.CatchException
>   libunwind: malformed __unwind_info at 0x192029E3C bad second level page
>   libunwind: malformed __unwind_info at 0x192029E3C bad second level page
>   libunwind: malformed __unwind_info at 0x192029E3C bad second level page
>   libunwind: malformed __unwind_info at 0x192029E3C bad second level page
>   libunwind: malformed __unwind_info at 0x192029E3C bad second level page
>   libunwind: malformed __unwind_info at 0x192029E3C bad second level page
>   libunwind: malformed __unwind_info at 0x192029E3C bad second level page
>   libunwind: malformed __unwind_info at 0x192029E3C bad second level page
>   
>
> Please take a look.

Yes, thanks for this information -- it fails also on hexagon so reverted it 
again :(


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107049/new/

https://reviews.llvm.org/D107049

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


[PATCH] D109232: [CUDA][NFC] Fix a wrong assert message

2021-09-03 Thread Ben Shi via Phabricator via cfe-commits
benshi001 created this revision.
benshi001 added reviewers: tra, Hahnfeld, fodinabor, yaxunl.
benshi001 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109232

Files:
  clang/lib/Driver/Driver.cpp


Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -2635,7 +2635,7 @@
   assert(CudaDeviceActions.size() == GpuArchList.size() &&
  "Expecting one action per GPU architecture.");
   assert(ToolChains.size() == 1 &&
- "Expecting to have a sing CUDA toolchain.");
+ "Expecting to have a single CUDA toolchain.");
   for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I)
 AddTopLevel(CudaDeviceActions[I], GpuArchList[I]);
 


Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -2635,7 +2635,7 @@
   assert(CudaDeviceActions.size() == GpuArchList.size() &&
  "Expecting one action per GPU architecture.");
   assert(ToolChains.size() == 1 &&
- "Expecting to have a sing CUDA toolchain.");
+ "Expecting to have a single CUDA toolchain.");
   for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I)
 AddTopLevel(CudaDeviceActions[I], GpuArchList[I]);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 8859640 - Revert "Reland "[clang-repl] Re-implement clang-interpreter as a test case.""

2021-09-03 Thread Vassil Vassilev via cfe-commits

Author: Vassil Vassilev
Date: 2021-09-03T13:18:09Z
New Revision: 8859640461149065ece1fbcdfed78f17f04a4926

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

LOG: Revert "Reland "[clang-repl] Re-implement clang-interpreter as a test 
case.""

This reverts commit 6fe2beba7d2a41964af658c8c59dd172683ef739 which fails on
clang-hexagon-elf

Added: 
clang/examples/clang-interpreter/CMakeLists.txt
clang/examples/clang-interpreter/README.txt
clang/examples/clang-interpreter/Test.cxx
clang/test/Misc/interpreter.c

Modified: 
clang/docs/ClangFormattedStatus.rst
clang/examples/CMakeLists.txt
clang/include/clang/Interpreter/Interpreter.h
clang/lib/Interpreter/IncrementalExecutor.cpp
clang/lib/Interpreter/IncrementalExecutor.h
clang/lib/Interpreter/Interpreter.cpp
clang/test/CMakeLists.txt
clang/test/lit.cfg.py
clang/unittests/Interpreter/CMakeLists.txt
clang/unittests/Interpreter/InterpreterTest.cpp

Removed: 
clang/unittests/Interpreter/ExceptionTests/CMakeLists.txt
clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp



diff  --git a/clang/docs/ClangFormattedStatus.rst 
b/clang/docs/ClangFormattedStatus.rst
index 77320cd2b6550..beca555ebc016 100644
--- a/clang/docs/ClangFormattedStatus.rst
+++ b/clang/docs/ClangFormattedStatus.rst
@@ -59,6 +59,11 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 04, 2021 13:01:37
  - `1`
  - `0`
  - :good:`100%`
+   * - clang/examples/clang-interpreter
+ - `1`
+ - `0`
+ - `1`
+ - :none:`0%`
* - clang/examples/PrintFunctionNames
  - `1`
  - `0`

diff  --git a/clang/examples/CMakeLists.txt b/clang/examples/CMakeLists.txt
index 8a4139f5d8c11..300d8d795c674 100644
--- a/clang/examples/CMakeLists.txt
+++ b/clang/examples/CMakeLists.txt
@@ -3,6 +3,7 @@ if(NOT CLANG_BUILD_EXAMPLES)
   set(EXCLUDE_FROM_ALL ON)
 endif()
 
+add_subdirectory(clang-interpreter)
 add_subdirectory(PrintFunctionNames)
 add_subdirectory(AnnotateFunctions)
 add_subdirectory(Attribute)

diff  --git a/clang/examples/clang-interpreter/CMakeLists.txt 
b/clang/examples/clang-interpreter/CMakeLists.txt
new file mode 100644
index 0..11056aa379ae8
--- /dev/null
+++ b/clang/examples/clang-interpreter/CMakeLists.txt
@@ -0,0 +1,93 @@
+set(LLVM_LINK_COMPONENTS
+  Core
+  ExecutionEngine
+  MC
+  MCJIT
+  Object
+  OrcJit
+  Option
+  RuntimeDyld
+  Support
+  native
+  )
+
+add_clang_executable(clang-interpreter
+  main.cpp
+  )
+
+add_dependencies(clang-interpreter
+  clang-resource-headers
+  )
+
+clang_target_link_libraries(clang-interpreter
+  PRIVATE
+  clangBasic
+  clangCodeGen
+  clangDriver
+  clangFrontend
+  clangSerialization
+  )
+
+export_executable_symbols(clang-interpreter)
+
+if (MSVC)
+  # Is this a CMake bug that even with export_executable_symbols, Windows
+  # needs to explictly export the type_info vtable
+  set_property(TARGET clang-interpreter
+   APPEND_STRING PROPERTY LINK_FLAGS " /EXPORT:??_7type_info@@6B@")
+endif()
+
+function(clang_enable_exceptions TARGET)
+  # Really have to jump through hoops to enable exception handling independent
+  # of how LLVM is being built.
+  if (NOT LLVM_REQUIRES_EH AND NOT LLVM_REQUIRES_RTTI)
+if (MSVC)
+  # /EHs to allow throwing from extern "C"
+  set(excptnExceptions_ON "/D _HAS_EXCEPTIONS=1 /EHs /wd4714")
+  set(excptnExceptions_OFF "/D _HAS_EXCEPTIONS=0 /EHs-c-")
+  set(excptnRTTI_ON "/GR")
+  set(excptnRTTI_OFF "/GR-")
+  set(excptnEHRTTIRegEx "(/EHs(-c-?)|_HAS_EXCEPTIONS=(0|1))")
+else()
+  set(excptnExceptions_ON "-fexceptions")
+  set(excptnExceptions_OFF "-fno-exceptions")
+  set(excptnRTTI_ON "-frtti")
+  set(excptnRTTI_OFF "-fno-rtti")
+  set(excptnEHRTTIRegEx "-f(exceptions|no-exceptions)")
+endif()
+if (LLVM_REQUIRES_EH)
+  set(excptnExceptions_DFLT ${excptnExceptions_ON})
+else()
+  set(excptnExceptions_DFLT ${excptnExceptions_OFF})
+endif()
+if (LLVM_REQUIRES_RTTI)
+  set(excptnRTTI_DFLT ${excptnRTTI_ON})
+else()
+  set(excptnRTTI_DFLT ${excptnRTTI_OFF})
+endif()
+
+# Strip the exception & rtti flags from the target
+get_property(addedFlags TARGET ${TARGET} PROPERTY COMPILE_FLAGS)
+string(REGEX REPLACE ${excptnEHRTTIRegEx} "" editedFlags "${addedFlags}")
+string(REPLACE ${excptnRTTI_OFF} "" editedFlags "${editedFlags}")
+set_property(TARGET ${TARGET} PROPERTY COMPILE_FLAGS "${editedFlags}")
+
+get_property(addedFlags TARGET ${TARGET} PROPERTY COMPILE_DEFINITIONS)
+string(REGEX REPLACE ${excptnEHRTTIRegEx} "" editedFlags "${addedFlags}")
+string(REPLACE ${excptnRTTI_OFF} "" editedFlags "${editedFlags}")
+set_property(TARGET ${TARGET} PROPERTY 

[PATCH] D107049: [clang-repl] Re-implement clang-interpreter as a test case.

2021-09-03 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Thanks for fixing! Intel macs are happy now.

But the test is still failing on arm macs: 
http://45.33.8.238/macm1/17292/step_7.txt

  FAIL: Clang-Unit :: 
Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests/InterpreterTest.CatchException
 (28440 of 28440)
   TEST 'Clang-Unit :: 
Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests/InterpreterTest.CatchException'
 FAILED 
  Script:
  --
  
/Users/thakis/src/llvm-project/out/gn/obj/clang/unittests/Interpreter/ExceptionTests/./ClangReplInterpreterExceptionTests
 --gtest_filter=InterpreterTest.CatchException
  --
  Note: Google Test filter = InterpreterTest.CatchException
  [==] Running 1 test from 1 test suite.
  [--] Global test environment set-up.
  [--] 1 test from InterpreterTest
  [ RUN  ] InterpreterTest.CatchException
  libunwind: malformed __unwind_info at 0x192029E3C bad second level page
  libunwind: malformed __unwind_info at 0x192029E3C bad second level page
  libunwind: malformed __unwind_info at 0x192029E3C bad second level page
  libunwind: malformed __unwind_info at 0x192029E3C bad second level page
  libunwind: malformed __unwind_info at 0x192029E3C bad second level page
  libunwind: malformed __unwind_info at 0x192029E3C bad second level page
  libunwind: malformed __unwind_info at 0x192029E3C bad second level page
  libunwind: malformed __unwind_info at 0x192029E3C bad second level page
  

Please take a look.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107049/new/

https://reviews.llvm.org/D107049

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


[PATCH] D108912: [release][analyzer] Add 13.0.0 release notes

2021-09-03 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

In D108912#2982169 , @RedDocMD wrote:

> I suppose that the `SmartPtrModelling` patches from GSoC this year shouldn't 
> be added since they only involve an alpha checker.

Actually, you also patched the enabled-by-default modeling part of smart 
pointers, haven't you? Those definitely deserve their mention!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108912/new/

https://reviews.llvm.org/D108912

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


[PATCH] D108912: [release][analyzer] Add 13.0.0 release notes

2021-09-03 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus marked an inline comment as done.
Szelethus added a comment.






Comment at: clang/docs/ReleaseNotes.rst:300-304
+.. 90377308de6c [analyzer] Support allocClassWithName in OSObjectCStyleCast 
checker
+
+- Add support for ``allocClassWithName`` in OSObjectCStyleCast checker.
+
+.. cad9b7f708e2b2d19d7890494980c5e427d6d4ea: Print time taken to analyze each 
function

whisperity wrote:
> Why is the commit prefix different between these two?
I copied them from the reviewer comments. Mind that this file is reset each 
release, and will likely never be read, so I figured it doesn't matter much :^) 
Its mostly there for me to double check whether I summarized the patch 
correctly.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108912/new/

https://reviews.llvm.org/D108912

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


[PATCH] D108912: [release][analyzer] Add 13.0.0 release notes

2021-09-03 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus updated this revision to Diff 370564.
Szelethus added a comment.

In D108912#2982169 , @RedDocMD wrote:

> I suppose that the `SmartPtrModelling` patches from GSoC this year shouldn't 
> be added since they only involve an alpha checker.

It would be a real shame if they went unrecognized! Added! (only those patches 
though that landed before the rc2 tag, which always happens right in the middle 
of GSoC projects.)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108912/new/

https://reviews.llvm.org/D108912

Files:
  clang/docs/ReleaseNotes.rst


Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -292,7 +292,53 @@
 Static Analyzer
 ---
 
-- ...
+.. 2407eb08a574 [analyzer] Update static analyzer to be support sarif-html
+
+- Add a new analyzer output type, ``sarif-html``, that outputs both HTML and
+  Sarif files.
+
+.. 90377308de6c [analyzer] Support allocClassWithName in OSObjectCStyleCast 
checker
+
+- Add support for ``allocClassWithName`` in OSObjectCStyleCast checker.
+
+.. cad9b7f708e2b2d19d7890494980c5e427d6d4ea: Print time taken to analyze each 
function
+
+- The option ``-analyzer-display-progress`` now also outputs analysis time for
+  each function.
+
+.. 9e02f58780ab8734e5d27a0138bd477d18ae64a1 [analyzer] Highlight arrows for 
currently selected event
+
+- For bug reports in HTML format, arrows are now highlighted for the currently
+  selected event.
+
+.. Deep Majumder's GSoC'21
+.. 80068ca6232b [analyzer] Fix for faulty namespace test in SmartPtrModelling
+.. d825309352b4 [analyzer] Handle std::make_unique
+.. 0cd98bef1b6f [analyzer] Handle std::swap for std::unique_ptr
+.. 13fe78212fe7 [analyzer] Handle << operator for std::unique_ptr
+.. 48688257c52d [analyzer] Model comparision methods of std::unique_ptr
+.. f8d3f47e1fd0 [analyzer] Updated comments to reflect D85817
+.. 21daada95079 [analyzer] Fix static_cast on pointer-to-member handling
+
+- While still in alpha, ``alpha.cplusplus.SmartPtr`` received numerous
+  improvements and nears production quality.
+
+.. 21daada95079 [analyzer] Fix static_cast on pointer-to-member handling
+.. 170c67d5b8cc [analyzer] Use the MacroExpansionContext for macro expansions 
in plists
+.. 02b51e5316cd [analyzer][solver] Redesign constraint ranges data structure
+.. 3085bda2b348 [analyzer][solver] Fix infeasible constraints (PR49642)
+.. 015c39882ebc [Analyzer] Infer 0 value when the divisible is 0 (bug fix)
+.. 90377308de6c [analyzer] Support allocClassWithName in OSObjectCStyleCast 
checker
+.. df64f471d1e2 [analyzer] DynamicSize: Store the dynamic size
+.. e273918038a7 [analyzer] Track leaking object through stores
+.. 61ae2db2d7a9 [analyzer] Adjust the reported variable name in retain count 
checker
+.. 50f17e9d3139 [analyzer] RetainCountChecker: Disable reference counting for 
OSMetaClass.
+
+- Various fixes and improvements, including modeling of casts (such as 
+  ``std::bit_cast<>``), constraint solving, explaining bug-causing variable
+  values, macro expansion notes, modeling the size of dynamic objects and the
+  modeling and reporting of Objective C/C++ retain count related bugs. These
+  should reduce false positives and make the remaining reports more readable.
 
 .. _release-notes-ubsan:
 


Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -292,7 +292,53 @@
 Static Analyzer
 ---
 
-- ...
+.. 2407eb08a574 [analyzer] Update static analyzer to be support sarif-html
+
+- Add a new analyzer output type, ``sarif-html``, that outputs both HTML and
+  Sarif files.
+
+.. 90377308de6c [analyzer] Support allocClassWithName in OSObjectCStyleCast checker
+
+- Add support for ``allocClassWithName`` in OSObjectCStyleCast checker.
+
+.. cad9b7f708e2b2d19d7890494980c5e427d6d4ea: Print time taken to analyze each function
+
+- The option ``-analyzer-display-progress`` now also outputs analysis time for
+  each function.
+
+.. 9e02f58780ab8734e5d27a0138bd477d18ae64a1 [analyzer] Highlight arrows for currently selected event
+
+- For bug reports in HTML format, arrows are now highlighted for the currently
+  selected event.
+
+.. Deep Majumder's GSoC'21
+.. 80068ca6232b [analyzer] Fix for faulty namespace test in SmartPtrModelling
+.. d825309352b4 [analyzer] Handle std::make_unique
+.. 0cd98bef1b6f [analyzer] Handle std::swap for std::unique_ptr
+.. 13fe78212fe7 [analyzer] Handle << operator for std::unique_ptr
+.. 48688257c52d [analyzer] Model comparision methods of std::unique_ptr
+.. f8d3f47e1fd0 [analyzer] Updated comments to reflect D85817
+.. 21daada95079 [analyzer] Fix static_cast on pointer-to-member handling
+
+- While still in alpha, ``alpha.cplusplus.SmartPtr`` received numerous
+  improvements and nears production quality.
+
+.. 

[PATCH] D108912: [release][analyzer] Add 13.0.0 release notes

2021-09-03 Thread Whisperity via Phabricator via cfe-commits
whisperity added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:300-304
+.. 90377308de6c [analyzer] Support allocClassWithName in OSObjectCStyleCast 
checker
+
+- Add support for ``allocClassWithName`` in OSObjectCStyleCast checker.
+
+.. cad9b7f708e2b2d19d7890494980c5e427d6d4ea: Print time taken to analyze each 
function

Why is the commit prefix different between these two?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108912/new/

https://reviews.llvm.org/D108912

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


[PATCH] D108912: [release][analyzer] Add 13.0.0 release notes

2021-09-03 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment.

I suppose that the `SmartPtrModelling` patches from GSoC this year shouldn't be 
added since they only involve an alpha checker.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108912/new/

https://reviews.llvm.org/D108912

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


[PATCH] D108912: [release][analyzer] Add 13.0.0 release notes

2021-09-03 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

In D108912#2972167 , @steakhal wrote:

> Maybe a couple other noteworthy commits:
> efa7df1682c2859dabe3646ee7dc01e68629417f 
> : better 
> R-value tracking.
> aa454dda2eed4e71081bc57b1f32dfce2486b177 
> : fixing 
> the modeling of `std::bit_cast<>`.

I added a bit more text to the final "various fixes" point, thanks! I didn't 
dedicate a new point for them though, because although we know how meaningful 
they are, in the grand scheme of things, I don't think they are as "flashy" 
from an end user's perspective. Even if they greatly increase confidence in the 
tool, and are harder to fix then writing a simple checker ;)

> cad9b7f708e2b2d19d7890494980c5e427d6d4ea 
> : Print 
> time taken to analyze each function

Good idea!

> 9cca5c1391d637b5500ada646cf136ddb38254a3 
> : Make 
> checker silencing work for non-pathsensitive bug reports. (It might be 
> valuable to highlight for other vendors.)

We're yet to iron out checker silencing, or finish its discussion before 
introducing it to the set of function intended for end users. I wouldn't like 
to advertise it before that happens.

In D108912#2976529 , @ASDenysPetrov 
wrote:

> Here is one more related to HTML diagnostics:
> rG9e02f58780ab8734e5d27a0138bd477d18ae64a1 
>  
> //Highlight arrows for currently selected event//

Good idea!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108912/new/

https://reviews.llvm.org/D108912

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


[PATCH] D108912: [release][analyzer] Add 13.0.0 release notes

2021-09-03 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus updated this revision to Diff 370561.
Szelethus added a comment.

Fixes according to reviewer comments, cheers!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108912/new/

https://reviews.llvm.org/D108912

Files:
  clang/docs/ReleaseNotes.rst


Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -292,7 +292,41 @@
 Static Analyzer
 ---
 
-- ...
+.. 2407eb08a574 [analyzer] Update static analyzer to be support sarif-html
+
+- Add a new analyzer output type, ``sarif-html``, that outputs both HTML and
+  Sarif files.
+
+.. 90377308de6c [analyzer] Support allocClassWithName in OSObjectCStyleCast 
checker
+
+- Add support for ``allocClassWithName`` in OSObjectCStyleCast checker.
+
+.. cad9b7f708e2b2d19d7890494980c5e427d6d4ea: Print time taken to analyze each 
function
+
+- The option ``-analyzer-display-progress`` now also outputs analysis time for
+  each function.
+
+.. 9e02f58780ab8734e5d27a0138bd477d18ae64a1 [analyzer] Highlight arrows for 
currently selected event
+
+- For bug reports in HTML format, arrows are now highlighted for the currently
+  selected event.
+
+.. 21daada95079 [analyzer] Fix static_cast on pointer-to-member handling
+.. 170c67d5b8cc [analyzer] Use the MacroExpansionContext for macro expansions 
in plists
+.. 02b51e5316cd [analyzer][solver] Redesign constraint ranges data structure
+.. 3085bda2b348 [analyzer][solver] Fix infeasible constraints (PR49642)
+.. 015c39882ebc [Analyzer] Infer 0 value when the divisible is 0 (bug fix)
+.. 90377308de6c [analyzer] Support allocClassWithName in OSObjectCStyleCast 
checker
+.. df64f471d1e2 [analyzer] DynamicSize: Store the dynamic size
+.. e273918038a7 [analyzer] Track leaking object through stores
+.. 61ae2db2d7a9 [analyzer] Adjust the reported variable name in retain count 
checker
+.. 50f17e9d3139 [analyzer] RetainCountChecker: Disable reference counting for 
OSMetaClass.
+
+- Various fixes and improvements, including modeling of casts (such as 
+  ``std::bit_cast<>``), constraint solving, explaining bug-causing variable
+  values, macro expansion notes, modeling the size of dynamic objects and the
+  modeling and reporting of Objective C/C++ retain count related bugs. These
+  should reduce false positives and make the remaining reports more readable.
 
 .. _release-notes-ubsan:
 


Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -292,7 +292,41 @@
 Static Analyzer
 ---
 
-- ...
+.. 2407eb08a574 [analyzer] Update static analyzer to be support sarif-html
+
+- Add a new analyzer output type, ``sarif-html``, that outputs both HTML and
+  Sarif files.
+
+.. 90377308de6c [analyzer] Support allocClassWithName in OSObjectCStyleCast checker
+
+- Add support for ``allocClassWithName`` in OSObjectCStyleCast checker.
+
+.. cad9b7f708e2b2d19d7890494980c5e427d6d4ea: Print time taken to analyze each function
+
+- The option ``-analyzer-display-progress`` now also outputs analysis time for
+  each function.
+
+.. 9e02f58780ab8734e5d27a0138bd477d18ae64a1 [analyzer] Highlight arrows for currently selected event
+
+- For bug reports in HTML format, arrows are now highlighted for the currently
+  selected event.
+
+.. 21daada95079 [analyzer] Fix static_cast on pointer-to-member handling
+.. 170c67d5b8cc [analyzer] Use the MacroExpansionContext for macro expansions in plists
+.. 02b51e5316cd [analyzer][solver] Redesign constraint ranges data structure
+.. 3085bda2b348 [analyzer][solver] Fix infeasible constraints (PR49642)
+.. 015c39882ebc [Analyzer] Infer 0 value when the divisible is 0 (bug fix)
+.. 90377308de6c [analyzer] Support allocClassWithName in OSObjectCStyleCast checker
+.. df64f471d1e2 [analyzer] DynamicSize: Store the dynamic size
+.. e273918038a7 [analyzer] Track leaking object through stores
+.. 61ae2db2d7a9 [analyzer] Adjust the reported variable name in retain count checker
+.. 50f17e9d3139 [analyzer] RetainCountChecker: Disable reference counting for OSMetaClass.
+
+- Various fixes and improvements, including modeling of casts (such as 
+  ``std::bit_cast<>``), constraint solving, explaining bug-causing variable
+  values, macro expansion notes, modeling the size of dynamic objects and the
+  modeling and reporting of Objective C/C++ retain count related bugs. These
+  should reduce false positives and make the remaining reports more readable.
 
 .. _release-notes-ubsan:
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109225: [clang-nvlink-wrapper] Add documentation in clang docs

2021-09-03 Thread Saiyedul Islam via Phabricator via cfe-commits
saiislam updated this revision to Diff 370559.
saiislam marked 14 inline comments as done.
saiislam added a comment.

1. Fixed wording as suggested.
2. Replaced hyperlink to generate html, using the :doc: tag as used in other 
places.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109225/new/

https://reviews.llvm.org/D109225

Files:
  clang/docs/ClangNvlinkWrapper.rst
  clang/docs/ReleaseNotes.rst
  clang/docs/index.rst
  clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp

Index: clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp
===
--- clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp
+++ clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp
@@ -13,7 +13,7 @@
 /// These temp (*.cubin) files are passed to nvlink, because nvlink does not
 /// support linking of archive files implicitly.
 ///
-/// During linking of heteregenous device archive libraries, the
+/// During linking of heterogeneous device archive libraries, the
 /// clang-offload-bundler creates a device specific archive of cubin files.
 /// Such an archive is then passed to this tool to extract cubin files before
 /// passing to nvlink.
@@ -60,7 +60,7 @@
   std::vector> ArchiveBuffers;
 
   ErrorOr> BufOrErr =
-  MemoryBuffer::getFileOrSTDIN(Filename, -1, false);
+  MemoryBuffer::getFileOrSTDIN(Filename, false, false);
   if (std::error_code EC = BufOrErr.getError())
 return createFileError(Filename, EC);
 
Index: clang/docs/index.rst
===
--- clang/docs/index.rst
+++ clang/docs/index.rst
@@ -80,6 +80,7 @@
ClangFormat
ClangFormatStyleOptions
ClangFormattedStatus
+   ClangNvlinkWrapper
ClangOffloadBundler
 
 Design Documents
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -147,7 +147,8 @@
 OpenMP Support in Clang
 ---
 
-- ...
+- ``clang-nvlink-wrapper`` tool introduced to support linking of cubin files archived in an archive. See :doc:`ClangNvlinkWrapper`.
+
 
 CUDA Support in Clang
 -
Index: clang/docs/ClangNvlinkWrapper.rst
===
--- /dev/null
+++ clang/docs/ClangNvlinkWrapper.rst
@@ -0,0 +1,57 @@
+
+Clang Nvlink Wrapper
+
+
+.. contents::
+   :local:
+
+.. _clang-nvlink-wrapper:
+
+Introduction
+
+
+This tool works as a wrapper over the ``nvlink`` program. It is required
+because ``nvlink`` does not support linking of archive files implicitly. It
+transparently passes every input option and object to ``nvlink`` except archive
+files. It reads each input archive file to extract the archived cubin files as
+temporary files. These temporary (*.cubin) files are passed to ``nvlink``.
+
+Use Case
+
+
+During linking of heterogeneous device archive libraries with an OpenMP
+program, the :doc:`ClangOffloadBundler` creates a device specific archive of
+cubin files. Such an archive is then passed to this wrapper tool to extract
+cubin files before passing to ``nvlink``.
+
+Working
+===
+
+**Inputs**
+
+  A command line generated by the OpenMP-Clang driver targeting NVPTX,
+  containing a set of flags, cubin object files, and zero or more archive
+  files.
+
+Example::
+
+  clang-nvlink-wrapper main.cubin /tmp/libTest-nvptx-sm_50.a -o main-linked.out
+
+**Processing**
+
+  1. From each archive file extract all cubin files as temporary files and
+ store their names in a list, `CubinFiles`.
+  2. Create a new command line, `NVLinkCommand`, such that
+ * Program is ``nvlink``
+ * All input flags are transparently passed on as flags
+ * All input archive file are replaced with `CubinFiles`
+  3. Execute NVLinkCommand
+
+::
+
+  1. Extract (libTest-nvptx-sm_50.a) => /tmp/a.cubin /tmp/b.cubin
+  2. nvlink -o a.out-openmp-nvptx64 main.cubin /tmp/a.cubin /tmp/b.cubin
+  
+**Output**
+
+  Output file generated by ``nvlink`` which links all cubin files.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106343: [OpenCL] Support cl_ext_float_atomics

2021-09-03 Thread Yang Haonan via Phabricator via cfe-commits
haonanya added a comment.

Kindly ping


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106343/new/

https://reviews.llvm.org/D106343

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


[PATCH] D108753: [analyzer] MallocChecker: Add notes from NoOwnershipChangeVisitor only when a function "intents", but doesn't change ownership, enable by default

2021-09-03 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus updated this revision to Diff 370553.
Szelethus added a comment.

indent->intent


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108753/new/

https://reviews.llvm.org/D108753

Files:
  clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
  clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  clang/test/Analysis/NewDeleteLeaks.cpp
  clang/test/Analysis/analyzer-config.c

Index: clang/test/Analysis/analyzer-config.c
===
--- clang/test/Analysis/analyzer-config.c
+++ clang/test/Analysis/analyzer-config.c
@@ -116,7 +116,7 @@
 // CHECK-NEXT: suppress-null-return-paths = true
 // CHECK-NEXT: track-conditions = true
 // CHECK-NEXT: track-conditions-debug = false
-// CHECK-NEXT: unix.DynamicMemoryModeling:AddNoOwnershipChangeNotes = false
+// CHECK-NEXT: unix.DynamicMemoryModeling:AddNoOwnershipChangeNotes = true
 // CHECK-NEXT: unix.DynamicMemoryModeling:Optimistic = false
 // CHECK-NEXT: unroll-loops = false
 // CHECK-NEXT: verbose-report-filename = false
Index: clang/test/Analysis/NewDeleteLeaks.cpp
===
--- clang/test/Analysis/NewDeleteLeaks.cpp
+++ clang/test/Analysis/NewDeleteLeaks.cpp
@@ -20,15 +20,16 @@
 
 bool coin();
 
+// TODO: AST analysis of sink would reveal that it doesn't intent to free the
+// allocated memory, but in this instance, its also the only function with
+// the ability to do so, we should see a note here.
 namespace memory_allocated_in_fn_call {
 
 void sink(int *P) {
-} // ownership-note {{Returning without deallocating memory or storing the pointer for later deallocation}}
+}
 
 void foo() {
   sink(new int(5)); // expected-note {{Memory is allocated}}
-// ownership-note@-1 {{Calling 'sink'}}
-// ownership-note@-2 {{Returning from 'sink'}}
 } // expected-warning {{Potential memory leak [cplusplus.NewDeleteLeaks]}}
 // expected-note@-1 {{Potential memory leak}}
 
@@ -109,17 +110,14 @@
 
 } // namespace memory_shared_with_ptr_of_same_lifetime
 
-// TODO: We don't want a note here. sink() doesn't seem like a function that
-// even attempts to take care of any memory ownership problems.
 namespace memory_passed_into_fn_that_doesnt_intend_to_free {
 
 void sink(int *P) {
-} // ownership-note {{Returning without deallocating memory or storing the pointer for later deallocation}}
+}
 
 void foo() {
   int *ptr = new int(5); // expected-note {{Memory is allocated}}
-  sink(ptr); // ownership-note {{Calling 'sink'}}
- // ownership-note@-1 {{Returning from 'sink'}}
+  sink(ptr);
 } // expected-warning {{Potential leak of memory pointed to by 'ptr' [cplusplus.NewDeleteLeaks]}}
 // expected-note@-1 {{Potential leak}}
 
Index: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -52,6 +52,8 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ParentMap.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Analysis/ProgramPoint.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceManager.h"
@@ -791,9 +793,28 @@
 return "";
   }
 
+  bool doesFnIntendToHandleOwnership(const Decl *Callee, ASTContext ) {
+using namespace clang::ast_matchers;
+const FunctionDecl *FD = dyn_cast(Callee);
+if (!FD)
+  return false;
+// TODO: Operator delete is hardly the only deallocator -- Can we reuse
+// isFreeingCall() or something thats already here?
+auto Deallocations = match(
+stmt(hasDescendant(cxxDeleteExpr().bind("delete"))
+ ), *FD->getBody(), ACtx);
+// TODO: Ownership my change with an attempt to store the allocated memory.
+return !Deallocations.empty();
+  }
+
   virtual bool
   wasModifiedInFunction(const ExplodedNode *CallEnterN,
 const ExplodedNode *CallExitEndN) override {
+if (!doesFnIntendToHandleOwnership(
+CallExitEndN->getFirstPred()->getLocationContext()->getDecl(),
+CallExitEndN->getState()->getAnalysisManager().getASTContext()))
+  return true;
+
 if (CallEnterN->getState()->get(Sym) !=
 CallExitEndN->getState()->get(Sym))
   return true;
Index: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
===
--- clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
+++ clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
@@ -493,8 +493,8 @@
   "that neither deallocated it, or have taken responsibility "
   "of the ownership are noted, similarly to "
   "NoStoreFuncVisitor.",
-  "false",
-  InAlpha,
+  "true",
+ 

[PATCH] D102943: [modules] Use `HashBuilder` and `MD5` for the module hash.

2021-09-03 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 accepted this revision.
jansvoboda11 added a comment.
This revision is now accepted and ready to land.

This looks good to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102943/new/

https://reviews.llvm.org/D102943

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


[clang] 6fe2beb - Reland "[clang-repl] Re-implement clang-interpreter as a test case."

2021-09-03 Thread Vassil Vassilev via cfe-commits

Author: Vassil Vassilev
Date: 2021-09-03T12:02:58Z
New Revision: 6fe2beba7d2a41964af658c8c59dd172683ef739

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

LOG: Reland "[clang-repl] Re-implement clang-interpreter as a test case."
Original commit message: "
Original commit message:"
  The current infrastructure in lib/Interpreter has a tool, clang-repl, very
  similar to clang-interpreter which also allows incremental compilation.

  This patch moves clang-interpreter as a test case and drops it as 
conditionally
  built example as we already have clang-repl in place.

  Differential revision: https://reviews.llvm.org/D107049
"

This patch also ignores ppc due to missing weak symbol for 
__gxx_personality_v0
which may be a feature request for the jit infrastructure. Also, adds a 
missing
build system dependency to the orc jit.
"

Additionally, this patch defines a custom exception type and thus avoids the
requirement to include header , making it easier to deploy across
systems without standard location of the c++ headers.

Differential revision: https://reviews.llvm.org/D107049

Added: 
clang/unittests/Interpreter/ExceptionTests/CMakeLists.txt
clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp

Modified: 
clang/docs/ClangFormattedStatus.rst
clang/examples/CMakeLists.txt
clang/include/clang/Interpreter/Interpreter.h
clang/lib/Interpreter/IncrementalExecutor.cpp
clang/lib/Interpreter/IncrementalExecutor.h
clang/lib/Interpreter/Interpreter.cpp
clang/test/CMakeLists.txt
clang/test/lit.cfg.py
clang/unittests/Interpreter/CMakeLists.txt
clang/unittests/Interpreter/InterpreterTest.cpp

Removed: 
clang/examples/clang-interpreter/CMakeLists.txt
clang/examples/clang-interpreter/README.txt
clang/examples/clang-interpreter/Test.cxx
clang/test/Misc/interpreter.c



diff  --git a/clang/docs/ClangFormattedStatus.rst 
b/clang/docs/ClangFormattedStatus.rst
index beca555ebc016..77320cd2b6550 100644
--- a/clang/docs/ClangFormattedStatus.rst
+++ b/clang/docs/ClangFormattedStatus.rst
@@ -59,11 +59,6 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 04, 2021 13:01:37
  - `1`
  - `0`
  - :good:`100%`
-   * - clang/examples/clang-interpreter
- - `1`
- - `0`
- - `1`
- - :none:`0%`
* - clang/examples/PrintFunctionNames
  - `1`
  - `0`

diff  --git a/clang/examples/CMakeLists.txt b/clang/examples/CMakeLists.txt
index 300d8d795c674..8a4139f5d8c11 100644
--- a/clang/examples/CMakeLists.txt
+++ b/clang/examples/CMakeLists.txt
@@ -3,7 +3,6 @@ if(NOT CLANG_BUILD_EXAMPLES)
   set(EXCLUDE_FROM_ALL ON)
 endif()
 
-add_subdirectory(clang-interpreter)
 add_subdirectory(PrintFunctionNames)
 add_subdirectory(AnnotateFunctions)
 add_subdirectory(Attribute)

diff  --git a/clang/examples/clang-interpreter/CMakeLists.txt 
b/clang/examples/clang-interpreter/CMakeLists.txt
deleted file mode 100644
index 11056aa379ae8..0
--- a/clang/examples/clang-interpreter/CMakeLists.txt
+++ /dev/null
@@ -1,93 +0,0 @@
-set(LLVM_LINK_COMPONENTS
-  Core
-  ExecutionEngine
-  MC
-  MCJIT
-  Object
-  OrcJit
-  Option
-  RuntimeDyld
-  Support
-  native
-  )
-
-add_clang_executable(clang-interpreter
-  main.cpp
-  )
-
-add_dependencies(clang-interpreter
-  clang-resource-headers
-  )
-
-clang_target_link_libraries(clang-interpreter
-  PRIVATE
-  clangBasic
-  clangCodeGen
-  clangDriver
-  clangFrontend
-  clangSerialization
-  )
-
-export_executable_symbols(clang-interpreter)
-
-if (MSVC)
-  # Is this a CMake bug that even with export_executable_symbols, Windows
-  # needs to explictly export the type_info vtable
-  set_property(TARGET clang-interpreter
-   APPEND_STRING PROPERTY LINK_FLAGS " /EXPORT:??_7type_info@@6B@")
-endif()
-
-function(clang_enable_exceptions TARGET)
-  # Really have to jump through hoops to enable exception handling independent
-  # of how LLVM is being built.
-  if (NOT LLVM_REQUIRES_EH AND NOT LLVM_REQUIRES_RTTI)
-if (MSVC)
-  # /EHs to allow throwing from extern "C"
-  set(excptnExceptions_ON "/D _HAS_EXCEPTIONS=1 /EHs /wd4714")
-  set(excptnExceptions_OFF "/D _HAS_EXCEPTIONS=0 /EHs-c-")
-  set(excptnRTTI_ON "/GR")
-  set(excptnRTTI_OFF "/GR-")
-  set(excptnEHRTTIRegEx "(/EHs(-c-?)|_HAS_EXCEPTIONS=(0|1))")
-else()
-  set(excptnExceptions_ON "-fexceptions")
-  set(excptnExceptions_OFF "-fno-exceptions")
-  set(excptnRTTI_ON "-frtti")
-  set(excptnRTTI_OFF "-fno-rtti")
-  set(excptnEHRTTIRegEx "-f(exceptions|no-exceptions)")
-endif()
-if (LLVM_REQUIRES_EH)
-  set(excptnExceptions_DFLT ${excptnExceptions_ON})
-else()
-  set(excptnExceptions_DFLT 

[PATCH] D109225: [clang-nvlink-wrapper] Add documentation in clang docs

2021-09-03 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM with only minor nits from me, thank you!




Comment at: clang/docs/ClangNvlinkWrapper.rst:13
+
+This tool works as a wrapper over nvlink program. It is required because 
nvlink does not
+support linking of archive files implicitly. It transparently passes every





Comment at: clang/docs/ClangNvlinkWrapper.rst:15
+support linking of archive files implicitly. It transparently passes every
+input option and objects to nvlink except archive files. It reads each input
+archive file to extract archived cubin files as temporary files.





Comment at: clang/docs/ClangNvlinkWrapper.rst:16
+input option and objects to nvlink except archive files. It reads each input
+archive file to extract archived cubin files as temporary files.
+These temp (*.cubin) files are passed to nvlink.





Comment at: clang/docs/ClangNvlinkWrapper.rst:17
+archive file to extract archived cubin files as temporary files.
+These temp (*.cubin) files are passed to nvlink.
+





Comment at: clang/docs/ClangNvlinkWrapper.rst:22
+creates a device specific archive of cubin files. Such an archive is then
+passed to this wrapper tool to extract cubin files before passing to nvlink.
+





Comment at: clang/docs/ClangNvlinkWrapper.rst:29
+
+  A command line generated by the OpenMP-Clang driver targeting NVPTX, 
containing a set of flags, cubin object files, and zero or more archive files
+

Also, 80-col limit.



Comment at: clang/docs/ClangNvlinkWrapper.rst:39
+  2. Create a new command line, `NVLinkCommand`, such that
+ * Program is nvlink
+ * All input flags are transparently passed on as flags





Comment at: clang/docs/ClangNvlinkWrapper.rst:51
+
+  Output file generated by nvlink by linking all cubin files.





Comment at: clang/docs/ClangNvlinkWrapper.rst:52
+  Output file generated by nvlink by linking all cubin files.
\ No newline at end of file


sylvestre.ledru wrote:
> please add a new line
> 
Might as well add the newline.



Comment at: clang/docs/ReleaseNotes.rst:150
 
-- ...
+- clang-nvlink-wrapper tool introduced to support linking of cubin files
+  archived in an archive. See `Clang Nvlink Wrapper 
`_ .




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109225/new/

https://reviews.llvm.org/D109225

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


[PATCH] D109225: [clang-nvlink-wrapper] Add documentation in clang docs

2021-09-03 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru added inline comments.



Comment at: clang/docs/ClangNvlinkWrapper.rst:1
+=
+Clang Nvlink Wrapper

please remove one "="
rst expects alignment




Comment at: clang/docs/ClangNvlinkWrapper.rst:52
+  Output file generated by nvlink by linking all cubin files.
\ No newline at end of file


please add a new line




Comment at: clang/docs/ReleaseNotes.rst:151
+- clang-nvlink-wrapper tool introduced to support linking of cubin files
+  archived in an archive. See `Clang Nvlink Wrapper 
`_ .
+

I think you should use rst link here. Not absolute link (ex: if I generate the 
doc locally)
:ref:`Clang Nvlink Wrapper`
should work



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109225/new/

https://reviews.llvm.org/D109225

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


[PATCH] D108695: [analyzer][NFCI] Allow clients of NoStateChangeFuncVisitor to check entire function calls, rather than each ExplodedNode in it

2021-09-03 Thread Kristóf Umann via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa375bfb5b729: [analyzer][NFCI] Allow clients of 
NoStateChangeFuncVisitor to check entire… (authored by Szelethus).

Changed prior to commit:
  https://reviews.llvm.org/D108695?vs=370274=370549#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108695/new/

https://reviews.llvm.org/D108695

Files:
  clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
  clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  clang/unittests/StaticAnalyzer/CMakeLists.txt
  clang/unittests/StaticAnalyzer/CallEventTest.cpp
  clang/unittests/StaticAnalyzer/CheckerRegistration.h
  clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp
  clang/unittests/StaticAnalyzer/NoStateChangeFuncVisitorTest.cpp
  clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp

Index: clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp
===
--- clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp
+++ clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp
@@ -51,7 +51,7 @@
 TEST(RegisterCustomCheckers, RegisterChecker) {
   std::string Diags;
   EXPECT_TRUE(runCheckerOnCode("void f() {;}", Diags));
-  EXPECT_EQ(Diags, "test.CustomChecker:Custom diagnostic description\n");
+  EXPECT_EQ(Diags, "test.CustomChecker: Custom diagnostic description\n");
 }
 
 //===--===//
@@ -169,7 +169,7 @@
 TEST(RegisterDeps, UnsatisfiedDependency) {
   std::string Diags;
   EXPECT_TRUE(runCheckerOnCode("void f() {int i;}", Diags));
-  EXPECT_EQ(Diags, "test.RegistrationOrder:test.RegistrationOrder\n");
+  EXPECT_EQ(Diags, "test.RegistrationOrder: test.RegistrationOrder\n");
 }
 
 //===--===//
@@ -272,7 +272,7 @@
   std::string Diags;
   EXPECT_TRUE(runCheckerOnCode(
   "void f() {int i;}", Diags));
-  EXPECT_EQ(Diags, "test.RegistrationOrder:test.WeakDep\ntest."
+  EXPECT_EQ(Diags, "test.RegistrationOrder: test.WeakDep\ntest."
"Dep\ntest.RegistrationOrder\n");
   Diags.clear();
 
@@ -280,31 +280,33 @@
   // but the dependencies are switched.
   EXPECT_TRUE(runCheckerOnCode(
   "void f() {int i;}", Diags));
-  EXPECT_EQ(Diags, "test.RegistrationOrder:test.Dep\ntest."
+  EXPECT_EQ(Diags, "test.RegistrationOrder: test.Dep\ntest."
"RegistrationOrder\ntest.WeakDep\n");
   Diags.clear();
 
   // Weak dependencies dont prevent dependent checkers from being enabled.
   EXPECT_TRUE(runCheckerOnCode(
   "void f() {int i;}", Diags));
-  EXPECT_EQ(Diags, "test.RegistrationOrder:test.Dep\ntest.RegistrationOrder\n");
+  EXPECT_EQ(Diags,
+"test.RegistrationOrder: test.Dep\ntest.RegistrationOrder\n");
   Diags.clear();
 
   // Nor will they be enabled just because a dependent checker is.
   EXPECT_TRUE(runCheckerOnCode(
   "void f() {int i;}", Diags));
-  EXPECT_EQ(Diags, "test.RegistrationOrder:test.Dep\ntest.RegistrationOrder\n");
+  EXPECT_EQ(Diags,
+"test.RegistrationOrder: test.Dep\ntest.RegistrationOrder\n");
   Diags.clear();
 
   EXPECT_TRUE(
   runCheckerOnCode("void f() {int i;}", Diags));
-  EXPECT_EQ(Diags, "test.RegistrationOrder:test.WeakDep2\ntest."
+  EXPECT_EQ(Diags, "test.RegistrationOrder: test.WeakDep2\ntest."
"Dep\ntest.RegistrationOrder\n");
   Diags.clear();
 
   EXPECT_TRUE(
   runCheckerOnCode("void f() {int i;}", Diags));
-  EXPECT_EQ(Diags, "test.RegistrationOrder:test.WeakDep2\ntest."
+  EXPECT_EQ(Diags, "test.RegistrationOrder: test.WeakDep2\ntest."
"WeakDep\ntest.Dep\ntest.RegistrationOrder\n");
   Diags.clear();
 }
@@ -414,7 +416,7 @@
   std::string Diags;
   EXPECT_TRUE(
   runCheckerOnCode("void f() {int i;}", Diags));
-  EXPECT_EQ(Diags, "test.RegistrationOrder:test.StrongDep\ntest."
+  EXPECT_EQ(Diags, "test.RegistrationOrder: test.StrongDep\ntest."
"WeakDep\ntest.Dep\ntest.RegistrationOrder\n");
   Diags.clear();
 
@@ -424,14 +426,14 @@
   // established in between the modeling portion and the weak dependency.
   EXPECT_TRUE(
   runCheckerOnCode("void f() {int i;}", Diags));
-  EXPECT_EQ(Diags, "test.RegistrationOrder:test.WeakDep\ntest."
+  EXPECT_EQ(Diags, "test.RegistrationOrder: test.WeakDep\ntest."
"StrongDep\ntest.Dep\ntest.RegistrationOrder\n");
   Diags.clear();
 
   // If a weak dependency is disabled, the checker itself can still be enabled.
   EXPECT_TRUE(runCheckerOnCode(
   "void f() {int i;}", Diags));
-  EXPECT_EQ(Diags, "test.RegistrationOrder:test.Dep\ntest."
+  EXPECT_EQ(Diags, "test.RegistrationOrder: test.Dep\ntest."
"RegistrationOrder\ntest.StrongDep\n");
   Diags.clear();
 
@@ 

[clang] a375bfb - [analyzer][NFCI] Allow clients of NoStateChangeFuncVisitor to check entire function calls, rather than each ExplodedNode in it

2021-09-03 Thread Kristóf Umann via cfe-commits

Author: Kristóf Umann
Date: 2021-09-03T13:50:18+02:00
New Revision: a375bfb5b729e0f3ca8d5e001f423fa89e74de87

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

LOG: [analyzer][NFCI] Allow clients of NoStateChangeFuncVisitor to check entire 
function calls, rather than each ExplodedNode in it

D105553 added NoStateChangeFuncVisitor, an abstract class to aid in creating
notes such as "Returning without writing to 'x'", or "Returning without changing
the ownership status of allocated memory". Its clients need to define, among
other things, what a change of state is.

For code like this:

f() {
  g();
}

foo() {
  f();
  h();
}

We'd have a path in the ExplodedGraph that looks like this:

 --  -->
/  \
 --- >---  --->
/\  /\
 -- -->

When we're interested in whether f neglected to change some property,
NoStateChangeFuncVisitor asks these questions:

   ÷×~
--  -->
   ß   /  \$

[PATCH] D109225: [clang-nvlink-wrapper] Add documentation in clang docs

2021-09-03 Thread Saiyedul Islam via Phabricator via cfe-commits
saiislam updated this revision to Diff 370547.
saiislam added a comment.

typo fix


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109225/new/

https://reviews.llvm.org/D109225

Files:
  clang/docs/ClangNvlinkWrapper.rst
  clang/docs/ReleaseNotes.rst
  clang/docs/index.rst
  clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp

Index: clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp
===
--- clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp
+++ clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp
@@ -13,7 +13,7 @@
 /// These temp (*.cubin) files are passed to nvlink, because nvlink does not
 /// support linking of archive files implicitly.
 ///
-/// During linking of heteregenous device archive libraries, the
+/// During linking of heterogeneous device archive libraries, the
 /// clang-offload-bundler creates a device specific archive of cubin files.
 /// Such an archive is then passed to this tool to extract cubin files before
 /// passing to nvlink.
@@ -60,7 +60,7 @@
   std::vector> ArchiveBuffers;
 
   ErrorOr> BufOrErr =
-  MemoryBuffer::getFileOrSTDIN(Filename, -1, false);
+  MemoryBuffer::getFileOrSTDIN(Filename, false, false);
   if (std::error_code EC = BufOrErr.getError())
 return createFileError(Filename, EC);
 
Index: clang/docs/index.rst
===
--- clang/docs/index.rst
+++ clang/docs/index.rst
@@ -80,6 +80,7 @@
ClangFormat
ClangFormatStyleOptions
ClangFormattedStatus
+   ClangNvlinkWrapper
ClangOffloadBundler
 
 Design Documents
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -147,7 +147,9 @@
 OpenMP Support in Clang
 ---
 
-- ...
+- clang-nvlink-wrapper tool introduced to support linking of cubin files
+  archived in an archive. See `Clang Nvlink Wrapper `_ .
+
 
 CUDA Support in Clang
 -
Index: clang/docs/ClangNvlinkWrapper.rst
===
--- /dev/null
+++ clang/docs/ClangNvlinkWrapper.rst
@@ -0,0 +1,51 @@
+=
+Clang Nvlink Wrapper
+=
+
+.. contents::
+   :local:
+
+.. _clang-nvlink-wrapper:
+
+Introduction
+
+
+This tool works as a wrapper over nvlink program. It is required because nvlink does not
+support linking of archive files implicitly. It transparently passes every
+input option and objects to nvlink except archive files. It reads each input
+archive file to extract archived cubin files as temporary files.
+These temp (*.cubin) files are passed to nvlink.
+
+During linking of heterogeneous device archive libraries with an OpenMP program,
+the `Clang Offload Bundler `_
+creates a device specific archive of cubin files. Such an archive is then
+passed to this wrapper tool to extract cubin files before passing to nvlink.
+
+Working
+===
+
+**Inputs**
+
+  A command line generated by the OpenMP-Clang driver targeting NVPTX, containing a set of flags, cubin object files, and zero or more archive files
+
+Example::
+
+  clang-nvlink-wrapper main.cubin /tmp/libTest-nvptx-sm_50.a -o a.out-openmp-nvptx64
+
+**Processing**
+
+  1. From each archive file extract all cubin files as temporary files and store their names in a list, CubinFiles.
+  2. Create a new command line, `NVLinkCommand`, such that
+ * Program is nvlink
+ * All input flags are transparently passed on as flags
+ * All input archive file are replaced with CubinFiles
+  3. Execute NVLinkCommand
+
+::
+
+  1. Extract (libTest-nvptx-sm_50.a) => /tmp/a.cubin /tmp/b.cubin
+  2. nvlink -o a.out-openmp-nvptx64 main.cubin /tmp/a.cubin /tmp/b.cubin
+  
+**Output**
+
+  Output file generated by nvlink by linking all cubin files.
\ No newline at end of file
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109225: [clang-nvlink-wrapper] Add documentation in clang docs

2021-09-03 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru added inline comments.



Comment at: clang/docs/ClangNvlinkWrapper.rst:19
+
+During linking of heterogenous device archive libraries with an OpenMP program,
+the `Clang Offload Bundler 
`_

heterogenous ==> heterogeneous


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109225/new/

https://reviews.llvm.org/D109225

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


[PATCH] D108979: [clang][deps] NFC: Stop going through ClangTool

2021-09-03 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 updated this revision to Diff 370545.
jansvoboda11 added a comment.

Resolve test failing on Windows by re-setting the VFS on `FileManager`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108979/new/

https://reviews.llvm.org/D108979

Files:
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp


Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -308,18 +308,28 @@
 llvm::Error DependencyScanningWorker::computeDependencies(
 const std::string , StringRef WorkingDirectory,
 const CompilationDatabase , DependencyConsumer ) {
+  // Reset what might have been modified in the previous worker invocation.
   RealFS->setCurrentWorkingDirectory(WorkingDirectory);
+  if (Files)
+Files->setVirtualFileSystem(RealFS);
+
+  llvm::IntrusiveRefCntPtr CurrentFiles =
+  Files ? Files : new FileManager(FileSystemOptions(), RealFS);
+
+  // FIXME: Avoid this copy.
+  std::vector CompileCommands = CDB.getCompileCommands(Input);
+  const std::vector  =
+  CompileCommands.front().CommandLine;
+
   return runWithDiags(DiagOpts.get(), [&](DiagnosticConsumer ) {
-/// Create the tool that uses the underlying file system to ensure that any
-/// file system requests that are made by the driver do not go through the
-/// dependency scanning filesystem.
-tooling::ClangTool Tool(CDB, Input, PCHContainerOps, RealFS, Files);
-Tool.clearArgumentsAdjusters();
-Tool.setRestoreWorkingDir(false);
-Tool.setPrintErrorMessage(false);
-Tool.setDiagnosticConsumer();
 DependencyScanningAction Action(WorkingDirectory, Consumer, DepFS,
 PPSkipMappings.get(), Format);
-return !Tool.run();
+// Create an invocation that uses the underlying file system to ensure that
+// any file system requests that are made by the driver do not go through
+// the dependency scanning filesystem.
+ToolInvocation Invocation(CommandLine, , CurrentFiles.get(),
+  PCHContainerOps);
+Invocation.setDiagnosticConsumer();
+return Invocation.run();
   });
 }


Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -308,18 +308,28 @@
 llvm::Error DependencyScanningWorker::computeDependencies(
 const std::string , StringRef WorkingDirectory,
 const CompilationDatabase , DependencyConsumer ) {
+  // Reset what might have been modified in the previous worker invocation.
   RealFS->setCurrentWorkingDirectory(WorkingDirectory);
+  if (Files)
+Files->setVirtualFileSystem(RealFS);
+
+  llvm::IntrusiveRefCntPtr CurrentFiles =
+  Files ? Files : new FileManager(FileSystemOptions(), RealFS);
+
+  // FIXME: Avoid this copy.
+  std::vector CompileCommands = CDB.getCompileCommands(Input);
+  const std::vector  =
+  CompileCommands.front().CommandLine;
+
   return runWithDiags(DiagOpts.get(), [&](DiagnosticConsumer ) {
-/// Create the tool that uses the underlying file system to ensure that any
-/// file system requests that are made by the driver do not go through the
-/// dependency scanning filesystem.
-tooling::ClangTool Tool(CDB, Input, PCHContainerOps, RealFS, Files);
-Tool.clearArgumentsAdjusters();
-Tool.setRestoreWorkingDir(false);
-Tool.setPrintErrorMessage(false);
-Tool.setDiagnosticConsumer();
 DependencyScanningAction Action(WorkingDirectory, Consumer, DepFS,
 PPSkipMappings.get(), Format);
-return !Tool.run();
+// Create an invocation that uses the underlying file system to ensure that
+// any file system requests that are made by the driver do not go through
+// the dependency scanning filesystem.
+ToolInvocation Invocation(CommandLine, , CurrentFiles.get(),
+  PCHContainerOps);
+Invocation.setDiagnosticConsumer();
+return Invocation.run();
   });
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108291: [clang-nvlink-wrapper] Wrapper around nvlink for archive files

2021-09-03 Thread Saiyedul Islam via Phabricator via cfe-commits
saiislam added a comment.

In D108291#2980737 , @sylvestre.ledru 
wrote:

> Maybe add this to the release notes of clang 14?

@sylvestre.ledru and @aaron.ballman please have a look at D109225 
. I have made the suggested changes.
I would like to include this wrapper in llvm-13 also because it is actually a 
fix required for D105191 , which is a part of 
a feature being worked on for over a year (D81109 
 and D93525 ).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108291/new/

https://reviews.llvm.org/D108291

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


[PATCH] D109225: [clang-nvlink-wrapper] Add documentation in clang docs

2021-09-03 Thread Saiyedul Islam via Phabricator via cfe-commits
saiislam updated this revision to Diff 370543.
saiislam added a comment.

Added MSVC warning fix also.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109225/new/

https://reviews.llvm.org/D109225

Files:
  clang/docs/ClangNvlinkWrapper.rst
  clang/docs/ReleaseNotes.rst
  clang/docs/index.rst
  clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp

Index: clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp
===
--- clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp
+++ clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp
@@ -13,7 +13,7 @@
 /// These temp (*.cubin) files are passed to nvlink, because nvlink does not
 /// support linking of archive files implicitly.
 ///
-/// During linking of heteregenous device archive libraries, the
+/// During linking of heterogenous device archive libraries, the
 /// clang-offload-bundler creates a device specific archive of cubin files.
 /// Such an archive is then passed to this tool to extract cubin files before
 /// passing to nvlink.
@@ -60,7 +60,7 @@
   std::vector> ArchiveBuffers;
 
   ErrorOr> BufOrErr =
-  MemoryBuffer::getFileOrSTDIN(Filename, -1, false);
+  MemoryBuffer::getFileOrSTDIN(Filename, false, false);
   if (std::error_code EC = BufOrErr.getError())
 return createFileError(Filename, EC);
 
Index: clang/docs/index.rst
===
--- clang/docs/index.rst
+++ clang/docs/index.rst
@@ -80,6 +80,7 @@
ClangFormat
ClangFormatStyleOptions
ClangFormattedStatus
+   ClangNvlinkWrapper
ClangOffloadBundler
 
 Design Documents
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -147,7 +147,9 @@
 OpenMP Support in Clang
 ---
 
-- ...
+- clang-nvlink-wrapper tool introduced to support linking of cubin files
+  archived in an archive. See `Clang Nvlink Wrapper `_ .
+
 
 CUDA Support in Clang
 -
Index: clang/docs/ClangNvlinkWrapper.rst
===
--- /dev/null
+++ clang/docs/ClangNvlinkWrapper.rst
@@ -0,0 +1,51 @@
+=
+Clang Nvlink Wrapper
+=
+
+.. contents::
+   :local:
+
+.. _clang-nvlink-wrapper:
+
+Introduction
+
+
+This tool works as a wrapper over nvlink program. It is required because nvlink does not
+support linking of archive files implicitly. It transparently passes every
+input option and objects to nvlink except archive files. It reads each input
+archive file to extract archived cubin files as temporary files.
+These temp (*.cubin) files are passed to nvlink.
+
+During linking of heterogenous device archive libraries with an OpenMP program,
+the `Clang Offload Bundler `_
+creates a device specific archive of cubin files. Such an archive is then
+passed to this wrapper tool to extract cubin files before passing to nvlink.
+
+Working
+===
+
+**Inputs**
+
+  A command line generated by the OpenMP-Clang driver targeting NVPTX, containing a set of flags, cubin object files, and zero or more archive files
+
+Example::
+
+  clang-nvlink-wrapper main.cubin /tmp/libTest-nvptx-sm_50.a -o a.out-openmp-nvptx64
+
+**Processing**
+
+  1. From each archive file extract all cubin files as temporary files and store their names in a list, CubinFiles.
+  2. Create a new command line, `NVLinkCommand`, such that
+ * Program is nvlink
+ * All input flags are transparently passed on as flags
+ * All input archive file are replaced with CubinFiles
+  3. Execute NVLinkCommand
+
+::
+
+  1. Extract (libTest-nvptx-sm_50.a) => /tmp/a.cubin /tmp/b.cubin
+  2. nvlink -o a.out-openmp-nvptx64 main.cubin /tmp/a.cubin /tmp/b.cubin
+  
+**Output**
+
+  Output file generated by nvlink by linking all cubin files.
\ No newline at end of file
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99797: [analyzer] Implemented RangeSet::Factory::unite function to handle intersections and adjacency

2021-09-03 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment.

How about this patch and the entire stack?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99797/new/

https://reviews.llvm.org/D99797

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


[PATCH] D107073: [analyzer] Disable direct binding from list initialization for constant arrays of local storage duration.

2021-09-03 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov abandoned this revision.
ASDenysPetrov added a comment.

This patch is currently irrelevant after last changes in the parent revision. 
It's going to be reworked or permanently abandoned.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107073/new/

https://reviews.llvm.org/D107073

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


[PATCH] D106681: [analyzer] Retrieve a value from list initialization of constant multi-dimensional array.

2021-09-03 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov abandoned this revision.
ASDenysPetrov added a comment.

This patch is currently irrelevant after last changes in the parent revision. 
It's going to be reworked or permanently abandoned.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106681/new/

https://reviews.llvm.org/D106681

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


[PATCH] D109225: [clang-nvlink-wrapper] Add documentation in clang docs

2021-09-03 Thread Saiyedul Islam via Phabricator via cfe-commits
saiislam created this revision.
saiislam added reviewers: sylvestre.ledru, ye-luo, jdoerfert.
Herald added a subscriber: arphaman.
saiislam requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Add documentation of clang-nvlink-wrapper tool in clang. Add it to
the release notes of clang.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109225

Files:
  clang/docs/ClangNvlinkWrapper.rst
  clang/docs/ReleaseNotes.rst
  clang/docs/index.rst


Index: clang/docs/index.rst
===
--- clang/docs/index.rst
+++ clang/docs/index.rst
@@ -80,6 +80,7 @@
ClangFormat
ClangFormatStyleOptions
ClangFormattedStatus
+   ClangNvlinkWrapper
ClangOffloadBundler
 
 Design Documents
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -147,7 +147,9 @@
 OpenMP Support in Clang
 ---
 
-- ...
+- clang-nvlink-wrapper tool introduced to support linking of cubin files
+  archived in an archive. See `Clang Nvlink Wrapper 
`_ .
+
 
 CUDA Support in Clang
 -
Index: clang/docs/ClangNvlinkWrapper.rst
===
--- /dev/null
+++ clang/docs/ClangNvlinkWrapper.rst
@@ -0,0 +1,51 @@
+=
+Clang Nvlink Wrapper
+=
+
+.. contents::
+   :local:
+
+.. _clang-nvlink-wrapper:
+
+Introduction
+
+
+This tool works as a wrapper over nvlink program. It is required because 
nvlink does not
+support linking of archive files implicitly. It transparently passes every
+input option and objects to nvlink except archive files. It reads each input
+archive file to extract archived cubin files as temporary files.
+These temp (*.cubin) files are passed to nvlink.
+
+During linking of heterogenous device archive libraries with an OpenMP program,
+the `Clang Offload Bundler 
`_
+creates a device specific archive of cubin files. Such an archive is then
+passed to this wrapper tool to extract cubin files before passing to nvlink.
+
+Working
+===
+
+**Inputs**
+
+  A command line generated by the OpenMP-Clang driver targeting NVPTX, 
containing a set of flags, cubin object files, and zero or more archive files
+
+Example::
+
+  clang-nvlink-wrapper main.cubin /tmp/libTest-nvptx-sm_50.a -o 
a.out-openmp-nvptx64
+
+**Processing**
+
+  1. From each archive file extract all cubin files as temporary files and 
store their names in a list, CubinFiles.
+  2. Create a new command line, `NVLinkCommand`, such that
+ * Program is nvlink
+ * All input flags are transparently passed on as flags
+ * All input archive file are replaced with CubinFiles
+  3. Execute NVLinkCommand
+
+::
+
+  1. Extract (libTest-nvptx-sm_50.a) => /tmp/a.cubin /tmp/b.cubin
+  2. nvlink -o a.out-openmp-nvptx64 main.cubin /tmp/a.cubin /tmp/b.cubin
+  
+**Output**
+
+  Output file generated by nvlink by linking all cubin files.
\ No newline at end of file


Index: clang/docs/index.rst
===
--- clang/docs/index.rst
+++ clang/docs/index.rst
@@ -80,6 +80,7 @@
ClangFormat
ClangFormatStyleOptions
ClangFormattedStatus
+   ClangNvlinkWrapper
ClangOffloadBundler
 
 Design Documents
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -147,7 +147,9 @@
 OpenMP Support in Clang
 ---
 
-- ...
+- clang-nvlink-wrapper tool introduced to support linking of cubin files
+  archived in an archive. See `Clang Nvlink Wrapper `_ .
+
 
 CUDA Support in Clang
 -
Index: clang/docs/ClangNvlinkWrapper.rst
===
--- /dev/null
+++ clang/docs/ClangNvlinkWrapper.rst
@@ -0,0 +1,51 @@
+=
+Clang Nvlink Wrapper
+=
+
+.. contents::
+   :local:
+
+.. _clang-nvlink-wrapper:
+
+Introduction
+
+
+This tool works as a wrapper over nvlink program. It is required because nvlink does not
+support linking of archive files implicitly. It transparently passes every
+input option and objects to nvlink except archive files. It reads each input
+archive file to extract archived cubin files as temporary files.
+These temp (*.cubin) files are passed to nvlink.
+
+During linking of heterogenous device archive libraries with an OpenMP program,
+the `Clang Offload Bundler `_
+creates a device specific archive of cubin files. Such an archive is then
+passed to this wrapper tool to 

  1   2   >