[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

Thanks for doing this. I'm going to test it in 2-3 hours and get back to you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133800

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


[PATCH] D133092: [clang] fix generation of .debug_aranges with LTO

2022-09-14 Thread Kazushi Marukawa via Phabricator via cfe-commits
kaz7 added a comment.

For your information, after this patch `check-clang` fails with following 
errors if there is no lld is installed (lld is not enable in CMake, and lld is 
not installed previously).  I appreciate if you run debug-options.c test with 
`-fuse-ld=lld` if the lld is existing.  Thanks.

  
/home/jam/llvm-upstream/llvm-project/clang/test/Driver/debug-options.c:379:16: 
error: LLDGARANGE: expected string not found in input
  // LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"
 ^
  :1:1: note: scanning from here
  clang version 16.0.0 (g...@kaz7.github.com:llvm/llvm-project.git 
734843ebc7c348a154182da00d4f0e215932d64e)
  ^
  :7:546: note: possible intended match here
   "/home/jam/llvm-upstream/build/bin/clang-16" "-cc1" "-triple" 
"x86_64-unknown-linux" "-emit-llvm-bc" "-flto=full" "-flto-unit" 
"-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" 
"-discard-value-names" "-main-file-name" "debug-options.c" "-mrelocation-model" 
"pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-fmath-errno" 
"-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" 
"-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-mllvm" 
"-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-mllvm" 
"-generate-arange-section" 
"-fcoverage-compilation-dir=/home/jam/llvm-upstream/build/tools/clang/test/Driver"
 "-resource-dir" "/home/jam/llvm-upstream/build/lib/clang/16.0.0" 
"-internal-isystem" "/home/jam/llvm-upstream/build/lib/clang/16.0.0/include" 
"-internal-isystem" "/usr/local/include" "-internal-isystem" 
"/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include" 
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" 
"-internal-externc-isystem" "/include" "-internal-externc-isystem" 
"/usr/include" 
"-fdebug-compilation-dir=/home/jam/llvm-upstream/build/tools/clang/test/Driver" 
"-ferror-limit" "19" "-fgnuc-version=4.2.1" "-faddrsig" 
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" 
"/tmp/lit-tmp-l8cchoyh/debug-options-1436f9.o" "-x" "c" 
"/home/jam/llvm-upstream/llvm-project/clang/test/Driver/debug-options.c"
  ...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133092

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


[clang] 1c0a90f - [C++20] [Coroutines] Prefer sized deallocation in promise_type

2022-09-14 Thread Chuanqi Xu via cfe-commits

Author: Chuanqi Xu
Date: 2022-09-14T15:07:31+08:00
New Revision: 1c0a90fd47bded1a6d5f31091e32cd79434bf4d4

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

LOG: [C++20] [Coroutines] Prefer sized deallocation in promise_type

Now when the compiler can't find the sized deallocation function
correctly in promise_type if there are multiple deallocation function
overloads there.

According to [dcl.fct.def.coroutine]p12:
> If both a usual deallocation function with only a pointer parameter
> and a usual deallocation function with both a pointer parameter and a
> size parameter are found, then the selected deallocation function
> shall be the one with two parameters.

So when there are multiple deallocation functions, the compiler should
choose the sized one instead of the unsized one. The patch fixes this.

Added: 


Modified: 
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaCoroutine.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/test/CodeGenCoroutines/coro-alloc.cpp

Removed: 




diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 459c1109b852e..44c4f92592b06 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -6646,8 +6646,8 @@ class Sema final {
ArrayRef Params);
 
   bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD,
-DeclarationName Name, FunctionDecl* &Operator,
-bool Diagnose = true);
+DeclarationName Name, FunctionDecl *&Operator,
+bool Diagnose = true, bool WantSize = false);
   FunctionDecl *FindUsualDeallocationFunction(SourceLocation StartLoc,
   bool CanProvideSize,
   bool Overaligned,

diff  --git a/clang/lib/Sema/SemaCoroutine.cpp 
b/clang/lib/Sema/SemaCoroutine.cpp
index 31a79e11f21f6..34ed416da3dd6 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -1043,7 +1043,8 @@ static bool findDeleteForPromise(Sema &S, SourceLocation 
Loc, QualType PromiseTy
   // The deallocation function's name is looked up by searching for it in the
   // scope of the promise type. If nothing is found, a search is performed in
   // the global scope.
-  if (S.FindDeallocationFunction(Loc, PointeeRD, DeleteName, OperatorDelete))
+  if (S.FindDeallocationFunction(Loc, PointeeRD, DeleteName, OperatorDelete,
+ /*Diagnose*/ true, /*WantSize*/ true))
 return false;
 
   // [dcl.fct.def.coroutine]p12

diff  --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index bc950ab7c4a7a..1c4e2e968d6c0 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -3176,7 +3176,8 @@ FunctionDecl 
*Sema::FindDeallocationFunctionForDestructor(SourceLocation Loc,
 
 bool Sema::FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD,
 DeclarationName Name,
-FunctionDecl *&Operator, bool Diagnose) {
+FunctionDecl *&Operator, bool Diagnose,
+bool WantSize) {
   LookupResult Found(*this, Name, StartLoc, LookupOrdinaryName);
   // Try to find operator delete/operator delete[] in class scope.
   LookupQualifiedName(Found, RD);
@@ -3192,7 +3193,7 @@ bool Sema::FindDeallocationFunction(SourceLocation 
StartLoc, CXXRecordDecl *RD,
   //   If the deallocation functions have class scope, the one without a
   //   parameter of type std::size_t is selected.
   llvm::SmallVector Matches;
-  resolveDeallocationOverload(*this, Found, /*WantSize*/ false,
+  resolveDeallocationOverload(*this, Found, /*WantSize*/ WantSize,
   /*WantAlign*/ Overaligned, &Matches);
 
   // If we could find an overload, use it.

diff  --git a/clang/test/CodeGenCoroutines/coro-alloc.cpp 
b/clang/test/CodeGenCoroutines/coro-alloc.cpp
index adcf7a1254f60..c16af68664e72 100644
--- a/clang/test/CodeGenCoroutines/coro-alloc.cpp
+++ b/clang/test/CodeGenCoroutines/coro-alloc.cpp
@@ -243,3 +243,32 @@ extern "C" int f4(promise_on_alloc_failure_tag) {
   // CHECK:   ret i32 %[[LoadRet]]
   co_return;
 }
+
+struct promise_sized_delete_tag2 {};
+
+template <>
+struct std::coroutine_traits {
+  struct promise_type {
+// Tests that the compiler can choose the correct operator delete
+// when we have multiple operator delete
+void operator delete(void*, unsigned long);
+void operator delete(void*);
+void get_return_object() {}
+suspend_always initial_suspend() { return {}; }
+suspend_always fi

[PATCH] D133834: [RISCV] Remove support for the unratified Zbt extension.

2022-09-14 Thread Chenbing.Zheng via Phabricator via cfe-commits
Chenbing.Zheng added a comment.

I agree that we should remove support for unratified extension.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133834

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


[PATCH] D133841: [test][clang] run test for lld emitting dwarf-aranages only if lld is presented Fixes: https://reviews.llvm.org/D133092 CI: https://lab.llvm.org/buildbot/#/builders/109/builds/46592

2022-09-14 Thread Azat Khuzhin via Phabricator via cfe-commits
azat created this revision.
azat added a reviewer: dblaikie.
Herald added a project: All.
azat 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/D133841

Files:
  clang/test/Driver/debug-options-lld.c
  clang/test/Driver/debug-options.c


Index: clang/test/Driver/debug-options.c
===
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -246,11 +246,7 @@
 // RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=NOPUB %s
 // RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck 
-check-prefix=NOPUB %s
 //
-// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | 
FileCheck -check-prefix=GARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 
| FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 
2>&1 | FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+// RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck 
-check-prefix=GARANGE %s
 //
 // RUN: %clang -### -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 
\
 // RUN:| FileCheck -check-prefix=FDTS %s
@@ -375,8 +371,6 @@
 // NORNGBSE-NOT: -fdebug-ranges-base-address
 //
 // GARANGE-DAG: -generate-arange-section
-// LDGARANGE-NOT: {{".*lld.*"}} {{.*}} "-generate-arange-section"
-// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"
 //
 // FDTS: "-mllvm" "-generate-type-units"
 // FDTSE: error: unsupported option '-fdebug-types-section' for target 
'x86_64-apple-darwin'
Index: clang/test/Driver/debug-options-lld.c
===
--- /dev/null
+++ clang/test/Driver/debug-options-lld.c
@@ -0,0 +1,12 @@
+// REQUIRES: lld
+// Check that lld will emit dwarf aranges.
+
+// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | 
FileCheck -check-prefix=GARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 
| FileCheck -check-prefix=LDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 
2>&1 | FileCheck -check-prefix=LDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+//
+// GARANGE-DAG: -generate-arange-section
+// LDGARANGE-NOT: {{".*lld.*"}} {{.*}} "-generate-arange-section"
+// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"


Index: clang/test/Driver/debug-options.c
===
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -246,11 +246,7 @@
 // RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=NOPUB %s
 // RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s
 //
-// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+// RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
 //
 // RUN: %clang -### -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 \
 // RUN:| FileCheck -check-prefix=FDTS %s
@@ -375,8 +371,6 @@
 // NORNGBSE-NOT: -fdebug-ranges-base-address
 //
 // GARANGE-DAG: -generate-arange-section
-// LDGARANGE-NOT: {{".*lld.*"}} {{.*}} "-generate-arange-section"
-// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"
 //
 // FDTS: "-mllvm" "-generate-type-units"
 // FDTSE: error: unsupported option '-fdebug-types-section' for target 'x86_64-apple-darwin'
Index: clang/test/Driver/debug-options-lld.c
===
--- /dev/null
+++ clang/test/Driver/debug-options-lld.c
@@ -0,0 +1,12 @@
+// REQUIRES: lld
+// Check that lld will emit dwarf aranges.
+
+// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE

[PATCH] D133092: [clang] fix generation of .debug_aranges with LTO

2022-09-14 Thread Azat Khuzhin via Phabricator via cfe-commits
azat added a comment.

In D133092#3788734 , @kaz7 wrote:

> For your information, after this patch `check-clang` fails with following 
> errors if there is no lld (lld is not enable in CMake, and lld is not 
> installed previously).  I appreciate if you run debug-options.c test with 
> `-fuse-ld=lld` if the lld is existing.  Thanks.

Yep, already worked on it, fix - https://reviews.llvm.org/D133841

P.S. I don't have commit rights so if someone can commit it after CI that will 
be great


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133092

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


[PATCH] D133341: [C++] [Coroutines] Prefer aligned (de)allocation for coroutines - implement the option2 of P2014R0

2022-09-14 Thread Chuanqi Xu via Phabricator via cfe-commits
ChuanqiXu updated this revision to Diff 459997.
ChuanqiXu marked 5 inline comments as done.
ChuanqiXu added a comment.

Address comments.


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

https://reviews.llvm.org/D133341

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/include/clang/Sema/Sema.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGCoroutine.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Sema/SemaCoroutine.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/CodeGenCoroutines/coro-aligned-alloc-2.cpp
  clang/test/CodeGenCoroutines/coro-aligned-alloc.cpp
  clang/test/SemaCXX/coroutine-alloc-4.cpp

Index: clang/test/SemaCXX/coroutine-alloc-4.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/coroutine-alloc-4.cpp
@@ -0,0 +1,116 @@
+// Tests that we'll find aligned allocation funciton properly.
+// RUN: %clang_cc1 %s -std=c++20 %s -fsyntax-only -verify -fcoro-aligned-allocation
+
+#include "Inputs/std-coroutine.h"
+
+namespace std {
+typedef __SIZE_TYPE__ size_t;
+enum class align_val_t : size_t {};
+}
+
+struct task {
+  struct promise_type {
+auto initial_suspend() { return std::suspend_always{}; }
+auto final_suspend() noexcept { return std::suspend_always{}; }
+auto get_return_object() { return task{}; }
+void unhandled_exception() {}
+void return_value(int) {}
+void *operator new(std::size_t); // expected-warning 1+{{found non aligned allocation function for coroutine}}
+  };
+};
+
+task f() {
+co_return 43;
+}
+
+struct task2 {
+  struct promise_type {
+auto initial_suspend() { return std::suspend_always{}; }
+auto final_suspend() noexcept { return std::suspend_always{}; }
+auto get_return_object() { return task2{}; }
+void unhandled_exception() {}
+void return_value(int) {}
+void *operator new(std::size_t, std::align_val_t);
+  };
+};
+
+// no diagnostic expected
+task2 f1() {
+co_return 43;
+}
+
+struct task3 {
+  struct promise_type {
+auto initial_suspend() { return std::suspend_always{}; }
+auto final_suspend() noexcept { return std::suspend_always{}; }
+auto get_return_object() { return task3{}; }
+void unhandled_exception() {}
+void return_value(int) {}
+void *operator new(std::size_t, std::align_val_t) noexcept;
+void *operator new(std::size_t) noexcept;
+static auto get_return_object_on_allocation_failure() { return task3{}; }
+  };
+};
+
+// no diagnostic expected
+task3 f2() {
+co_return 43;
+}
+
+struct task4 {
+  struct promise_type {
+auto initial_suspend() { return std::suspend_always{}; }
+auto final_suspend() noexcept { return std::suspend_always{}; }
+auto get_return_object() { return task4{}; }
+void unhandled_exception() {}
+void return_value(int) {}
+void *operator new(std::size_t, std::align_val_t, int, double, int) noexcept;
+  };
+};
+
+// no diagnostic expected
+task4 f3(int, double, int) {
+co_return 43;
+}
+
+struct task5 {
+  struct promise_type {
+auto initial_suspend() { return std::suspend_always{}; }
+auto final_suspend() noexcept { return std::suspend_always{}; }
+auto get_return_object() { return task5{}; }
+void unhandled_exception() {}
+void return_value(int) {}
+  };
+};
+
+// no diagnostic expected.
+// The aligned allocation will be declared by the compiler.
+task5 f4() {
+co_return 43;
+}
+
+namespace std {
+  struct nothrow_t {};
+  constexpr nothrow_t nothrow = {};
+}
+
+struct task6 {
+  struct promise_type {
+auto initial_suspend() { return std::suspend_always{}; }
+auto final_suspend() noexcept { return std::suspend_always{}; }
+auto get_return_object() { return task6{}; }
+void unhandled_exception() {}
+void return_value(int) {}
+static task6 get_return_object_on_allocation_failure() { return task6{}; }
+  };
+};
+
+task6 f5() { // expected-error 1+{{unable to find '::operator new(size_t, align_val_t, nothrow_t)' for 'f5'}}
+co_return 43;
+}
+
+void *operator new(std::size_t, std::align_val_t, std::nothrow_t) noexcept; 
+
+task6 f6() {
+co_return 43;
+}
Index: clang/test/CodeGenCoroutines/coro-aligned-alloc.cpp
===
--- /dev/null
+++ clang/test/CodeGenCoroutines/coro-aligned-alloc.cpp
@@ -0,0 +1,190 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 \
+// RUN:   -fcoro-aligned-allocation -S -emit-llvm %s -o - -disable-llvm-passes \
+// RUN:   | FileCheck %s
+
+#include "Inputs/coroutine.h"
+
+namespace std {
+typedef __SIZE_TYPE__ size_t;
+enum class align_val_t : size_t {};
+}
+
+struct task {
+  struct promise_type {
+auto initial_suspend() { return std::suspend_always{}

[PATCH] D133341: [C++] [Coroutines] Prefer aligned (de)allocation for coroutines - implement the option2 of P2014R0

2022-09-14 Thread Chuanqi Xu via Phabricator via cfe-commits
ChuanqiXu marked 2 inline comments as done.
ChuanqiXu added a comment.

In D133341#3788283 , @ychen wrote:

> It surprises me that Option 2 does not change 
> https://eel.is/c++draft/dcl.fct.def.coroutine#10. For consistency, I think it 
> should. And according to your test case, it deals with alignment as expected. 
> Probably we should change the P2014R0 wording accordingly. Before that, let's 
> just mention this difference in the Clang release notes.

Yeah, in fact due to the wording of coroutine allocation has changed slightly 
recently, the wording of P2014  must be updated 
before merged. And I agree it should be consistent.




Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:11283
+def err_conflicting_aligned_options : Error <
+  "conflicting option '-fcoro-aligned-allocation' and 
'-fno-aligned-allocation'"
 >;

ychen wrote:
> Since we're digressing from the usual operator new/delete look-up rules per 
> Option 2, I think it might be easier to just *not* respect 
> `-fno-aligned-allocation` and `-fno-sized-deallocation`. Using 
> '-fcoro-aligned-allocation' explicitly should permit us to assume these 
> functions could be found.
I guess it may not be good to enable `-fsized-deallocation` automatically if 
`-fcoro-aligned-allocation` enabled. Since it looks like there are other 
reasons why we disabled `-fsized-deallocation` before. And it looks it will 
block our users to use `-fcoro-aligned-allocation`. For the 
`-faligned-allocation` flag, this is enabled by default but people could 
disable it explicitly. So the check here is for that.



Comment at: clang/lib/Sema/SemaCoroutine.cpp:1302-1318
   // According to [dcl.fct.def.coroutine]p9, Lookup allocation functions using 
a
   // parameter list composed of the requested size of the coroutine state being
   // allocated, followed by the coroutine function's arguments. If a matching
   // allocation function exists, use it. Otherwise, use an allocation function
   // that just takes the requested size.
   //
   // [dcl.fct.def.coroutine]p9

ychen wrote:
> Update comment here.
Since P2014 is not standardized, I feel it might not be good to edit them here.



Comment at: clang/lib/Sema/SemaCoroutine.cpp:1400
 
+  // If we found a non-aligned allocation function in the promise_type,
+  // it indicates the user forgot to update the allocation function. Let's emit

ychen wrote:
> Option 2's order of look-up is 
> ```
> void* T::operator new  ( std::size_t count, std::align_val_t al, 
> user-defined-args... );
> void* T::operator new  ( std::size_t count, std::align_val_t al);
> void* T::operator new  ( std::size_t count, user-defined-args... );
> void* T::operator new  ( std::size_t count);
> void* operator new  ( std::size_t count, std::align_val_t al );
> ```
> Why not allow `void* T::operator new  ( std::size_t count);` here?
My original thought is to be as strict as we can. But now I feel a warning may 
be good enough.



Comment at: clang/test/CodeGenCoroutines/coro-aligned-alloc.cpp:94
+void return_value(int) {}
+void operator delete(void *ptr, std::align_val_t);
+  };

ychen wrote:
> Please add test cases for 
> ```
> void operator delete  ( void* ptr, std::size_t, std::align_val_t);
> void operator delete  ( void* ptr, std::size_t);
> void operator delete  ( void* ptr);
> void ::operator delete  ( void* ptr, std::size_t, std::align_val_t);
> void ::operator delete  ( void* ptr, std::size_t);
> void ::operator delete  ( void* ptr);
> ```
> in that lookup order, and makes sure the look-up order is expected.
I've tried my best. But it looks hard to test these operator delete under 
global namespace since they are automatically declared by the compiler.



Comment at: clang/test/SemaCXX/coroutine-alloc-4.cpp:49
+void return_value(int) {}
+void *operator new(std::size_t, std::align_val_t) noexcept;
+void *operator new(std::size_t) noexcept;

ychen wrote:
> Like this test case, please add additional test cases to check the expected 
> look-up order, one test for each consecutive pair should be good.
> 
> ```
> void* T::operator new  ( std::size_t count, std::align_val_t al, 
> user-defined-args... );
> void* T::operator new  ( std::size_t count, std::align_val_t al);
> void* T::operator new  ( std::size_t count, user-defined-args... );
> void* T::operator new  ( std::size_t count);
> void* operator new  ( std::size_t count, std::align_val_t al );
> ```
> 
> 
Yeah, I'm testing this in CodeGenCoroutines. (It is hard to test the selection 
in Sema Test)


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

https://reviews.llvm.org/D133341

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

[clang] a884364 - [clang][Interp] Remove struct from a testcase

2022-09-14 Thread Timm Bäder via cfe-commits

Author: Timm Bäder
Date: 2022-09-14T09:44:01+02:00
New Revision: a8843643cd75d0e93ebcf3f30b470d2b8e59868d

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

LOG: [clang][Interp] Remove struct from a testcase

This should fix the leak sanitizer breakage introduced by
https://reviews.llvm.org/D132997, e.g.
https://lab.llvm.org/buildbot/#/builders/5/builds/27410

Added: 


Modified: 
clang/test/AST/Interp/references.cpp

Removed: 




diff  --git a/clang/test/AST/Interp/references.cpp 
b/clang/test/AST/Interp/references.cpp
index 61d4d91e42245..2b5187ca29dd9 100644
--- a/clang/test/AST/Interp/references.cpp
+++ b/clang/test/AST/Interp/references.cpp
@@ -75,6 +75,7 @@ static_assert(testGetValue() == 30, "");
 constexpr const int &MCE = 1; // expected-error{{must be initialized by a 
constant expression}}
 
 
+#if 0
 struct S {
   int i, j;
 };
@@ -88,4 +89,5 @@ constexpr int RefToMemberExpr() {
   return j;
 }
 // FIXME: Should be accepted.
-static_assert(RefToMemberExpr() == 11, ""); // expected-error{{not an integral 
constant expression}}
+static_assert(RefToMemberExpr() == 11, "");
+#endif



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


[PATCH] D133841: [test][clang] run test for lld emitting dwarf-aranages only if lld is presented

2022-09-14 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

This looks good to me, I'm going to land this for you once I confirm that it 
fixes the test failure (we can address any post comments from dblaikie@).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133841

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


[PATCH] D116443: [clangd] Implement textDocument/typeDefinition

2022-09-14 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.
Herald added a project: All.



Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:1292
+for (const LocatedSymbol &Sym : *Types)
+  Response.push_back(Sym.PreferredDeclaration);
+return Reply(std::move(Response));

any particular reason for jumping to declaration here, rather than using 
definition when it's available or was this just an oversight?

because this results in us jumping to forward declarations every now and then, 
and I can't see any use case where a declaration would be preferred to 
definition of a type.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116443

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


[PATCH] D91721: [clangd] textDocument/implementation (LSP layer)

2022-09-14 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.
Herald added projects: clang-tools-extra, All.



Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:1306
+for (const LocatedSymbol &Sym : *Overrides)
+  Impls.push_back(Sym.PreferredDeclaration);
+return Reply(std::move(Impls));

any particular reason for preferring declarations here that I am missing (in 
presence of a definition)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91721

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


[PATCH] D133843: [clangd] Prefer definitions for gototype and implementation

2022-09-14 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet created this revision.
kadircet added reviewers: sammccall, usaxena95.
Herald added a subscriber: arphaman.
Herald added a project: All.
kadircet requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133843

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp


Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -615,7 +615,6 @@
  CodeAction::INFO_KIND}}}
   : llvm::json::Value(true);
 
-
   std::vector Commands;
   for (llvm::StringRef Command : Handlers.CommandHandlers.keys())
 Commands.push_back(Command);
@@ -1408,7 +1407,7 @@
   return Reply(Types.takeError());
 std::vector Response;
 for (const LocatedSymbol &Sym : *Types)
-  Response.push_back(Sym.PreferredDeclaration);
+  
Response.push_back(Sym.Definition.value_or(Sym.PreferredDeclaration));
 return Reply(std::move(Response));
   });
 }
@@ -1424,7 +1423,7 @@
   return Reply(Overrides.takeError());
 std::vector Impls;
 for (const LocatedSymbol &Sym : *Overrides)
-  Impls.push_back(Sym.PreferredDeclaration);
+  Impls.push_back(Sym.Definition.value_or(Sym.PreferredDeclaration));
 return Reply(std::move(Impls));
   });
 }


Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -615,7 +615,6 @@
  CodeAction::INFO_KIND}}}
   : llvm::json::Value(true);
 
-
   std::vector Commands;
   for (llvm::StringRef Command : Handlers.CommandHandlers.keys())
 Commands.push_back(Command);
@@ -1408,7 +1407,7 @@
   return Reply(Types.takeError());
 std::vector Response;
 for (const LocatedSymbol &Sym : *Types)
-  Response.push_back(Sym.PreferredDeclaration);
+  Response.push_back(Sym.Definition.value_or(Sym.PreferredDeclaration));
 return Reply(std::move(Response));
   });
 }
@@ -1424,7 +1423,7 @@
   return Reply(Overrides.takeError());
 std::vector Impls;
 for (const LocatedSymbol &Sym : *Overrides)
-  Impls.push_back(Sym.PreferredDeclaration);
+  Impls.push_back(Sym.Definition.value_or(Sym.PreferredDeclaration));
 return Reply(std::move(Impls));
   });
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D133841: [test][clang] run test for lld emitting dwarf-aranages only if lld is presented

2022-09-14 Thread Haojian Wu 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 rG44075cc34a9b: [test][clang] run test for lld emitting 
dwarf-aranages only if lld is presented (authored by azat, committed by hokein).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133841

Files:
  clang/test/Driver/debug-options-lld.c
  clang/test/Driver/debug-options.c


Index: clang/test/Driver/debug-options.c
===
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -246,11 +246,7 @@
 // RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=NOPUB %s
 // RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck 
-check-prefix=NOPUB %s
 //
-// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | 
FileCheck -check-prefix=GARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 
| FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 
2>&1 | FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+// RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck 
-check-prefix=GARANGE %s
 //
 // RUN: %clang -### -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 
\
 // RUN:| FileCheck -check-prefix=FDTS %s
@@ -375,8 +371,6 @@
 // NORNGBSE-NOT: -fdebug-ranges-base-address
 //
 // GARANGE-DAG: -generate-arange-section
-// LDGARANGE-NOT: {{".*lld.*"}} {{.*}} "-generate-arange-section"
-// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"
 //
 // FDTS: "-mllvm" "-generate-type-units"
 // FDTSE: error: unsupported option '-fdebug-types-section' for target 
'x86_64-apple-darwin'
Index: clang/test/Driver/debug-options-lld.c
===
--- /dev/null
+++ clang/test/Driver/debug-options-lld.c
@@ -0,0 +1,12 @@
+// REQUIRES: lld
+// Check that lld will emit dwarf aranges.
+
+// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | 
FileCheck -check-prefix=GARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 
| FileCheck -check-prefix=LDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 
2>&1 | FileCheck -check-prefix=LDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+//
+// GARANGE-DAG: -generate-arange-section
+// LDGARANGE-NOT: {{".*lld.*"}} {{.*}} "-generate-arange-section"
+// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"


Index: clang/test/Driver/debug-options.c
===
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -246,11 +246,7 @@
 // RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=NOPUB %s
 // RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s
 //
-// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+// RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
 //
 // RUN: %clang -### -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 \
 // RUN:| FileCheck -check-prefix=FDTS %s
@@ -375,8 +371,6 @@
 // NORNGBSE-NOT: -fdebug-ranges-base-address
 //
 // GARANGE-DAG: -generate-arange-section
-// LDGARANGE-NOT: {{".*lld.*"}} {{.*}} "-generate-arange-section"
-// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"
 //
 // FDTS: "-mllvm" "-generate-type-units"
 // FDTSE: error: unsupported option '-fdebug-types-section' for target 'x86_64-apple-darwin'
Index: clang/test/Driver/debug-options-lld.c
===
--- /dev/null
+++ clang/test/Driver/debug-options-lld.c
@@ -0,0 +1,12 @@
+// REQUIRES: lld
+// C

[clang] 44075cc - [test][clang] run test for lld emitting dwarf-aranages only if lld is presented

2022-09-14 Thread Haojian Wu via cfe-commits

Author: Azat Khuzhin
Date: 2022-09-14T10:17:03+02:00
New Revision: 44075cc34a9b373714b594964001ce283598eac1

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

LOG: [test][clang] run test for lld emitting dwarf-aranages only if lld is 
presented

Fixes: https://reviews.llvm.org/D133092
CI: https://lab.llvm.org/buildbot/#/builders/109/builds/46592

Reviewed By: hokein

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

Added: 
clang/test/Driver/debug-options-lld.c

Modified: 
clang/test/Driver/debug-options.c

Removed: 




diff  --git a/clang/test/Driver/debug-options-lld.c 
b/clang/test/Driver/debug-options-lld.c
new file mode 100644
index ..a69ebe3b1b4c
--- /dev/null
+++ b/clang/test/Driver/debug-options-lld.c
@@ -0,0 +1,12 @@
+// REQUIRES: lld
+// Check that lld will emit dwarf aranges.
+
+// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | 
FileCheck -check-prefix=GARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 
| FileCheck -check-prefix=LDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 
2>&1 | FileCheck -check-prefix=LDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+//
+// GARANGE-DAG: -generate-arange-section
+// LDGARANGE-NOT: {{".*lld.*"}} {{.*}} "-generate-arange-section"
+// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"

diff  --git a/clang/test/Driver/debug-options.c 
b/clang/test/Driver/debug-options.c
index 2da192d098e2..04004716aa50 100644
--- a/clang/test/Driver/debug-options.c
+++ b/clang/test/Driver/debug-options.c
@@ -246,11 +246,7 @@
 // RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=NOPUB %s
 // RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck 
-check-prefix=NOPUB %s
 //
-// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | 
FileCheck -check-prefix=GARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 
| FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 
2>&1 | FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+// RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck 
-check-prefix=GARANGE %s
 //
 // RUN: %clang -### -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 
\
 // RUN:| FileCheck -check-prefix=FDTS %s
@@ -375,8 +371,6 @@
 // NORNGBSE-NOT: -fdebug-ranges-base-address
 //
 // GARANGE-DAG: -generate-arange-section
-// LDGARANGE-NOT: {{".*lld.*"}} {{.*}} "-generate-arange-section"
-// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"
 //
 // FDTS: "-mllvm" "-generate-type-units"
 // FDTSE: error: unsupported option '-fdebug-types-section' for target 
'x86_64-apple-darwin'



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


[PATCH] D111283: [clang] template / auto deduction deduces common sugar

2022-09-14 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 460010.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111283

Files:
  clang-tools-extra/clangd/unittests/ASTTests.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/Type.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
  clang/test/SemaCXX/deduced-return-void.cpp
  clang/test/SemaCXX/sugared-auto.cpp
  clang/test/SemaTemplate/deduction.cpp
  libcxx/utils/ci/buildkite-pipeline.yml

Index: libcxx/utils/ci/buildkite-pipeline.yml
===
--- libcxx/utils/ci/buildkite-pipeline.yml
+++ libcxx/utils/ci/buildkite-pipeline.yml
@@ -59,19 +59,6 @@
   limit: 2
 timeout_in_minutes: 120
 
-  - label: "Documentation"
-command: "libcxx/utils/ci/run-buildbot documentation"
-artifact_paths:
-  - "**/test-results.xml"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
   #
   # General testing with the default configuration, under all the supported
   # Standard modes, with Clang and GCC. This catches most issues upfront.
@@ -79,273 +66,6 @@
   #
   - wait
 
-  - label: "C++2b"
-command: "libcxx/utils/ci/run-buildbot generic-cxx2b"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-CC: "clang-${LLVM_HEAD_VERSION}"
-CXX: "clang++-${LLVM_HEAD_VERSION}"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  - label: "C++11"
-command: "libcxx/utils/ci/run-buildbot generic-cxx11"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-CC: "clang-${LLVM_HEAD_VERSION}"
-CXX: "clang++-${LLVM_HEAD_VERSION}"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  - label: "C++03"
-command: "libcxx/utils/ci/run-buildbot generic-cxx03"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-CC: "clang-${LLVM_HEAD_VERSION}"
-CXX: "clang++-${LLVM_HEAD_VERSION}"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  - label: "Modular build"
-command: "libcxx/utils/ci/run-buildbot generic-modules"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-CC: "clang-${LLVM_HEAD_VERSION}"
-CXX: "clang++-${LLVM_HEAD_VERSION}"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  - label: "GCC ${GCC_STABLE_VERSION} / C++latest"
-command: "libcxx/utils/ci/run-buildbot generic-gcc"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-CC: "gcc-${GCC_STABLE_VERSION}"
-CXX: "g++-${GCC_STABLE_VERSION}"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  #
-  # All other supported configurations of libc++.
-  #
-  - wait
-
-  - label: "C++20"
-command: "libcxx/utils/ci/run-buildbot generic-cxx20"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-CC: "clang-${LLVM_HEAD_VERSION}"
-CXX: "clang++-${LLVM_HEAD_VERSION}"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  - label: "C++17"
-command: "libcxx/utils/ci/run-buildbot generic-cxx17"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-# TODO (mordante) use head
-#CC: "clang-${LLVM_HEAD_VERSION}"
-#CXX: "clang++-${LLVM_HEAD_VERSION}"
-CC: "clang-15"
-CXX: "clang++-15"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  - label: "C++

[PATCH] D129926: [clang-format] Handle constructor invocations after new operator in C# correct

2022-09-14 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a subscriber: aaron.ballman.
MyDeveloperDay added a comment.

@eoanermine  ping... we need your name/email before we can commit.

(@curdeius, @owenpan, @HazardyKnusperkeks ) we need to have a policy for this, 
that if we don't get the name for a commit we are happy to land, that we'll do 
it the old way, and just mention them, Its frustrating for us to waste our time 
doing reviews only to fall at the last hurdle. (@aaron.ballman any thoughts)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129926

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


[PATCH] D132131: [clang-format] Adds a formatter for aligning trailing comments over empty lines

2022-09-14 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments.



Comment at: clang/include/clang/Format/Format.h:428
+
+bool operator==(const TrailingCommentsAlignmentStyle &R) const {
+  return Kind == R.Kind && OverEmptyLines == R.OverEmptyLines;

yusuke-kadowaki wrote:
> MyDeveloperDay wrote:
> > yusuke-kadowaki wrote:
> > > > I don't understand the need for state as a struct could have multiple 
> > > > options (as enums) each enum should have a state that means "Leave"
> > > 
> > > @MyDeveloperDay 
> > > Without having state, how can this be implemented?
> > bool Enabled  =  (Kind != FormatStyle::TCAS_Leave)
> Oh ok so I think we are on the same page.
do you need this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132131

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


[PATCH] D132316: [CMake] Avoid `LLVM_BINARY_DIR` when other more specific variable are better-suited, part 2

2022-09-14 Thread Sebastian Neubauer via Phabricator via cfe-commits
sebastian-ne accepted this revision.
sebastian-ne added a comment.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132316

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


[PATCH] D133648: Clang, increase upper bound of partially initialized array sizes

2022-09-14 Thread Ofek Shochat via Phabricator via cfe-commits
OfekShochat marked an inline comment as done.
OfekShochat added a comment.

I created a diff for the AsmPrinter part, its at D133845 





Comment at: clang/lib/Sema/SemaInit.cpp:866
 ElementEntity.getKind() == InitializedEntity::EK_VectorElement)
   ElementEntity.setElementIndex(Init);
 

efriedma wrote:
> shafik wrote:
> > `setElementIndex(...)` takes `unsigned` as well and therefore 
> > `InitializedEntity` also uses `unsigned`.
> > 
> > I briefly looked at this with another bug 
> > https://github.com/llvm/llvm-project/issues/57317
> > 
> > and I believe the 32 bit assumption is made in a lot of this code in this 
> > area. 
> You don't need to solve everything at once...
oh, right, should I change that after I split the diff in AsmPrinter to another 
patch?



Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3167
   // Print the fields in successive locations. Pad to align if needed!
-  unsigned Size = DL.getTypeAllocSize(CS->getType());
+  uint64_t Size = DL.getTypeAllocSize(CS->getType());
   const StructLayout *Layout = DL.getStructLayout(CS->getType());

efriedma wrote:
> Can you split this into a separate patch (with an appropriate testcase)?
yep


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133648

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


[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Michał Górny via Phabricator via cfe-commits
mgorny requested changes to this revision.
mgorny added a comment.
This revision now requires changes to proceed.

I'm seeing test failures with this patch applied:

  Failed Tests (3):
Clang :: CodeGen/PowerPC/builtins-ppc-p8vector.c
Clang :: CodeGen/builtins-arm-msvc-compat-only.c
Clang :: CodeGen/neon-crypto.c

Overall, they all look like they were relying on the `-Werror=...` behavior.

Test failure details: F24546597: tests.txt 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133800

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


[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

Hmm, I just realized that I've tested on top of 15.0.0. If commits already on 
top of `release/15.x` branch already fix that, I'm sorry!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133800

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


[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Nikita Popov via Phabricator via cfe-commits
nikic added a comment.

I tested this patch as well and saw the same failures as @mgorny. Here's the 
additional patch I had to apply to make this pass:

  diff --git a/clang/test/CodeGen/PowerPC/builtins-ppc-p8vector.c 
b/clang/test/CodeGen/PowerPC/builtins-ppc-p8vector.c
  index af3d5c7d066b..3c55e63d1bc8 100644
  --- a/clang/test/CodeGen/PowerPC/builtins-ppc-p8vector.c
  +++ b/clang/test/CodeGen/PowerPC/builtins-ppc-p8vector.c
  @@ -143,7 +143,7 @@ void test1() {
 res_vui = vec_mergee(vui, vui);
   // CHECK: @llvm.ppc.altivec.vperm
   // CHECK-LE: @llvm.ppc.altivec.vperm
  -// CHECK-PPC: error: call to undeclared function 'vec_mergee'
  +// CHECK-PPC: warning: call to undeclared function 'vec_mergee'
   
 res_vbll = vec_mergee(vbll, vbll);
   // CHECK: @llvm.ppc.altivec.vperm
  @@ -177,7 +177,7 @@ void test1() {
 res_vui = vec_mergeo(vui, vui);
   // CHECK: @llvm.ppc.altivec.vperm
   // CHECK-LE: @llvm.ppc.altivec.vperm
  -// CHECK-PPC: error: call to undeclared function 'vec_mergeo'
  +// CHECK-PPC: warning: call to undeclared function 'vec_mergeo'
   
 /* vec_cmpeq */
 res_vbll = vec_cmpeq(vbll, vbll);
  diff --git a/clang/test/CodeGen/builtins-arm-msvc-compat-only.c 
b/clang/test/CodeGen/builtins-arm-msvc-compat-only.c
  index 42cc9d70a142..c2b021b31174 100644
  --- a/clang/test/CodeGen/builtins-arm-msvc-compat-only.c
  +++ b/clang/test/CodeGen/builtins-arm-msvc-compat-only.c
  @@ -1,6 +1,6 @@
   // RUN: %clang_cc1 -triple thumbv7-windows -fms-extensions -emit-llvm -o - 
%s \
   // RUN: | FileCheck %s -check-prefix CHECK-MSVC
  -// RUN: not %clang_cc1 -triple armv7-eabi -emit-llvm %s -o /dev/null 2>&1 \
  +// RUN: %clang_cc1 -triple armv7-eabi -emit-llvm %s -o /dev/null 2>&1 \
   // RUN: | FileCheck %s -check-prefix CHECK-EABI
   // REQUIRES: arm-registered-target
   
  @@ -9,7 +9,7 @@ void emit() {
   }
   
   // CHECK-MSVC: call void asm sideeffect ".inst.n 0xDEFE", ""()
  -// CHECK-EABI: error: call to undeclared function '__emit'
  +// CHECK-EABI: warning: call to undeclared function '__emit'
   
   void emit_truncated() {
 __emit(0x); // movs r0, r0
  diff --git a/clang/test/CodeGen/neon-crypto.c 
b/clang/test/CodeGen/neon-crypto.c
  index 916886574416..1b29b1a53096 100644
  --- a/clang/test/CodeGen/neon-crypto.c
  +++ b/clang/test/CodeGen/neon-crypto.c
  @@ -14,7 +14,7 @@
   
   uint8x16_t test_vaeseq_u8(uint8x16_t data, uint8x16_t key) {
 // CHECK-LABEL: @test_vaeseq_u8
  -  // CHECK-NO-CRYPTO: error: call to undeclared function 'vaeseq_u8'
  +  // CHECK-NO-CRYPTO: warning: call to undeclared function 'vaeseq_u8'
 return vaeseq_u8(data, key);
 // CHECK: call <16 x i8> @llvm.{{arm.neon|aarch64.crypto}}.aese(<16 x i8> 
%data, <16 x i8> %key)
   }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133800

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


[PATCH] D133804: Cuda Check for ignored return errors from api calls to cuda

2022-09-14 Thread Bartłomiej Cieślar via Phabricator via cfe-commits
barcisz updated this revision to Diff 460019.
barcisz added a comment.

More explanation comments for the check's code


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133804

Files:
  clang-tools-extra/clang-tidy/cuda/CMakeLists.txt
  clang-tools-extra/clang-tidy/cuda/CudaTidyModule.cpp
  clang-tools-extra/clang-tidy/cuda/UnsafeApiCallCheck.cpp
  clang-tools-extra/clang-tidy/cuda/UnsafeApiCallCheck.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda_runtime.h
  clang-tools-extra/test/clang-tidy/checkers/cuda/.keep
  
clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-function-handler.cu
  
clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-macro-handler.cu

Index: clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-macro-handler.cu
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-macro-handler.cu
@@ -0,0 +1,104 @@
+//===--- SlicingCheck.cpp - clang-tidy-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// RUN: %check_clang_tidy %s cuda-unsafe-api-call %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: cuda-unsafe-api-call.HandlerName, \
+// RUN:   value: 'CUDA_HANDLER'}] \
+// RUN: }" \
+// RUN:   -- -isystem %clang_tidy_headers -nocudalib -nocudainc -std=c++14
+#include 
+
+class DummyContainer {
+ public:
+  int* begin();
+  int* end();
+};
+
+#define DUMMY_CUDA_HANDLER(stmt) stmt
+#define CUDA_HANDLER(stmt) do {auto err = stmt;} while(0)
+#define API_CALL() do {cudaDeviceReset();} while(0)
+
+void errorCheck();
+void errorCheck(cudaError_t error);
+
+void bad() {
+  API_CALL();
+  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+  // There isn't supposed to be a fix here since it's a macro call
+
+  cudaDeviceReset();
+  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+  // CHECK-FIXES:  {{^}}  CUDA_HANDLER(cudaDeviceReset());{{$}}
+  errorCheck();
+
+  if (true)
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  while (true)
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  do
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+  while(false);
+
+  switch (0) {
+case 0:
+  cudaDeviceReset();
+  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+  // CHECK-FIXES:  {{^}}  CUDA_HANDLER(cudaDeviceReset());{{$}}
+  }
+
+  for(
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+;
+cudaDeviceReset()
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset()){{$}}
+  ) cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}  ) CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  for(int i : DummyContainer())
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  auto x = ({
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+true;
+  });
+}
+
+int good() {
+  DUMMY_CUDA_HANDLER(cudaDeviceReset());
+
+  if (cudaDeviceReset()) {
+return 0;
+  }
+
+  switch (cudaDeviceReset()) {
+case cudaErrorInvalidValue: return 1;
+case cudaErrorMemoryAllocation: return 2;
+default: return 3;
+  }
+
+  auto err = ({cudaDeviceReset();});
+  // NOTE: We don't check that `errorCheck()` actually handles the error; we just assume it does.
+  errorCheck(cudaDeviceReset());
+}
Index: clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-function-handler.cu
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-function-handler.cu
@@ -0,0 +1,73 @@
+// (c) Meta Pla

[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

@nikic, with your patch I still have `CodeGen/PowerPC/builtins-ppc-p8vector.c` 
failing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133800

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


[PATCH] D111283: [clang] template / auto deduction deduces common sugar

2022-09-14 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 460021.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111283

Files:
  clang-tools-extra/clangd/unittests/ASTTests.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/Type.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
  clang/test/SemaCXX/deduced-return-void.cpp
  clang/test/SemaCXX/sugared-auto.cpp
  clang/test/SemaTemplate/deduction.cpp
  libcxx/utils/ci/buildkite-pipeline.yml

Index: libcxx/utils/ci/buildkite-pipeline.yml
===
--- libcxx/utils/ci/buildkite-pipeline.yml
+++ libcxx/utils/ci/buildkite-pipeline.yml
@@ -59,19 +59,6 @@
   limit: 2
 timeout_in_minutes: 120
 
-  - label: "Documentation"
-command: "libcxx/utils/ci/run-buildbot documentation"
-artifact_paths:
-  - "**/test-results.xml"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
   #
   # General testing with the default configuration, under all the supported
   # Standard modes, with Clang and GCC. This catches most issues upfront.
@@ -79,273 +66,6 @@
   #
   - wait
 
-  - label: "C++2b"
-command: "libcxx/utils/ci/run-buildbot generic-cxx2b"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-CC: "clang-${LLVM_HEAD_VERSION}"
-CXX: "clang++-${LLVM_HEAD_VERSION}"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  - label: "C++11"
-command: "libcxx/utils/ci/run-buildbot generic-cxx11"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-CC: "clang-${LLVM_HEAD_VERSION}"
-CXX: "clang++-${LLVM_HEAD_VERSION}"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  - label: "C++03"
-command: "libcxx/utils/ci/run-buildbot generic-cxx03"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-CC: "clang-${LLVM_HEAD_VERSION}"
-CXX: "clang++-${LLVM_HEAD_VERSION}"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  - label: "Modular build"
-command: "libcxx/utils/ci/run-buildbot generic-modules"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-CC: "clang-${LLVM_HEAD_VERSION}"
-CXX: "clang++-${LLVM_HEAD_VERSION}"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  - label: "GCC ${GCC_STABLE_VERSION} / C++latest"
-command: "libcxx/utils/ci/run-buildbot generic-gcc"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-CC: "gcc-${GCC_STABLE_VERSION}"
-CXX: "g++-${GCC_STABLE_VERSION}"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  #
-  # All other supported configurations of libc++.
-  #
-  - wait
-
-  - label: "C++20"
-command: "libcxx/utils/ci/run-buildbot generic-cxx20"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-CC: "clang-${LLVM_HEAD_VERSION}"
-CXX: "clang++-${LLVM_HEAD_VERSION}"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  - label: "C++17"
-command: "libcxx/utils/ci/run-buildbot generic-cxx17"
-artifact_paths:
-  - "**/test-results.xml"
-  - "**/*.abilist"
-env:
-# TODO (mordante) use head
-#CC: "clang-${LLVM_HEAD_VERSION}"
-#CXX: "clang++-${LLVM_HEAD_VERSION}"
-CC: "clang-15"
-CXX: "clang++-15"
-agents:
-  queue: "libcxx-builders"
-  os: "linux"
-retry:
-  automatic:
-- exit_status: -1  # Agent was lost
-  limit: 2
-timeout_in_minutes: 120
-
-  - label: "C++

[PATCH] D133804: Cuda Check for ignored return errors from api calls to cuda

2022-09-14 Thread Bartłomiej Cieślar via Phabricator via cfe-commits
barcisz updated this revision to Diff 460025.
barcisz added a comment.

Rebase and better comments for cuda-related decisions in the check


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133804

Files:
  clang-tools-extra/-
  clang-tools-extra/clang-tidy/cuda/CMakeLists.txt
  clang-tools-extra/clang-tidy/cuda/CudaTidyModule.cpp
  clang-tools-extra/clang-tidy/cuda/UnsafeApiCallCheck.cpp
  clang-tools-extra/clang-tidy/cuda/UnsafeApiCallCheck.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda_runtime.h
  clang-tools-extra/test/clang-tidy/checkers/cuda/.keep
  
clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-function-handler.cu
  
clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-macro-handler.cu

Index: clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-macro-handler.cu
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-macro-handler.cu
@@ -0,0 +1,96 @@
+// RUN: %check_clang_tidy %s cuda-unsafe-api-call %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: cuda-unsafe-api-call.HandlerName, \
+// RUN:   value: 'CUDA_HANDLER'}] \
+// RUN: }" \
+// RUN:   -- -isystem %clang_tidy_headers -nocudalib -nocudainc -std=c++14
+#include 
+
+class DummyContainer {
+ public:
+  int* begin();
+  int* end();
+};
+
+#define DUMMY_CUDA_HANDLER(stmt) stmt
+#define CUDA_HANDLER(stmt) do {auto err = stmt;} while(0)
+#define API_CALL() do {cudaDeviceReset();} while(0)
+
+void errorCheck();
+void errorCheck(cudaError_t error);
+
+void bad() {
+  API_CALL();
+  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+  // There isn't supposed to be a fix here since it's a macro call
+
+  cudaDeviceReset();
+  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+  // CHECK-FIXES:  {{^}}  CUDA_HANDLER(cudaDeviceReset());{{$}}
+  errorCheck();
+
+  if (true)
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  while (true)
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  do
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+  while(false);
+
+  switch (0) {
+case 0:
+  cudaDeviceReset();
+  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+  // CHECK-FIXES:  {{^}}  CUDA_HANDLER(cudaDeviceReset());{{$}}
+  }
+
+  for(
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+;
+cudaDeviceReset()
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset()){{$}}
+  ) cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}  ) CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  for(int i : DummyContainer())
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  auto x = ({
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+true;
+  });
+}
+
+int good() {
+  DUMMY_CUDA_HANDLER(cudaDeviceReset());
+
+  if (cudaDeviceReset()) {
+return 0;
+  }
+
+  switch (cudaDeviceReset()) {
+case cudaErrorInvalidValue: return 1;
+case cudaErrorMemoryAllocation: return 2;
+default: return 3;
+  }
+
+  auto err = ({cudaDeviceReset();});
+  // NOTE: We don't check that `errorCheck()` actually handles the error; we just assume it does.
+  errorCheck(cudaDeviceReset());
+}
Index: clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-function-handler.cu
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-function-handler.cu
@@ -0,0 +1,71 @@
+// RUN: %check_clang_tidy %s cuda-unsafe-api-call %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: cuda-unsafe-api-call.HandlerName, \
+// RUN:   value: 'cudaHandler'}, \
+// RUN:  {key: cuda-unsafe-api-call.AcceptedHandlers, \
+// RUN:   value: 'CUDA_HANDLER, DUMMY_CUDA_HANDLER, \
+// RUN: 

[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Nikita Popov via Phabricator via cfe-commits
nikic added a comment.

@mgorny Yeah, that was a testing fail on my side. I've updated it to a 
hopefully correct version.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133800

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


[PATCH] D133436: Ground work for cuda-related checks in clang-tidy

2022-09-14 Thread Bartłomiej Cieślar via Phabricator via cfe-commits
barcisz updated this revision to Diff 460027.
barcisz added a comment.

Better explanation of cuda-related flags in tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133436

Files:
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
  clang-tools-extra/clang-tidy/cuda/CMakeLists.txt
  clang-tools-extra/clang-tidy/cuda/CudaTidyModule.cpp
  clang-tools-extra/test/clang-tidy/check_clang_tidy.py
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda-initializers.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda.h
  clang-tools-extra/test/clang-tidy/checkers/cuda/.keep

Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda.h
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda.h
@@ -0,0 +1,28 @@
+/* Minimal declarations for CUDA support.  Testing purposes only. */
+
+#include 
+
+#define __constant__ __attribute__((constant))
+#define __device__ __attribute__((device))
+#define __global__ __attribute__((global))
+#define __host__ __attribute__((host))
+#define __shared__ __attribute__((shared))
+
+struct dim3 {
+  unsigned x, y, z;
+  __host__ __device__ dim3(unsigned x, unsigned y = 1, unsigned z = 1) : x(x), y(y), z(z) {}
+};
+
+typedef struct cudaStream *cudaStream_t;
+typedef enum cudaError {} cudaError_t;
+extern "C" int cudaConfigureCall(dim3 gridSize, dim3 blockSize,
+ size_t sharedSize = 0,
+ cudaStream_t stream = 0);
+extern "C" int __cudaPushCallConfiguration(dim3 gridSize, dim3 blockSize,
+   size_t sharedSize = 0,
+   cudaStream_t stream = 0);
+extern "C" cudaError_t cudaLaunchKernel(const void *func, dim3 gridDim,
+dim3 blockDim, void **args,
+size_t sharedMem, cudaStream_t stream);
+
+extern "C" __device__ int printf(const char*, ...);
Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda-initializers.h
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda-initializers.h
@@ -0,0 +1,145 @@
+// CUDA struct types with interesting initialization properties.
+// Keep in sync with clang/test/SemaCUDA/Inputs/cuda-initializers.h.
+
+// Base classes with different initializer variants.
+
+// trivial constructor -- allowed
+struct T {
+  int t;
+};
+
+// empty constructor
+struct EC {
+  int ec;
+  __device__ EC() {} // -- allowed
+  __device__ EC(int) {}  // -- not allowed
+};
+
+// empty destructor
+struct ED {
+  __device__ ~ED() {} // -- allowed
+};
+
+struct ECD {
+  __device__ ECD() {} // -- allowed
+  __device__ ~ECD() {}// -- allowed
+};
+
+// empty templated constructor -- allowed with no arguments
+struct ETC {
+  template  __device__ ETC(T...) {}
+};
+
+// undefined constructor -- not allowed
+struct UC {
+  int uc;
+  __device__ UC();
+};
+
+// undefined destructor -- not allowed
+struct UD {
+  int ud;
+  __device__ ~UD();
+};
+
+// empty constructor w/ initializer list -- not allowed
+struct ECI {
+  int eci;
+  __device__ ECI() : eci(1) {}
+};
+
+// non-empty constructor -- not allowed
+struct NEC {
+  int nec;
+  __device__ NEC() { nec = 1; }
+};
+
+// non-empty destructor -- not allowed
+struct NED {
+  int ned;
+  __device__ ~NED() { ned = 1; }
+};
+
+// no-constructor,  virtual method -- not allowed
+struct NCV {
+  int ncv;
+  __device__ virtual void vm() {}
+};
+
+// virtual destructor -- not allowed.
+struct VD {
+  __device__ virtual ~VD() {}
+};
+
+// dynamic in-class field initializer -- not allowed
+__device__ int f();
+struct NCF {
+  int ncf = f();
+};
+
+// static in-class field initializer.  NVCC does not allow it, but
+// clang generates static initializer for this, so we'll accept it.
+// We still can't use it on __shared__ vars as they don't allow *any*
+// initializers.
+struct NCFS {
+  int ncfs = 3;
+};
+
+// undefined templated constructor -- not allowed
+struct UTC {
+  template  __device__ UTC(T...);
+};
+
+// non-empty templated constructor -- not allowed
+struct NETC {
+  int netc;
+  template  __device__ NETC(T...) { netc = 1; }
+};
+
+// Regular base class -- allowed
+struct T_B_T : T {};
+
+// Incapsulated object of allowed class -- allowed
+struct T_F_T {
+  T t;
+};
+
+// array of allowed objects -- allowed
+struct T_FA_T {
+  T t[2];
+};
+
+
+// Calling empty base class initializer is OK
+struct EC_I_EC : EC {
+  __device__ EC_I_EC() : EC() {}
+};
+
+// .. though passing arguments is not allowed.
+struct EC_I_EC1 : EC {
+  __device__ EC_I_EC1() : EC(1) {}
+};
+
+// Virtual base class -- not allowed
+struct T_V_T : 

[PATCH] D133847: [test][clang] fix pattern for LDGARANGE-NOT in debug-options-lld test

2022-09-14 Thread Azat Khuzhin via Phabricator via cfe-commits
azat created this revision.
azat added reviewers: hokein, dblaikie.
Herald added a project: All.
azat requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Now, when the filename contains lld, it does not filter correctly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133847

Files:
  clang/test/Driver/debug-options-lld.c


Index: clang/test/Driver/debug-options-lld.c
===
--- clang/test/Driver/debug-options-lld.c
+++ clang/test/Driver/debug-options-lld.c
@@ -8,5 +8,5 @@
 // RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
 //
 // GARANGE-DAG: -generate-arange-section
-// LDGARANGE-NOT: {{".*lld.*"}} {{.*}} "-generate-arange-section"
-// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"
+// LDGARANGE-NOT: {{"[^"]*lld(\.exe){0,1}".*}} {{.*}} 
"-generate-arange-section"
+// LLDGARANGE: {{"[^"]*lld(\.exe){0,1}".*}} {{.*}} "-generate-arange-section"


Index: clang/test/Driver/debug-options-lld.c
===
--- clang/test/Driver/debug-options-lld.c
+++ clang/test/Driver/debug-options-lld.c
@@ -8,5 +8,5 @@
 // RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
 //
 // GARANGE-DAG: -generate-arange-section
-// LDGARANGE-NOT: {{".*lld.*"}} {{.*}} "-generate-arange-section"
-// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"
+// LDGARANGE-NOT: {{"[^"]*lld(\.exe){0,1}".*}} {{.*}} "-generate-arange-section"
+// LLDGARANGE: {{"[^"]*lld(\.exe){0,1}".*}} {{.*}} "-generate-arange-section"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D133753: [clang][Interp] WIP: Array fillers

2022-09-14 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments.



Comment at: clang/lib/AST/Interp/Context.cpp:54
+  assert(Stk.empty());
+  return true;
 }

The additional asserts I inserted here could be in another patch. However, I 
added them because I ran into a peculiar problem: when creating a `Pointer`, it 
calls `Pointee->addPointer(this)`. It will only remove itself from the pointee 
again in its destructor. //But// the destructor is not (necessarily) being 
called at all because the `Pointer` is constructed in the stack (or otherwise 
placement-new'ed into a larger memory region).



Comment at: clang/lib/AST/Interp/Interp.h:832
+_B->invokeCtor();
+
+memcpy(_B->data(), Pointee->data(), Desc->getAllocSize());

Note here that both the block and the descriptor are leaked. They are usually 
allocated in `Program`, which uses its own allocator for them. I'm not 100% 
sure what to do about this, since the blocks have different lifetimes depending 
on if they are for global or local variables (or parameters).
 Short of introducing a `Program::managesBlock(Block* B)` that just does a 
linear search for the blocks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133753

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


[PATCH] D133804: Cuda Check for ignored return errors from api calls to cuda

2022-09-14 Thread Bartłomiej Cieślar via Phabricator via cfe-commits
barcisz updated this revision to Diff 460034.
barcisz added a comment.

Removed unnecessary cuda-related compilation flags from tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133804

Files:
  clang-tools-extra/-
  clang-tools-extra/clang-tidy/cuda/CMakeLists.txt
  clang-tools-extra/clang-tidy/cuda/CudaTidyModule.cpp
  clang-tools-extra/clang-tidy/cuda/UnsafeApiCallCheck.cpp
  clang-tools-extra/clang-tidy/cuda/UnsafeApiCallCheck.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda_runtime.h
  clang-tools-extra/test/clang-tidy/checkers/cuda/.keep
  
clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-function-handler.cu
  
clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-macro-handler.cu

Index: clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-macro-handler.cu
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-macro-handler.cu
@@ -0,0 +1,96 @@
+// RUN: %check_clang_tidy %s cuda-unsafe-api-call %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: cuda-unsafe-api-call.HandlerName, \
+// RUN:   value: 'CUDA_HANDLER'}] \
+// RUN: }" \
+// RUN:   -- -isystem %clang_tidy_headers -std=c++14
+#include 
+
+class DummyContainer {
+ public:
+  int* begin();
+  int* end();
+};
+
+#define DUMMY_CUDA_HANDLER(stmt) stmt
+#define CUDA_HANDLER(stmt) do {auto err = stmt;} while(0)
+#define API_CALL() do {cudaDeviceReset();} while(0)
+
+void errorCheck();
+void errorCheck(cudaError_t error);
+
+void bad() {
+  API_CALL();
+  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+  // There isn't supposed to be a fix here since it's a macro call
+
+  cudaDeviceReset();
+  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+  // CHECK-FIXES:  {{^}}  CUDA_HANDLER(cudaDeviceReset());{{$}}
+  errorCheck();
+
+  if (true)
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  while (true)
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  do
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+  while(false);
+
+  switch (0) {
+case 0:
+  cudaDeviceReset();
+  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+  // CHECK-FIXES:  {{^}}  CUDA_HANDLER(cudaDeviceReset());{{$}}
+  }
+
+  for(
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+;
+cudaDeviceReset()
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset()){{$}}
+  ) cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}  ) CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  for(int i : DummyContainer())
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  auto x = ({
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+true;
+  });
+}
+
+int good() {
+  DUMMY_CUDA_HANDLER(cudaDeviceReset());
+
+  if (cudaDeviceReset()) {
+return 0;
+  }
+
+  switch (cudaDeviceReset()) {
+case cudaErrorInvalidValue: return 1;
+case cudaErrorMemoryAllocation: return 2;
+default: return 3;
+  }
+
+  auto err = ({cudaDeviceReset();});
+  // NOTE: We don't check that `errorCheck()` actually handles the error; we just assume it does.
+  errorCheck(cudaDeviceReset());
+}
Index: clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-function-handler.cu
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-function-handler.cu
@@ -0,0 +1,71 @@
+// RUN: %check_clang_tidy %s cuda-unsafe-api-call %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: cuda-unsafe-api-call.HandlerName, \
+// RUN:   value: 'cudaHandler'}, \
+// RUN:  {key: cuda-unsafe-api-call.AcceptedHandlers, \
+// RUN:   value: 'CUDA_HANDLER, DUMMY_CUDA_HANDLER, \
+// RUN:   alter

[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman updated this revision to Diff 460035.
aaron.ballman added a comment.
Herald added subscribers: kbarton, nemanjai.

Updated the failing tests caught during review (thank you!) and moved the 
release notes around and reworded them somewhat for clarity.


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

https://reviews.llvm.org/D133800

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/test/C/drs/dr0xx.c
  clang/test/C/drs/dr1xx.c
  clang/test/CodeGen/PowerPC/builtins-ppc-p8vector.c
  clang/test/CodeGen/builtins-arm-msvc-compat-only.c
  clang/test/CodeGen/neon-crypto.c
  clang/test/Driver/cxx_for_opencl.clcpp
  clang/test/FixIt/fixit.c
  clang/test/Frontend/fixed_point_errors.c
  clang/test/Frontend/fixed_point_not_enabled.c
  clang/test/Frontend/system-header-line-directive.c
  clang/test/Headers/arm-cmse-header-ns.c
  clang/test/Modules/config_macros.m
  clang/test/Modules/malformed-overload.m
  clang/test/Modules/modulemap-locations.m
  clang/test/OpenMP/declare_mapper_messages.c
  clang/test/PCH/chain-macro-override.c
  clang/test/Parser/altivec.c
  clang/test/Parser/attributes.c
  clang/test/Parser/declarators.c
  clang/test/Parser/objc-forcollection-neg-2.m
  clang/test/Preprocessor/macro_paste_msextensions.c
  clang/test/Sema/__try.c
  clang/test/Sema/aarch64-tme-errors.c
  clang/test/Sema/address_spaces.c
  clang/test/Sema/auto-type.c
  clang/test/Sema/bitfield.c
  clang/test/Sema/block-args.c
  clang/test/Sema/block-literal.c
  clang/test/Sema/builtin-setjmp.c
  clang/test/Sema/builtins.c
  clang/test/Sema/crash-invalid-builtin.c
  clang/test/Sema/cxx-as-c.c
  clang/test/Sema/function.c
  clang/test/Sema/implicit-builtin-decl.c
  clang/test/Sema/implicit-decl.c
  clang/test/Sema/implicit-int.c
  clang/test/Sema/implicit-intel-builtin-decl.c
  clang/test/Sema/implicit-ms-builtin-decl.c
  clang/test/Sema/invalid-decl.c
  clang/test/Sema/invalid-struct-init.c
  clang/test/Sema/redefinition.c
  clang/test/Sema/typo-correction.c
  clang/test/Sema/varargs.c
  clang/test/Sema/vla.c
  clang/test/SemaObjC/builtin_objc_lib_functions.m
  clang/test/SemaObjC/builtin_objc_nslog.m
  clang/test/SemaObjC/ivar-lookup-resolution-builtin.m
  clang/test/SemaObjC/protocols.m
  clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl

Index: clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
===
--- clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
+++ clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
@@ -10,7 +10,7 @@
 // expected-error@-5 {{C++ for OpenCL version 2021 does not support the 'pipe' type qualifier}}
 // expected-error@-6 {{access qualifier can only be used for pipe and image type}}
 #else
-// expected-error@-8 {{type specifier missing, defaults to 'int'}}
+// expected-warning@-8 {{type specifier missing, defaults to 'int'}}
 // expected-error@-9 {{access qualifier can only be used for pipe and image type}}
 // expected-error@-10 {{expected ')'}} expected-note@-10 {{to match this '('}}
 #endif
Index: clang/test/SemaObjC/protocols.m
===
--- clang/test/SemaObjC/protocols.m
+++ clang/test/SemaObjC/protocols.m
@@ -62,6 +62,6 @@
 @end
 
 @protocol P
-- (int)test:(int)param, ..; // expected-error{{type specifier missing}} \
+- (int)test:(int)param, ..; // expected-warning{{type specifier missing}} \
   // expected-error{{expected ';' after method prototype}}
 @end
Index: clang/test/SemaObjC/ivar-lookup-resolution-builtin.m
===
--- clang/test/SemaObjC/ivar-lookup-resolution-builtin.m
+++ clang/test/SemaObjC/ivar-lookup-resolution-builtin.m
@@ -28,7 +28,7 @@
 @implementation Test1
 - (int) InstMethod
 {
-  return index;	// expected-error {{call to undeclared library function 'index'}}	\
+  return index;	// expected-warning {{call to undeclared library function 'index'}}	\
 // expected-note {{include the header  or explicitly provide a declaration for 'index'}} \
 // expected-error {{incompatible pointer to integer conversion returning}}
 }
Index: clang/test/SemaObjC/builtin_objc_nslog.m
===
--- clang/test/SemaObjC/builtin_objc_nslog.m
+++ clang/test/SemaObjC/builtin_objc_nslog.m
@@ -3,11 +3,11 @@
 #include 
 
 void f1(id arg) {
-  NSLog(@"%@", arg); // expected-error {{call to undeclared library function 'NSLog' with type 'void (id, ...)'}} \
+  NSLog(@"%@", arg); // expected-warning {{call to undeclared library function 'NSLog' with type 'void (id, ...)'}} \
   // expected-note {{include the header  or explicitly provide a declaration for 'NSLog'}}
 }
 
 void f2(id str, va_list args) {
-  NSLogv(@"%@", args); // expected-error {{call to undeclared library function 'NSLogv' with type }} \
+  NSLogv(@"%@", args); // expected-warning {{call to undeclared library func

[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D133800#3788950 , @nikic wrote:

> I tested this patch as well and saw the same failures as @mgorny.

Thank you, I think I've got those patched up, but with one difference:

>   
>   diff --git a/clang/test/CodeGen/neon-crypto.c 
> b/clang/test/CodeGen/neon-crypto.c
>   index 916886574416..1b29b1a53096 100644
>   --- a/clang/test/CodeGen/neon-crypto.c
>   +++ b/clang/test/CodeGen/neon-crypto.c
>   @@ -14,7 +14,7 @@
>
>uint8x16_t test_vaeseq_u8(uint8x16_t data, uint8x16_t key) {
>  // CHECK-LABEL: @test_vaeseq_u8
>   -  // CHECK-NO-CRYPTO: error: call to undeclared function 'vaeseq_u8'
>   +  // CHECK-NO-CRYPTO: warning: call to undeclared function 'vaeseq_u8'
>  return vaeseq_u8(data, key);
>  // CHECK: call <16 x i8> @llvm.{{arm.neon|aarch64.crypto}}.aese(<16 x 
> i8> %data, <16 x i8> %key)
>}

Because this was the only `error` in the file, I changed the `RUN` line to 
remove the `not` in front of `%clang_cc1`, as that seemed like it would be 
necessary to get the test to pass as well.


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

https://reviews.llvm.org/D133800

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


[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

In D133800#3788983 , @nikic wrote:

> @mgorny Yeah, that was a testing fail on my side. I've updated it to a 
> hopefully correct version.

Ok, thanks. This version worked for me.


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

https://reviews.llvm.org/D133800

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


[PATCH] D129926: [clang-format] Handle constructor invocations after new operator in C# correct

2022-09-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D129926#3788866 , @MyDeveloperDay 
wrote:

> @eoanermine  ping... we need your name/email before we can commit.
>
> (@curdeius, @owenpan, @HazardyKnusperkeks ) we need to have a policy for 
> this, that if we don't get the name for a commit we are happy to land, that 
> we'll do it the old way, and just mention them, Its frustrating for us to 
> waste our time doing reviews only to fall at the last hurdle. (@aaron.ballman 
> any thoughts)

Good idea on starting a policy for this. I think that policy should be 
discussed by the community via an RFC because we should be consistent across 
the project in how we handle this sort of situation, IMO (at least within the 
`clang` part of the repo; it'd be weird for the static analyzer to have a 
different policy from Clang which is different from clang-format). Personally, 
I think if there's been no response for a month, we're probably fine to 
commandeer the patch. That should be sufficient time for folks who have gone on 
vacation to have come back and responded, hopefully. I think the only situation 
where we might want a more tight timeframe is when the patch is critical 
(blocking a release kind of thing), but hopefully that situation is so rare as 
to not require making a policy for it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129926

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


[PATCH] D111509: [clang] use getCommonSugar in an assortment of places

2022-09-14 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 460036.
mizvekov marked an inline comment as not done.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111509

Files:
  clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/narrowing-conversions-ignoreconversionfromtypes-option.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/AST/ast-dump-fpfeatures.cpp
  clang/test/CodeGen/compound-assign-overflow.c
  clang/test/Sema/complex-int.c
  clang/test/Sema/matrix-type-operators.c
  clang/test/Sema/nullability.c
  clang/test/Sema/sugar-common-types.c
  clang/test/SemaCXX/complex-conversion.cpp
  clang/test/SemaCXX/matrix-type-operators.cpp
  clang/test/SemaCXX/sugar-common-types.cpp
  clang/test/SemaCXX/sugared-auto.cpp
  clang/test/SemaObjC/format-strings-objc.m
  compiler-rt/test/ubsan/TestCases/Integer/add-overflow.cpp
  compiler-rt/test/ubsan/TestCases/Integer/no-recover.cpp
  compiler-rt/test/ubsan/TestCases/Integer/sub-overflow.cpp
  compiler-rt/test/ubsan/TestCases/Integer/uadd-overflow.cpp
  compiler-rt/test/ubsan/TestCases/Integer/umul-overflow.cpp
  compiler-rt/test/ubsan/TestCases/Integer/usub-overflow.cpp
  libcxx/DELETE.ME
  lldb/test/API/commands/expression/rdar42038760/main.c
  lldb/test/API/commands/expression/rdar44436068/main.c

Index: lldb/test/API/commands/expression/rdar44436068/main.c
===
--- lldb/test/API/commands/expression/rdar44436068/main.c
+++ lldb/test/API/commands/expression/rdar44436068/main.c
@@ -3,6 +3,6 @@
 __int128_t n = 1;
 n = n + n;
 return n; //%self.expect("p n", substrs=['(__int128_t) $0 = 2'])
-  //%self.expect("p n + 6", substrs=['(__int128) $1 = 8'])
-  //%self.expect("p n + n", substrs=['(__int128) $2 = 4'])
+  //%self.expect("p n + 6", substrs=['(__int128_t) $1 = 8'])
+  //%self.expect("p n + n", substrs=['(__int128_t) $2 = 4'])
 }
Index: lldb/test/API/commands/expression/rdar42038760/main.c
===
--- lldb/test/API/commands/expression/rdar42038760/main.c
+++ lldb/test/API/commands/expression/rdar42038760/main.c
@@ -10,7 +10,7 @@
   struct S0 l_19;
   l_19.f2 = 419;
   uint32_t l_4037 = 4294967295UL;
-  l_19.f2 = g_463; //%self.expect("expr ((l_4037 % (-(g_463))) | l_19.f2)", substrs=['(unsigned int) $0 = 358717883'])
+  l_19.f2 = g_463; //%self.expect("expr ((l_4037 % (-(g_463))) | l_19.f2)", substrs=['(uint32_t) $0 = 358717883'])
 }
 int main()
 {
Index: libcxx/DELETE.ME
===
--- /dev/null
+++ libcxx/DELETE.ME
@@ -0,0 +1 @@
+D111509
Index: compiler-rt/test/ubsan/TestCases/Integer/usub-overflow.cpp
===
--- compiler-rt/test/ubsan/TestCases/Integer/usub-overflow.cpp
+++ compiler-rt/test/ubsan/TestCases/Integer/usub-overflow.cpp
@@ -12,12 +12,12 @@
 
 #ifdef SUB_I32
   (void)(uint32_t(1) - uint32_t(2));
-  // CHECK-SUB_I32: usub-overflow.cpp:[[@LINE-1]]:22: runtime error: unsigned integer overflow: 1 - 2 cannot be represented in type 'unsigned int'
+  // CHECK-SUB_I32: usub-overflow.cpp:[[@LINE-1]]:22: runtime error: unsigned integer overflow: 1 - 2 cannot be represented in type '{{uint32_t|unsigned int}}'
 #endif
 
 #ifdef SUB_I64
   (void)(uint64_t(800ll) - uint64_t(900ll));
-  // CHECK-SUB_I64: 800 - 900 cannot be represented in type 'unsigned {{long( long)?}}'
+  // CHECK-SUB_I64: 800 - 900 cannot be represented in type '{{uint64_t|unsigned long( long)?}}'
 #endif
 
 #ifdef SUB_I128
@@ -26,6 +26,6 @@
 # else
   puts("__int128 not supported\n");
 # endif
-  // CHECK-SUB_I128: {{0x4000 - 0x8000 cannot be represented in type 'unsigned __int128'|__int128 not supported}}
+  // CHECK-SUB_I128: {{0x4000 - 0x8000 cannot be represented in type '__uint128_t'|__int128 not supported}}
 #endif
 }
Index: compiler-rt/test/ubsan/TestCases/Integer/umul-overflow.cpp
===
--- compiler-rt/test/ubsan/TestCases/Integer/umul-overflow.cpp
+++ compiler-rt/test/ubsan/TestCases/Integer/umul-overflow.cpp
@@ -13,7 +13,7 @@
   (void)(uint16_t(0x) * uint16_t(0x8001));
 
   (void)(uint32_t(0x) * uint32_t(0x2));
-  // CHECK: umul-overflow.cpp:15:31: runtime error: unsigned integer overflow: 4294967295 * 2 cannot be represented in type 'unsigned int'
+  // CHECK: umul-overflow.cpp:15:31: runtime error: unsigned integer overflow: 4294967295 * 2 cannot be represented in type '{{uint32_t|unsigned int}}'
 
   return 0;
 }
Index: compiler-rt/t

[PATCH] D133664: [clangd] Fix hover on symbol introduced by using declaration

2022-09-14 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.



Comment at: clang-tools-extra/clangd/Hover.cpp:1023
+  // which in this example would be the actual declaration of foo.
+  if (Candidates.size() == 2) {
+if (llvm::isa(Candidates.front()))

nit: you can change this to `Candidates.size() <= 2` and get rid of the extra 
single candidate case above (after changing it to always return 
Candidate.front() when Candidate.back() is a using decl.)



Comment at: clang-tools-extra/clangd/Hover.cpp:1026
+  return Candidates.back();
+if (llvm::isa(Candidates.back()))
+  return Candidates.front();

just drop this if check and always return front, when it isn't a using decl.



Comment at: clang-tools-extra/clangd/Hover.cpp:1031
+  // For something like
+  // namespace ns { void foo(int); void foo(char) }
+  // using ns::fo

can we have a test case for this?



Comment at: clang-tools-extra/clangd/Hover.cpp:1032
+  // namespace ns { void foo(int); void foo(char) }
+  // using ns::fo
+  // template  void bar() { fo^o(T{}); }

nit: `ns::foo` not `fo`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133664

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


[PATCH] D133851: [analyzer] Initialize ShouldEmitErrorsOnInvalidConfigValue analyzer option

2022-09-14 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision.
steakhal added reviewers: NoQ, martong, Szelethus.
Herald added subscribers: manas, ASDenysPetrov, dkrupp, donat.nagy, 
mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: All.
steakhal requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Downstream users who don't make use of the clang cc1 frontend for
commandline argument parsing, won't benefit from the Marshalling
provided default initialization of the AnalyzerOptions entries. More
about this later.
Those analyzer option fields, as they are bitfields, cannot be default
initialized at the declaration (prior c++20), hence they are initialized
at the constructor.
The only problem is that `ShouldEmitErrorsOnInvalidConfigValue` was
forgotten.

In this patch, I'm proposing to initialize that field with the rest.

Note that this value is read by
`CheckerRegistry.cpp:insertAndValidate()`.
The analyzer options are initialized by the marshalling at
`CompilerInvocation.cpp:GenerateAnalyzerArgs()` by the expansion of the
`ANALYZER_OPTION_WITH_MARSHALLING` xmacro to the appropriate default
value regardless of the constructor initialized list which I'm touching.
Due to that this only affects users using CSA as a library, without
serious effort, I believe we cannot test this.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133851

Files:
  clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h


Index: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
===
--- clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
+++ clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
@@ -289,7 +289,8 @@
 ShowCheckerHelpAlpha(false), ShowCheckerHelpDeveloper(false),
 ShowCheckerOptionList(false), ShowCheckerOptionAlphaList(false),
 ShowCheckerOptionDeveloperList(false), ShowEnabledCheckerList(false),
-ShowConfigOptionsList(false), AnalyzeAll(false),
+ShowConfigOptionsList(false),
+ShouldEmitErrorsOnInvalidConfigValue(false), AnalyzeAll(false),
 AnalyzerDisplayProgress(false), eagerlyAssumeBinOpBifurcation(false),
 TrimGraph(false), visualizeExplodedGraphWithGraphViz(false),
 UnoptimizedCFG(false), PrintStats(false), NoRetryExhausted(false),


Index: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
===
--- clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
+++ clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
@@ -289,7 +289,8 @@
 ShowCheckerHelpAlpha(false), ShowCheckerHelpDeveloper(false),
 ShowCheckerOptionList(false), ShowCheckerOptionAlphaList(false),
 ShowCheckerOptionDeveloperList(false), ShowEnabledCheckerList(false),
-ShowConfigOptionsList(false), AnalyzeAll(false),
+ShowConfigOptionsList(false),
+ShouldEmitErrorsOnInvalidConfigValue(false), AnalyzeAll(false),
 AnalyzerDisplayProgress(false), eagerlyAssumeBinOpBifurcation(false),
 TrimGraph(false), visualizeExplodedGraphWithGraphViz(false),
 UnoptimizedCFG(false), PrintStats(false), NoRetryExhausted(false),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D133853: [AST] Add msvc-specific C++11 attributes

2022-09-14 Thread Richard Dzenis via Phabricator via cfe-commits
RIscRIpt created this revision.
Herald added a reviewer: aaron.ballman.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
RIscRIpt requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

- 'msvc::no_tls_guard', first appeared in MSVC toolchain 14.25.28610
- 'msvc::known_semantics', first appeared in MSVC toolchain 14.27.29110
- 'msvc::noop_dtor', first appeared in MSVC toolchain 14.28.29333
- 'msvc::constexpr', first appeared in MSVC toolchain 14.33.31629

Closes #57696


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133853

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/lib/AST/TypePrinter.cpp
  clang/lib/Sema/SemaStmtAttr.cpp
  clang/test/AST/msvc-attrs.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test

Index: clang/test/Misc/pragma-attribute-supported-attributes-list.test
===
--- clang/test/Misc/pragma-attribute-supported-attributes-list.test
+++ clang/test/Misc/pragma-attribute-supported-attributes-list.test
@@ -83,6 +83,9 @@
 // CHECK-NEXT: LoaderUninitialized (SubjectMatchRule_variable_is_global)
 // CHECK-NEXT: Lockable (SubjectMatchRule_record)
 // CHECK-NEXT: MIGServerRoutine (SubjectMatchRule_function, SubjectMatchRule_objc_method, SubjectMatchRule_block)
+// CHECK-NEXT: MSConstexpr (SubjectMatchRule_function)
+// CHECK-NEXT: MSNoTlsGuard (SubjectMatchRule_variable)
+// CHECK-NEXT: MSNoopDtor (SubjectMatchRule_function)
 // CHECK-NEXT: MSStruct (SubjectMatchRule_record)
 // CHECK-NEXT: MaybeUndef (SubjectMatchRule_variable_is_parameter)
 // CHECK-NEXT: MicroMips (SubjectMatchRule_function)
Index: clang/test/AST/msvc-attrs.cpp
===
--- /dev/null
+++ clang/test/AST/msvc-attrs.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -fms-extensions -std=c++20 -DMSX -ast-dump %s | FileCheck %s
+// RUN: not %clang_cc1 -Werror=ignored-attributes -ast-dump %s 2>&1 | grep "8 errors generated"
+
+// CHECK: VarDecl 0x{{[0-9a-f]+}} <{{.*}}:[[@LINE+3]]:24, col:47> col:47 no_tls_guard_var
+// CHECK-NEXT: MSNoTlsGuardAttr 0x{{[0-9a-f]+}} 
+// CHECK-NEXT: ThreadAttr 0x{{[0-9a-f]+}} 
+[[msvc::no_tls_guard]] __declspec(thread) int no_tls_guard_var;
+
+// CHECK: MSKnownSemanticsAttr 0x{{[0-9a-f]+}} 
+// CHECK-NEXT: CXXRecordDecl 0x{{[0-9a-f]+}}  col:34
+struct [[msvc::known_semantics]] Struct {};
+
+// CHECK: TypeAliasDecl 0x{{[0-9a-f]+}}  col:7 Int 'int'
+// CHECK-NEXT: BuiltinType 0x{{[0-9a-f]+}} 'int'
+// CHECK-NEXT: MSKnownSemanticsAttr 0x{{[0-9a-f]+}} 
+using Int [[msvc::known_semantics]] = int;
+
+struct Dtor {
+  // CHECK: CXXDestructorDecl 0x{{[0-9a-f]+}}  col:23 ~Dtor 'void () noexcept'
+  // CHECK-NEXT: CompoundStmt 0x{{[0-9a-f]+}} 
+  // CHECK-NEXT: MSNoopDtorAttr 0x{{[0-9a-f]+}} 
+  [[msvc::noop_dtor]] ~Dtor() {}
+};
+
+// CHECK: FunctionDecl 0x{{[0-9a-f]+}}  col:27 New1 'void *(void *)'
+// CHECK: MSConstexprAttr 0x{{[0-9a-f]+}} 
+[[msvc::constexpr]] void *New1(void *where) { return where; }
+
+// CHECK: FunctionDecl {{.*}}  line:[[@LINE+4]]:17 constexpr New2
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: AttributedStmt
+// CHECK-NEXT: MSConstexprAttr
+constexpr char *New2() {
+  [[msvc::constexpr]] return ::new char[1];
+}
Index: clang/lib/Sema/SemaStmtAttr.cpp
===
--- clang/lib/Sema/SemaStmtAttr.cpp
+++ clang/lib/Sema/SemaStmtAttr.cpp
@@ -290,6 +290,12 @@
   return ::new (S.Context) UnlikelyAttr(S.Context, A);
 }
 
+static Attr *handleMSConstexpr(Sema &S, Stmt *St, const ParsedAttr &A,
+   SourceRange Range) {
+  // Validation is in Sema::ActOnAttributedStmt().
+  return ::new (S.Context) MSConstexprAttr(S.Context, A);
+}
+
 #define WANT_STMT_MERGE_LOGIC
 #include "clang/Sema/AttrParsedAttrImpl.inc"
 #undef WANT_STMT_MERGE_LOGIC
@@ -485,6 +491,8 @@
 return handleLikely(S, St, A, Range);
   case ParsedAttr::AT_Unlikely:
 return handleUnlikely(S, St, A, Range);
+  case ParsedAttr::AT_MSConstexpr:
+return handleMSConstexpr(S, St, A, Range);
   default:
 // N.B., ClangAttrEmitter.cpp emits a diagnostic helper that ensures a
 // declaration attribute is not written on a statement, but this code is
Index: clang/lib/AST/TypePrinter.cpp
===
--- clang/lib/AST/TypePrinter.cpp
+++ clang/lib/AST/TypePrinter.cpp
@@ -1745,6 +1745,7 @@
   case attr::AddressSpace:
   case attr::CmseNSCall:
   case attr::AnnotateType:
+  case attr::MSKnownSemantics:
 llvm_unreachable("This attribute should have been handled already");
 
   case attr::NSReturnsRetained:
Index: clang/include/clang/Basic/AttrDocs.td
===
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -3478,6 +3478,41 @@
 }];
 }
 
+def M

[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

In D133800#3789100 , @aaron.ballman 
wrote:

> In D133800#3788950 , @nikic wrote:
>
>> I tested this patch as well and saw the same failures as @mgorny.
>
> Thank you, I think I've got those patched up, but with one difference:
>
>>   
>>   diff --git a/clang/test/CodeGen/neon-crypto.c 
>> b/clang/test/CodeGen/neon-crypto.c
>>   index 916886574416..1b29b1a53096 100644
>>   --- a/clang/test/CodeGen/neon-crypto.c
>>   +++ b/clang/test/CodeGen/neon-crypto.c
>>   @@ -14,7 +14,7 @@
>>
>>uint8x16_t test_vaeseq_u8(uint8x16_t data, uint8x16_t key) {
>>  // CHECK-LABEL: @test_vaeseq_u8
>>   -  // CHECK-NO-CRYPTO: error: call to undeclared function 'vaeseq_u8'
>>   +  // CHECK-NO-CRYPTO: warning: call to undeclared function 'vaeseq_u8'
>>  return vaeseq_u8(data, key);
>>  // CHECK: call <16 x i8> @llvm.{{arm.neon|aarch64.crypto}}.aese(<16 x 
>> i8> %data, <16 x i8> %key)
>>}
>
> Because this was the only `error` in the file, I changed the `RUN` line to 
> remove the `not` in front of `%clang_cc1`, as that seemed like it would be 
> necessary to get the test to pass as well.

I'm afraid this version fails:

  FAIL: Clang :: CodeGen/neon-crypto.c (4802 of 15654)
   TEST 'Clang :: CodeGen/neon-crypto.c' FAILED 

  Script:
  --
  : 'RUN: at line 1';   
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/clang
 -cc1 -internal-isystem 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/15.0.0/include
 -nostdsysteminc -triple arm-none-linux-gnueabi -target-feature +neon   
-target-feature +sha2 -target-feature +aes   -target-cpu cortex-a57 -emit-llvm 
-O1 -o - 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
 | /usr/lib/llvm/15/bin/FileCheck 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
  : 'RUN: at line 5';   
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/clang
 -cc1 -internal-isystem 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/15.0.0/include
 -nostdsysteminc -triple arm64-none-linux-gnu -target-feature +neon
-target-feature +sha2 -target-feature +aes-emit-llvm -O1 -o - 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
 | /usr/lib/llvm/15/bin/FileCheck 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
  : 'RUN: at line 8';   
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/clang
 -cc1 -internal-isystem 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/15.0.0/include
 -nostdsysteminc -triple arm64-none-linux-gnu -target-feature +neon-S -O3 
-o - 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
 2>&1 | /usr/lib/llvm/15/bin/FileCheck --check-prefix=CHECK-NO-CRYPTO 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  + : 'RUN: at line 1'
  + /usr/lib/llvm/15/bin/FileCheck 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
  + 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/clang
 -cc1 -internal-isystem 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/15.0.0/include
 -nostdsysteminc -triple arm-none-linux-gnueabi -target-feature +neon 
-target-feature +sha2 -target-feature +aes -target-cpu cortex-a57 -emit-llvm 
-O1 -o - 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
  + : 'RUN: at line 5'
  + /usr/lib/llvm/15/bin/FileCheck 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
  + 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/clang
 -cc1 -internal-isystem 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/15.0.0/include
 -nostdsysteminc -triple arm64-none-linux-gnu -target-feature +neon 
-target-feature +sha2 -target-feature +aes -emit-llvm -O1 -o - 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
  + : 'RUN: at line 8'
  + /usr/lib/llvm/15/bin/FileCheck --check-prefix=CHECK-NO-CRYPTO 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
  + 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/clang
 -cc1 -internal-isystem 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/15.0.0/include
 -nostdsysteminc -triple arm64-none-linux-gnu -target-feature +neon -S -O3 -o - 
/var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
  
  --
  
  

[PATCH] D133841: [test][clang] run test for lld emitting dwarf-aranages only if lld is presented

2022-09-14 Thread Alex Gatea via Phabricator via cfe-commits
alexgatea reopened this revision.
alexgatea added a comment.
This revision is now accepted and ready to land.

Hi
This test case is still failing for me due to the lines without -fuse-ld=ldd:

  // RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 
2>&1 | FileCheck -check-prefix=LDGARANGE %s
  // RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges 
%s 2>&1 | FileCheck -check-prefix=LDGARANGE %s

Can you please fix this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133841

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


[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D133800#3789188 , @mgorny wrote:

> In D133800#3789100 , @aaron.ballman 
> wrote:
>
>> In D133800#3788950 , @nikic wrote:
>>
>>> I tested this patch as well and saw the same failures as @mgorny.
>>
>> Thank you, I think I've got those patched up, but with one difference:
>>
>>>   
>>>   diff --git a/clang/test/CodeGen/neon-crypto.c 
>>> b/clang/test/CodeGen/neon-crypto.c
>>>   index 916886574416..1b29b1a53096 100644
>>>   --- a/clang/test/CodeGen/neon-crypto.c
>>>   +++ b/clang/test/CodeGen/neon-crypto.c
>>>   @@ -14,7 +14,7 @@
>>>
>>>uint8x16_t test_vaeseq_u8(uint8x16_t data, uint8x16_t key) {
>>>  // CHECK-LABEL: @test_vaeseq_u8
>>>   -  // CHECK-NO-CRYPTO: error: call to undeclared function 'vaeseq_u8'
>>>   +  // CHECK-NO-CRYPTO: warning: call to undeclared function 'vaeseq_u8'
>>>  return vaeseq_u8(data, key);
>>>  // CHECK: call <16 x i8> @llvm.{{arm.neon|aarch64.crypto}}.aese(<16 x 
>>> i8> %data, <16 x i8> %key)
>>>}
>>
>> Because this was the only `error` in the file, I changed the `RUN` line to 
>> remove the `not` in front of `%clang_cc1`, as that seemed like it would be 
>> necessary to get the test to pass as well.
>
> I'm afraid this version fails:
>
>   FAIL: Clang :: CodeGen/neon-crypto.c (4802 of 15654)
>    TEST 'Clang :: CodeGen/neon-crypto.c' FAILED 
> 
>   Script:
>   --
>   : 'RUN: at line 1';   
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/clang
>  -cc1 -internal-isystem 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/15.0.0/include
>  -nostdsysteminc -triple arm-none-linux-gnueabi -target-feature +neon   
> -target-feature +sha2 -target-feature +aes   -target-cpu cortex-a57 
> -emit-llvm -O1 -o - 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
>  | /usr/lib/llvm/15/bin/FileCheck 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
>   : 'RUN: at line 5';   
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/clang
>  -cc1 -internal-isystem 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/15.0.0/include
>  -nostdsysteminc -triple arm64-none-linux-gnu -target-feature +neon
> -target-feature +sha2 -target-feature +aes-emit-llvm -O1 -o - 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
>  | /usr/lib/llvm/15/bin/FileCheck 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
>   : 'RUN: at line 8';   
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/clang
>  -cc1 -internal-isystem 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/15.0.0/include
>  -nostdsysteminc -triple arm64-none-linux-gnu -target-feature +neon-S -O3 
> -o - 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
>  2>&1 | /usr/lib/llvm/15/bin/FileCheck --check-prefix=CHECK-NO-CRYPTO 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
>   --
>   Exit Code: 1
>   
>   Command Output (stderr):
>   --
>   + : 'RUN: at line 1'
>   + /usr/lib/llvm/15/bin/FileCheck 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
>   + 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/clang
>  -cc1 -internal-isystem 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/15.0.0/include
>  -nostdsysteminc -triple arm-none-linux-gnueabi -target-feature +neon 
> -target-feature +sha2 -target-feature +aes -target-cpu cortex-a57 -emit-llvm 
> -O1 -o - 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
>   + : 'RUN: at line 5'
>   + /usr/lib/llvm/15/bin/FileCheck 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
>   + 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/clang
>  -cc1 -internal-isystem 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/15.0.0/include
>  -nostdsysteminc -triple arm64-none-linux-gnu -target-feature +neon 
> -target-feature +sha2 -target-feature +aes -emit-llvm -O1 -o - 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
>   + : 'RUN: at line 8'
>   + /usr/lib/llvm/15/bin/FileCheck --check-prefix=CHECK-NO-CRYPTO 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/clang/test/CodeGen/neon-crypto.c
>   + 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang-abi_x86_32.x86/bin/clang
>  -cc1 -internal-isystem 
> /var/tmp/portage/sys-devel/clang-15.0.0-r1/work/x/y/clang

[PATCH] D133841: [test][clang] run test for lld emitting dwarf-aranages only if lld is presented

2022-09-14 Thread Azat Khuzhin via Phabricator via cfe-commits
azat added a comment.

> Can you please fix this?

It should be fixed in https://reviews.llvm.org/D133847


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133841

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


[PATCH] D133847: [test][clang] fix pattern for LDGARANGE-NOT in debug-options-lld test

2022-09-14 Thread Azat Khuzhin via Phabricator via cfe-commits
azat added a comment.

Can someone pick this please?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133847

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


[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman updated this revision to Diff 460051.
aaron.ballman added a comment.

Added the `not` back into the neon-crypto.c test.


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

https://reviews.llvm.org/D133800

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/test/C/drs/dr0xx.c
  clang/test/C/drs/dr1xx.c
  clang/test/CodeGen/PowerPC/builtins-ppc-p8vector.c
  clang/test/CodeGen/builtins-arm-msvc-compat-only.c
  clang/test/CodeGen/neon-crypto.c
  clang/test/Driver/cxx_for_opencl.clcpp
  clang/test/FixIt/fixit.c
  clang/test/Frontend/fixed_point_errors.c
  clang/test/Frontend/fixed_point_not_enabled.c
  clang/test/Frontend/system-header-line-directive.c
  clang/test/Headers/arm-cmse-header-ns.c
  clang/test/Modules/config_macros.m
  clang/test/Modules/malformed-overload.m
  clang/test/Modules/modulemap-locations.m
  clang/test/OpenMP/declare_mapper_messages.c
  clang/test/PCH/chain-macro-override.c
  clang/test/Parser/altivec.c
  clang/test/Parser/attributes.c
  clang/test/Parser/declarators.c
  clang/test/Parser/objc-forcollection-neg-2.m
  clang/test/Preprocessor/macro_paste_msextensions.c
  clang/test/Sema/__try.c
  clang/test/Sema/aarch64-tme-errors.c
  clang/test/Sema/address_spaces.c
  clang/test/Sema/auto-type.c
  clang/test/Sema/bitfield.c
  clang/test/Sema/block-args.c
  clang/test/Sema/block-literal.c
  clang/test/Sema/builtin-setjmp.c
  clang/test/Sema/builtins.c
  clang/test/Sema/crash-invalid-builtin.c
  clang/test/Sema/cxx-as-c.c
  clang/test/Sema/function.c
  clang/test/Sema/implicit-builtin-decl.c
  clang/test/Sema/implicit-decl.c
  clang/test/Sema/implicit-int.c
  clang/test/Sema/implicit-intel-builtin-decl.c
  clang/test/Sema/implicit-ms-builtin-decl.c
  clang/test/Sema/invalid-decl.c
  clang/test/Sema/invalid-struct-init.c
  clang/test/Sema/redefinition.c
  clang/test/Sema/typo-correction.c
  clang/test/Sema/varargs.c
  clang/test/Sema/vla.c
  clang/test/SemaObjC/builtin_objc_lib_functions.m
  clang/test/SemaObjC/builtin_objc_nslog.m
  clang/test/SemaObjC/ivar-lookup-resolution-builtin.m
  clang/test/SemaObjC/protocols.m
  clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl

Index: clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
===
--- clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
+++ clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
@@ -10,7 +10,7 @@
 // expected-error@-5 {{C++ for OpenCL version 2021 does not support the 'pipe' type qualifier}}
 // expected-error@-6 {{access qualifier can only be used for pipe and image type}}
 #else
-// expected-error@-8 {{type specifier missing, defaults to 'int'}}
+// expected-warning@-8 {{type specifier missing, defaults to 'int'}}
 // expected-error@-9 {{access qualifier can only be used for pipe and image type}}
 // expected-error@-10 {{expected ')'}} expected-note@-10 {{to match this '('}}
 #endif
Index: clang/test/SemaObjC/protocols.m
===
--- clang/test/SemaObjC/protocols.m
+++ clang/test/SemaObjC/protocols.m
@@ -62,6 +62,6 @@
 @end
 
 @protocol P
-- (int)test:(int)param, ..; // expected-error{{type specifier missing}} \
+- (int)test:(int)param, ..; // expected-warning{{type specifier missing}} \
   // expected-error{{expected ';' after method prototype}}
 @end
Index: clang/test/SemaObjC/ivar-lookup-resolution-builtin.m
===
--- clang/test/SemaObjC/ivar-lookup-resolution-builtin.m
+++ clang/test/SemaObjC/ivar-lookup-resolution-builtin.m
@@ -28,7 +28,7 @@
 @implementation Test1
 - (int) InstMethod
 {
-  return index;	// expected-error {{call to undeclared library function 'index'}}	\
+  return index;	// expected-warning {{call to undeclared library function 'index'}}	\
 // expected-note {{include the header  or explicitly provide a declaration for 'index'}} \
 // expected-error {{incompatible pointer to integer conversion returning}}
 }
Index: clang/test/SemaObjC/builtin_objc_nslog.m
===
--- clang/test/SemaObjC/builtin_objc_nslog.m
+++ clang/test/SemaObjC/builtin_objc_nslog.m
@@ -3,11 +3,11 @@
 #include 
 
 void f1(id arg) {
-  NSLog(@"%@", arg); // expected-error {{call to undeclared library function 'NSLog' with type 'void (id, ...)'}} \
+  NSLog(@"%@", arg); // expected-warning {{call to undeclared library function 'NSLog' with type 'void (id, ...)'}} \
   // expected-note {{include the header  or explicitly provide a declaration for 'NSLog'}}
 }
 
 void f2(id str, va_list args) {
-  NSLogv(@"%@", args); // expected-error {{call to undeclared library function 'NSLogv' with type }} \
+  NSLogv(@"%@", args); // expected-warning {{call to undeclared library function 'NSLogv' with type }} \
   // expected-note {{include the header  or explicitly provide a declaration for 'NSLogv'}}
 }
Index:

[PATCH] D133289: [C2X] N3007 Type inference for object definitions

2022-09-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D133289#3788655 , @to268 wrote:

> In D133289#3784042 , @aaron.ballman 
> wrote:
>
>>   auto auto k = 12; // 99% this is intended to be accepted; first `auto` is 
>> the storage class specifier, second `auto` is a redundant storage class 
>> specifier
>
> It seems that specifying `auto` twice isn't supported at the time being, so i 
> think i should fix that too.
>
>   auto auto test = 12; // error: cannot combine with previous 'auto' 
> declaration specifier

Yup! I just learned yesterday that the error there is correct and intended, at 
least according to the author of WG N3007.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133289

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


[PATCH] D133841: [test][clang] run test for lld emitting dwarf-aranages only if lld is presented

2022-09-14 Thread Alex Gatea via Phabricator via cfe-commits
alexgatea closed this revision.
alexgatea added a comment.

> It should be fixed in https://reviews.llvm.org/D133847

Ah I didn't see that. Thank you!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133841

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


[PATCH] D133354: [Clang]: Diagnose deprecated copy operations also in MSVC compatibility mode

2022-09-14 Thread Julius via Phabricator via cfe-commits
ningvin added a comment.

@hans just to clarify as I do not have commit access: do I still need to 
perform some action?


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

https://reviews.llvm.org/D133354

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


[PATCH] D133664: [clangd] Fix hover on symbol introduced by using declaration

2022-09-14 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.



Comment at: clang-tools-extra/clangd/Hover.cpp:1011
+const NamedDecl *
+pickDeclToUse(const llvm::SmallVector &Candidates) {
+  if (Candidates.empty())

you can just pass in ArrayRef instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133664

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


[PATCH] D133804: Cuda Check for ignored return errors from api calls to cuda

2022-09-14 Thread Bartłomiej Cieślar via Phabricator via cfe-commits
barcisz added inline comments.



Comment at: clang-tools-extra/test/clang-tidy/check_clang_tidy.py:121
 
+# Tests should not rely on a certain cuda device being available on the 
machine,
+# or a certain version of it

tra wrote:
> The comment is incorrect. These flags have nothing to do with GPU 
> availability, but rather with CUDA SDK which is normally expected to provide 
> the 'standard' set of CUDA headers and libdevice bitcode.
Yes by CUDA I meant cuda library here but I'll change it accordingly



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-function-handler.cu:1
+// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
+

tra wrote:
> This does not look right. 
Fixed


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133804

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


[PATCH] D133804: Cuda Check for ignored return errors from api calls to cuda

2022-09-14 Thread Bartłomiej Cieślar via Phabricator via cfe-commits
barcisz updated this revision to Diff 460055.
barcisz added a comment.

Update base to D133801 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133804

Files:
  clang-tools-extra/-
  clang-tools-extra/clang-tidy/cuda/CMakeLists.txt
  clang-tools-extra/clang-tidy/cuda/CudaTidyModule.cpp
  clang-tools-extra/clang-tidy/cuda/UnsafeApiCallCheck.cpp
  clang-tools-extra/clang-tidy/cuda/UnsafeApiCallCheck.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda_runtime.h
  clang-tools-extra/test/clang-tidy/checkers/cuda/.keep
  
clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-function-handler.cu
  
clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-macro-handler.cu

Index: clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-macro-handler.cu
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-macro-handler.cu
@@ -0,0 +1,96 @@
+// RUN: %check_clang_tidy %s cuda-unsafe-api-call %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: cuda-unsafe-api-call.HandlerName, \
+// RUN:   value: 'CUDA_HANDLER'}] \
+// RUN: }" \
+// RUN:   -- -isystem %clang_tidy_headers -std=c++14
+#include 
+
+class DummyContainer {
+ public:
+  int* begin();
+  int* end();
+};
+
+#define DUMMY_CUDA_HANDLER(stmt) stmt
+#define CUDA_HANDLER(stmt) do {auto err = stmt;} while(0)
+#define API_CALL() do {cudaDeviceReset();} while(0)
+
+void errorCheck();
+void errorCheck(cudaError_t error);
+
+void bad() {
+  API_CALL();
+  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+  // There isn't supposed to be a fix here since it's a macro call
+
+  cudaDeviceReset();
+  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+  // CHECK-FIXES:  {{^}}  CUDA_HANDLER(cudaDeviceReset());{{$}}
+  errorCheck();
+
+  if (true)
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  while (true)
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  do
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+  while(false);
+
+  switch (0) {
+case 0:
+  cudaDeviceReset();
+  // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+  // CHECK-FIXES:  {{^}}  CUDA_HANDLER(cudaDeviceReset());{{$}}
+  }
+
+  for(
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+;
+cudaDeviceReset()
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset()){{$}}
+  ) cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}  ) CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  for(int i : DummyContainer())
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+
+  auto x = ({
+cudaDeviceReset();
+// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: Unchecked CUDA API call.
+// CHECK-FIXES:  {{^}}CUDA_HANDLER(cudaDeviceReset());{{$}}
+true;
+  });
+}
+
+int good() {
+  DUMMY_CUDA_HANDLER(cudaDeviceReset());
+
+  if (cudaDeviceReset()) {
+return 0;
+  }
+
+  switch (cudaDeviceReset()) {
+case cudaErrorInvalidValue: return 1;
+case cudaErrorMemoryAllocation: return 2;
+default: return 3;
+  }
+
+  auto err = ({cudaDeviceReset();});
+  // NOTE: We don't check that `errorCheck()` actually handles the error; we just assume it does.
+  errorCheck(cudaDeviceReset());
+}
Index: clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-function-handler.cu
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/cuda/unsafe-api-call-function-handler.cu
@@ -0,0 +1,71 @@
+// RUN: %check_clang_tidy %s cuda-unsafe-api-call %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: cuda-unsafe-api-call.HandlerName, \
+// RUN:   value: 'cudaHandler'}, \
+// RUN:  {key: cuda-unsafe-api-call.AcceptedHandlers, \
+// RUN:   value: 'CUDA_HANDLER, DUMMY_CUDA_HANDLER, \
+// RUN:   alternati

[PATCH] D133807: Update Unicode to 15.0

2022-09-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

The changes LGTM, but I'd like to wait for @tahonermann to weigh in with the 
final acceptance.




Comment at: llvm/lib/Support/UnicodeCaseFold.cpp:713
+  // 8 characters
+  if (C <= 0xa7c2)
 return C | 1;

cor3ntin wrote:
> shafik wrote:
> > Maybe I am misunderstanding the comments but should this be `0xa7be`?
> Quirk of the script,  the comment for C|1 never make sense, the values seems 
> correct though (this script is the only think i have not written myself)
> https://github.com/llvm/llvm-project/blob/main/llvm/utils/unicode-case-fold.py#L89
> So you have 8 even codepoints mapping to  C|1 + 7 odd codepoint mapping to 
> C|1 which is C. If my math is correct.
> I'm a bit reluctant to modify that script
Heh, I thought it should have been `0xa7bc` based on the changed comment above, 
but after talking to Corentin off-list, it sounds like any time we see `return 
C | 1;`, the comment above it is specifying the wrong number of characters in 
the range. So the issue is that the comment says `8 characters` when it should 
say `14 characters`.

We could correct the comment manually, but the next time we run the script 
we'll get the incorrect comment again. So for right now, I think this code is 
actually correct. At some point, we should fix that script to output the 
correct comment though, as it's hard to review the generated changes when the 
comments are misleading.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133807

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


[PATCH] D133664: [clangd] Fix hover on symbol introduced by using declaration

2022-09-14 Thread Tom Praschan via Phabricator via cfe-commits
tom-anders updated this revision to Diff 460058.
tom-anders marked 5 inline comments as done.
tom-anders added a comment.

Add additional test, tidy up logic in pickDeclToUse()


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133664

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
@@ -1630,6 +1630,38 @@
 HI.Type = "int";
 HI.Definition = "int foo";
   }},
+  {
+  R"cpp(// Function definition via using declaration
+namespace ns { 
+  void foo(); 
+}
+int main() {
+  using ns::foo;
+  ^[[foo]]();
+}
+  )cpp",
+  [](HoverInfo &HI) {
+HI.Name = "foo";
+HI.Kind = index::SymbolKind::Function;
+HI.NamespaceScope = "ns::";
+HI.Type = "void ()";
+HI.Definition = "void foo()";
+HI.Documentation = "";
+HI.ReturnType = "void";
+HI.Parameters = std::vector{};
+  }},
+  {
+  R"cpp( // using declaration and two possible function declarations
+namespace ns { void foo(int); void foo(char); }
+using ns::foo;
+template  void bar() { [[f^oo]](T{}); }
+  )cpp",
+  [](HoverInfo &HI) {
+HI.Name = "foo";
+HI.Kind = index::SymbolKind::Using;
+HI.NamespaceScope = "";
+HI.Definition = "using ns::foo";
+  }},
   {
   R"cpp(// Macro
 #define MACRO 0
@@ -1734,6 +1766,25 @@
 HI.Definition = "ONE";
 HI.Value = "0";
   }},
+  {
+  R"cpp(// C++20's using enum
+enum class Hello {
+  ONE, TWO, THREE,
+};
+void foo() {
+  using enum Hello;
+  Hello hello = [[O^NE]];
+}
+  )cpp",
+  [](HoverInfo &HI) {
+HI.Name = "ONE";
+HI.Kind = index::SymbolKind::EnumConstant;
+HI.NamespaceScope = "";
+HI.LocalScope = "Hello::";
+HI.Type = "enum Hello";
+HI.Definition = "ONE";
+HI.Value = "0";
+  }},
   {
   R"cpp(// Enumerator in anonymous enum
 enum {
Index: clang-tools-extra/clangd/Hover.cpp
===
--- clang-tools-extra/clangd/Hover.cpp
+++ clang-tools-extra/clangd/Hover.cpp
@@ -1006,6 +1006,38 @@
   HI.CallPassType.emplace(PassType);
 }
 
+const NamedDecl *pickDeclToUse(llvm::ArrayRef Candidates) {
+  if (Candidates.empty())
+return nullptr;
+
+  // This is e.g the case for
+  // namespace ns { void foo(); }
+  // void bar() { using ns::foo; f^oo(); }
+  // One declaration in Candidates will refer to the using declaration,
+  // which isn't really useful for Hover. So use the other one,
+  // which in this example would be the actual declaration of foo.
+  if (Candidates.size() <= 2) {
+if (llvm::isa(Candidates.front()))
+  return Candidates.back();
+
+return Candidates.front();
+  }
+
+  // For something like
+  // namespace ns { void foo(int); void foo(char); }
+  // using ns::foo;
+  // template  void bar() { fo^o(T{}); }
+  // we actually want to show the using declaration,
+  // it's not clear which declaration to pick otherwise.
+  auto BaseDecls = llvm::make_filter_range(Candidates, [](const NamedDecl *D) {
+return llvm::isa(D);
+  });
+  if (std::distance(BaseDecls.begin(), BaseDecls.end()) == 1)
+return *BaseDecls.begin();
+
+  return Candidates.front();
+}
+
 } // namespace
 
 llvm::Optional getHover(ParsedAST &AST, Position Pos,
@@ -1081,11 +1113,11 @@
   // FIXME: Fill in HighlightRange with range coming from N->ASTNode.
   auto Decls = explicitReferenceTargets(N->ASTNode, DeclRelation::Alias,
 AST.getHeuristicResolver());
-  if (!Decls.empty()) {
-HI = getHoverContents(Decls.front(), PP, Index, TB);
+  if (const auto *DeclToUse = pickDeclToUse(Decls)) {
+HI = getHoverContents(DeclToUse, PP, Index, TB);
 // Layout info only shown when hovering on the field/class itself.
-if (Decls.front() == N->ASTNode.get())
-  addLayoutInfo(*Decls.front(), *HI);
+if (DeclToUse == N->ASTNode.get())
+  addLayoutInfo(*DeclToUse, *HI);
 // Look for a close enclosing expression to show the value of.
 if (!HI->Value)
   HI->Value = printExprValue(N, AST.getASTContext());
___
cfe-

[PATCH] D133664: [clangd] Fix hover on symbol introduced by using declaration

2022-09-14 Thread Tom Praschan via Phabricator via cfe-commits
tom-anders added inline comments.



Comment at: clang-tools-extra/clangd/Hover.cpp:1011
+const NamedDecl *
+pickDeclToUse(const llvm::SmallVector &Candidates) {
+  if (Candidates.empty())

kadircet wrote:
> you can just pass in ArrayRef instead.
Ah of course, forgot about that nice class


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133664

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


[PATCH] D133856: [clang][Interp] Pass initializer through when creating variables

2022-09-14 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision.
tbaeder added reviewers: aaron.ballman, erichkeane, shafik, tahonermann.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This is of course in preparation of https://reviews.llvm.org/D133753. I think 
this patch is needed no matter how the array filler approach ends up.

Pass the initializer of the variable through when creating variables. This way 
we can later inspect the initializer in `Program::createDescriptor()` for the 
array size.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133856

Files:
  clang/lib/AST/Interp/ByteCodeExprGen.cpp
  clang/lib/AST/Interp/Program.cpp
  clang/lib/AST/Interp/Program.h

Index: clang/lib/AST/Interp/Program.h
===
--- clang/lib/AST/Interp/Program.h
+++ clang/lib/AST/Interp/Program.h
@@ -69,7 +69,7 @@
   llvm::Optional getOrCreateDummy(const ParmVarDecl *PD);
 
   /// Creates a global and returns its index.
-  llvm::Optional createGlobal(const ValueDecl *VD);
+  llvm::Optional createGlobal(const ValueDecl *VD, const Expr *E);
 
   /// Creates a global from a lifetime-extended temporary.
   llvm::Optional createGlobal(const Expr *E);
@@ -111,7 +111,8 @@
   /// Creates a descriptor for a composite type.
   Descriptor *createDescriptor(const DeclTy &D, const Type *Ty,
bool IsConst = false, bool IsTemporary = false,
-   bool IsMutable = false);
+   bool IsMutable = false,
+   const Expr *Init = nullptr);
 
   /// Context to manage declaration lifetimes.
   class DeclScope {
@@ -134,7 +135,8 @@
   friend class DeclScope;
 
   llvm::Optional createGlobal(const DeclTy &D, QualType Ty,
-bool IsStatic, bool IsExtern);
+bool IsStatic, bool IsExtern,
+const Expr *Init = nullptr);
 
   /// Reference to the VM context.
   Context &Ctx;
Index: clang/lib/AST/Interp/Program.cpp
===
--- clang/lib/AST/Interp/Program.cpp
+++ clang/lib/AST/Interp/Program.cpp
@@ -127,7 +127,7 @@
   if (auto Idx = getGlobal(VD))
 return Idx;
 
-  if (auto Idx = createGlobal(VD)) {
+  if (auto Idx = createGlobal(VD, nullptr)) {
 GlobalIndices[VD] = *Idx;
 return Idx;
   }
@@ -153,7 +153,8 @@
   return {};
 }
 
-llvm::Optional Program::createGlobal(const ValueDecl *VD) {
+llvm::Optional Program::createGlobal(const ValueDecl *VD,
+   const Expr *Init) {
   bool IsStatic, IsExtern;
   if (auto *Var = dyn_cast(VD)) {
 IsStatic = !Var->hasLocalStorage();
@@ -162,7 +163,7 @@
 IsStatic = false;
 IsExtern = true;
   }
-  if (auto Idx = createGlobal(VD, VD->getType(), IsStatic, IsExtern)) {
+  if (auto Idx = createGlobal(VD, VD->getType(), IsStatic, IsExtern, Init)) {
 for (const Decl *P = VD; P; P = P->getPreviousDecl())
   GlobalIndices[P] = *Idx;
 return *Idx;
@@ -175,7 +176,8 @@
 }
 
 llvm::Optional Program::createGlobal(const DeclTy &D, QualType Ty,
-   bool IsStatic, bool IsExtern) {
+   bool IsStatic, bool IsExtern,
+   const Expr *Init) {
   // Create a descriptor for the global.
   Descriptor *Desc;
   const bool IsConst = Ty.isConstQualified();
@@ -310,7 +312,7 @@
 
 Descriptor *Program::createDescriptor(const DeclTy &D, const Type *Ty,
   bool IsConst, bool IsTemporary,
-  bool IsMutable) {
+  bool IsMutable, const Expr *Init) {
   // Classes and structures.
   if (auto *RT = Ty->getAs()) {
 if (auto *Record = getOrCreateRecord(RT->getDecl()))
Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp
===
--- clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -513,18 +513,23 @@
   QualType Ty;
 
   const ValueDecl *Key = nullptr;
+  const Expr *Init = nullptr;
   bool IsTemporary = false;
-  if (auto *VD = dyn_cast_or_null(Src.dyn_cast())) {
+  if (auto *VD = dyn_cast_if_present(Src.dyn_cast())) {
 Key = VD;
 Ty = VD->getType();
+
+if (const auto *VarD = dyn_cast(VD))
+  Init = VarD->getInit();
   }
   if (auto *E = Src.dyn_cast()) {
 IsTemporary = true;
 Ty = E->getType();
   }
 
-  Descriptor *D = P.createDescriptor(Src, Ty.getTypePtr(),
- Ty.isConstQualified(), IsTemporary);
+  Descriptor *D =
+  P.createDescriptor(Src, Ty.getTypePtr(), Ty.isConstQualified(),
+ IsTemporary, /*IsMutable=*/false, Init);
   if (!D)

[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Michał Górny via Phabricator via cfe-commits
mgorny accepted this revision.
mgorny added a comment.
This revision is now accepted and ready to land.

The newest version looks good. Thanks!


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

https://reviews.llvm.org/D133800

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


[PATCH] D133753: [clang][Interp] WIP: Array fillers

2022-09-14 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 460059.

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

https://reviews.llvm.org/D133753

Files:
  clang/lib/AST/Interp/Boolean.h
  clang/lib/AST/Interp/ByteCodeExprGen.cpp
  clang/lib/AST/Interp/Context.cpp
  clang/lib/AST/Interp/Descriptor.cpp
  clang/lib/AST/Interp/Descriptor.h
  clang/lib/AST/Interp/EvalEmitter.cpp
  clang/lib/AST/Interp/Integral.h
  clang/lib/AST/Interp/Interp.h
  clang/lib/AST/Interp/InterpBlock.cpp
  clang/lib/AST/Interp/InterpBlock.h
  clang/lib/AST/Interp/InterpFrame.cpp
  clang/lib/AST/Interp/InterpFrame.h
  clang/lib/AST/Interp/InterpStack.h
  clang/lib/AST/Interp/Pointer.cpp
  clang/lib/AST/Interp/Pointer.h
  clang/lib/AST/Interp/Program.cpp
  clang/lib/AST/Interp/Program.h
  clang/test/AST/Interp/arrays.cpp

Index: clang/test/AST/Interp/arrays.cpp
===
--- clang/test/AST/Interp/arrays.cpp
+++ clang/test/AST/Interp/arrays.cpp
@@ -98,3 +98,59 @@
 struct fred y [] = { [0] = { .s[0] = 'q' } };
 #endif
 #pragma clang diagnostic pop
+
+namespace indices {
+  constexpr int first[] = {1};
+  constexpr int firstValue = first[2]; // ref-error {{must be initialized by a constant expression}} \
+   // ref-note {{cannot refer to element 2 of array of 1}} \
+   // expected-error {{must be initialized by a constant expression}} \
+   // expected-note {{cannot refer to element 2 of array of 1}}
+
+  constexpr int second[10] = {17};
+  constexpr int secondValue = second[10];// ref-error {{must be initialized by a constant expression}} \
+ // ref-note {{read of dereferenced one-past-the-end pointer}} \
+ // expected-error {{must be initialized by a constant expression}} \
+ // expected-note {{cannot refer to element 10 of array of 10}}
+
+  constexpr int negative = second[-2]; // ref-error {{must be initialized by a constant expression}} \
+   // ref-note {{cannot refer to element -2 of array of 10}} \
+   // expected-error {{must be initialized by a constant expression}} \
+   // expected-note {{cannot refer to element -2 of array of 10}}
+};
+
+namespace fillers {
+  constexpr int k[3] = {1337};
+  constexpr int foo(int m) {
+return k[m];
+  }
+  static_assert(foo(0) == 1337, "");
+  static_assert(foo(1) == 0, "");
+  static_assert(foo(2) == 0, "");
+
+  constexpr int N = 12;
+  constexpr int local(unsigned i) {
+int arr[N] = {1,2,3};
+return arr[i];
+  }
+  static_assert(local(0) == 1, "");
+  static_assert(local(1) == 2, "");
+  static_assert(local(2) == 3, "");
+  static_assert(local(3) == 0, "");
+  static_assert(local(N - 1) == 0, "");
+
+  /// FIXME: Non-primitive array fillers are not handled properly currently,
+  ///   but nobody notices right now because all fillers are 0 anyway and
+  ///   that's also was we memset() the memory to.
+  constexpr int twodim[2][4] = {
+{1,2},
+{3,4}
+  };
+  static_assert(twodim[0][0] == 1, "");
+  static_assert(twodim[0][1] == 2, "");
+  static_assert(twodim[0][2] == 0, "");
+  static_assert(twodim[0][3] == 0, "");
+  static_assert(twodim[1][0] == 3, "");
+  static_assert(twodim[1][1] == 4, "");
+  static_assert(twodim[1][2] == 0, "");
+  static_assert(twodim[1][3] == 0, "");
+};
Index: clang/lib/AST/Interp/Program.h
===
--- clang/lib/AST/Interp/Program.h
+++ clang/lib/AST/Interp/Program.h
@@ -56,7 +56,12 @@
   /// Returns the value of a global.
   Block *getGlobal(unsigned Idx) {
 assert(Idx < Globals.size());
-return Globals[Idx]->block();
+return Globals[Idx].block();
+  }
+
+  /// Checks whether the given pointer points to a global variable.
+  bool isGlobalPointer(const Pointer &P) const {
+return false;
   }
 
   /// Finds a global's index.
@@ -156,35 +161,12 @@
   /// Custom allocator for global storage.
   using PoolAllocTy = llvm::BumpPtrAllocatorImpl;
 
-  /// Descriptor + storage for a global object.
-  ///
-  /// Global objects never go out of scope, thus they do not track pointers.
-  class Global {
-  public:
-/// Create a global descriptor for string literals.
-template 
-Global(Tys... Args) : B(std::forward(Args)...) {}
-
-/// Allocates the global in the pool, reserving storate for data.
-void *operator new(size_t Meta, PoolAllocTy &Alloc, size_t Data) {
-  return Alloc.Allocate(Meta + Data, alignof(void *));
-}
-
-/// Return a pointer to the data.
-char *data() { return B.data(); }
-/// Return a pointer to the block.
-Block *block() { return &B; }
-
-  private:
-/// Required metadata - does not actually track pointers.
-Block B;
-  };

[PATCH] D130308: [clang] extend getCommonSugaredType to merge sugar nodes

2022-09-14 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov edited the summary of this revision.
mizvekov updated this revision to Diff 460063.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130308

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/test/SemaCXX/sugar-common-types.cpp
  clang/test/SemaTemplate/deduction.cpp

Index: clang/test/SemaTemplate/deduction.cpp
===
--- clang/test/SemaTemplate/deduction.cpp
+++ clang/test/SemaTemplate/deduction.cpp
@@ -190,6 +190,14 @@
 }
 } // namespace test7
 
+namespace test8 {
+template  void foo(T);
+void test(int a) {
+char n[a];
+foo(n);
+}
+} // namespace test8
+
 // Verify that we can deduce enum-typed arguments correctly.
 namespace test14 {
   enum E { E0, E1 };
Index: clang/test/SemaCXX/sugar-common-types.cpp
===
--- clang/test/SemaCXX/sugar-common-types.cpp
+++ clang/test/SemaCXX/sugar-common-types.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++20 -fenable-matrix
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++20 -fenable-matrix -triple i686-pc-win32
 
 enum class N {};
 
@@ -38,3 +38,77 @@
 N t7 = X4() + Y4(); // expected-error {{rvalue of type 'B4'}}
 N t8 = X4() * Y4(); // expected-error {{rvalue of type 'B4'}}
 N t9 = X5() * Y5(); // expected-error {{rvalue of type 'A4 __attribute__((matrix_type(3, 3)))'}}
+
+template  struct S1 {
+  template  struct S2 {};
+};
+
+N t10 = 0 ? S1() : S1(); // expected-error {{from 'S1' (aka 'S1')}}
+N t11 = 0 ? S1::S2() : S1::S2(); // expected-error {{from 'S1::S2' (aka 'S2')}}
+
+template  using Al = S1;
+
+N t12 = 0 ? Al() : Al(); // expected-error {{from 'Al' (aka 'S1')}}
+
+#define AS1 __attribute__((address_space(1)))
+#define AS2 __attribute__((address_space(1)))
+using AS1X1 = AS1 B1;
+using AS1Y1 = AS1 B1;
+using AS2Y1 = AS2 B1;
+N t13 = 0 ? (AS1X1){} : (AS1Y1){}; // expected-error {{rvalue of type 'AS1 B1' (aka '__attribute__((address_space(1))) int')}}
+N t14 = 0 ? (AS1X1){} : (AS2Y1){}; // expected-error {{rvalue of type '__attribute__((address_space(1))) B1' (aka '__attribute__((address_space(1))) int')}}
+
+using FX1 = X1 ();
+using FY1 = Y1 ();
+N t15 = 0 ? (FX1*){} : (FY1*){}; // expected-error {{rvalue of type 'B1 (*)()' (aka 'int (*)()')}}
+
+struct SS1 {};
+using SB1 = SS1;
+using SX1 = SB1;
+using SY1 = SB1;
+
+using MFX1 = X1 SX1::*();
+using MFY1 = Y1 SY1::*();
+
+N t16 = 0 ? (MFX1*){} : (MFY1*){}; // expected-error {{rvalue of type 'B1 SB1::*(*)()'}}
+
+N t17 = 0 ? (FX1 SX1::*){} : (FY1 SY1::*){}; // expected-error {{rvalue of type 'B1 (SB1::*)() __attribute__((thiscall))'}}
+
+N t18 = 0 ? (__typeof(X1*)){} : (__typeof(Y1*)){}; // expected-error {{rvalue of type 'typeof(B1 *)' (aka 'int *')}}
+
+struct Enums {
+  enum X : B1;
+  enum Y : ::B1;
+};
+using EnumsB = Enums;
+using EnumsX = EnumsB;
+using EnumsY = EnumsB;
+
+N t19 = 0 ? (__underlying_type(EnumsX::X)){} : (__underlying_type(EnumsY::Y)){};
+// expected-error@-1 {{rvalue of type 'B1' (aka 'int')}}
+
+N t20 = 0 ? (__underlying_type(EnumsX::X)){} : (__underlying_type(EnumsY::X)){};
+// expected-error@-1 {{rvalue of type '__underlying_type(Enums::X)' (aka 'int')}}
+
+using SBTF1 = SS1 [[clang::btf_type_tag("1")]];
+using SBTF2 = ::SS1 [[clang::btf_type_tag("1")]];
+using SBTF3 = ::SS1 [[clang::btf_type_tag("2")]];
+
+N t21 = 0 ? (SBTF1){} : (SBTF3){}; // expected-error {{from 'SS1'}}
+N t22 = 0 ? (SBTF1){} : (SBTF2){}; // expected-error {{from 'SS1 btf_type_tag(1)' (aka 'SS1')}}
+
+using QX = const SB1 *;
+using QY = const ::SB1 *;
+N t23 = 0 ? (QX){} : (QY){}; // expected-error {{rvalue of type 'const SB1 *' (aka 'const SS1 *')}}
+
+template  using Alias = short;
+N t24 = 0 ? (Alias){} : (Alias){}; // expected-error {{rvalue of type 'Alias' (aka 'short')}}
+N t25 = 0 ? (Alias){} : (Alias){}; // expected-error {{rvalue of type 'short'}}
+
+template  concept C1 = true;
+template  concept C2 = true;
+C1 auto t26_1 = (SB1){};
+C1 auto t26_2 = (::SB1){};
+C2 auto t26_3 = (::SB1){};
+N t26 = 0 ? t26_1 : t26_2; // expected-error {{from 'SB1' (aka 'SS1')}}
+N t27 = 0 ? t26_1 : t26_3; // expected-error {{from 'SB1' (aka 'SS1')}}
Index: clang/lib/Sema/SemaTemplateDeduction.cpp
===
--- clang/lib/Sema/SemaTemplateDeduction.cpp
+++ clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -3825,13 +3825,11 @@
 //   - If A is an array type, the pointer type produced by the
 // array-to-pointer standard conversion (4.2) is used in place of
 // A for type deduction; otherwise,
-if (ArgType->isArrayType())
-  ArgType = S.Context.getArrayDecayedType(ArgType);
 //   - If A is a function type, the pointer type produced by the
 // function-to-pointer standard conv

[PATCH] D130308: [clang] extend getCommonSugaredType to merge sugar nodes

2022-09-14 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 460064.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130308

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/test/SemaCXX/sugar-common-types.cpp
  clang/test/SemaTemplate/deduction.cpp
  libcxx/DELETE.ME

Index: libcxx/DELETE.ME
===
--- libcxx/DELETE.ME
+++ libcxx/DELETE.ME
@@ -1 +1,2 @@
 D111509
+D130308
Index: clang/test/SemaTemplate/deduction.cpp
===
--- clang/test/SemaTemplate/deduction.cpp
+++ clang/test/SemaTemplate/deduction.cpp
@@ -190,6 +190,14 @@
 }
 } // namespace test7
 
+namespace test8 {
+template  void foo(T);
+void test(int a) {
+char n[a];
+foo(n);
+}
+} // namespace test8
+
 // Verify that we can deduce enum-typed arguments correctly.
 namespace test14 {
   enum E { E0, E1 };
Index: clang/test/SemaCXX/sugar-common-types.cpp
===
--- clang/test/SemaCXX/sugar-common-types.cpp
+++ clang/test/SemaCXX/sugar-common-types.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++20 -fenable-matrix
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++20 -fenable-matrix -triple i686-pc-win32
 
 enum class N {};
 
@@ -38,3 +38,77 @@
 N t7 = X4() + Y4(); // expected-error {{rvalue of type 'B4'}}
 N t8 = X4() * Y4(); // expected-error {{rvalue of type 'B4'}}
 N t9 = X5() * Y5(); // expected-error {{rvalue of type 'A4 __attribute__((matrix_type(3, 3)))'}}
+
+template  struct S1 {
+  template  struct S2 {};
+};
+
+N t10 = 0 ? S1() : S1(); // expected-error {{from 'S1' (aka 'S1')}}
+N t11 = 0 ? S1::S2() : S1::S2(); // expected-error {{from 'S1::S2' (aka 'S2')}}
+
+template  using Al = S1;
+
+N t12 = 0 ? Al() : Al(); // expected-error {{from 'Al' (aka 'S1')}}
+
+#define AS1 __attribute__((address_space(1)))
+#define AS2 __attribute__((address_space(1)))
+using AS1X1 = AS1 B1;
+using AS1Y1 = AS1 B1;
+using AS2Y1 = AS2 B1;
+N t13 = 0 ? (AS1X1){} : (AS1Y1){}; // expected-error {{rvalue of type 'AS1 B1' (aka '__attribute__((address_space(1))) int')}}
+N t14 = 0 ? (AS1X1){} : (AS2Y1){}; // expected-error {{rvalue of type '__attribute__((address_space(1))) B1' (aka '__attribute__((address_space(1))) int')}}
+
+using FX1 = X1 ();
+using FY1 = Y1 ();
+N t15 = 0 ? (FX1*){} : (FY1*){}; // expected-error {{rvalue of type 'B1 (*)()' (aka 'int (*)()')}}
+
+struct SS1 {};
+using SB1 = SS1;
+using SX1 = SB1;
+using SY1 = SB1;
+
+using MFX1 = X1 SX1::*();
+using MFY1 = Y1 SY1::*();
+
+N t16 = 0 ? (MFX1*){} : (MFY1*){}; // expected-error {{rvalue of type 'B1 SB1::*(*)()'}}
+
+N t17 = 0 ? (FX1 SX1::*){} : (FY1 SY1::*){}; // expected-error {{rvalue of type 'B1 (SB1::*)() __attribute__((thiscall))'}}
+
+N t18 = 0 ? (__typeof(X1*)){} : (__typeof(Y1*)){}; // expected-error {{rvalue of type 'typeof(B1 *)' (aka 'int *')}}
+
+struct Enums {
+  enum X : B1;
+  enum Y : ::B1;
+};
+using EnumsB = Enums;
+using EnumsX = EnumsB;
+using EnumsY = EnumsB;
+
+N t19 = 0 ? (__underlying_type(EnumsX::X)){} : (__underlying_type(EnumsY::Y)){};
+// expected-error@-1 {{rvalue of type 'B1' (aka 'int')}}
+
+N t20 = 0 ? (__underlying_type(EnumsX::X)){} : (__underlying_type(EnumsY::X)){};
+// expected-error@-1 {{rvalue of type '__underlying_type(Enums::X)' (aka 'int')}}
+
+using SBTF1 = SS1 [[clang::btf_type_tag("1")]];
+using SBTF2 = ::SS1 [[clang::btf_type_tag("1")]];
+using SBTF3 = ::SS1 [[clang::btf_type_tag("2")]];
+
+N t21 = 0 ? (SBTF1){} : (SBTF3){}; // expected-error {{from 'SS1'}}
+N t22 = 0 ? (SBTF1){} : (SBTF2){}; // expected-error {{from 'SS1 btf_type_tag(1)' (aka 'SS1')}}
+
+using QX = const SB1 *;
+using QY = const ::SB1 *;
+N t23 = 0 ? (QX){} : (QY){}; // expected-error {{rvalue of type 'const SB1 *' (aka 'const SS1 *')}}
+
+template  using Alias = short;
+N t24 = 0 ? (Alias){} : (Alias){}; // expected-error {{rvalue of type 'Alias' (aka 'short')}}
+N t25 = 0 ? (Alias){} : (Alias){}; // expected-error {{rvalue of type 'short'}}
+
+template  concept C1 = true;
+template  concept C2 = true;
+C1 auto t26_1 = (SB1){};
+C1 auto t26_2 = (::SB1){};
+C2 auto t26_3 = (::SB1){};
+N t26 = 0 ? t26_1 : t26_2; // expected-error {{from 'SB1' (aka 'SS1')}}
+N t27 = 0 ? t26_1 : t26_3; // expected-error {{from 'SB1' (aka 'SS1')}}
Index: clang/lib/Sema/SemaTemplateDeduction.cpp
===
--- clang/lib/Sema/SemaTemplateDeduction.cpp
+++ clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -3825,13 +3825,11 @@
 //   - If A is an array type, the pointer type produced by the
 // array-to-pointer standard conversion (4.2) is used in place of
 // A for type deduction; otherwise,
-if (ArgType->isArrayType())
-  ArgType = S.Context.getArr

[PATCH] D133726: [OpenMP][AMDGPU] Link bitcode ROCm device libraries per-TU

2022-09-14 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield accepted this revision.
JonChesterfield added a comment.
This revision is now accepted and ready to land.

I don't like this but will concede it's quicker than changing device libs to 
contain IR that doesn't have to be patched on the fly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133726

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


[PATCH] D133851: [analyzer] Initialize ShouldEmitErrorsOnInvalidConfigValue analyzer option

2022-09-14 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, I don't see any problem with this change. LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133851

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


[PATCH] D133664: [clangd] Fix hover on symbol introduced by using declaration

2022-09-14 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

thanks, lgtm! i think you have commit access now, but let me know if I should 
land this for you (preferably with an email address for commit attribution)




Comment at: clang-tools-extra/clangd/Hover.cpp:1022
+  return Candidates.back();
+
+return Candidates.front();

nit: drop the empty line


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133664

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


[PATCH] D133436: Ground work for cuda-related checks in clang-tidy

2022-09-14 Thread Bartłomiej Cieślar via Phabricator via cfe-commits
barcisz updated this revision to Diff 460070.
barcisz added a comment.
Herald added a subscriber: arphaman.

Common documentation for cuda checks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133436

Files:
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
  clang-tools-extra/clang-tidy/cuda/CMakeLists.txt
  clang-tools-extra/clang-tidy/cuda/CudaTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/cuda/.keep
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/index.rst
  clang-tools-extra/test/clang-tidy/check_clang_tidy.py
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda-initializers.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda.h
  clang-tools-extra/test/clang-tidy/checkers/cuda/.keep

Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda.h
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda.h
@@ -0,0 +1,28 @@
+/* Minimal declarations for CUDA support.  Testing purposes only. */
+
+#include 
+
+#define __constant__ __attribute__((constant))
+#define __device__ __attribute__((device))
+#define __global__ __attribute__((global))
+#define __host__ __attribute__((host))
+#define __shared__ __attribute__((shared))
+
+struct dim3 {
+  unsigned x, y, z;
+  __host__ __device__ dim3(unsigned x, unsigned y = 1, unsigned z = 1) : x(x), y(y), z(z) {}
+};
+
+typedef struct cudaStream *cudaStream_t;
+typedef enum cudaError {} cudaError_t;
+extern "C" int cudaConfigureCall(dim3 gridSize, dim3 blockSize,
+ size_t sharedSize = 0,
+ cudaStream_t stream = 0);
+extern "C" int __cudaPushCallConfiguration(dim3 gridSize, dim3 blockSize,
+   size_t sharedSize = 0,
+   cudaStream_t stream = 0);
+extern "C" cudaError_t cudaLaunchKernel(const void *func, dim3 gridDim,
+dim3 blockDim, void **args,
+size_t sharedMem, cudaStream_t stream);
+
+extern "C" __device__ int printf(const char*, ...);
Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda-initializers.h
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/cuda/cuda-initializers.h
@@ -0,0 +1,145 @@
+// CUDA struct types with interesting initialization properties.
+// Keep in sync with clang/test/SemaCUDA/Inputs/cuda-initializers.h.
+
+// Base classes with different initializer variants.
+
+// trivial constructor -- allowed
+struct T {
+  int t;
+};
+
+// empty constructor
+struct EC {
+  int ec;
+  __device__ EC() {} // -- allowed
+  __device__ EC(int) {}  // -- not allowed
+};
+
+// empty destructor
+struct ED {
+  __device__ ~ED() {} // -- allowed
+};
+
+struct ECD {
+  __device__ ECD() {} // -- allowed
+  __device__ ~ECD() {}// -- allowed
+};
+
+// empty templated constructor -- allowed with no arguments
+struct ETC {
+  template  __device__ ETC(T...) {}
+};
+
+// undefined constructor -- not allowed
+struct UC {
+  int uc;
+  __device__ UC();
+};
+
+// undefined destructor -- not allowed
+struct UD {
+  int ud;
+  __device__ ~UD();
+};
+
+// empty constructor w/ initializer list -- not allowed
+struct ECI {
+  int eci;
+  __device__ ECI() : eci(1) {}
+};
+
+// non-empty constructor -- not allowed
+struct NEC {
+  int nec;
+  __device__ NEC() { nec = 1; }
+};
+
+// non-empty destructor -- not allowed
+struct NED {
+  int ned;
+  __device__ ~NED() { ned = 1; }
+};
+
+// no-constructor,  virtual method -- not allowed
+struct NCV {
+  int ncv;
+  __device__ virtual void vm() {}
+};
+
+// virtual destructor -- not allowed.
+struct VD {
+  __device__ virtual ~VD() {}
+};
+
+// dynamic in-class field initializer -- not allowed
+__device__ int f();
+struct NCF {
+  int ncf = f();
+};
+
+// static in-class field initializer.  NVCC does not allow it, but
+// clang generates static initializer for this, so we'll accept it.
+// We still can't use it on __shared__ vars as they don't allow *any*
+// initializers.
+struct NCFS {
+  int ncfs = 3;
+};
+
+// undefined templated constructor -- not allowed
+struct UTC {
+  template  __device__ UTC(T...);
+};
+
+// non-empty templated constructor -- not allowed
+struct NETC {
+  int netc;
+  template  __device__ NETC(T...) { netc = 1; }
+};
+
+// Regular base class -- allowed
+struct T_B_T : T {};
+
+// Incapsulated object of allowed class -- allowed
+struct T_F_T {
+  T t;
+};
+
+// array of allowed objects -- allowed
+struct T_FA_T {
+  T t[2];
+};
+
+
+// Calling empty base class initializer is OK
+struct EC_I_

[PATCH] D133262: [clang] Fixes how we represent / emulate builtin templates

2022-09-14 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 460073.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133262

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/DeclTemplate.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/DeclTemplate.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/test/SemaTemplate/make_integer_seq.cpp
  clang/test/SemaTemplate/type_pack_element.cpp
  libcxx/DELETE.ME

Index: libcxx/DELETE.ME
===
--- libcxx/DELETE.ME
+++ libcxx/DELETE.ME
@@ -1,2 +1,3 @@
 D111509
 D130308
+D133262
Index: clang/test/SemaTemplate/type_pack_element.cpp
===
--- clang/test/SemaTemplate/type_pack_element.cpp
+++ clang/test/SemaTemplate/type_pack_element.cpp
@@ -3,7 +3,7 @@
 using test1 = __type_pack_element<0, int>;
 //  CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}} <:3:1, col:41> col:7 test1 '__type_pack_element<0, int>':'int'
 // CHECK-NEXT:   `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__type_pack_element<0, int>' sugar
-// CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__type_pack_element<0, int>' sugar __type_pack_element
+// CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__type_pack_element<0, int>' sugar alias __type_pack_element
 // CHECK-NEXT:   |-TemplateArgument expr
 // CHECK-NEXT:   | `-ConstantExpr 0x{{[0-9A-Fa-f]+}}  'unsigned long'
 // CHECK-NEXT:   |   |-value: Int 0
@@ -11,53 +11,79 @@
 // CHECK-NEXT:   | `-IntegerLiteral 0x{{[0-9A-Fa-f]+}}  'int' 0
 // CHECK-NEXT:   |-TemplateArgument type 'int'
 // CHECK-NEXT:   | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
-// CHECK-NEXT:   `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
+// CHECK-NEXT:   `-SubstTemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'int' sugar
+// CHECK-NEXT: |-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'auto' dependent depth 0 index 1
+// CHECK-NEXT: | `-TemplateTypeParm 0x{{[0-9A-Fa-f]+}} ''
+// CHECK-NEXT: `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
 
 template struct A {
   using test2 = __type_pack_element;
-//  CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test2 '__type_pack_element':'__type_pack_element'
+//  CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test2 '__type_pack_element':'__type_pack_element'
 // CHECK-NEXT:   `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__type_pack_element' sugar dependent
-// CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__type_pack_element' dependent __type_pack_element
+// CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__type_pack_element' sugar dependent alias __type_pack_element
 // CHECK-NEXT:   |-TemplateArgument expr
 // CHECK-NEXT:   | `-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}}  'unsigned long' 
 // CHECK-NEXT:   |   `-DeclRefExpr 0x{{[0-9A-Fa-f]+}}  'int' NonTypeTemplateParm 0x{{[0-9A-Fa-f]+}} 'N' 'int'
-// CHECK-NEXT:   `-TemplateArgument type 'Ts...'
-// CHECK-NEXT: `-PackExpansionType 0x{{[0-9A-Fa-f]+}} 'Ts...' dependent
-// CHECK-NEXT:   `-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'Ts' dependent contains_unexpanded_pack depth 0 index 1 pack
-// CHECK-NEXT: `-TemplateTypeParm 0x{{[0-9A-Fa-f]+}} 'Ts'
+// CHECK-NEXT:   |-TemplateArgument type 'Ts...'
+// CHECK-NEXT:   | `-PackExpansionType 0x{{[0-9A-Fa-f]+}} 'Ts...' dependent
+// CHECK-NEXT:   |   `-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'Ts' dependent contains_unexpanded_pack depth 0 index 1 pack
+// CHECK-NEXT:   | `-TemplateTypeParm 0x{{[0-9A-Fa-f]+}} 'Ts'
+// CHECK-NEXT:   `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__type_pack_element' dependent __type_pack_element
+// CHECK-NEXT: |-TemplateArgument expr
+// CHECK-NEXT: | `-ImplicitCastExpr 0x{{[0-9A-Fa-f]+}}  'unsigned long' 
+// CHECK-NEXT: |   `-DeclRefExpr 0x{{[0-9A-Fa-f]+}}  'int' NonTypeTemplateParm 0x{{[0-9A-Fa-f]+}} 'N' 'int'
+// CHECK-NEXT: `-TemplateArgument pack
+// CHECK-NEXT:   `-TemplateArgument type 'type-parameter-0-1...'
+// CHECK-NEXT: `-PackExpansionType 0x{{[0-9A-Fa-f]+}} 'type-parameter-0-1...' dependent
+// CHECK-NEXT:   `-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'type-parameter-0-1' dependent contains_unexpanded_pack depth 0 index 1 pack
 
   using test3 = __type_pack_element<0, Ts...>;
-//  CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test3 '__type_pack_element<0, Ts...>':'__type_pack_element<0, Ts...>'
+//  CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test3 '__type_pack_element<0, Ts...>':'__type_pack_element<0, type-parameter-0-1...>'
 // CHECK-NEXT:   `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__type_pack_element<0, Ts...>' sugar dependent
-// CHECK-NEXT: `-TemplateSpecializationType

[PATCH] D133773: [clang] fix linker executable path in test

2022-09-14 Thread Ashay Rane via Phabricator via cfe-commits
ashay-github added a comment.

@alvinhochun @mstorsjo Let me know if you'd like to see more changes. With the 
new regex, the tests pass at my end as well as in the Phabricator CI.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133773

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


[PATCH] D133800: [Clang 15.0.1] Downgrade implicit int and implicit function declaration to warning only

2022-09-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D133800#3787378 , @thieta wrote:

> I think the easiest way to handle this is that when you have it approved here 
> - push it to fork on GitHub based on the release branch and create a GitHub 
> issue and write /branch aballman/llvm-project/my_branch in a comment and it 
> will queue up the cherry pick.

I've filed https://github.com/llvm/llvm-project/issues/57739 and assigned it to 
you @thieta -- please let me know if I've mucked something up!


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

https://reviews.llvm.org/D133800

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


[PATCH] D133863: [RISCV] Add MC support of RISCV zcmt Extension

2022-09-14 Thread Xinlong Wu via Phabricator via cfe-commits
VincentWu created this revision.
VincentWu added reviewers: kito-cheng, MaskRay, craig.topper, jrtc27, 
HsiangKai, asb.
Herald added subscribers: sunshaoce, luke957, StephenFan, vkmr, frasercrmck, 
jdoerfert, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, 
psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, 
edward-jones, zzheng, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, 
hiraditya, arichardson.
Herald added a project: All.
VincentWu requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, pcwang-thead, eopXD.
Herald added projects: clang, LLVM.

This patch add the instructions of zcmt extension.

Which includes two instructions (cm.jt&cm.jalt) and a CSR Reg JVT

co-author: @Scott Egerton


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133863

Files:
  clang/test/Preprocessor/riscv-target-features.c
  llvm/lib/Support/RISCVISAInfo.cpp
  llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
  llvm/lib/Target/RISCV/RISCV.td
  llvm/lib/Target/RISCV/RISCVInstrInfo.td
  llvm/lib/Target/RISCV/RISCVInstrInfoZc.td
  llvm/lib/Target/RISCV/RISCVSchedRocket.td
  llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
  llvm/lib/Target/RISCV/RISCVSubtarget.h
  llvm/lib/Target/RISCV/RISCVSystemOperands.td
  llvm/test/CodeGen/RISCV/attributes.ll
  llvm/test/MC/RISCV/attribute-arch.s
  llvm/test/MC/RISCV/rv32zcmt-Invalid.s
  llvm/test/MC/RISCV/rv32zcmt-valid.s
  llvm/test/MC/RISCV/rv64zcmt-Invalid.s
  llvm/test/MC/RISCV/rv64zcmt-valid.s

Index: llvm/test/MC/RISCV/rv64zcmt-valid.s
===
--- /dev/null
+++ llvm/test/MC/RISCV/rv64zcmt-valid.s
@@ -0,0 +1,21 @@
+# RUN: llvm-mc %s -triple=riscv64 -mattr=+experimental-zcmt\
+# RUN:  -riscv-no-aliases -show-encoding \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+experimental-zcmt\
+# RUN:  -mattr=m < %s \
+# RUN: | llvm-objdump --mattr=+experimental-zcmt\
+# RUN:  -M no-aliases -d -r - \
+# RUN: | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s
+
+# CHECK-ASM-AND-OBJ: cm.jt 1
+# CHECK-ASM: encoding: [0x06,0xa0]
+cm.jt 1
+
+# CHECK-ASM: cm.jalt 1
+# CHECK-OBJ: cm.jt 1
+# CHECK-ASM: encoding: [0x06,0xa0]
+cm.jalt 1
+
+# CHECK-ASM-AND-OBJ: cm.jalt 64
+# CHECK-ASM: encoding: [0x02,0xa1]
+cm.jalt 64
Index: llvm/test/MC/RISCV/rv64zcmt-Invalid.s
===
--- /dev/null
+++ llvm/test/MC/RISCV/rv64zcmt-Invalid.s
@@ -0,0 +1,5 @@
+# RUN: not llvm-mc -triple=riscv64 -mattr=+experimental-zcmt -riscv-no-aliases -show-encoding < %s 2>&1 \
+# RUN: | FileCheck -check-prefixes=CHECK-ERROR %s
+
+# CHECK-ERROR: error: immediate must be an integer in the range [0, 63]
+cm.jt 64
Index: llvm/test/MC/RISCV/rv32zcmt-valid.s
===
--- /dev/null
+++ llvm/test/MC/RISCV/rv32zcmt-valid.s
@@ -0,0 +1,21 @@
+# RUN: llvm-mc %s -triple=riscv32 -mattr=+experimental-zcmt\
+# RUN:  -riscv-no-aliases -show-encoding \
+# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+experimental-zcmt\
+# RUN:  -mattr=m < %s \
+# RUN: | llvm-objdump --mattr=+experimental-zcmt\
+# RUN:  -M no-aliases -d -r - \
+# RUN: | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s
+
+# CHECK-ASM-AND-OBJ: cm.jt 1
+# CHECK-ASM: encoding: [0x06,0xa0]
+cm.jt 1
+
+# CHECK-ASM: cm.jalt 1
+# CHECK-OBJ: cm.jt 1
+# CHECK-ASM: encoding: [0x06,0xa0]
+cm.jalt 1
+
+# CHECK-ASM-AND-OBJ: cm.jalt 64
+# CHECK-ASM: encoding: [0x02,0xa1]
+cm.jalt 64
Index: llvm/test/MC/RISCV/rv32zcmt-Invalid.s
===
--- /dev/null
+++ llvm/test/MC/RISCV/rv32zcmt-Invalid.s
@@ -0,0 +1,5 @@
+# RUN: not llvm-mc -triple=riscv32 -mattr=+experimental-zcmt -riscv-no-aliases -show-encoding < %s 2>&1 \
+# RUN: | FileCheck -check-prefixes=CHECK-ERROR %s
+
+# CHECK-ERROR: error: immediate must be an integer in the range [0, 63]
+cm.jt 64
Index: llvm/test/MC/RISCV/attribute-arch.s
===
--- llvm/test/MC/RISCV/attribute-arch.s
+++ llvm/test/MC/RISCV/attribute-arch.s
@@ -196,3 +196,6 @@
 
 .attribute arch, "rv32izca0p70"
 # CHECK: attribute  5, "rv32i2p0_zca0p70"
+
+.attribute arch, "rv32izcmt0p70"
+# CHECK: attribute  5, "rv32i2p0_zcmt0p70"
Index: llvm/test/CodeGen/RISCV/attributes.ll
===
--- llvm/test/CodeGen/RISCV/attributes.ll
+++ llvm/test/CodeGen/RISCV/attributes.ll
@@ -42,6 +42,7 @@
 ; RUN: llc -mtriple=riscv32 -mattr=+zicbom %s -o - | FileCheck --check-prefix=RV32ZICBOM %s
 ; RUN: llc -mtriple=riscv32 -mattr=+zicboz %s -o - | FileCheck --check-prefix=RV32ZICBOZ %s
 ; RUN: llc -mtriple=riscv32 -mattr=+zicbop %s -o - | FileCheck --check-prefix=R

[clang] 194ec84 - [OpenMP][AMDGPU] Link bitcode ROCm device libraries per-TU

2022-09-14 Thread Joseph Huber via cfe-commits

Author: Joseph Huber
Date: 2022-09-14T09:42:06-05:00
New Revision: 194ec844f5c67306f505a3418038c5e75859bad8

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

LOG: [OpenMP][AMDGPU] Link bitcode ROCm device libraries per-TU

Previously, we linked in the ROCm device libraries which provide math
and other utility functions late. This is not stricly correct as this
library contains several flags that are only set per-TU, such as fast
math or denormalization. This patch changes this to pass the bitcode
libraries per-TU using the same method we use for the CUDA libraries.
This has the advantage that we correctly propagate attributes making
this implementation more correct. Additionally, many annoying unused
functions were not being fully removed during LTO. This lead to
erroneous warning messages and remarks on unused functions.

I am not sure if not finding these libraries should be a hard error. let
me know if it should be demoted to a warning saying that some device
utilities will not work without them.

Reviewed By: JonChesterfield

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

Added: 


Modified: 
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChain.cpp
clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
clang/lib/Driver/ToolChains/AMDGPUOpenMP.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/HIPAMD.cpp
clang/lib/Driver/ToolChains/HIPAMD.h
clang/lib/Driver/ToolChains/HIPSPV.cpp
clang/lib/Driver/ToolChains/HIPSPV.h
clang/test/Driver/amdgpu-openmp-toolchain.c

Removed: 




diff  --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 59d8dafc079f..28137e36e2af 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -714,9 +714,9 @@ class ToolChain {
   virtual VersionTuple computeMSVCVersion(const Driver *D,
   const llvm::opt::ArgList &Args) 
const;
 
-  /// Get paths of HIP device libraries.
+  /// Get paths for device libraries.
   virtual llvm::SmallVector
-  getHIPDeviceLibs(const llvm::opt::ArgList &Args) const;
+  getDeviceLibs(const llvm::opt::ArgList &Args) const;
 
   /// Add the system specific linker arguments to use
   /// for the given HIP runtime library type.

diff  --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 7f16469155bd..26c5087b4ac2 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -1099,7 +1099,7 @@ void ToolChain::AddHIPIncludeArgs(const ArgList 
&DriverArgs,
   ArgStringList &CC1Args) const {}
 
 llvm::SmallVector
-ToolChain::getHIPDeviceLibs(const ArgList &DriverArgs) const {
+ToolChain::getDeviceLibs(const ArgList &DriverArgs) const {
   return {};
 }
 

diff  --git a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp 
b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
index 4866982a8dfa..8ab79e1af532 100644
--- a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
@@ -75,6 +75,12 @@ void AMDGPUOpenMPToolChain::addClangTargetOptions(
   if (DriverArgs.hasArg(options::OPT_nogpulib))
 return;
 
+  for (auto BCFile : getDeviceLibs(DriverArgs)) {
+CC1Args.push_back(BCFile.ShouldInternalize ? "-mlink-builtin-bitcode"
+   : "-mlink-bitcode-file");
+CC1Args.push_back(DriverArgs.MakeArgString(BCFile.Path));
+  }
+
   // Link the bitcode library late if we're using device LTO.
   if (getDriver().isUsingLTO(/* IsOffload */ true))
 return;
@@ -158,3 +164,24 @@ AMDGPUOpenMPToolChain::computeMSVCVersion(const Driver *D,
   const ArgList &Args) const {
   return HostTC.computeMSVCVersion(D, Args);
 }
+
+llvm::SmallVector
+AMDGPUOpenMPToolChain::getDeviceLibs(const llvm::opt::ArgList &Args) const {
+  if (Args.hasArg(options::OPT_nogpulib))
+return {};
+
+  if (!RocmInstallation.hasDeviceLibrary()) {
+getDriver().Diag(diag::err_drv_no_rocm_device_lib) << 0;
+return {};
+  }
+
+  StringRef GpuArch = getProcessorFromTargetID(
+  getTriple(), Args.getLastArgValue(options::OPT_march_EQ));
+
+  SmallVector BCLibs;
+  for (auto BCLib : getCommonDeviceLibNames(Args, GpuArch.str(),
+/*IsOpenMP=*/true))
+BCLibs.emplace_back(BCLib);
+
+  return BCLibs;
+}

diff  --git a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.h 
b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.h
index 51a1c4696754..2be444a42c55 100644
--- a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.h
+++ b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.h
@@ -54,6 +54,9 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUOpenMPToolChain final
   computeMSVCVersion(const Dri

[PATCH] D133726: [OpenMP][AMDGPU] Link bitcode ROCm device libraries per-TU

2022-09-14 Thread Joseph Huber via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG194ec844f5c6: [OpenMP][AMDGPU] Link bitcode ROCm device 
libraries per-TU (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133726

Files:
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
  clang/lib/Driver/ToolChains/AMDGPUOpenMP.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/HIPAMD.cpp
  clang/lib/Driver/ToolChains/HIPAMD.h
  clang/lib/Driver/ToolChains/HIPSPV.cpp
  clang/lib/Driver/ToolChains/HIPSPV.h
  clang/test/Driver/amdgpu-openmp-toolchain.c

Index: clang/test/Driver/amdgpu-openmp-toolchain.c
===
--- clang/test/Driver/amdgpu-openmp-toolchain.c
+++ clang/test/Driver/amdgpu-openmp-toolchain.c
@@ -49,5 +49,12 @@
 // RUN:   %clang -### --target=x86_64-unknown-linux-gnu -emit-llvm -S -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-EMIT-LLVM-IR
 // CHECK-EMIT-LLVM-IR: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}}"-emit-llvm"
 
-// RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx803 -lm --rocm-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode %s 2>&1 | FileCheck %s --check-prefix=CHECK-LIB-DEVICE-NEW
-// CHECK-LIB-DEVICE-NEW: {{.*}}clang-linker-wrapper{{.*}}--bitcode-library=openmp-amdgcn-amd-amdhsa-gfx803={{.*}}ocml.bc"{{.*}}ockl.bc"{{.*}}oclc_daz_opt_on.bc"{{.*}}oclc_unsafe_math_off.bc"{{.*}}oclc_finite_only_off.bc"{{.*}}oclc_correctly_rounded_sqrt_on.bc"{{.*}}oclc_wavefrontsize64_on.bc"{{.*}}oclc_isa_version_803.bc"
+// RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp --offload-arch=gfx803 \
+// RUN:   --rocm-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode -fopenmp-new-driver %s  2>&1 | \
+// RUN: FileCheck %s --check-prefix=CHECK-LIB-DEVICE
+// CHECK-LIB-DEVICE: "-cc1" {{.*}}ocml.bc"{{.*}}ockl.bc"{{.*}}oclc_daz_opt_on.bc"{{.*}}oclc_unsafe_math_off.bc"{{.*}}oclc_finite_only_off.bc"{{.*}}oclc_correctly_rounded_sqrt_on.bc"{{.*}}oclc_wavefrontsize64_on.bc"{{.*}}oclc_isa_version_803.bc"
+
+// RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp --offload-arch=gfx803 -nogpulib \
+// RUN:   --rocm-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode -fopenmp-new-driver %s  2>&1 | \
+// RUN: FileCheck %s --check-prefix=CHECK-LIB-DEVICE-NOGPULIB
+// CHECK-LIB-DEVICE-NOGPULIB-NOT: "-cc1" {{.*}}ocml.bc"{{.*}}ockl.bc"{{.*}}oclc_daz_opt_on.bc"{{.*}}oclc_unsafe_math_off.bc"{{.*}}oclc_finite_only_off.bc"{{.*}}oclc_correctly_rounded_sqrt_on.bc"{{.*}}oclc_wavefrontsize64_on.bc"{{.*}}oclc_isa_version_803.bc"
Index: clang/lib/Driver/ToolChains/HIPSPV.h
===
--- clang/lib/Driver/ToolChains/HIPSPV.h
+++ clang/lib/Driver/ToolChains/HIPSPV.h
@@ -69,7 +69,7 @@
   void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  llvm::opt::ArgStringList &CC1Args) const override;
   llvm::SmallVector
-  getHIPDeviceLibs(const llvm::opt::ArgList &Args) const override;
+  getDeviceLibs(const llvm::opt::ArgList &Args) const override;
 
   SanitizerMask getSupportedSanitizers() const override;
 
Index: clang/lib/Driver/ToolChains/HIPSPV.cpp
===
--- clang/lib/Driver/ToolChains/HIPSPV.cpp
+++ clang/lib/Driver/ToolChains/HIPSPV.cpp
@@ -154,7 +154,7 @@
 CC1Args.append(
 {"-fvisibility=hidden", "-fapply-global-visibility-to-externs"});
 
-  llvm::for_each(getHIPDeviceLibs(DriverArgs),
+  llvm::for_each(getDeviceLibs(DriverArgs),
  [&](const BitCodeLibraryInfo &BCFile) {
CC1Args.append({"-mlink-builtin-bitcode",
DriverArgs.MakeArgString(BCFile.Path)});
@@ -206,7 +206,7 @@
 }
 
 llvm::SmallVector
-HIPSPVToolChain::getHIPDeviceLibs(const llvm::opt::ArgList &DriverArgs) const {
+HIPSPVToolChain::getDeviceLibs(const llvm::opt::ArgList &DriverArgs) const {
   llvm::SmallVector BCLibs;
   if (DriverArgs.hasArg(options::OPT_nogpulib))
 return {};
Index: clang/lib/Driver/ToolChains/HIPAMD.h
===
--- clang/lib/Driver/ToolChains/HIPAMD.h
+++ clang/lib/Driver/ToolChains/HIPAMD.h
@@ -76,7 +76,7 @@
   void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  llvm::opt::ArgStringList &CC1Args) const override;
   llvm::SmallVector
-  getHIPDeviceLibs(const llvm::opt::ArgList &Args) const override;
+  getDeviceLibs(const llvm::opt::ArgList &Args) const override;
 
   SanitizerMask getSupportedSanitizers() const override;
 
Index: clang/lib/Driver/ToolChains/HIPAMD.cpp

[clang] b8e1da0 - [analyzer] Initialize ShouldEmitErrorsOnInvalidConfigValue analyzer option

2022-09-14 Thread Balazs Benics via cfe-commits

Author: Balazs Benics
Date: 2022-09-14T16:45:44+02:00
New Revision: b8e1da050673470f20a75d4ecca2c0a00d1a8691

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

LOG: [analyzer] Initialize ShouldEmitErrorsOnInvalidConfigValue analyzer option

Downstream users who doesn't make use of the clang cc1 frontend for
commandline argument parsing, won't benefit from the Marshalling
provided default initialization of the AnalyzerOptions entries. More
about this later.
Those analyzer option fields, as they are bitfields, cannot be default
initialized at the declaration (prior c++20), hence they are initialized
at the constructor.
The only problem is that `ShouldEmitErrorsOnInvalidConfigValue` was
forgotten.

In this patch I'm proposing to initialize that field with the rest.

Note that this value is read by
`CheckerRegistry.cpp:insertAndValidate()`.
The analyzer options are initialized by the marshalling at
`CompilerInvocation.cpp:GenerateAnalyzerArgs()` by the expansion of the
`ANALYZER_OPTION_WITH_MARSHALLING` xmacro to the appropriate default
value regardless of the constructor initialized list which I'm touching.
Due to that this only affects users using CSA as a library, without
serious effort, I believe we cannot test this.

Reviewed By: martong

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

Added: 


Modified: 
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h

Removed: 




diff  --git a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h 
b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
index 2baa7f2e0475..ea80761fe31e 100644
--- a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
+++ b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
@@ -289,7 +289,8 @@ class AnalyzerOptions : public 
RefCountedBase {
 ShowCheckerHelpAlpha(false), ShowCheckerHelpDeveloper(false),
 ShowCheckerOptionList(false), ShowCheckerOptionAlphaList(false),
 ShowCheckerOptionDeveloperList(false), ShowEnabledCheckerList(false),
-ShowConfigOptionsList(false), AnalyzeAll(false),
+ShowConfigOptionsList(false),
+ShouldEmitErrorsOnInvalidConfigValue(false), AnalyzeAll(false),
 AnalyzerDisplayProgress(false), eagerlyAssumeBinOpBifurcation(false),
 TrimGraph(false), visualizeExplodedGraphWithGraphViz(false),
 UnoptimizedCFG(false), PrintStats(false), NoRetryExhausted(false),



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


[PATCH] D133851: [analyzer] Initialize ShouldEmitErrorsOnInvalidConfigValue analyzer option

2022-09-14 Thread Balázs Benics via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb8e1da050673: [analyzer] Initialize 
ShouldEmitErrorsOnInvalidConfigValue analyzer option (authored by steakhal).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133851

Files:
  clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h


Index: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
===
--- clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
+++ clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
@@ -289,7 +289,8 @@
 ShowCheckerHelpAlpha(false), ShowCheckerHelpDeveloper(false),
 ShowCheckerOptionList(false), ShowCheckerOptionAlphaList(false),
 ShowCheckerOptionDeveloperList(false), ShowEnabledCheckerList(false),
-ShowConfigOptionsList(false), AnalyzeAll(false),
+ShowConfigOptionsList(false),
+ShouldEmitErrorsOnInvalidConfigValue(false), AnalyzeAll(false),
 AnalyzerDisplayProgress(false), eagerlyAssumeBinOpBifurcation(false),
 TrimGraph(false), visualizeExplodedGraphWithGraphViz(false),
 UnoptimizedCFG(false), PrintStats(false), NoRetryExhausted(false),


Index: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
===
--- clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
+++ clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
@@ -289,7 +289,8 @@
 ShowCheckerHelpAlpha(false), ShowCheckerHelpDeveloper(false),
 ShowCheckerOptionList(false), ShowCheckerOptionAlphaList(false),
 ShowCheckerOptionDeveloperList(false), ShowEnabledCheckerList(false),
-ShowConfigOptionsList(false), AnalyzeAll(false),
+ShowConfigOptionsList(false),
+ShouldEmitErrorsOnInvalidConfigValue(false), AnalyzeAll(false),
 AnalyzerDisplayProgress(false), eagerlyAssumeBinOpBifurcation(false),
 TrimGraph(false), visualizeExplodedGraphWithGraphViz(false),
 UnoptimizedCFG(false), PrintStats(false), NoRetryExhausted(false),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D131858: [clang] Track the templated entity in type substitution.

2022-09-14 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov edited the summary of this revision.
mizvekov updated this revision to Diff 460095.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131858

Files:
  clang-tools-extra/clang-tidy/hicpp/ExceptionBaseclassCheck.cpp
  clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
  clang-tools-extra/clangd/AST.cpp
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/ASTNodeTraverser.h
  clang/include/clang/AST/JSONNodeDumper.h
  clang/include/clang/AST/TextNodeDumper.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeProperties.td
  clang/include/clang/Sema/Template.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/ASTStructuralEquivalence.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/ODRHash.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/AST/Type.cpp
  clang/lib/AST/TypePrinter.cpp
  clang/lib/Sema/SemaConcept.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/SemaTemplateVariadic.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/lib/Serialization/ASTWriterDecl.cpp
  clang/lib/StaticAnalyzer/Checkers/MismatchedIteratorChecker.cpp
  clang/test/AST/ast-dump-openmp-begin-declare-variant_reference.cpp
  clang/test/AST/ast-dump-template-decls.cpp
  clang/test/AST/deduction-guides.cpp
  clang/test/SemaTemplate/deduction-guide.cpp
  clang/test/SemaTemplate/make_integer_seq.cpp
  clang/test/SemaTemplate/type_pack_element.cpp
  libcxx/DELETE.ME

Index: libcxx/DELETE.ME
===
--- libcxx/DELETE.ME
+++ libcxx/DELETE.ME
@@ -1,3 +1,4 @@
 D111509
 D130308
 D133262
+D131858
Index: clang/test/SemaTemplate/type_pack_element.cpp
===
--- clang/test/SemaTemplate/type_pack_element.cpp
+++ clang/test/SemaTemplate/type_pack_element.cpp
@@ -11,14 +11,13 @@
 // CHECK-NEXT:   | `-IntegerLiteral 0x{{[0-9A-Fa-f]+}}  'int' 0
 // CHECK-NEXT:   |-TemplateArgument type 'int'
 // CHECK-NEXT:   | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
-// CHECK-NEXT:   `-SubstTemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'int' sugar
-// CHECK-NEXT: |-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'auto' dependent depth 0 index 1
-// CHECK-NEXT: | `-TemplateTypeParm 0x{{[0-9A-Fa-f]+}} ''
+// CHECK-NEXT:   `-SubstTemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'int' sugar typename depth 0 index 1 ...
+// CHECK-NEXT: |-BuiltinTemplate 0x{{[0-9A-Fa-f]+}} '__type_pack_element'
 // CHECK-NEXT: `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
 
 template struct A {
   using test2 = __type_pack_element;
-//  CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test2 '__type_pack_element':'__type_pack_element'
+//  CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test2 '__type_pack_element':'__type_pack_element'
 // CHECK-NEXT:   `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__type_pack_element' sugar dependent
 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__type_pack_element' sugar dependent alias __type_pack_element
 // CHECK-NEXT:   |-TemplateArgument expr
@@ -38,7 +37,7 @@
 // CHECK-NEXT:   `-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'type-parameter-0-1' dependent contains_unexpanded_pack depth 0 index 1 pack
 
   using test3 = __type_pack_element<0, Ts...>;
-//  CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test3 '__type_pack_element<0, Ts...>':'__type_pack_element<0, type-parameter-0-1...>'
+//  CHECK: |-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test3 '__type_pack_element<0, Ts...>':'__type_pack_element<0, type-parameter-0-1...>'
 // CHECK-NEXT:   `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__type_pack_element<0, Ts...>' sugar dependent
 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__type_pack_element<0, Ts...>' sugar dependent alias __type_pack_element
 // CHECK-NEXT:   |-TemplateArgument expr
@@ -58,7 +57,7 @@
 // CHECK-NEXT:   `-TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'type-parameter-0-1' dependent contains_unexpanded_pack depth 0 index 1 pack
 
   using test4 = __type_pack_element;
-//  CHECK: `-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test4 '__type_pack_element':'__type_pack_element'
+//  CHECK: `-TypeAliasDecl 0x{{[0-9A-Fa-f]+}}  col:9 test4 '__type_pack_element':'__type_pack_element'
 // CHECK-NEXT:   `-ElaboratedType 0x{{[0-9A-Fa-f]+}} '__type_pack_element' sugar dependent
 // CHECK-NEXT: `-TemplateSpecializationType 0x{{[0-9A-Fa-f]+}} '__type_pack_element' sugar dependent alias __type_pack_element
 // CHECK-NEXT:   |-TemplateArgument expr
Index: clang/test/SemaTemplate/make_integer_seq.cpp
=

[PATCH] D132608: [CMake] Clean up CMake binary dir handling

2022-09-14 Thread John Ericson via Phabricator via cfe-commits
Ericson2314 updated this revision to Diff 460099.
Ericson2314 added a comment.

Fix typo in compiler-rt


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132608

Files:
  bolt/CMakeLists.txt
  clang/CMakeLists.txt
  clang/tools/scan-build/CMakeLists.txt
  cmake/Modules/GNUBinaryDirs.cmake
  cmake/Modules/LLVMLibdirSuffix.cmake
  cmake/Modules/LLVMSetIntDirs.cmake
  compiler-rt/CMakeLists.txt
  compiler-rt/cmake/base-config-ix.cmake
  flang/CMakeLists.txt
  libc/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/docs/BuildingLibcxx.rst
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  libunwind/docs/BuildingLibunwind.rst
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  lldb/cmake/modules/LLDBStandalone.cmake
  llvm/CMakeLists.txt
  mlir/CMakeLists.txt
  openmp/CMakeLists.txt
  polly/CMakeLists.txt

Index: polly/CMakeLists.txt
===
--- polly/CMakeLists.txt
+++ polly/CMakeLists.txt
@@ -1,12 +1,28 @@
 # Check if this is a in tree build.
+
+set(POLLY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(POLLY_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+
 if (NOT DEFINED LLVM_MAIN_SRC_DIR)
   project(Polly)
   cmake_minimum_required(VERSION 3.13.4)
   set(POLLY_STANDALONE_BUILD TRUE)
 endif()
 
+if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
+  set(LLVM_COMMON_CMAKE_UTILS ${POLLY_SOURCE_DIR}/../cmake)
+endif()
+
+list(INSERT CMAKE_MODULE_PATH 0
+  "${LLVM_COMMON_CMAKE_UTILS}/Modules"
+  )
+
+# Must go before the first `include(GNUInstallDirs)`.
+include(LLVMLibdirSuffix)
+
 # Must go below project(..)
 include(GNUInstallDirs)
+include(GNUBinaryDirs)
 
 if(POLLY_STANDALONE_BUILD)
   # Where is LLVM installed?
@@ -48,18 +64,10 @@
   set(POLLY_GTEST_AVAIL 1)
 endif ()
 
-set(POLLY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-set(POLLY_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
-
-if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
-  set(LLVM_COMMON_CMAKE_UTILS ${POLLY_SOURCE_DIR}/../cmake)
-endif()
-
 # Make sure that our source directory is on the current cmake module path so that
 # we can include cmake files from this directory.
 list(INSERT CMAKE_MODULE_PATH 0
   "${POLLY_SOURCE_DIR}/cmake"
-  "${LLVM_COMMON_CMAKE_UTILS}/Modules"
   )
 
 include("polly_macros")
Index: openmp/CMakeLists.txt
===
--- openmp/CMakeLists.txt
+++ openmp/CMakeLists.txt
@@ -1,12 +1,5 @@
 cmake_minimum_required(VERSION 3.13.4)
 
-set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
-
-# Add path for custom modules
-list(INSERT CMAKE_MODULE_PATH 0
-  "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
-  "${LLVM_COMMON_CMAKE_UTILS}/Modules"
-  )
 
 # llvm/runtimes/ will set OPENMP_STANDALONE_BUILD.
 if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
@@ -14,6 +7,18 @@
   project(openmp C CXX)
 endif()
 
+if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
+  set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+endif()
+
+# Add path for custom modules
+list(INSERT CMAKE_MODULE_PATH 0
+  "${LLVM_COMMON_CMAKE_UTILS}/Modules"
+  )
+
+# Must go before the first `include(GNUInstallDirs)`.
+include(LLVMLibdirSuffix)
+
 # Must go below project(..)
 include(GNUInstallDirs)
 
@@ -51,6 +56,11 @@
   endif()
 endif()
 
+# Add path for custom modules
+list(INSERT CMAKE_MODULE_PATH 0
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
+  )
+
 # Check and set up common compiler flags.
 include(config-ix)
 include(HandleOpenMPOptions)
Index: mlir/CMakeLists.txt
===
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -1,13 +1,28 @@
 # MLIR project.
 
+set(MLIR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(MLIR_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+
 # Check if MLIR is built as a standalone project.
 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   project(mlir)
   set(MLIR_STANDALONE_BUILD TRUE)
 endif()
 
+if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
+  set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+endif()
+
+list(INSERT CMAKE_MODULE_PATH 0
+  "${LLVM_COMMON_CMAKE_UTILS}/Modules"
+  )
+
+# Must go before the first `include(GNUInstallDirs)`.
+include(LLVMLibdirSuffix)
+
 # Must go below project(..)
 include(GNUInstallDirs)
+include(GNUBinaryDirs)
 
 if(MLIR_STANDALONE_BUILD)
   cmake_minimum_required(VERSION 3.13.4)
@@ -36,12 +51,10 @@
 "Path for binary subdirectory (defaults to '${CMAKE_INSTALL_BINDIR}')")
 mark_as_advanced(MLIR_TOOLS_INSTALL_DIR)
 
-set(MLIR_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}  )
+set(MLIR_MAIN_SRC_DIR ${MLIR_SOURCE_DIR}   )
 set(MLIR_MAIN_INCLUDE_DIR ${MLIR_MAIN_SRC_DIR}/include )
 
-set(MLIR_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
-set(MLIR_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
-set(MLIR_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
+set(MLIR_INCLUDE_DIR ${MLIR_BINARY_DIR}/include)
 set(MLIR_TOOLS_DIR   ${CMAKE_RUNTIME_

[clang] bae1a2c - [OpenMP] Remove unused function after removing simplified interface

2022-09-14 Thread Joseph Huber via cfe-commits

Author: Joseph Huber
Date: 2022-09-14T10:14:43-05:00
New Revision: bae1a2cf3cce529b0d03df8bac962d13b407e117

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

LOG: [OpenMP] Remove unused function after removing simplified interface

Summary:
A previous patch removed the user of this function but did not remove
the function causing unused function warnings. Remove it.

Added: 


Modified: 
clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index 1587d52846b1..0ab988968908 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -905,92 +905,6 @@ static bool hasNestedLightweightDirective(ASTContext &Ctx,
   return false;
 }
 
-/// Checks if the construct supports lightweight runtime. It must be SPMD
-/// construct + inner loop-based construct with static scheduling.
-static bool supportsLightweightRuntime(ASTContext &Ctx,
-   const OMPExecutableDirective &D) {
-  if (!supportsSPMDExecutionMode(Ctx, D))
-return false;
-  OpenMPDirectiveKind DirectiveKind = D.getDirectiveKind();
-  switch (DirectiveKind) {
-  case OMPD_target:
-  case OMPD_target_teams:
-  case OMPD_target_parallel:
-return hasNestedLightweightDirective(Ctx, D);
-  case OMPD_target_parallel_for:
-  case OMPD_target_parallel_for_simd:
-  case OMPD_target_teams_distribute_parallel_for:
-  case OMPD_target_teams_distribute_parallel_for_simd:
-// (Last|First)-privates must be shared in parallel region.
-return hasStaticScheduling(D);
-  case OMPD_target_simd:
-  case OMPD_target_teams_distribute_simd:
-return true;
-  case OMPD_target_teams_distribute:
-return false;
-  case OMPD_parallel:
-  case OMPD_for:
-  case OMPD_parallel_for:
-  case OMPD_parallel_master:
-  case OMPD_parallel_sections:
-  case OMPD_for_simd:
-  case OMPD_parallel_for_simd:
-  case OMPD_cancel:
-  case OMPD_cancellation_point:
-  case OMPD_ordered:
-  case OMPD_threadprivate:
-  case OMPD_allocate:
-  case OMPD_task:
-  case OMPD_simd:
-  case OMPD_sections:
-  case OMPD_section:
-  case OMPD_single:
-  case OMPD_master:
-  case OMPD_critical:
-  case OMPD_taskyield:
-  case OMPD_barrier:
-  case OMPD_taskwait:
-  case OMPD_taskgroup:
-  case OMPD_atomic:
-  case OMPD_flush:
-  case OMPD_depobj:
-  case OMPD_scan:
-  case OMPD_teams:
-  case OMPD_target_data:
-  case OMPD_target_exit_data:
-  case OMPD_target_enter_data:
-  case OMPD_distribute:
-  case OMPD_distribute_simd:
-  case OMPD_distribute_parallel_for:
-  case OMPD_distribute_parallel_for_simd:
-  case OMPD_teams_distribute:
-  case OMPD_teams_distribute_simd:
-  case OMPD_teams_distribute_parallel_for:
-  case OMPD_teams_distribute_parallel_for_simd:
-  case OMPD_target_update:
-  case OMPD_declare_simd:
-  case OMPD_declare_variant:
-  case OMPD_begin_declare_variant:
-  case OMPD_end_declare_variant:
-  case OMPD_declare_target:
-  case OMPD_end_declare_target:
-  case OMPD_declare_reduction:
-  case OMPD_declare_mapper:
-  case OMPD_taskloop:
-  case OMPD_taskloop_simd:
-  case OMPD_master_taskloop:
-  case OMPD_master_taskloop_simd:
-  case OMPD_parallel_master_taskloop:
-  case OMPD_parallel_master_taskloop_simd:
-  case OMPD_requires:
-  case OMPD_unknown:
-  default:
-break;
-  }
-  llvm_unreachable(
-  "Unknown programming model for OpenMP directive on NVPTX target.");
-}
-
 void CGOpenMPRuntimeGPU::emitNonSPMDKernel(const OMPExecutableDirective &D,
  StringRef ParentName,
  llvm::Function *&OutlinedFn,



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


[clang] f6e759b - Remove some unused static functions in CGOpenMPRuntimeGPU.cpp, NFC

2022-09-14 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2022-09-14T17:20:02+02:00
New Revision: f6e759bd26b24e046573ac46d3ee3be6eebd5526

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

LOG: Remove some unused static functions in CGOpenMPRuntimeGPU.cpp, NFC

Added: 


Modified: 
clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index 0ab988968908..a44d454f9f72 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -730,181 +730,6 @@ static bool supportsSPMDExecutionMode(ASTContext &Ctx,
   "Unknown programming model for OpenMP directive on NVPTX target.");
 }
 
-/// Check if the directive is loops based and has schedule clause at all or has
-/// static scheduling.
-static bool hasStaticScheduling(const OMPExecutableDirective &D) {
-  assert(isOpenMPWorksharingDirective(D.getDirectiveKind()) &&
- isOpenMPLoopDirective(D.getDirectiveKind()) &&
- "Expected loop-based directive.");
-  return !D.hasClausesOfKind() &&
- (!D.hasClausesOfKind() ||
-  llvm::any_of(D.getClausesOfKind(),
-   [](const OMPScheduleClause *C) {
- return C->getScheduleKind() == OMPC_SCHEDULE_static;
-   }));
-}
-
-/// Check for inner (nested) lightweight runtime construct, if any
-static bool hasNestedLightweightDirective(ASTContext &Ctx,
-  const OMPExecutableDirective &D) {
-  assert(supportsSPMDExecutionMode(Ctx, D) && "Expected SPMD mode directive.");
-  const auto *CS = D.getInnermostCapturedStmt();
-  const auto *Body =
-  CS->getCapturedStmt()->IgnoreContainers(/*IgnoreCaptured=*/true);
-  const Stmt *ChildStmt = CGOpenMPRuntime::getSingleCompoundChild(Ctx, Body);
-
-  if (const auto *NestedDir =
-  dyn_cast_or_null(ChildStmt)) {
-OpenMPDirectiveKind DKind = NestedDir->getDirectiveKind();
-switch (D.getDirectiveKind()) {
-case OMPD_target:
-  if (isOpenMPParallelDirective(DKind) &&
-  isOpenMPWorksharingDirective(DKind) && isOpenMPLoopDirective(DKind) 
&&
-  hasStaticScheduling(*NestedDir))
-return true;
-  if (DKind == OMPD_teams_distribute_simd || DKind == OMPD_simd)
-return true;
-  if (DKind == OMPD_parallel) {
-Body = NestedDir->getInnermostCapturedStmt()->IgnoreContainers(
-/*IgnoreCaptured=*/true);
-if (!Body)
-  return false;
-ChildStmt = CGOpenMPRuntime::getSingleCompoundChild(Ctx, Body);
-if (const auto *NND =
-dyn_cast_or_null(ChildStmt)) {
-  DKind = NND->getDirectiveKind();
-  if (isOpenMPWorksharingDirective(DKind) &&
-  isOpenMPLoopDirective(DKind) && hasStaticScheduling(*NND))
-return true;
-}
-  } else if (DKind == OMPD_teams) {
-Body = NestedDir->getInnermostCapturedStmt()->IgnoreContainers(
-/*IgnoreCaptured=*/true);
-if (!Body)
-  return false;
-ChildStmt = CGOpenMPRuntime::getSingleCompoundChild(Ctx, Body);
-if (const auto *NND =
-dyn_cast_or_null(ChildStmt)) {
-  DKind = NND->getDirectiveKind();
-  if (isOpenMPParallelDirective(DKind) &&
-  isOpenMPWorksharingDirective(DKind) &&
-  isOpenMPLoopDirective(DKind) && hasStaticScheduling(*NND))
-return true;
-  if (DKind == OMPD_parallel) {
-Body = NND->getInnermostCapturedStmt()->IgnoreContainers(
-/*IgnoreCaptured=*/true);
-if (!Body)
-  return false;
-ChildStmt = CGOpenMPRuntime::getSingleCompoundChild(Ctx, Body);
-if (const auto *NND =
-dyn_cast_or_null(ChildStmt)) {
-  DKind = NND->getDirectiveKind();
-  if (isOpenMPWorksharingDirective(DKind) &&
-  isOpenMPLoopDirective(DKind) && hasStaticScheduling(*NND))
-return true;
-}
-  }
-}
-  }
-  return false;
-case OMPD_target_teams:
-  if (isOpenMPParallelDirective(DKind) &&
-  isOpenMPWorksharingDirective(DKind) && isOpenMPLoopDirective(DKind) 
&&
-  hasStaticScheduling(*NestedDir))
-return true;
-  if (DKind == OMPD_distribute_simd || DKind == OMPD_simd)
-return true;
-  if (DKind == OMPD_parallel) {
-Body = NestedDir->getInnermostCapturedStmt()->IgnoreContainers(
-/*IgnoreCaptured=*/true);
-if (!Body)
-  return false;
-ChildStmt = CGOpenMPRuntime::getSingleCompoundChild(Ctx, Body);
-if (const auto *NND =
-dyn_cast_or

[PATCH] D133841: [test][clang] run test for lld emitting dwarf-aranages only if lld is presented

2022-09-14 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka added a comment.

the test crashes with sanitizers 
https://lab.llvm.org/buildbot/#/builders/5/builds/27437


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133841

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


[PATCH] D133841: [test][clang] run test for lld emitting dwarf-aranages only if lld is presented

2022-09-14 Thread Azat Khuzhin via Phabricator via cfe-commits
azat added a comment.

> the test crashes with sanitizers 
> https://lab.llvm.org/buildbot/#/builders/5/builds/27437

yep, this should be fixed in https://reviews.llvm.org/D133847


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133841

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


[PATCH] D128142: [MemProf] Memprof profile matching and annotation

2022-09-14 Thread Snehasish Kumar via Phabricator via cfe-commits
snehasish accepted this revision.
snehasish added a comment.
This revision is now accepted and ready to land.

lgtm




Comment at: llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp:1276
+  if (Error E = MemProfResult.takeError()) {
+handleAllErrors(std::move(E), [&](const InstrProfError &IPE) {
+  auto Err = IPE.get();

tejohnson wrote:
> snehasish wrote:
> > Consider defining the lambda outside above the condition to reduce 
> > indentation. IMO it will be  a little easier to follow if it wasn't inlined 
> > into the if statement itself.
> I could do this, but as is it mirrors the structure of the similar handling 
> in readCounters, which has some advantages. wdyt?
I wasn't a big fan of the existing structure in readCounters but I didn't want 
to ask you to change the other code. Let's leave it as is for now. 



Comment at: llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp:1360
+  // If leaf was found in a map, iterators pointing to its location in both
+  // of the maps (it may only exist in one).
+  std::map>::iterator

tejohnson wrote:
> snehasish wrote:
> > Can you add an assert for this?
> In this case "may only" meant "might only", not "may only at most". So I 
> can't assert on anything. This can happen for example if we have a location 
> that corresponds to both an allocation call and another callsite (I've seen 
> this periodically, and can reproduce e.g. with a macro). We would need to use 
> discriminators more widely to better distinguish them in that case (with the 
> handling here we will only match to the allocation call for now - edit: a 
> slight change noted further below ensures this is the case). Will change 
> /may/might/ and add a note.
Thanks for the explanation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128142

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


[PATCH] D132816: [clang] AST: SubstTemplateTypeParmType support for non-canonical underlying type

2022-09-14 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 460127.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132816

Files:
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeProperties.td
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Type.cpp
  clang/lib/Sema/SemaTemplate.cpp

Index: clang/lib/Sema/SemaTemplate.cpp
===
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -3506,8 +3506,8 @@
 
   // Wrap the type in substitution sugar.
   auto getSubstType = [&](unsigned IndexReplaced, QualType Replacement) {
-return SemaRef.Context.getSubstTemplateTypeParmType(
-Replacement.getCanonicalType(), BTD, IndexReplaced);
+return SemaRef.Context.getSubstTemplateTypeParmType(Replacement, BTD,
+IndexReplaced);
   };
 
   switch (BTD->getBuiltinTemplateKind()) {
Index: clang/lib/AST/Type.cpp
===
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3718,6 +3718,11 @@
 : Type(SubstTemplateTypeParm, Replacement.getCanonicalType(),
Replacement->getDependence()),
   ReplacedDecl(ReplacedDecl) {
+  SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType =
+  Replacement != getCanonicalTypeInternal();
+  if (SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType)
+*getTrailingObjects() = Replacement;
+
   SubstTemplateTypeParmTypeBits.Index = Index;
   assert(ReplacedDecl != nullptr);
   assert(getReplacedParameter() != nullptr);
Index: clang/lib/AST/ASTImporter.cpp
===
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -1529,8 +1529,7 @@
 return ToReplacementTypeOrErr.takeError();
 
   return Importer.getToContext().getSubstTemplateTypeParmType(
-  ToReplacementTypeOrErr->getCanonicalType(), *ReplacedOrErr,
-  T->getIndex());
+  *ToReplacementTypeOrErr, *ReplacedOrErr, T->getIndex());
 }
 
 ExpectedType ASTNodeImporter::VisitSubstTemplateTypeParmPackType(
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -4752,9 +4752,6 @@
 QualType ASTContext::getSubstTemplateTypeParmType(QualType Replacement,
   Decl *ReplacedDecl,
   unsigned Index) const {
-  assert(Replacement.isCanonical()
- && "replacement types must always be canonical");
-
   llvm::FoldingSetNodeID ID;
   SubstTemplateTypeParmType::Profile(ID, Replacement, ReplacedDecl, Index);
   void *InsertPos = nullptr;
@@ -4762,8 +4759,11 @@
   SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
 
   if (!SubstParm) {
-SubstParm = new (*this, TypeAlignment)
-SubstTemplateTypeParmType(Replacement, ReplacedDecl, Index);
+void *Mem = Allocate(SubstTemplateTypeParmType::totalSizeToAlloc(
+ !Replacement.isCanonical()),
+ TypeAlignment);
+SubstParm =
+new (Mem) SubstTemplateTypeParmType(Replacement, ReplacedDecl, Index);
 Types.push_back(SubstParm);
 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
   }
Index: clang/include/clang/AST/TypeProperties.td
===
--- clang/include/clang/AST/TypeProperties.td
+++ clang/include/clang/AST/TypeProperties.td
@@ -741,7 +741,7 @@
   // The call to getCanonicalType here existed in ASTReader.cpp, too.
   def : Creator<[{
 return ctx.getSubstTemplateTypeParmType(
-ctx.getCanonicalType(replacementType), replacedDecl, Index);
+replacementType, replacedDecl, Index);
   }]>;
 }
 
Index: clang/include/clang/AST/Type.h
===
--- clang/include/clang/AST/Type.h
+++ clang/include/clang/AST/Type.h
@@ -1798,8 +1798,10 @@
 
 unsigned : NumTypeBits;
 
+unsigned HasNonCanonicalUnderlyingType : 1;
+
 // The index of the template parameter this substitution represents.
-unsigned Index;
+unsigned Index : 16;
   };
 
   class SubstTemplateTypeParmPackTypeBitfields {
@@ -4981,8 +4983,12 @@
 /// been replaced with these.  They are used solely to record that a
 /// type was originally written as a template type parameter;
 /// therefore they are never canonical.
-class SubstTemplateTypeParmType : public Type, public llvm::FoldingSetNode {
+class SubstTemplateTypeParmType final
+: public Type,
+  public llvm::FoldingSetNode,
+  private llvm::TrailingObjects {
   friend class ASTContext;
+  friend class llvm::TrailingObjects;
 
   Decl *ReplacedDecl;
 
@@ -4992,7 +4998,11 @@
 public:
   /// 

[PATCH] D133773: [clang] fix linker executable path in test

2022-09-14 Thread Stella Stamenova via Phabricator via cfe-commits
stella.stamenova accepted this revision.
stella.stamenova added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133773

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


[PATCH] D133092: [clang] fix generation of .debug_aranges with LTO

2022-09-14 Thread Kazushi Marukawa via Phabricator via cfe-commits
kaz7 added a comment.

In D133092#3788749 , @azat wrote:

> In D133092#3788734 , @kaz7 wrote:
>
>> For your information, after this patch `check-clang` fails with following 
>> errors if there is no lld (lld is not enable in CMake, and lld is not 
>> installed previously).  I appreciate if you run debug-options.c test with 
>> `-fuse-ld=lld` if the lld is existing.  Thanks.
>
> Yep, already worked on it, fix - https://reviews.llvm.org/D133841
>
> P.S. I don't have commit rights so if someone can commit it after CI that 
> will be great

Thank you.  I've not noticed it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133092

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


[PATCH] D133841: [test][clang] run test for lld emitting dwarf-aranages only if lld is presented

2022-09-14 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

As far as I can tell, this broke check-clang everywhere. (See e.g.: 
https://lab.llvm.org/buildbot/#/builders/139/builds/28039 and many of the bots 
on https://lab.llvm.org/buildbot/#/console

Before landing changes, please:

- run tests locally
- wait for the presubmit bots to post a success message on your phab review

After landing changes, please:

- watch the bots
- if they turn red, either quickly fix or quickly revert

Please don't land a change and then keep bots red for over 8 hours.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133841

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


[PATCH] D133841: [test][clang] run test for lld emitting dwarf-aranages only if lld is presented

2022-09-14 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Reverted in db6a53450facdfead8b0c8d20cfa361a785945fd for now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133841

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


[clang] db6a534 - Revert "[test][clang] run test for lld emitting dwarf-aranages only if lld is presented"

2022-09-14 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2022-09-14T12:17:41-04:00
New Revision: db6a53450facdfead8b0c8d20cfa361a785945fd

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

LOG: Revert "[test][clang] run test for lld emitting dwarf-aranages only if lld 
is presented"

This reverts commit 44075cc34a9b373714b594964001ce283598eac1.
Broke check-clang, see comments on https://reviews.llvm.org/D133841

Added: 


Modified: 
clang/test/Driver/debug-options.c

Removed: 
clang/test/Driver/debug-options-lld.c



diff  --git a/clang/test/Driver/debug-options-lld.c 
b/clang/test/Driver/debug-options-lld.c
deleted file mode 100644
index a69ebe3b1b4c..
--- a/clang/test/Driver/debug-options-lld.c
+++ /dev/null
@@ -1,12 +0,0 @@
-// REQUIRES: lld
-// Check that lld will emit dwarf aranges.
-
-// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | 
FileCheck -check-prefix=GARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 
| FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 
2>&1 | FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
-//
-// GARANGE-DAG: -generate-arange-section
-// LDGARANGE-NOT: {{".*lld.*"}} {{.*}} "-generate-arange-section"
-// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"

diff  --git a/clang/test/Driver/debug-options.c 
b/clang/test/Driver/debug-options.c
index 04004716aa50..2da192d098e2 100644
--- a/clang/test/Driver/debug-options.c
+++ b/clang/test/Driver/debug-options.c
@@ -246,7 +246,11 @@
 // RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=NOPUB %s
 // RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck 
-check-prefix=NOPUB %s
 //
-// RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck 
-check-prefix=GARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | 
FileCheck -check-prefix=GARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 
| FileCheck -check-prefix=LDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 
2>&1 | FileCheck -check-prefix=LDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
 //
 // RUN: %clang -### -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 
\
 // RUN:| FileCheck -check-prefix=FDTS %s
@@ -371,6 +375,8 @@
 // NORNGBSE-NOT: -fdebug-ranges-base-address
 //
 // GARANGE-DAG: -generate-arange-section
+// LDGARANGE-NOT: {{".*lld.*"}} {{.*}} "-generate-arange-section"
+// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"
 //
 // FDTS: "-mllvm" "-generate-type-units"
 // FDTSE: error: unsupported option '-fdebug-types-section' for target 
'x86_64-apple-darwin'



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


[PATCH] D133468: [clang] Implement divergence for TypedefType and UsingType

2022-09-14 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 460133.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133468

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/JSONNodeDumper.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeProperties.td
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/ASTStructuralEquivalence.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/AST/Type.cpp
  clang/test/SemaCXX/sugar-common-types.cpp

Index: clang/test/SemaCXX/sugar-common-types.cpp
===
--- clang/test/SemaCXX/sugar-common-types.cpp
+++ clang/test/SemaCXX/sugar-common-types.cpp
@@ -112,3 +112,22 @@
 C2 auto t26_3 = (::SB1){};
 N t26 = 0 ? t26_1 : t26_2; // expected-error {{from 'SB1' (aka 'SS1')}}
 N t27 = 0 ? t26_1 : t26_3; // expected-error {{from 'SB1' (aka 'SS1')}}
+
+using RPB1 = X1*;
+using RPX1 = RPB1;
+using RPB1 = Y1*; // redeclared
+using RPY1 = RPB1;
+N t28 = *(RPB1){}; // expected-error {{lvalue of type 'Y1' (aka 'int')}}
+auto t29 = 0 ? (RPX1){} : (RPY1){};
+N t30 = t29;  // expected-error {{lvalue of type 'RPB1' (aka 'int *')}}
+N t31 = *t29; // expected-error {{lvalue of type 'B1' (aka 'int')}}
+
+namespace A { using type1 = X1*; };
+namespace C { using A::type1; };
+using UPX1 = C::type1;
+namespace A { using type1 = Y1*; };  // redeclared
+namespace C { using A::type1; }; // redeclared
+using UPY1 = C::type1;
+auto t32 = 0 ? (UPX1){} : (UPY1){};
+N t33 = t32;  // expected-error {{lvalue of type 'C::type1' (aka 'int *')}}
+N t34 = *t32; // expected-error {{lvalue of type 'B1' (aka 'int')}}
Index: clang/lib/AST/Type.cpp
===
--- clang/lib/AST/Type.cpp
+++ clang/lib/AST/Type.cpp
@@ -3434,25 +3434,34 @@
 }
 
 TypedefType::TypedefType(TypeClass tc, const TypedefNameDecl *D,
- QualType underlying, QualType can)
-: Type(tc, can, toSemanticDependence(underlying->getDependence())),
+ QualType Underlying, QualType can)
+: Type(tc, can, toSemanticDependence(can->getDependence())),
   Decl(const_cast(D)) {
   assert(!isa(can) && "Invalid canonical type");
+  TypedefBits.isDivergent = !Underlying.isNull();
+  if (isDivergent())
+*reinterpret_cast(this + 1) = Underlying;
 }
 
 QualType TypedefType::desugar() const {
-  return getDecl()->getUnderlyingType();
+  return isDivergent() ? *getTrailingObjects()
+   : Decl->getUnderlyingType();
 }
 
 UsingType::UsingType(const UsingShadowDecl *Found, QualType Underlying,
  QualType Canon)
-: Type(Using, Canon, toSemanticDependence(Underlying->getDependence())),
+: Type(Using, Canon, toSemanticDependence(Canon->getDependence())),
   Found(const_cast(Found)) {
-  assert(Underlying == getUnderlyingType());
+  UsingBits.isDivergent = !Underlying.isNull();
+  if (isDivergent())
+*reinterpret_cast(this + 1) = Underlying;
 }
 
 QualType UsingType::getUnderlyingType() const {
-  return QualType(cast(Found->getTargetDecl())->getTypeForDecl(), 0);
+  return isDivergent()
+ ? *getTrailingObjects()
+ : QualType(
+   cast(Found->getTargetDecl())->getTypeForDecl(), 0);
 }
 
 QualType MacroQualifiedType::desugar() const { return getUnderlyingType(); }
Index: clang/lib/AST/TextNodeDumper.cpp
===
--- clang/lib/AST/TextNodeDumper.cpp
+++ clang/lib/AST/TextNodeDumper.cpp
@@ -1543,10 +1543,14 @@
 
 void TextNodeDumper::VisitUsingType(const UsingType *T) {
   dumpDeclRef(T->getFoundDecl());
+  if (T->isDivergent())
+OS << " divergent";
 }
 
 void TextNodeDumper::VisitTypedefType(const TypedefType *T) {
   dumpDeclRef(T->getDecl());
+  if (T->isDivergent())
+OS << " divergent";
 }
 
 void TextNodeDumper::VisitUnaryTransformType(const UnaryTransformType *T) {
Index: clang/lib/AST/JSONNodeDumper.cpp
===
--- clang/lib/AST/JSONNodeDumper.cpp
+++ clang/lib/AST/JSONNodeDumper.cpp
@@ -531,6 +531,14 @@
 
 void JSONNodeDumper::VisitTypedefType(const TypedefType *TT) {
   JOS.attribute("decl", createBareDeclRef(TT->getDecl()));
+  if (TT->isDivergent())
+JOS.attribute("type", createQualType(TT->desugar()));
+}
+
+void JSONNodeDumper::VisitUsingType(const UsingType *TT) {
+  JOS.attribute("decl", createBareDeclRef(TT->getFoundDecl()));
+  if (TT->isDivergent())
+JOS.attribute("type", createQualType(TT->desugar()));
 }
 
 void JSONNodeDumper::VisitFunctionType(const FunctionType *T) {
Index: clang/lib/AST/ASTStructuralEquivalence.cpp
===
--- clang/lib/AST/ASTStructuralEquivalence.cpp
+++ clang/lib/AST/ASTStructuralEquivalence.cpp
@@ -957,11 +957,

[PATCH] D133841: [test][clang] run test for lld emitting dwarf-aranages only if lld is presented

2022-09-14 Thread Azat Khuzhin via Phabricator via cfe-commits
azat added a comment.

@thakis Thanks for taking a look!

Actually initially the problem had been introduced in 
https://reviews.llvm.org/D133092
I've run tests locally, however I did have lld in a system, so I did not 
noticed the problem.
And CI did not find the problem either, since I guess it also has lld.

Final fix for this problem should be - https://reviews.llvm.org/D133847


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133841

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


[PATCH] D133773: [clang] fix linker executable path in test

2022-09-14 Thread Ashay Rane via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf1848b0a0ed7: [clang] fix linker executable path in test 
(authored by ashay).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133773

Files:
  clang/test/Driver/mingw-cfguard.c


Index: clang/test/Driver/mingw-cfguard.c
===
--- clang/test/Driver/mingw-cfguard.c
+++ clang/test/Driver/mingw-cfguard.c
@@ -3,7 +3,7 @@
 // NO_CF: "-cc1"
 // NO_CF-NOT: "-cfguard"
 // NO_CF-NOT: "-cfguard-no-checks"
-// NO_CF-NEXT: ld"
+// NO_CF-NEXT: ld{{(.lld)?}}{{(.exe)?}}"
 // NO_CF-NOT: "--guard-cf"
 // DEFAULT-NOT: "--no-guard-cf"
 // GUARD_NONE-SAME: "--no-guard-cf"
@@ -11,7 +11,7 @@
 // RUN: %clang --target=x86_64-w64-windows-gnu -### %s -mguard=cf 2>&1 | 
FileCheck -check-prefix=GUARD_CF %s
 // GUARD_CF: "-cc1"
 // GUARD_CF-SAME: "-cfguard"
-// GUARD_CF-NEXT: ld"
+// GUARD_CF-NEXT: ld{{(.lld)?}}{{(.exe)?}}"
 // GUARD_CF-SAME: "--guard-cf"
 // GUARD_CF-NOT: "--no-guard-cf"
 
@@ -20,7 +20,7 @@
 // GUARD_NOCHECKS-NOT: "-cfguard"
 // GUARD_NOCHECKS-SAME: "-cfguard-no-checks"
 // GUARD_NOCHECKS-NOT: "-cfguard"
-// GUARD_NOCHECKS-NEXT: ld"
+// GUARD_NOCHECKS-NEXT: ld{{(.lld)?}}{{(.exe)?}}"
 // GUARD_NOCHECKS-SAME: "--guard-cf"
 // GUARD_NOCHECKS-NOT: "--no-guard-cf"
 


Index: clang/test/Driver/mingw-cfguard.c
===
--- clang/test/Driver/mingw-cfguard.c
+++ clang/test/Driver/mingw-cfguard.c
@@ -3,7 +3,7 @@
 // NO_CF: "-cc1"
 // NO_CF-NOT: "-cfguard"
 // NO_CF-NOT: "-cfguard-no-checks"
-// NO_CF-NEXT: ld"
+// NO_CF-NEXT: ld{{(.lld)?}}{{(.exe)?}}"
 // NO_CF-NOT: "--guard-cf"
 // DEFAULT-NOT: "--no-guard-cf"
 // GUARD_NONE-SAME: "--no-guard-cf"
@@ -11,7 +11,7 @@
 // RUN: %clang --target=x86_64-w64-windows-gnu -### %s -mguard=cf 2>&1 | FileCheck -check-prefix=GUARD_CF %s
 // GUARD_CF: "-cc1"
 // GUARD_CF-SAME: "-cfguard"
-// GUARD_CF-NEXT: ld"
+// GUARD_CF-NEXT: ld{{(.lld)?}}{{(.exe)?}}"
 // GUARD_CF-SAME: "--guard-cf"
 // GUARD_CF-NOT: "--no-guard-cf"
 
@@ -20,7 +20,7 @@
 // GUARD_NOCHECKS-NOT: "-cfguard"
 // GUARD_NOCHECKS-SAME: "-cfguard-no-checks"
 // GUARD_NOCHECKS-NOT: "-cfguard"
-// GUARD_NOCHECKS-NEXT: ld"
+// GUARD_NOCHECKS-NEXT: ld{{(.lld)?}}{{(.exe)?}}"
 // GUARD_NOCHECKS-SAME: "--guard-cf"
 // GUARD_NOCHECKS-NOT: "--no-guard-cf"
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] f1848b0 - [clang] fix linker executable path in test

2022-09-14 Thread Ashay Rane via cfe-commits

Author: Ashay Rane
Date: 2022-09-14T11:35:37-05:00
New Revision: f1848b0a0ed70fc91eff50f6c47561ca24362a37

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

LOG: [clang] fix linker executable path in test

A previous patch (https://reviews.llvm.org/D132810) introduced a test
that fails on systems where the linker executable (`ld`) has a `.exe`
extension.  This patch updates the regex in the test so that lit can
look for both `ld` as well as `ld.exe`.

Reviewed By: stella.stamenova

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

Added: 


Modified: 
clang/test/Driver/mingw-cfguard.c

Removed: 




diff  --git a/clang/test/Driver/mingw-cfguard.c 
b/clang/test/Driver/mingw-cfguard.c
index f88fd59098b8..d9297042b10e 100644
--- a/clang/test/Driver/mingw-cfguard.c
+++ b/clang/test/Driver/mingw-cfguard.c
@@ -3,7 +3,7 @@
 // NO_CF: "-cc1"
 // NO_CF-NOT: "-cfguard"
 // NO_CF-NOT: "-cfguard-no-checks"
-// NO_CF-NEXT: ld"
+// NO_CF-NEXT: ld{{(.lld)?}}{{(.exe)?}}"
 // NO_CF-NOT: "--guard-cf"
 // DEFAULT-NOT: "--no-guard-cf"
 // GUARD_NONE-SAME: "--no-guard-cf"
@@ -11,7 +11,7 @@
 // RUN: %clang --target=x86_64-w64-windows-gnu -### %s -mguard=cf 2>&1 | 
FileCheck -check-prefix=GUARD_CF %s
 // GUARD_CF: "-cc1"
 // GUARD_CF-SAME: "-cfguard"
-// GUARD_CF-NEXT: ld"
+// GUARD_CF-NEXT: ld{{(.lld)?}}{{(.exe)?}}"
 // GUARD_CF-SAME: "--guard-cf"
 // GUARD_CF-NOT: "--no-guard-cf"
 
@@ -20,7 +20,7 @@
 // GUARD_NOCHECKS-NOT: "-cfguard"
 // GUARD_NOCHECKS-SAME: "-cfguard-no-checks"
 // GUARD_NOCHECKS-NOT: "-cfguard"
-// GUARD_NOCHECKS-NEXT: ld"
+// GUARD_NOCHECKS-NEXT: ld{{(.lld)?}}{{(.exe)?}}"
 // GUARD_NOCHECKS-SAME: "--guard-cf"
 // GUARD_NOCHECKS-NOT: "--no-guard-cf"
 



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


[clang] 5631d20 - Revert "[clang] fix generation of .debug_aranges with LTO"

2022-09-14 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2022-09-14T12:43:24-04:00
New Revision: 5631d20bfc9f77d15435badf6ce34e1a56c27e1c

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

LOG: Revert "[clang] fix generation of .debug_aranges with LTO"

This reverts commit 6bf6730ac55e064edf46915ebba02e9c716f48e8.
Breaks tests if LLD isn't being built, see comments on
https://reviews.llvm.org/D133092

Added: 


Modified: 
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/debug-options.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index c61fcfc946b8..22025d95e7c8 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -506,19 +506,6 @@ void tools::addLTOOptions(const ToolChain &ToolChain, 
const ArgList &Args,
 Suffix,
 Plugin);
 CmdArgs.push_back(Args.MakeArgString(Plugin));
-  } else {
-// NOTE:
-// - it is not possible to use lld for PS4
-// - addLTOOptions() is not used for PS5
-// Hence no need to handle SCE (like in Clang.cpp::renderDebugOptions()).
-//
-// But note, this solution is far from perfect, better to encode it into IR
-// metadata, but this may not be worth it, since it looks like aranges is
-// on the way out.
-if (Args.hasArg(options::OPT_gdwarf_aranges)) {
-  CmdArgs.push_back(Args.MakeArgString("-mllvm"));
-  CmdArgs.push_back(Args.MakeArgString("-generate-arange-section"));
-}
   }
 
   // Try to pass driver level flags relevant to LTO code generation down to

diff  --git a/clang/test/Driver/debug-options.c 
b/clang/test/Driver/debug-options.c
index 2da192d098e2..04004716aa50 100644
--- a/clang/test/Driver/debug-options.c
+++ b/clang/test/Driver/debug-options.c
@@ -246,11 +246,7 @@
 // RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=NOPUB %s
 // RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck 
-check-prefix=NOPUB %s
 //
-// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | 
FileCheck -check-prefix=GARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 
| FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 
2>&1 | FileCheck -check-prefix=LDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
-// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+// RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck 
-check-prefix=GARANGE %s
 //
 // RUN: %clang -### -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 
\
 // RUN:| FileCheck -check-prefix=FDTS %s
@@ -375,8 +371,6 @@
 // NORNGBSE-NOT: -fdebug-ranges-base-address
 //
 // GARANGE-DAG: -generate-arange-section
-// LDGARANGE-NOT: {{".*lld.*"}} {{.*}} "-generate-arange-section"
-// LLDGARANGE: {{".*lld.*"}} {{.*}} "-generate-arange-section"
 //
 // FDTS: "-mllvm" "-generate-type-units"
 // FDTSE: error: unsupported option '-fdebug-types-section' for target 
'x86_64-apple-darwin'



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


[PATCH] D133092: [clang] fix generation of .debug_aranges with LTO

2022-09-14 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Reverted this in 5631d20bfc9f77d15435badf6ce34e1a56c27e1c 
 since the 
fix for the test failures this change here caused got reverted due to breaking 
other tests.

Let's regroup and make a new patch that lands this change with all test 
failures addressed :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133092

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


[PATCH] D133847: [test][clang] fix pattern for LDGARANGE-NOT in debug-options-lld test

2022-09-14 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

Presumably this would break if someone's build uses a tool suffix (so lld 
becomes lld-tot or something like that)? Perhaps `lld[^"]*"` would be better?
Are there other test cases that test something similar that we could look at to 
see how they work/more likely get something that works as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133847

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


[PATCH] D133847: [test][clang] fix pattern for LDGARANGE-NOT in debug-options-lld test

2022-09-14 Thread Azat Khuzhin via Phabricator via cfe-commits
azat added a comment.

> Presumably this would break if someone's build uses a tool suffix (so lld 
> becomes lld-tot or something like that)? Perhaps lld[^"]*" would be better?

I thought about this too, but I found this in another test, so likely it should 
work...

> Are there other test cases that test something similar that we could look at 
> to see how they work/more likely get something that works as well?

This one is copied from `clang/test/Driver/debug-options-lld.c`

Anyway I need to resubmit the initial patch since it got reverted.
But I don't see close button here, only trusted users can do this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133847

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


[PATCH] D133711: [Sema] Reject array element types whose alignments are larger than their sizes

2022-09-14 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

I agree, there's no reason to change the i686 MSVC record layout algorithm. It 
was written, tested, done, it's fragile. We used to have some decent continuous 
integration testing for ABI issues like this, but as usual these things require 
care and feeding and it did not survive the passage of time.

This patch implements the new GCC behavior, right? Reject arrays when size is 
not a multiple of alignment? That sounds good to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133711

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


[PATCH] D133574: [C2x] reject type definitions in offsetof

2022-09-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/include/clang/Parse/Parser.h:2311
 case DeclSpecContext::DSC_association:
+case DeclSpecContext::DSC_offsetof:
   return true;

Is this correct? I don't think we can deduce the type from `offsetof` through 
CTAD, can we?

https://godbolt.org/z/Kab6ahYe7

(This might be a good test case to add assuming we don't already have that 
coverage.)



Comment at: clang/include/clang/Sema/DeclSpec.h:2069
 case DeclaratorContext::Association:
+case DeclaratorContext::OffsetOf:
   return true;

I don't think we can omit the identifier in this context -- this function is 
used to see whether you can do something like:
```
template 
void func(int) {
  try {
  } catch (int) {
  }
}
```
and `offsetof` seems quite different from that.



Comment at: clang/test/Sema/offsetof.c:79
+int a;
+struct B // no-error, struct B is not defined within __builtin_offsetof 
directly
+{

I think this is defensible. The wording in the standard is "If the specified 
type defines a new type or if the specified member is a bit-field, the behavior 
is undefined." and the specified type in this case is `struct A`; that `struct 
A` happens to also define `struct B` is immaterial.

However, the intent behind the change to the rule is to support older 
implementations of `offsetof` to protect them from having to deal with a case 
like: `offsetof(struct S { int a, b }, b);` where `offsetof` is a macro and 
thus the comma between `a` and `b` is treated as a separator. So there's a part 
of me that wonders if we want to also support diagnosing this case. But then 
we'd have to look at the declarator context more recursively to see whether any 
of the contexts on the stack are an `offsetof` context and that might be tricky.

Thoughts?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133574

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


[PATCH] D133875: [clang] fix generation of .debug_aranges with LTO (resubmit)

2022-09-14 Thread Azat Khuzhin via Phabricator via cfe-commits
azat created this revision.
Herald added a subscriber: inglorion.
Herald added a project: All.
azat requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

Right now in case of LTO the section is not emited:

  $ cat test.c
  void __attribute__((optnone)) bar()
  {
  }
  void __attribute__((optnone)) foo()
  {
  bar();
  }
  int main()
  {
  foo();
  }
  
  $ clang -flto=thin -gdwarf-aranges -g -O3 test.c
  $ eu-readelf -waranges a.out  | fgrep -c -e foo -e bar
  0
  
  $ clang -gdwarf-aranges -g -O3 test.c
  $ eu-readelf -waranges a.out  | fgrep -c -e foo -e bar
  2

Fix this by passing explicitly -mllvm -generate-arange-section.

But as mentioned by @dblaikie:

  the better solution would be to encode this in IR metadata
  (DICompileUnit) if it's reasonable to respect this option on a per-CU
  basis (which it probably is, though that'd be a bit of backend work) -
  or to set it as IR global metadata (like how the DWARF version is
  encoded - probably using the same IR linker merging strategy, of
  choosing the highest value (so if any module has aranges, then a linked
  module has aranges too - even for the CUs that had it turned off) if
  it's really not feasible to support on a per-CU basis) but probably
  OK-enough, given that aranges is hopefully on the way out & not worth
  all the work of the deeper fix

This is the resubmit, previous submission [1], got reverted, due to test
failures, that had been addressed in [2] and [3].

  [1]: https://reviews.llvm.org/D133092
  [3]: https://reviews.llvm.org/D133841
  [4]: https://reviews.llvm.org/D133847

Signed-off-by: Azat Khuzhin 
Suggested-by: OCHyams 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133875

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/debug-options-lld.c


Index: clang/test/Driver/debug-options-lld.c
===
--- /dev/null
+++ clang/test/Driver/debug-options-lld.c
@@ -0,0 +1,12 @@
+// REQUIRES: lld
+// Check that lld will emit dwarf aranges.
+
+// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | 
FileCheck -check-prefix=GARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 
| FileCheck -check-prefix=LDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 
2>&1 | FileCheck -check-prefix=LDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin 
-gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+//
+// GARANGE-DAG: -generate-arange-section
+// LDGARANGE-NOT: {{"[^"]*lld[^"]*"}} {{.*}} "-generate-arange-section"
+// LLDGARANGE: {{"[^"]*lld[^"]*"}} {{.*}} "-generate-arange-section"
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -506,6 +506,19 @@
 Suffix,
 Plugin);
 CmdArgs.push_back(Args.MakeArgString(Plugin));
+  } else {
+// NOTE:
+// - it is not possible to use lld for PS4
+// - addLTOOptions() is not used for PS5
+// Hence no need to handle SCE (like in Clang.cpp::renderDebugOptions()).
+//
+// But note, this solution is far from perfect, better to encode it into IR
+// metadata, but this may not be worth it, since it looks like aranges is
+// on the way out.
+if (Args.hasArg(options::OPT_gdwarf_aranges)) {
+  CmdArgs.push_back(Args.MakeArgString("-mllvm"));
+  CmdArgs.push_back(Args.MakeArgString("-generate-arange-section"));
+}
   }
 
   // Try to pass driver level flags relevant to LTO code generation down to


Index: clang/test/Driver/debug-options-lld.c
===
--- /dev/null
+++ clang/test/Driver/debug-options-lld.c
@@ -0,0 +1,12 @@
+// REQUIRES: lld
+// Check that lld will emit dwarf aranges.
+
+// RUN: %clang -### -target x86_64-unknown-linux -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -flto=thin -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+// RUN: %clang -### -target x86_64-unknown-linux -fuse-ld=lld -flto=thin -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=LLDGARANGE %s
+//
+// GARANGE-DAG: -generate-arange-section
+// LDGARANGE-NOT: {{"[^"]*lld[^"]*"}} {{.*}} "-generate-arange-section"
+// LLDGARANGE: {{"[^"]*lld[^"]*"}} {{.*}} "-generate-arange-sec

[PATCH] D133847: [test][clang] fix pattern for LDGARANGE-NOT in debug-options-lld test

2022-09-14 Thread Azat Khuzhin via Phabricator via cfe-commits
azat added a comment.

> Perhaps lld[^"]*" would be better?

But yeah, this looks better anyway. Applied your suggestion. New revision - 
https://reviews.llvm.org/D133875


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133847

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


[PATCH] D133574: [C2x] reject type definitions in offsetof

2022-09-14 Thread YingChi Long via Phabricator via cfe-commits
inclyc added inline comments.



Comment at: clang/include/clang/Parse/Parser.h:2311
 case DeclSpecContext::DSC_association:
+case DeclSpecContext::DSC_offsetof:
   return true;

aaron.ballman wrote:
> Is this correct? I don't think we can deduce the type from `offsetof` through 
> CTAD, can we?
> 
> https://godbolt.org/z/Kab6ahYe7
> 
> (This might be a good test case to add assuming we don't already have that 
> coverage.)
Emm, these checks just return as the same as "type_specifier". Because that's 
what we passed into "ParsingTypename" before.



Comment at: clang/test/Sema/offsetof.c:79
+int a;
+struct B // no-error, struct B is not defined within __builtin_offsetof 
directly
+{

aaron.ballman wrote:
> I think this is defensible. The wording in the standard is "If the specified 
> type defines a new type or if the specified member is a bit-field, the 
> behavior is undefined." and the specified type in this case is `struct A`; 
> that `struct A` happens to also define `struct B` is immaterial.
> 
> However, the intent behind the change to the rule is to support older 
> implementations of `offsetof` to protect them from having to deal with a case 
> like: `offsetof(struct S { int a, b }, b);` where `offsetof` is a macro and 
> thus the comma between `a` and `b` is treated as a separator. So there's a 
> part of me that wonders if we want to also support diagnosing this case. But 
> then we'd have to look at the declarator context more recursively to see 
> whether any of the contexts on the stack are an `offsetof` context and that 
> might be tricky.
> 
> Thoughts?
FWIW, gcc seems just rejects all definitions in this context. (Perhaps during 
Parsing the statements). If we add a bool state to the Parser (just using RAII 
object as before) struct B will trigger diagnostic error because the state 
"ParsingOffsetof" is passed into inner declaration.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133574

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


[PATCH] D132421: [HLSL] Support PCH for cc1 mode

2022-09-14 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:50
+if (S.LookupQualifiedName(Result, HLSLNamespace)) {
+  NamedDecl *Found = Result.getFoundDecl();
+  if (auto *TD = dyn_cast(Found)) {

99.9% sure this is safe because we're looking up a tag name and I can't think 
of any way that might return multiple results for the same identifier, but 
bringing it up just in case anyone else knows of some obscure extension where 
that's possible.



Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:55
+  } else
+PrevDecl = dyn_cast(Found);
+  assert(PrevDecl && "Unexpected lookup result type.");

Is it possible that this finds a different kind of tag, like an enumeration?



Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:85-86
 AccessSpecifier Access = AccessSpecifier::AS_private) {
+if (Record->isCompleteDefinition())
+  return *this;
 assert(Record->isBeingDefined() &&

A downside to this pattern is that we need to repeat the "if it's a complete 
definition, don't do anything" predicate in basically any mutating member 
function. Getting that wrong will lead to hard-to-debug issues with PCH, as I 
understand it. But I don't think there's a cleaner way to do that without doing 
far more invasive changes.



Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:378
+  if (S.LookupQualifiedName(Result, AST.getTranslationUnitDecl()))
+PrevDecl = Result.getAsSingle();
+  HLSLNamespace = NamespaceDecl::Create(AST, AST.getTranslationUnitDecl(),

How certain are you that there's only one result possible here?



Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:387
+  // Force external decls in the HLSL namespace to load from the PCH.
+  HLSLNamespace->getCanonicalDecl()->decls_begin();
   defineTrivialHLSLTypes();





Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:459-461
+  ASTContext &AST = SemaPtr->getASTContext();
+  IdentifierInfo &II = AST.Idents.get("Resource", tok::TokenKind::identifier);
+  LookupResult Result(*SemaPtr, &II, SourceLocation(), Sema::LookupTagName);

We made a lookup result but then do nothing with it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132421

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


[PATCH] D133817: MSVC ABI: Looks like even non-aarch64 uses the MSVC/14 definition for pod/aggregate passing

2022-09-14 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

Thanks!

> But I had
> trouble figuring out how to exercise this functionality properly to add
> test coverage and then compare that to MSVC itself... - I got very
> confused/turned around trying to test this, so I've given up enough to
> send what I have out for review, but happy to look further into this
> with help.

I think I would take the three cases you found (protected, nsdmi, defaulted 
copy ctor), add each to this file, and check for the IR prototypes here in this 
test file. Either sret is used, or it is not.

Regarding HFAs, I believe that logic is only used on x86/x64 for the 
__vectorcall calling convention. I believe it is well-tested with respect to 
C-like structs, but the C++ aspects that you are changing are not well tested. 
I think I managed to construct a case using NSDMIs (Richard used to prefer the 
terminology "default member initializers" which is simpler): 
https://godbolt.org/z/daPzKxj3h It looks like we don't match arm64 MSVC's 
behavior exactly here, but your change to remove the "!isAArch64" test would 
probably cause us to change behavior in this case, right?




Comment at: clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp:77
 
+struct SmallWithSmallWithPrivate {
+  SmallWithPrivate p;

I'm amused that this class is passed directly, but if you pass the field by 
itself, it is passed indirectly. :shrug:



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133817

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


  1   2   3   >