[Lldb-commits] [lldb] [openmp] [clang] [clang-tools-extra] [lld] [libunwind] [mlir] [llvm] [flang] [compiler-rt] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread Phoebe Wang via lldb-commits


@@ -1363,6 +1363,14 @@ bool BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) 
{
 MachineBasicBlock *Pred = *(MBB->pred_end()-1);
 Pred->ReplaceUsesOfBlockWith(MBB, &*FallThrough);
   }
+  // Add rest successors of MBB to successors of FallThrough. Those
+  // successors are not directly reachable via MBB, so it should be
+  // landing-pad.
+  for (auto SI = MBB->succ_begin(), SE = MBB->succ_end(); SI != SE; ++SI)
+if (*SI != &*FallThrough && !FallThrough->isSuccessor(*SI)) {
+  assert((*SI)->isEHPad() && "Bad CFG");
+  FallThrough->copySuccessor(MBB, SI);
+}

phoebewang wrote:

This doesn't answer the questions. My questions are:

- Why can't put the code in `ReplaceUsesOfBlockWith`? The `isSuccessor` can 
make sure the same BB won't add again;
- Is it possible the added BB might be removed latter. We don't have a 
mechanism to remove the dead successors. Would it be a problem if we keep an 
edge to dead BBs?

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


[Lldb-commits] [compiler-rt] [flang] [openmp] [clang-tools-extra] [mlir] [clang] [lldb] [llvm] [lld] [libunwind] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread Phoebe Wang via lldb-commits


@@ -1624,6 +1632,15 @@ bool BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) 
{
 } else {
   DidChange = true;
   PMBB->ReplaceUsesOfBlockWith(MBB, CurTBB);
+  // Add rest successors of MBB to successors of CurTBB. Those
+  // successors are not directly reachable via MBB, so it should be
+  // landing-pad.
+  for (auto SI = MBB->succ_begin(), SE = MBB->succ_end(); SI != SE;
+   ++SI)
+if (*SI != CurTBB && !CurTBB->isSuccessor(*SI)) {
+  assert((*SI)->isEHPad() && "Bad CFG");
+  CurTBB->copySuccessor(MBB, SI);

phoebewang wrote:

I see we assert for `(*SI)->isEHPad()`, but `bb.6` is not a EHPad. Did I 
misunderstand something here?
BTW, can we use `SI->isEHPad()` directly?

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


[Lldb-commits] [clang-tools-extra] [lldb] [clang] [llvm] [flang] [compiler-rt] [libunwind] [openmp] [mlir] [lld] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread via lldb-commits


@@ -1363,6 +1363,14 @@ bool BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) 
{
 MachineBasicBlock *Pred = *(MBB->pred_end()-1);
 Pred->ReplaceUsesOfBlockWith(MBB, &*FallThrough);
   }
+  // Add rest successors of MBB to successors of FallThrough. Those
+  // successors are not directly reachable via MBB, so it should be
+  // landing-pad.
+  for (auto SI = MBB->succ_begin(), SE = MBB->succ_end(); SI != SE; ++SI)
+if (*SI != &*FallThrough && !FallThrough->isSuccessor(*SI)) {
+  assert((*SI)->isEHPad() && "Bad CFG");
+  FallThrough->copySuccessor(MBB, SI);
+}

HaohaiWen wrote:

> Why can't put the code in ReplaceUsesOfBlockWith? The isSuccessor can make 
> sure the same BB won't add again;

It's possible MBB don't have any predecessor. e.g. The function entry BB is 
invoke llvm.seh.scope.begin. In such case, we still need to add bb.4 as 
successor of bb.3 before removing MBB.
```
bb.2:
  successors: %bb.3(0x7800), %bb.4(0x0800); %bb.3(100.00%), %bb.4(0.00%)


bb.3:
; predecessors: %bb.2
  successors: %bb.6(0x8000); %bb.6(100.00%)

  JMP_1 %bb.6

bb.4 (machine-block-address-taken, landing-pad, ehfunclet-entry):
; predecessors: %bb.2
  successors: %bb.5(0x8000); %bb.5(100.00%)

  CLEANUPRET

bb.5 (landing-pad, ehfunclet-entry):
; predecessors: %bb.4

  CLEANUPRET

bb.6:
; predecessors: %bb.3

  RET 0

# End machine code for function main.
```

> Is it possible the added BB might be removed latter. We don't have a 
> mechanism to remove the dead successors. Would it be a problem if we keep an 
> edge to dead BBs?

No, addSuccessor(), removeSuccessor() will properly maintain predecessors. We 
don't need to care about that.

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


[Lldb-commits] [compiler-rt] [mlir] [libunwind] [llvm] [flang] [lldb] [clang-tools-extra] [clang] [lld] [openmp] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread via lldb-commits


@@ -1624,6 +1632,15 @@ bool BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) 
{
 } else {
   DidChange = true;
   PMBB->ReplaceUsesOfBlockWith(MBB, CurTBB);
+  // Add rest successors of MBB to successors of CurTBB. Those
+  // successors are not directly reachable via MBB, so it should be
+  // landing-pad.
+  for (auto SI = MBB->succ_begin(), SE = MBB->succ_end(); SI != SE;
+   ++SI)
+if (*SI != CurTBB && !CurTBB->isSuccessor(*SI)) {
+  assert((*SI)->isEHPad() && "Bad CFG");
+  CurTBB->copySuccessor(MBB, SI);

HaohaiWen wrote:

bb.6 is CurTBB so it will be skipped.
using pred_iterator = std::vector< MachineBasicBlock * >::iterator
Dereference pred_iterator get MachineBasicBlock *.


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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [Clang] [c++20] P1907R1: Support for generalized non-type template ar… (PR #77428)

2024-01-11 Thread via lldb-commits

cor3ntin wrote:

@bolshakov-a we are going to branch LLVM 23 in about 10 days. If you can update 
this by early next week, we will try to finish the review so that it can land 
in 18.

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


[Lldb-commits] [llvm] [libc] [clang] [libcxx] [compiler-rt] [flang] [clang-tools-extra] [lldb] [flang] FDATE extension implementation: get date and time in ctime format (PR #71222)

2024-01-11 Thread Yi Wu via lldb-commits

https://github.com/yi-wu-arm closed 
https://github.com/llvm/llvm-project/pull/71222
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [flang] [lld] [compiler-rt] [lldb] [libunwind] [mlir] [clang-tools-extra] [clang] [openmp] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread Phoebe Wang via lldb-commits

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

LGTM.

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


[Lldb-commits] [lldb] [clang-tools-extra] [mlir] [compiler-rt] [llvm] [libunwind] [flang] [lld] [clang] [openmp] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread via lldb-commits

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


[Lldb-commits] [clang-tools-extra] [clang] [lldb] [compiler-rt] [lld] [flang] [openmp] [mlir] [llvm] [libunwind] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread via lldb-commits


@@ -0,0 +1,80 @@
+; RUN: llc -mtriple=x86_64-pc-windows-msvc %s

dyung wrote:

This RUN line seems to leave a .s file around that causes failures in 
subsequent runs:
https://lab.llvm.org/buildbot/#/builders/139/builds/56922
```
 TEST 'LLVM :: CodeGen/X86/windows-seh-EHa-PreserveCFG.s' 
FAILED 
Test has no 'RUN:' line

```
Is this actually testing anything? Or is it just trying to verify the compiler 
does not crash?

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


[Lldb-commits] [flang] [lldb] [lld] [clang] [llvm] [clang-tools-extra] [libclc] [libunwind] [libcxx] [libc] [compiler-rt] [clang] Add tests for DRs about complete-class context (PR #77444)

2024-01-11 Thread Vlad Serebrennikov via lldb-commits

https://github.com/Endilll updated 
https://github.com/llvm/llvm-project/pull/77444

>From 1cbf8eec15112cd6871fcfb69425c62f08c8f681 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov 
Date: Tue, 9 Jan 2024 14:17:21 +0300
Subject: [PATCH 1/4] [clang] Add tests for DRs about complete-class context
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[P1787](https://wg21.link/p1787): The intent for CWG2335 (contra those of the 
older CWG1890, CWG1626, CWG1255, and CWG287) is supported by retaining the 
unrestricted forward lookup in complete-class contexts (despite current 
implementation behavior for non-templates).
Wording: The declaration set is the result of a single search in the scope of C 
for N from immediately after the class-specifier of C if P is in a 
complete-class context of C or from P otherwise. [Drafting note: The plan for 
CWG2335 is to describe forbidden dependency cycles among the complete-class 
contexts of a class. — end drafting note] ([class.member.lookup]/4)

Complete-class context is described in [class.mem.general] 
[p7](http://eel.is/c++draft/class#mem.general-7) and 
[p8](http://eel.is/c++draft/class#mem.general-8). In this patch I add tests 
only for CWG issues that fall under current definition of complete-class 
context, because I'm not sure how CWG1255 and CWG287 are going to work. That's 
why I skip over them, but mark CWG1308 as superseded by CWG1330.
---
 clang/test/CXX/drs/dr13xx.cpp |  2 ++
 clang/test/CXX/drs/dr16xx.cpp | 22 
 clang/test/CXX/drs/dr18xx.cpp | 38 +++
 clang/test/CXX/drs/dr2335.cpp | 48 +++
 clang/www/cxx_dr_status.html  |  8 +++---
 5 files changed, 109 insertions(+), 9 deletions(-)
 create mode 100644 clang/test/CXX/drs/dr2335.cpp

diff --git a/clang/test/CXX/drs/dr13xx.cpp b/clang/test/CXX/drs/dr13xx.cpp
index 359c04b3e0f3d4..81a8a8a361700a 100644
--- a/clang/test/CXX/drs/dr13xx.cpp
+++ b/clang/test/CXX/drs/dr13xx.cpp
@@ -40,6 +40,8 @@ void caller() {
 #endif // __cplusplus >= 201103L
 } // namespace dr1307
 
+// dr1308: sup 1330
+
 namespace dr1310 { // dr1310: 5
   struct S {} * sp = new S::S;
   // expected-error@-1 {{qualified reference to 'S' is a constructor name 
rather than a type in this context}}
diff --git a/clang/test/CXX/drs/dr16xx.cpp b/clang/test/CXX/drs/dr16xx.cpp
index 3f074c4d57354a..342240cdc7a43d 100644
--- a/clang/test/CXX/drs/dr16xx.cpp
+++ b/clang/test/CXX/drs/dr16xx.cpp
@@ -42,6 +42,28 @@ namespace dr1611 { // dr1611: dup 1658
   C c;
 }
 
+namespace dr1626 { // dr1626: no open
+// FIXME: current consensus for CWG2335 is that the examples are well-formed.
+#if __cplusplus >= 201103L
+namespace ex1 {
+template  struct C {
+  template  static constexpr bool _S_chk() { return false; }
+  static const bool __value = _S_chk();
+};
+template struct C;
+} // namespace ex1
+
+namespace ex2 {
+struct C {
+  static constexpr bool _S_chk() { return false; }
+  static const bool __value = _S_chk();
+  // expected-error@-1 {{in-class initializer for static data member is not a 
constant expression}}
+};
+C c;
+} // namespace ex2
+#endif
+} // namespace dr1626
+
 namespace dr1631 {  // dr1631: 3.7
 #if __cplusplus >= 201103L
   // Incorrect overload resolution for single-element initializer-list
diff --git a/clang/test/CXX/drs/dr18xx.cpp b/clang/test/CXX/drs/dr18xx.cpp
index fbe67bd0c2f6db..0a0213c28595fd 100644
--- a/clang/test/CXX/drs/dr18xx.cpp
+++ b/clang/test/CXX/drs/dr18xx.cpp
@@ -1,10 +1,10 @@
 // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s 
-verify=expected,cxx98 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions 
-pedantic-errors
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s 
-verify=expected,cxx11-17,since-cxx11 -fexceptions -Wno-deprecated-builtins 
-fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s 
-verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions 
-Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s 
-verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions 
-Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s 
-verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions 
-Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s 
-verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions 
-Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s 
-verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions 
-Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s 
-verify=expected,since-cxx14,cxx11-17,since-cxx11,since-cxx14 -fexceptions 
-Wno-deprecated-builtins -fcx

[Lldb-commits] [openmp] [clang-tools-extra] [lldb] [lld] [flang] [mlir] [libunwind] [compiler-rt] [llvm] [clang] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread via lldb-commits


@@ -0,0 +1,80 @@
+; RUN: llc -mtriple=x86_64-pc-windows-msvc %s

dyung wrote:

@HaohaiWen Could you restructure this test so that it doesn't generate the .s 
file (maybe redirect the output to /dev/null or something similar?) This is 
causing unresolved test errors on several of the buildbots I manage.

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


[Lldb-commits] [libcxxabi] [libc] [libcxx] [clang-tools-extra] [lldb] [mlir] [flang] [lld] [libunwind] [compiler-rt] [llvm] [clang] [clang] static operators should evaluate object argument (PR #68485)

2024-01-11 Thread via lldb-commits

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


[Lldb-commits] [mlir] [lldb] [flang] [llvm] [libunwind] [clang-tools-extra] [compiler-rt] [libcxxabi] [lld] [libcxx] [libc] [clang] [clang] static operators should evaluate object argument (PR #68485)

2024-01-11 Thread via lldb-commits

https://github.com/cor3ntin commented:

Just a few nits, but I think it looks good

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


[Lldb-commits] [compiler-rt] [libc] [clang-tools-extra] [llvm] [libunwind] [clang] [libcxxabi] [lld] [lldb] [mlir] [libcxx] [flang] [clang] static operators should evaluate object argument (PR #68485)

2024-01-11 Thread via lldb-commits


@@ -858,10 +858,14 @@ Bug Fixes to C++ Support
   (`#64086 `_)
 
 - Fixed a regression where clang forgets how to substitute into constraints on 
template-template
-  parameters. Fixes: 
+  parameters. Fixes:
   (`#57410 `_) and
   (`#76604 `_)
 
+- Fix an issue that the object argument of ``static operator()`` and ``static 
operator[]`` is not evaluate.

cor3ntin wrote:

```suggestion
- Fix incorrect code generation caused by the object argument of ``static 
operator()`` and ``static operator[]`` calls not being evaluated.
```

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


[Lldb-commits] [llvm] [mlir] [flang] [compiler-rt] [lldb] [clang] [libunwind] [libcxx] [lld] [libcxxabi] [clang-tools-extra] [libc] [clang] static operators should evaluate object argument (PR #68485)

2024-01-11 Thread via lldb-commits


@@ -5680,8 +5680,13 @@ static ImplicitConversionSequence 
TryObjectArgumentInitialization(
   QualType ClassType = S.Context.getTypeDeclType(ActingContext);
   // [class.dtor]p2: A destructor can be invoked for a const, volatile or
   // const volatile object.
+  // Also, a static operator can be invoked for a const, volatile or const
+  // volatile object, apparently.

cor3ntin wrote:

The best wording i can find is this one 
https://eel.is/c++draft/over.match#funcs.general-4.sentence-5

```suggestion
  C++23 [over.match.funcs.general] p4.2 For static member functions, the 
implicit object parameter is considered to match any object.
```

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


[Lldb-commits] [llvm] [mlir] [flang] [compiler-rt] [lldb] [libunwind] [clang] [openmp] [lld] [clang-tools-extra] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread via lldb-commits


@@ -0,0 +1,80 @@
+; RUN: llc -mtriple=x86_64-pc-windows-msvc %s

HaohaiWen wrote:

Oh, sorry. I fixed it in https://github.com/llvm/llvm-project/pull/77784.
It's verifying compiler not crash. 

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


[Lldb-commits] [clang] [compiler-rt] [libc] [libunwind] [clang-tools-extra] [libclc] [lldb] [libcxx] [llvm] [flang] [lld] [clang] Add tests for DRs about complete-class context (PR #77444)

2024-01-11 Thread Vlad Serebrennikov via lldb-commits

https://github.com/Endilll updated 
https://github.com/llvm/llvm-project/pull/77444

>From 1cbf8eec15112cd6871fcfb69425c62f08c8f681 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov 
Date: Tue, 9 Jan 2024 14:17:21 +0300
Subject: [PATCH 1/4] [clang] Add tests for DRs about complete-class context
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[P1787](https://wg21.link/p1787): The intent for CWG2335 (contra those of the 
older CWG1890, CWG1626, CWG1255, and CWG287) is supported by retaining the 
unrestricted forward lookup in complete-class contexts (despite current 
implementation behavior for non-templates).
Wording: The declaration set is the result of a single search in the scope of C 
for N from immediately after the class-specifier of C if P is in a 
complete-class context of C or from P otherwise. [Drafting note: The plan for 
CWG2335 is to describe forbidden dependency cycles among the complete-class 
contexts of a class. — end drafting note] ([class.member.lookup]/4)

Complete-class context is described in [class.mem.general] 
[p7](http://eel.is/c++draft/class#mem.general-7) and 
[p8](http://eel.is/c++draft/class#mem.general-8). In this patch I add tests 
only for CWG issues that fall under current definition of complete-class 
context, because I'm not sure how CWG1255 and CWG287 are going to work. That's 
why I skip over them, but mark CWG1308 as superseded by CWG1330.
---
 clang/test/CXX/drs/dr13xx.cpp |  2 ++
 clang/test/CXX/drs/dr16xx.cpp | 22 
 clang/test/CXX/drs/dr18xx.cpp | 38 +++
 clang/test/CXX/drs/dr2335.cpp | 48 +++
 clang/www/cxx_dr_status.html  |  8 +++---
 5 files changed, 109 insertions(+), 9 deletions(-)
 create mode 100644 clang/test/CXX/drs/dr2335.cpp

diff --git a/clang/test/CXX/drs/dr13xx.cpp b/clang/test/CXX/drs/dr13xx.cpp
index 359c04b3e0f3d4..81a8a8a361700a 100644
--- a/clang/test/CXX/drs/dr13xx.cpp
+++ b/clang/test/CXX/drs/dr13xx.cpp
@@ -40,6 +40,8 @@ void caller() {
 #endif // __cplusplus >= 201103L
 } // namespace dr1307
 
+// dr1308: sup 1330
+
 namespace dr1310 { // dr1310: 5
   struct S {} * sp = new S::S;
   // expected-error@-1 {{qualified reference to 'S' is a constructor name 
rather than a type in this context}}
diff --git a/clang/test/CXX/drs/dr16xx.cpp b/clang/test/CXX/drs/dr16xx.cpp
index 3f074c4d57354a..342240cdc7a43d 100644
--- a/clang/test/CXX/drs/dr16xx.cpp
+++ b/clang/test/CXX/drs/dr16xx.cpp
@@ -42,6 +42,28 @@ namespace dr1611 { // dr1611: dup 1658
   C c;
 }
 
+namespace dr1626 { // dr1626: no open
+// FIXME: current consensus for CWG2335 is that the examples are well-formed.
+#if __cplusplus >= 201103L
+namespace ex1 {
+template  struct C {
+  template  static constexpr bool _S_chk() { return false; }
+  static const bool __value = _S_chk();
+};
+template struct C;
+} // namespace ex1
+
+namespace ex2 {
+struct C {
+  static constexpr bool _S_chk() { return false; }
+  static const bool __value = _S_chk();
+  // expected-error@-1 {{in-class initializer for static data member is not a 
constant expression}}
+};
+C c;
+} // namespace ex2
+#endif
+} // namespace dr1626
+
 namespace dr1631 {  // dr1631: 3.7
 #if __cplusplus >= 201103L
   // Incorrect overload resolution for single-element initializer-list
diff --git a/clang/test/CXX/drs/dr18xx.cpp b/clang/test/CXX/drs/dr18xx.cpp
index fbe67bd0c2f6db..0a0213c28595fd 100644
--- a/clang/test/CXX/drs/dr18xx.cpp
+++ b/clang/test/CXX/drs/dr18xx.cpp
@@ -1,10 +1,10 @@
 // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s 
-verify=expected,cxx98 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions 
-pedantic-errors
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s 
-verify=expected,cxx11-17,since-cxx11 -fexceptions -Wno-deprecated-builtins 
-fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s 
-verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions 
-Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s 
-verify=expected,cxx11-17,since-cxx11,since-cxx14 -fexceptions 
-Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s 
-verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions 
-Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s 
-verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions 
-Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s 
-verify=expected,since-cxx20,since-cxx11,since-cxx14 -fexceptions 
-Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s 
-verify=expected,since-cxx14,cxx11-17,since-cxx11,since-cxx14 -fexceptions 
-Wno-deprecated-builtins -fcx

[Lldb-commits] [llvm] [libclc] [lldb] [libcxx] [flang] [libc] [libunwind] [lld] [clang] [clang-tools-extra] [compiler-rt] [clang] Add tests for DRs about complete-class context (PR #77444)

2024-01-11 Thread Vlad Serebrennikov via lldb-commits


@@ -42,6 +42,28 @@ namespace dr1611 { // dr1611: dup 1658
   C c;
 }
 
+namespace dr1626 { // dr1626: no open
+// FIXME: current consensus for CWG2335 is that the examples are well-formed.

Endilll wrote:

We had an offline discussion, and concluded that this test should be removed.

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


[Lldb-commits] [llvm] [flang] [openmp] [compiler-rt] [mlir] [lld] [clang] [libunwind] [lldb] [clang-tools-extra] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread via lldb-commits


@@ -0,0 +1,80 @@
+; RUN: llc -mtriple=x86_64-pc-windows-msvc %s

dyung wrote:

Thanks, that worked, although I did need to manually delete the .s file on the 
buildbot because the file was generated in the source tree which is not 
normally cleaned between runs. But once I deleted it, your fix worked.

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


[Lldb-commits] [llvm] [flang] [compiler-rt] [mlir] [libcxx] [lld] [clang] [libc] [libcxxabi] [lldb] [libunwind] [clang-tools-extra] [clang] static operators should evaluate object argument (PR #68485)

2024-01-11 Thread Tianlan Zhou via lldb-commits

https://github.com/SuperSodaSea updated 
https://github.com/llvm/llvm-project/pull/68485

>From 03276260c48d9cafb2a0d80825156e77cdf02eba Mon Sep 17 00:00:00 2001
From: SuperSodaSea 
Date: Sat, 7 Oct 2023 21:05:17 +0800
Subject: [PATCH 01/12] [clang] static operators should evaluate object
 argument

---
 clang/lib/AST/ExprConstant.cpp|  3 +-
 clang/lib/CodeGen/CGExpr.cpp  |  2 +-
 clang/lib/CodeGen/CGExprCXX.cpp   | 41 --
 clang/lib/CodeGen/CodeGenFunction.h   |  3 +
 clang/lib/Sema/SemaChecking.cpp   |  5 +-
 clang/lib/Sema/SemaOverload.cpp   | 33 ---
 clang/test/AST/ast-dump-static-operators.cpp  | 55 +++
 .../CodeGenCXX/cxx2b-static-call-operator.cpp | 26 ++---
 .../cxx2b-static-subscript-operator.cpp   | 11 +++-
 9 files changed, 137 insertions(+), 42 deletions(-)
 create mode 100644 clang/test/AST/ast-dump-static-operators.cpp

diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 5a33e918db8e8c..a6c81f467fbe01 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -7806,7 +7806,8 @@ class ExprEvaluatorBase
   // Overloaded operator calls to member functions are represented as 
normal
   // calls with '*this' as the first argument.
   const CXXMethodDecl *MD = dyn_cast(FD);
-  if (MD && MD->isImplicitObjectMemberFunction()) {
+  if (MD &&
+  (MD->isImplicitObjectMemberFunction() || (OCE && MD->isStatic( {
 // FIXME: When selecting an implicit conversion for an overloaded
 // operator delete, we sometimes try to evaluate calls to conversion
 // operators without a 'this' parameter!
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 54a1d300a9ac73..19406ff174dea1 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -5070,7 +5070,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
   if (const auto *CE = dyn_cast(E))
 if (const auto *MD =
 dyn_cast_if_present(CE->getCalleeDecl());
-MD && MD->isImplicitObjectMemberFunction())
+MD && !MD->isExplicitObjectMemberFunction())
   return EmitCXXOperatorMemberCallExpr(CE, MD, ReturnValue);
 
   CGCallee callee = EmitCallee(E->getCallee());
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 2e7059cc8f5b63..a580c635998510 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -489,11 +489,42 @@ RValue
 CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
const CXXMethodDecl *MD,
ReturnValueSlot ReturnValue) {
-  assert(MD->isImplicitObjectMemberFunction() &&
- "Trying to emit a member call expr on a static method!");
-  return EmitCXXMemberOrOperatorMemberCallExpr(
-  E, MD, ReturnValue, /*HasQualifier=*/false, /*Qualifier=*/nullptr,
-  /*IsArrow=*/false, E->getArg(0));
+  assert(!MD->isExplicitObjectMemberFunction() &&
+ "Trying to emit a member call expr on an explicit object member "
+ "function!");
+
+  if (MD->isStatic())
+return EmitCXXStaticOperatorMemberCallExpr(E, MD, ReturnValue);
+  else
+return EmitCXXMemberOrOperatorMemberCallExpr(
+E, MD, ReturnValue, /*HasQualifier=*/false, /*Qualifier=*/nullptr,
+/*IsArrow=*/false, E->getArg(0));
+}
+
+RValue CodeGenFunction::EmitCXXStaticOperatorMemberCallExpr(
+const CXXOperatorCallExpr *E, const CXXMethodDecl *MD,
+ReturnValueSlot ReturnValue) {
+  assert(MD->isStatic());
+
+  CGCallee Callee = EmitCallee(E->getCallee());
+
+  // Emit and ignore `this` pointer.
+  EmitIgnoredExpr(E->getArg(0));
+
+  auto ProtoType = MD->getFunctionType()->castAs();
+
+  // Emit the rest of the call args.
+  CallArgList Args;
+  EmitCallArgs(Args, ProtoType, drop_begin(E->arguments(), 1),
+   E->getDirectCallee());
+
+  bool Chain = E == MustTailCall;
+  const CGFunctionInfo &FnInfo =
+  CGM.getTypes().arrangeFreeFunctionCall(Args, ProtoType, Chain);
+  llvm::CallBase *CallOrInvoke = nullptr;
+
+  return EmitCall(FnInfo, Callee, ReturnValue, Args, &CallOrInvoke, Chain,
+  E->getExprLoc());
 }
 
 RValue CodeGenFunction::EmitCUDAKernelCallExpr(const CUDAKernelCallExpr *E,
diff --git a/clang/lib/CodeGen/CodeGenFunction.h 
b/clang/lib/CodeGen/CodeGenFunction.h
index d5336382a2b9c9..42de125e748991 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -4163,6 +4163,9 @@ class CodeGenFunction : public CodeGenTypeCache {
   RValue EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
const CXXMethodDecl *MD,
ReturnValueSlot ReturnValue);
+  RValue EmitCXXStaticOperatorMemberCallExpr(const CXXOperatorCallExpr *C

[Lldb-commits] [lldb] [lldb][Progress] Separate title and details (PR #77547)

2024-01-11 Thread Chelsea Cassanova via lldb-commits

https://github.com/chelcassanova updated 
https://github.com/llvm/llvm-project/pull/77547

>From 44a3cdca21bc9c2aa24eeaf5d82c8b8af382bfa7 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Tue, 9 Jan 2024 18:32:06 -0800
Subject: [PATCH 1/5] [lldb][Progress] Separate title and details

Per this RFC:
https://discourse.llvm.org/t/rfc-improve-lldb-progress-reporting/75717
on improving progress reports, this commit separates the title field and
details field so that the title specifies the category that the progress
report falls under. The details field is added as a part of the
constructor for progress reports and by default is an empty string. Also
updates the test to check for details being correctly reported from the
event structured data dictionary.
---
 lldb/include/lldb/Core/DebuggerEvents.h| 4 ++--
 lldb/include/lldb/Core/Progress.h  | 3 ++-
 lldb/source/Core/Progress.cpp  | 7 ---
 lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp  | 2 +-
 lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp  | 4 +---
 lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp   | 6 ++
 .../Plugins/SymbolLocator/Default/SymbolLocatorDefault.cpp | 4 +---
 .../progress_reporting/TestProgressReporting.py| 2 ++
 8 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/lldb/include/lldb/Core/DebuggerEvents.h 
b/lldb/include/lldb/Core/DebuggerEvents.h
index 982b9701f8..1fadb96a4b565d 100644
--- a/lldb/include/lldb/Core/DebuggerEvents.h
+++ b/lldb/include/lldb/Core/DebuggerEvents.h
@@ -20,9 +20,9 @@ class Stream;
 
 class ProgressEventData : public EventData {
 public:
-  ProgressEventData(uint64_t progress_id, std::string title, std::string 
update,
+  ProgressEventData(uint64_t progress_id, std::string title, std::string 
details,
 uint64_t completed, uint64_t total, bool debugger_specific)
-  : m_title(std::move(title)), m_details(std::move(update)),
+  : m_title(std::move(title)), m_details(std::move(details)),
 m_id(progress_id), m_completed(completed), m_total(total),
 m_debugger_specific(debugger_specific) {}
 
diff --git a/lldb/include/lldb/Core/Progress.h 
b/lldb/include/lldb/Core/Progress.h
index b2b8781a43b059..1ea6df01a4bd4a 100644
--- a/lldb/include/lldb/Core/Progress.h
+++ b/lldb/include/lldb/Core/Progress.h
@@ -69,7 +69,7 @@ class Progress {
   ///
   /// @param [in] debugger An optional debugger pointer to specify that this
   /// progress is to be reported only to specific debuggers.
-  Progress(std::string title, uint64_t total = UINT64_MAX,
+Progress(std::string title, std::string details = {}, uint64_t total = 
UINT64_MAX,
lldb_private::Debugger *debugger = nullptr);
 
   /// Destroy the progress object.
@@ -96,6 +96,7 @@ class Progress {
   static std::atomic g_id;
   /// The title of the progress activity.
   std::string m_title;
+  std::string m_details;
   std::mutex m_mutex;
   /// A unique integer identifier for progress reporting.
   const uint64_t m_id;
diff --git a/lldb/source/Core/Progress.cpp b/lldb/source/Core/Progress.cpp
index ea3f874916a999..8c99b561373362 100644
--- a/lldb/source/Core/Progress.cpp
+++ b/lldb/source/Core/Progress.cpp
@@ -16,9 +16,9 @@ using namespace lldb_private;
 
 std::atomic Progress::g_id(0);
 
-Progress::Progress(std::string title, uint64_t total,
+Progress::Progress(std::string title, std::string details, uint64_t total,
lldb_private::Debugger *debugger)
-: m_title(title), m_id(++g_id), m_completed(0), m_total(total) {
+: m_title(title), m_details(details), m_id(++g_id), m_completed(0), 
m_total(total) {
   assert(total > 0);
   if (debugger)
 m_debugger_id = debugger->GetID();
@@ -38,6 +38,7 @@ Progress::~Progress() {
 void Progress::Increment(uint64_t amount, std::string update) {
   if (amount > 0) {
 std::lock_guard guard(m_mutex);
+m_details = update;
 // Watch out for unsigned overflow and make sure we don't increment too
 // much and exceed m_total.
 if (amount > (m_total - m_completed))
@@ -53,7 +54,7 @@ void Progress::ReportProgress(std::string update) {
 // Make sure we only send one notification that indicates the progress is
 // complete.
 m_complete = m_completed == m_total;
-Debugger::ReportProgress(m_id, m_title, std::move(update), m_completed,
+Debugger::ReportProgress(m_id, m_title, m_details, m_completed,
  m_total, m_debugger_id);
   }
 }
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 182a9f2afaeb2e..f451bac598b874 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -2225,7 +2225,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
   const char *file_name = file.GetFilename().AsCString("");
   LL

[Lldb-commits] [llvm] [flang] [compiler-rt] [mlir] [libcxx] [lld] [clang] [libc] [libcxxabi] [lldb] [libunwind] [clang-tools-extra] [clang] static operators should evaluate object argument (PR #68485)

2024-01-11 Thread Tianlan Zhou via lldb-commits

https://github.com/SuperSodaSea updated 
https://github.com/llvm/llvm-project/pull/68485

>From 03276260c48d9cafb2a0d80825156e77cdf02eba Mon Sep 17 00:00:00 2001
From: SuperSodaSea 
Date: Sat, 7 Oct 2023 21:05:17 +0800
Subject: [PATCH 01/13] [clang] static operators should evaluate object
 argument

---
 clang/lib/AST/ExprConstant.cpp|  3 +-
 clang/lib/CodeGen/CGExpr.cpp  |  2 +-
 clang/lib/CodeGen/CGExprCXX.cpp   | 41 --
 clang/lib/CodeGen/CodeGenFunction.h   |  3 +
 clang/lib/Sema/SemaChecking.cpp   |  5 +-
 clang/lib/Sema/SemaOverload.cpp   | 33 ---
 clang/test/AST/ast-dump-static-operators.cpp  | 55 +++
 .../CodeGenCXX/cxx2b-static-call-operator.cpp | 26 ++---
 .../cxx2b-static-subscript-operator.cpp   | 11 +++-
 9 files changed, 137 insertions(+), 42 deletions(-)
 create mode 100644 clang/test/AST/ast-dump-static-operators.cpp

diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 5a33e918db8e8c..a6c81f467fbe01 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -7806,7 +7806,8 @@ class ExprEvaluatorBase
   // Overloaded operator calls to member functions are represented as 
normal
   // calls with '*this' as the first argument.
   const CXXMethodDecl *MD = dyn_cast(FD);
-  if (MD && MD->isImplicitObjectMemberFunction()) {
+  if (MD &&
+  (MD->isImplicitObjectMemberFunction() || (OCE && MD->isStatic( {
 // FIXME: When selecting an implicit conversion for an overloaded
 // operator delete, we sometimes try to evaluate calls to conversion
 // operators without a 'this' parameter!
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 54a1d300a9ac73..19406ff174dea1 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -5070,7 +5070,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
   if (const auto *CE = dyn_cast(E))
 if (const auto *MD =
 dyn_cast_if_present(CE->getCalleeDecl());
-MD && MD->isImplicitObjectMemberFunction())
+MD && !MD->isExplicitObjectMemberFunction())
   return EmitCXXOperatorMemberCallExpr(CE, MD, ReturnValue);
 
   CGCallee callee = EmitCallee(E->getCallee());
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 2e7059cc8f5b63..a580c635998510 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -489,11 +489,42 @@ RValue
 CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
const CXXMethodDecl *MD,
ReturnValueSlot ReturnValue) {
-  assert(MD->isImplicitObjectMemberFunction() &&
- "Trying to emit a member call expr on a static method!");
-  return EmitCXXMemberOrOperatorMemberCallExpr(
-  E, MD, ReturnValue, /*HasQualifier=*/false, /*Qualifier=*/nullptr,
-  /*IsArrow=*/false, E->getArg(0));
+  assert(!MD->isExplicitObjectMemberFunction() &&
+ "Trying to emit a member call expr on an explicit object member "
+ "function!");
+
+  if (MD->isStatic())
+return EmitCXXStaticOperatorMemberCallExpr(E, MD, ReturnValue);
+  else
+return EmitCXXMemberOrOperatorMemberCallExpr(
+E, MD, ReturnValue, /*HasQualifier=*/false, /*Qualifier=*/nullptr,
+/*IsArrow=*/false, E->getArg(0));
+}
+
+RValue CodeGenFunction::EmitCXXStaticOperatorMemberCallExpr(
+const CXXOperatorCallExpr *E, const CXXMethodDecl *MD,
+ReturnValueSlot ReturnValue) {
+  assert(MD->isStatic());
+
+  CGCallee Callee = EmitCallee(E->getCallee());
+
+  // Emit and ignore `this` pointer.
+  EmitIgnoredExpr(E->getArg(0));
+
+  auto ProtoType = MD->getFunctionType()->castAs();
+
+  // Emit the rest of the call args.
+  CallArgList Args;
+  EmitCallArgs(Args, ProtoType, drop_begin(E->arguments(), 1),
+   E->getDirectCallee());
+
+  bool Chain = E == MustTailCall;
+  const CGFunctionInfo &FnInfo =
+  CGM.getTypes().arrangeFreeFunctionCall(Args, ProtoType, Chain);
+  llvm::CallBase *CallOrInvoke = nullptr;
+
+  return EmitCall(FnInfo, Callee, ReturnValue, Args, &CallOrInvoke, Chain,
+  E->getExprLoc());
 }
 
 RValue CodeGenFunction::EmitCUDAKernelCallExpr(const CUDAKernelCallExpr *E,
diff --git a/clang/lib/CodeGen/CodeGenFunction.h 
b/clang/lib/CodeGen/CodeGenFunction.h
index d5336382a2b9c9..42de125e748991 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -4163,6 +4163,9 @@ class CodeGenFunction : public CodeGenTypeCache {
   RValue EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
const CXXMethodDecl *MD,
ReturnValueSlot ReturnValue);
+  RValue EmitCXXStaticOperatorMemberCallExpr(const CXXOperatorCallExpr *C

[Lldb-commits] [clang] [libunwind] [llvm] [lld] [flang] [libc] [mlir] [libcxx] [lldb] [compiler-rt] [libcxxabi] [clang-tools-extra] [clang] static operators should evaluate object argument (PR #68485)

2024-01-11 Thread via lldb-commits

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

LGTM
@erichkeane you want to look at that?

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


[Lldb-commits] [clang] [libunwind] [llvm] [lld] [flang] [libc] [mlir] [libcxx] [lldb] [compiler-rt] [libcxxabi] [clang-tools-extra] [clang] static operators should evaluate object argument (PR #68485)

2024-01-11 Thread Erich Keane via lldb-commits

erichkeane wrote:

> LGTM @erichkeane you want to look at that?

I'd looked at it a while back, and just did another scroll, happy as-is.

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


[Lldb-commits] [llvm] [mlir] [compiler-rt] [libc] [libcxxabi] [clang] [libcxx] [clang-tools-extra] [lld] [libunwind] [lldb] [flang] [clang] static operators should evaluate object argument (PR #68485)

2024-01-11 Thread Tianlan Zhou via lldb-commits

https://github.com/SuperSodaSea updated 
https://github.com/llvm/llvm-project/pull/68485

>From 03276260c48d9cafb2a0d80825156e77cdf02eba Mon Sep 17 00:00:00 2001
From: SuperSodaSea 
Date: Sat, 7 Oct 2023 21:05:17 +0800
Subject: [PATCH 01/14] [clang] static operators should evaluate object
 argument

---
 clang/lib/AST/ExprConstant.cpp|  3 +-
 clang/lib/CodeGen/CGExpr.cpp  |  2 +-
 clang/lib/CodeGen/CGExprCXX.cpp   | 41 --
 clang/lib/CodeGen/CodeGenFunction.h   |  3 +
 clang/lib/Sema/SemaChecking.cpp   |  5 +-
 clang/lib/Sema/SemaOverload.cpp   | 33 ---
 clang/test/AST/ast-dump-static-operators.cpp  | 55 +++
 .../CodeGenCXX/cxx2b-static-call-operator.cpp | 26 ++---
 .../cxx2b-static-subscript-operator.cpp   | 11 +++-
 9 files changed, 137 insertions(+), 42 deletions(-)
 create mode 100644 clang/test/AST/ast-dump-static-operators.cpp

diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 5a33e918db8e8c..a6c81f467fbe01 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -7806,7 +7806,8 @@ class ExprEvaluatorBase
   // Overloaded operator calls to member functions are represented as 
normal
   // calls with '*this' as the first argument.
   const CXXMethodDecl *MD = dyn_cast(FD);
-  if (MD && MD->isImplicitObjectMemberFunction()) {
+  if (MD &&
+  (MD->isImplicitObjectMemberFunction() || (OCE && MD->isStatic( {
 // FIXME: When selecting an implicit conversion for an overloaded
 // operator delete, we sometimes try to evaluate calls to conversion
 // operators without a 'this' parameter!
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 54a1d300a9ac73..19406ff174dea1 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -5070,7 +5070,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
   if (const auto *CE = dyn_cast(E))
 if (const auto *MD =
 dyn_cast_if_present(CE->getCalleeDecl());
-MD && MD->isImplicitObjectMemberFunction())
+MD && !MD->isExplicitObjectMemberFunction())
   return EmitCXXOperatorMemberCallExpr(CE, MD, ReturnValue);
 
   CGCallee callee = EmitCallee(E->getCallee());
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 2e7059cc8f5b63..a580c635998510 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -489,11 +489,42 @@ RValue
 CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
const CXXMethodDecl *MD,
ReturnValueSlot ReturnValue) {
-  assert(MD->isImplicitObjectMemberFunction() &&
- "Trying to emit a member call expr on a static method!");
-  return EmitCXXMemberOrOperatorMemberCallExpr(
-  E, MD, ReturnValue, /*HasQualifier=*/false, /*Qualifier=*/nullptr,
-  /*IsArrow=*/false, E->getArg(0));
+  assert(!MD->isExplicitObjectMemberFunction() &&
+ "Trying to emit a member call expr on an explicit object member "
+ "function!");
+
+  if (MD->isStatic())
+return EmitCXXStaticOperatorMemberCallExpr(E, MD, ReturnValue);
+  else
+return EmitCXXMemberOrOperatorMemberCallExpr(
+E, MD, ReturnValue, /*HasQualifier=*/false, /*Qualifier=*/nullptr,
+/*IsArrow=*/false, E->getArg(0));
+}
+
+RValue CodeGenFunction::EmitCXXStaticOperatorMemberCallExpr(
+const CXXOperatorCallExpr *E, const CXXMethodDecl *MD,
+ReturnValueSlot ReturnValue) {
+  assert(MD->isStatic());
+
+  CGCallee Callee = EmitCallee(E->getCallee());
+
+  // Emit and ignore `this` pointer.
+  EmitIgnoredExpr(E->getArg(0));
+
+  auto ProtoType = MD->getFunctionType()->castAs();
+
+  // Emit the rest of the call args.
+  CallArgList Args;
+  EmitCallArgs(Args, ProtoType, drop_begin(E->arguments(), 1),
+   E->getDirectCallee());
+
+  bool Chain = E == MustTailCall;
+  const CGFunctionInfo &FnInfo =
+  CGM.getTypes().arrangeFreeFunctionCall(Args, ProtoType, Chain);
+  llvm::CallBase *CallOrInvoke = nullptr;
+
+  return EmitCall(FnInfo, Callee, ReturnValue, Args, &CallOrInvoke, Chain,
+  E->getExprLoc());
 }
 
 RValue CodeGenFunction::EmitCUDAKernelCallExpr(const CUDAKernelCallExpr *E,
diff --git a/clang/lib/CodeGen/CodeGenFunction.h 
b/clang/lib/CodeGen/CodeGenFunction.h
index d5336382a2b9c9..42de125e748991 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -4163,6 +4163,9 @@ class CodeGenFunction : public CodeGenTypeCache {
   RValue EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
const CXXMethodDecl *MD,
ReturnValueSlot ReturnValue);
+  RValue EmitCXXStaticOperatorMemberCallExpr(const CXXOperatorCallExpr *C

[Lldb-commits] [clang] [libunwind] [llvm] [lld] [flang] [libc] [mlir] [libcxx] [lldb] [compiler-rt] [libcxxabi] [clang-tools-extra] [clang] static operators should evaluate object argument (PR #68485)

2024-01-11 Thread Tianlan Zhou via lldb-commits


@@ -5680,8 +5680,13 @@ static ImplicitConversionSequence 
TryObjectArgumentInitialization(
   QualType ClassType = S.Context.getTypeDeclType(ActingContext);
   // [class.dtor]p2: A destructor can be invoked for a const, volatile or
   // const volatile object.
+  // Also, a static operator can be invoked for a const, volatile or const
+  // volatile object, apparently.

SuperSodaSea wrote:

I checked the old version of the standard and found that this wording exists in 
C++98. File updated.

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


[Lldb-commits] [llvm] [mlir] [compiler-rt] [libc] [libcxxabi] [clang] [libcxx] [clang-tools-extra] [lld] [libunwind] [lldb] [flang] [clang] static operators should evaluate object argument (PR #68485)

2024-01-11 Thread Tianlan Zhou via lldb-commits

https://github.com/SuperSodaSea updated 
https://github.com/llvm/llvm-project/pull/68485

>From 03276260c48d9cafb2a0d80825156e77cdf02eba Mon Sep 17 00:00:00 2001
From: SuperSodaSea 
Date: Sat, 7 Oct 2023 21:05:17 +0800
Subject: [PATCH 01/15] [clang] static operators should evaluate object
 argument

---
 clang/lib/AST/ExprConstant.cpp|  3 +-
 clang/lib/CodeGen/CGExpr.cpp  |  2 +-
 clang/lib/CodeGen/CGExprCXX.cpp   | 41 --
 clang/lib/CodeGen/CodeGenFunction.h   |  3 +
 clang/lib/Sema/SemaChecking.cpp   |  5 +-
 clang/lib/Sema/SemaOverload.cpp   | 33 ---
 clang/test/AST/ast-dump-static-operators.cpp  | 55 +++
 .../CodeGenCXX/cxx2b-static-call-operator.cpp | 26 ++---
 .../cxx2b-static-subscript-operator.cpp   | 11 +++-
 9 files changed, 137 insertions(+), 42 deletions(-)
 create mode 100644 clang/test/AST/ast-dump-static-operators.cpp

diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 5a33e918db8e8c..a6c81f467fbe01 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -7806,7 +7806,8 @@ class ExprEvaluatorBase
   // Overloaded operator calls to member functions are represented as 
normal
   // calls with '*this' as the first argument.
   const CXXMethodDecl *MD = dyn_cast(FD);
-  if (MD && MD->isImplicitObjectMemberFunction()) {
+  if (MD &&
+  (MD->isImplicitObjectMemberFunction() || (OCE && MD->isStatic( {
 // FIXME: When selecting an implicit conversion for an overloaded
 // operator delete, we sometimes try to evaluate calls to conversion
 // operators without a 'this' parameter!
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 54a1d300a9ac73..19406ff174dea1 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -5070,7 +5070,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
   if (const auto *CE = dyn_cast(E))
 if (const auto *MD =
 dyn_cast_if_present(CE->getCalleeDecl());
-MD && MD->isImplicitObjectMemberFunction())
+MD && !MD->isExplicitObjectMemberFunction())
   return EmitCXXOperatorMemberCallExpr(CE, MD, ReturnValue);
 
   CGCallee callee = EmitCallee(E->getCallee());
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 2e7059cc8f5b63..a580c635998510 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -489,11 +489,42 @@ RValue
 CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
const CXXMethodDecl *MD,
ReturnValueSlot ReturnValue) {
-  assert(MD->isImplicitObjectMemberFunction() &&
- "Trying to emit a member call expr on a static method!");
-  return EmitCXXMemberOrOperatorMemberCallExpr(
-  E, MD, ReturnValue, /*HasQualifier=*/false, /*Qualifier=*/nullptr,
-  /*IsArrow=*/false, E->getArg(0));
+  assert(!MD->isExplicitObjectMemberFunction() &&
+ "Trying to emit a member call expr on an explicit object member "
+ "function!");
+
+  if (MD->isStatic())
+return EmitCXXStaticOperatorMemberCallExpr(E, MD, ReturnValue);
+  else
+return EmitCXXMemberOrOperatorMemberCallExpr(
+E, MD, ReturnValue, /*HasQualifier=*/false, /*Qualifier=*/nullptr,
+/*IsArrow=*/false, E->getArg(0));
+}
+
+RValue CodeGenFunction::EmitCXXStaticOperatorMemberCallExpr(
+const CXXOperatorCallExpr *E, const CXXMethodDecl *MD,
+ReturnValueSlot ReturnValue) {
+  assert(MD->isStatic());
+
+  CGCallee Callee = EmitCallee(E->getCallee());
+
+  // Emit and ignore `this` pointer.
+  EmitIgnoredExpr(E->getArg(0));
+
+  auto ProtoType = MD->getFunctionType()->castAs();
+
+  // Emit the rest of the call args.
+  CallArgList Args;
+  EmitCallArgs(Args, ProtoType, drop_begin(E->arguments(), 1),
+   E->getDirectCallee());
+
+  bool Chain = E == MustTailCall;
+  const CGFunctionInfo &FnInfo =
+  CGM.getTypes().arrangeFreeFunctionCall(Args, ProtoType, Chain);
+  llvm::CallBase *CallOrInvoke = nullptr;
+
+  return EmitCall(FnInfo, Callee, ReturnValue, Args, &CallOrInvoke, Chain,
+  E->getExprLoc());
 }
 
 RValue CodeGenFunction::EmitCUDAKernelCallExpr(const CUDAKernelCallExpr *E,
diff --git a/clang/lib/CodeGen/CodeGenFunction.h 
b/clang/lib/CodeGen/CodeGenFunction.h
index d5336382a2b9c9..42de125e748991 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -4163,6 +4163,9 @@ class CodeGenFunction : public CodeGenTypeCache {
   RValue EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
const CXXMethodDecl *MD,
ReturnValueSlot ReturnValue);
+  RValue EmitCXXStaticOperatorMemberCallExpr(const CXXOperatorCallExpr *C

[Lldb-commits] [lldb] ee45710 - [lldb] Fix MaxSummaryLength target property type (#72233)

2024-01-11 Thread via lldb-commits

Author: dancing-leaves
Date: 2024-01-11T17:57:30Z
New Revision: ee457102585e99ac7c832926aa5be8d12025d466

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

LOG: [lldb] Fix MaxSummaryLength target property type (#72233)

There seems to be a regression since
https://github.com/llvm/llvm-project/commit/6f8b33f6dfd0a0f8d2522b6c832bd6298ae2f3f3.
`Max String Summary Length` target property is not read properly and the
default value (1024) is being used instead.

16.0.6:
```
(lldb) settings set target.max-string-summary-length 16
(lldb) var
(std::string) longStdString = 
"0123456789101112131415161718192021222324252627282930313233343536"
(const char *) longCharPointer = 0x5556f310 
"0123456789101112131415161718192021222324252627282930313233343536"
```

17.0.4:
```
(lldb) settings set target.max-string-summary-length 16
(lldb) var
(std::string) longStdString = 
"0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133234335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377"...
(const char *) longCharPointer = 0x5556f310 "*same as line above*"...
```

Comparison fails here:

https://github.com/llvm/llvm-project/blob/9cb1673fa5d267148ac81ee31b37f1d2f7c0f2b8/lldb/source/Interpreter/OptionValue.cpp#L256

Due to the type difference:

https://github.com/llvm/llvm-project/blob/9cb1673fa5d267148ac81ee31b37f1d2f7c0f2b8/lldb/source/Target/Target.cpp#L4611

https://github.com/llvm/llvm-project/blob/9cb1673fa5d267148ac81ee31b37f1d2f7c0f2b8/lldb/source/Target/TargetProperties.td#L98

Added: 


Modified: 
lldb/source/Target/TargetProperties.td

Removed: 




diff  --git a/lldb/source/Target/TargetProperties.td 
b/lldb/source/Target/TargetProperties.td
index 154a6e5919ab0c..d2fccdb7b9b39c 100644
--- a/lldb/source/Target/TargetProperties.td
+++ b/lldb/source/Target/TargetProperties.td
@@ -95,7 +95,7 @@ let Definition = "target" in {
   def MaxChildrenDepth: Property<"max-children-depth", "UInt64">,
 DefaultUnsignedValue<0x>,
 Desc<"Maximum depth to expand children.">;
-  def MaxSummaryLength: Property<"max-string-summary-length", "SInt64">,
+  def MaxSummaryLength: Property<"max-string-summary-length", "UInt64">,
 DefaultUnsignedValue<1024>,
 Desc<"Maximum number of characters to show when using %s in summary 
strings.">;
   def MaxMemReadSize: Property<"max-memory-read-size", "SInt64">,



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


[Lldb-commits] [lldb] [lldb] Fix MaxSummaryLength target property type (PR #72233)

2024-01-11 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix MaxSummaryLength target property type (PR #72233)

2024-01-11 Thread Michael Buch via lldb-commits

Michael137 wrote:

Merged the PR since we do want this fix ASAP. Will add the tests as a follow-up

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


[Lldb-commits] [clang-tools-extra] [llvm] [libcxxabi] [libclc] [libcxx] [flang] [clang] [libunwind] [compiler-rt] [libc] [lld] [lldb] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Alexander Richardson via lldb-commits


@@ -374,10 +376,10 @@ static __inline fp_t __compiler_rt_fmax(fp_t x, fp_t y) {
 #endif
 }
 
-#elif defined(QUAD_PRECISION) && defined(CRT_HAS_TF_MODE)
+#elif defined(QUAD_PRECISION)
 // The generic implementation only works for ieee754 floating point. For other
 // floating point types, continue to rely on the libm implementation for now.
-#if defined(CRT_HAS_IEEE_TF)
+#if defined(CRT_HAS_TF_MODE) && defined(CRT_HAS_IEEE_TF)

arichardson wrote:

```suggestion
#if defined(CRT_HAS_IEEE_TF) && defined(CRT_HAS_128BIT)
```

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


[Lldb-commits] [libc] [lldb] [clang-tools-extra] [libclc] [llvm] [libunwind] [clang] [lld] [compiler-rt] [libcxx] [libcxxabi] [flang] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Alexander Richardson via lldb-commits


@@ -189,11 +189,15 @@ typedef long double tf_float;
 #define CRT_LDBL_IEEE_F128
 #endif
 #define TF_C(x) x##L
-#elif __LDBL_MANT_DIG__ == 113
-// Use long double instead of __float128 if it matches the IEEE 128-bit format.
+#elif __LDBL_MANT_DIG__ == 113 ||  
\
+(__FLT_RADIX__ == 16 && __LDBL_MANT_DIG__ == 28)
+// Use long double instead of __float128 if it matches the IEEE 128-bit format
+// or the IBM hexadecimal format.
 #define CRT_LDBL_128BIT
+#if __LDBL_MANT_DIG__ == 113
 #define CRT_HAS_F128
 #define CRT_HAS_IEEE_TF
+#endif
 #define CRT_LDBL_IEEE_F128

arichardson wrote:

```suggestion
#define CRT_LDBL_128BIT
#define CRT_HAS_F128
#if __LDBL_MANT_DIG__ == 113
#define CRT_HAS_IEEE_TF
#define CRT_LDBL_IEEE_F128
#endif
```

I was suggesting to not define the tf_float is IEEE macros, CRT_HAS_F128 should 
still be set since we do have a 128-bit floating point type.

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


[Lldb-commits] [llvm] [clang] [lldb] [libcxx] [libc] [clang-tools-extra] [mlir] [BOLT][NFC] Print BAT section size (PR #76897)

2024-01-11 Thread Rafael Auler via lldb-commits

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


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


[Lldb-commits] [libcxx] [libc] [clang-tools-extra] [llvm] [lldb] [clang] [mlir] [BOLT][NFC] Print BAT section size (PR #76897)

2024-01-11 Thread Amir Ayupov via lldb-commits

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


[Lldb-commits] [llvm] [compiler-rt] [lld] [clang-tools-extra] [libc] [flang] [libcxx] [clang] [lldb] [libc++][variant] P2637R3: Member `visit` (`std::variant`) (PR #76447)

2024-01-11 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/76447
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang-tools-extra] [compiler-rt] [flang] [libcxxabi] [llvm] [lldb] [libunwind] [libclc] [lld] [libc] [clang] [libcxx] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Sean Perry via lldb-commits

https://github.com/perry-ca updated 
https://github.com/llvm/llvm-project/pull/77554

>From 7ba4d61bd2beda03ba0fcefc9ca5c1ff08ffd48e Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Tue, 9 Jan 2024 20:59:28 -0600
Subject: [PATCH 1/4] Generate __multc3 for z/OS

---
 compiler-rt/lib/builtins/divtc3.c| 3 ---
 compiler-rt/lib/builtins/fp_lib.h| 8 ++--
 compiler-rt/lib/builtins/int_types.h | 6 --
 compiler-rt/lib/builtins/multc3.c| 4 
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index e970cef574b21d..6ec9c5f17d4b68 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-#if defined(CRT_HAS_TF_MODE)
 
 // Returns: the quotient of (a + ib) / (c + id)
 
@@ -52,5 +51,3 @@ COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t 
__c, fp_t __d) {
   }
   return z;
 }
-
-#endif
diff --git a/compiler-rt/lib/builtins/fp_lib.h 
b/compiler-rt/lib/builtins/fp_lib.h
index af406e760497a4..a293788fc68f56 100644
--- a/compiler-rt/lib/builtins/fp_lib.h
+++ b/compiler-rt/lib/builtins/fp_lib.h
@@ -188,6 +188,8 @@ static __inline void wideMultiply(rep_t a, rep_t b, rep_t 
*hi, rep_t *lo) {
 #undef Word_HiMask
 #undef Word_LoMask
 #undef Word_FullMask
+#else
+typedef long double fp_t;
 #endif // defined(CRT_HAS_TF_MODE)
 #else
 #error SINGLE_PRECISION, DOUBLE_PRECISION or QUAD_PRECISION must be defined.
@@ -374,10 +376,10 @@ static __inline fp_t __compiler_rt_fmax(fp_t x, fp_t y) {
 #endif
 }
 
-#elif defined(QUAD_PRECISION) && defined(CRT_HAS_TF_MODE)
+#elif defined(QUAD_PRECISION)
 // The generic implementation only works for ieee754 floating point. For other
 // floating point types, continue to rely on the libm implementation for now.
-#if defined(CRT_HAS_IEEE_TF)
+#if defined(CRT_HAS_TF_MODE) && defined(CRT_HAS_IEEE_TF)
 static __inline tf_float __compiler_rt_logbtf(tf_float x) {
   return __compiler_rt_logbX(x);
 }
@@ -405,6 +407,8 @@ static __inline tf_float __compiler_rt_fmaxtf(tf_float x, 
tf_float y) {
 #define __compiler_rt_logbl crt_logbl
 #define __compiler_rt_scalbnl crt_scalbnl
 #define __compiler_rt_fmaxl crt_fmaxl
+#define crt_fabstf crt_fabsl
+#define crt_copysigntf crt_copysignl
 #else
 #error Unsupported TF mode type
 #endif
diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index 7624c728061518..ebbc63af598b76 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -189,8 +189,10 @@ typedef long double tf_float;
 #define CRT_LDBL_IEEE_F128
 #endif
 #define TF_C(x) x##L
-#elif __LDBL_MANT_DIG__ == 113
-// Use long double instead of __float128 if it matches the IEEE 128-bit format.
+#elif __LDBL_MANT_DIG__ == 113 ||  
\
+(__FLT_RADIX__ == 16 && __LDBL_MANT_DIG__ == 28)
+// Use long double instead of __float128 if it matches the IEEE 128-bit format
+// or the IBM hexadecimal format.
 #define CRT_LDBL_128BIT
 #define CRT_HAS_F128
 #define CRT_HAS_IEEE_TF
diff --git a/compiler-rt/lib/builtins/multc3.c 
b/compiler-rt/lib/builtins/multc3.c
index f20e53ccbf233b..21c522d0330b7f 100644
--- a/compiler-rt/lib/builtins/multc3.c
+++ b/compiler-rt/lib/builtins/multc3.c
@@ -15,8 +15,6 @@
 #include "int_lib.h"
 #include "int_math.h"
 
-#if defined(CRT_HAS_TF_MODE)
-
 // Returns: the product of a + ib and c + id
 
 COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, fp_t d) {
@@ -66,5 +64,3 @@ COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, 
fp_t d) {
   }
   return z;
 }
-
-#endif

>From 81b814ccc0b216eb9464c9fa5d4d28b0511c2338 Mon Sep 17 00:00:00 2001
From: Sean Perry <39927768+perry...@users.noreply.github.com>
Date: Tue, 9 Jan 2024 23:49:29 -0500
Subject: [PATCH 2/4] formatting update

---
 compiler-rt/lib/builtins/divtc3.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index 6ec9c5f17d4b68..7d3185c9d71fbb 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-
 // Returns: the quotient of (a + ib) / (c + id)
 
 COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t __c, fp_t __d) {

>From 2cb932ab37caf472aa296f5d7c811feada8464f0 Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Wed, 10 Jan 2024 16:03:48 -0600
Subject: [PATCH 3/4] only define CRT_HAS_F128 & CRT_HAS_IEEE_TF for IEEE

---
 compiler-rt/lib/builtins/int_types.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index ebbc63af598b76..9ceced37a997f4 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -194,8 +194,10 @@ typedef long double tf_float;
 // Use long double instead of __float128 if it matches the IEEE 128-

[Lldb-commits] [clang-tools-extra] [compiler-rt] [flang] [libcxxabi] [llvm] [lldb] [libunwind] [libclc] [lld] [libc] [clang] [libcxx] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Sean Perry via lldb-commits

https://github.com/perry-ca updated 
https://github.com/llvm/llvm-project/pull/77554

>From 7ba4d61bd2beda03ba0fcefc9ca5c1ff08ffd48e Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Tue, 9 Jan 2024 20:59:28 -0600
Subject: [PATCH 1/5] Generate __multc3 for z/OS

---
 compiler-rt/lib/builtins/divtc3.c| 3 ---
 compiler-rt/lib/builtins/fp_lib.h| 8 ++--
 compiler-rt/lib/builtins/int_types.h | 6 --
 compiler-rt/lib/builtins/multc3.c| 4 
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index e970cef574b21d..6ec9c5f17d4b68 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-#if defined(CRT_HAS_TF_MODE)
 
 // Returns: the quotient of (a + ib) / (c + id)
 
@@ -52,5 +51,3 @@ COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t 
__c, fp_t __d) {
   }
   return z;
 }
-
-#endif
diff --git a/compiler-rt/lib/builtins/fp_lib.h 
b/compiler-rt/lib/builtins/fp_lib.h
index af406e760497a4..a293788fc68f56 100644
--- a/compiler-rt/lib/builtins/fp_lib.h
+++ b/compiler-rt/lib/builtins/fp_lib.h
@@ -188,6 +188,8 @@ static __inline void wideMultiply(rep_t a, rep_t b, rep_t 
*hi, rep_t *lo) {
 #undef Word_HiMask
 #undef Word_LoMask
 #undef Word_FullMask
+#else
+typedef long double fp_t;
 #endif // defined(CRT_HAS_TF_MODE)
 #else
 #error SINGLE_PRECISION, DOUBLE_PRECISION or QUAD_PRECISION must be defined.
@@ -374,10 +376,10 @@ static __inline fp_t __compiler_rt_fmax(fp_t x, fp_t y) {
 #endif
 }
 
-#elif defined(QUAD_PRECISION) && defined(CRT_HAS_TF_MODE)
+#elif defined(QUAD_PRECISION)
 // The generic implementation only works for ieee754 floating point. For other
 // floating point types, continue to rely on the libm implementation for now.
-#if defined(CRT_HAS_IEEE_TF)
+#if defined(CRT_HAS_TF_MODE) && defined(CRT_HAS_IEEE_TF)
 static __inline tf_float __compiler_rt_logbtf(tf_float x) {
   return __compiler_rt_logbX(x);
 }
@@ -405,6 +407,8 @@ static __inline tf_float __compiler_rt_fmaxtf(tf_float x, 
tf_float y) {
 #define __compiler_rt_logbl crt_logbl
 #define __compiler_rt_scalbnl crt_scalbnl
 #define __compiler_rt_fmaxl crt_fmaxl
+#define crt_fabstf crt_fabsl
+#define crt_copysigntf crt_copysignl
 #else
 #error Unsupported TF mode type
 #endif
diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index 7624c728061518..ebbc63af598b76 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -189,8 +189,10 @@ typedef long double tf_float;
 #define CRT_LDBL_IEEE_F128
 #endif
 #define TF_C(x) x##L
-#elif __LDBL_MANT_DIG__ == 113
-// Use long double instead of __float128 if it matches the IEEE 128-bit format.
+#elif __LDBL_MANT_DIG__ == 113 ||  
\
+(__FLT_RADIX__ == 16 && __LDBL_MANT_DIG__ == 28)
+// Use long double instead of __float128 if it matches the IEEE 128-bit format
+// or the IBM hexadecimal format.
 #define CRT_LDBL_128BIT
 #define CRT_HAS_F128
 #define CRT_HAS_IEEE_TF
diff --git a/compiler-rt/lib/builtins/multc3.c 
b/compiler-rt/lib/builtins/multc3.c
index f20e53ccbf233b..21c522d0330b7f 100644
--- a/compiler-rt/lib/builtins/multc3.c
+++ b/compiler-rt/lib/builtins/multc3.c
@@ -15,8 +15,6 @@
 #include "int_lib.h"
 #include "int_math.h"
 
-#if defined(CRT_HAS_TF_MODE)
-
 // Returns: the product of a + ib and c + id
 
 COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, fp_t d) {
@@ -66,5 +64,3 @@ COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, 
fp_t d) {
   }
   return z;
 }
-
-#endif

>From 81b814ccc0b216eb9464c9fa5d4d28b0511c2338 Mon Sep 17 00:00:00 2001
From: Sean Perry <39927768+perry...@users.noreply.github.com>
Date: Tue, 9 Jan 2024 23:49:29 -0500
Subject: [PATCH 2/5] formatting update

---
 compiler-rt/lib/builtins/divtc3.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index 6ec9c5f17d4b68..7d3185c9d71fbb 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-
 // Returns: the quotient of (a + ib) / (c + id)
 
 COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t __c, fp_t __d) {

>From 2cb932ab37caf472aa296f5d7c811feada8464f0 Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Wed, 10 Jan 2024 16:03:48 -0600
Subject: [PATCH 3/5] only define CRT_HAS_F128 & CRT_HAS_IEEE_TF for IEEE

---
 compiler-rt/lib/builtins/int_types.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index ebbc63af598b76..9ceced37a997f4 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -194,8 +194,10 @@ typedef long double tf_float;
 // Use long double instead of __float128 if it matches the IEEE 128-

[Lldb-commits] [llvm] [libunwind] [compiler-rt] [lld] [clang-tools-extra] [libc] [flang] [libcxx] [clang] [lldb] [libclc] [libcxxabi] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Alexander Richardson via lldb-commits


@@ -15,8 +15,6 @@
 #include "int_lib.h"
 #include "int_math.h"
 
-#if defined(CRT_HAS_TF_MODE)

arichardson wrote:

I'm not sure if we support architectures without a "tf" floating point type. To 
be safe I believe we still need a guard here since this file is compiled 
unconditionally. We just have to replace it with "CRT_HAS_F128".

A nice future cleanup would be to change CRT_HAS_TF_MODE to actually mean 
tf_float exists and explicitly guard for INT128 where needed. But that is a 
larger cleanup that probably shouldn't be part of this PR.

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


[Lldb-commits] [flang] [clang-tools-extra] [lld] [llvm] [libcxx] [compiler-rt] [clang] [libcxxabi] [libc] [libunwind] [lldb] [libclc] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Alexander Richardson via lldb-commits


@@ -13,8 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-#if defined(CRT_HAS_TF_MODE)

arichardson wrote:

I'd suggest replacing this with CRT_HAS_F128 as noted below (unless you're will 
to audit all current uses of CRT_HAS_TF_MODE since that currently is a proxy 
for TF_MODE&&INT128 rather than just TF_MODE).

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


[Lldb-commits] [libcxxabi] [clang-tools-extra] [libc] [clang] [llvm] [lld] [mlir] [flang] [libcxx] [lldb] [libunwind] [openmp] [compiler-rt] [clang] static operators should evaluate object argument (P

2024-01-11 Thread Tianlan Zhou via lldb-commits

https://github.com/SuperSodaSea updated 
https://github.com/llvm/llvm-project/pull/68485

>From 03276260c48d9cafb2a0d80825156e77cdf02eba Mon Sep 17 00:00:00 2001
From: SuperSodaSea 
Date: Sat, 7 Oct 2023 21:05:17 +0800
Subject: [PATCH 01/15] [clang] static operators should evaluate object
 argument

---
 clang/lib/AST/ExprConstant.cpp|  3 +-
 clang/lib/CodeGen/CGExpr.cpp  |  2 +-
 clang/lib/CodeGen/CGExprCXX.cpp   | 41 --
 clang/lib/CodeGen/CodeGenFunction.h   |  3 +
 clang/lib/Sema/SemaChecking.cpp   |  5 +-
 clang/lib/Sema/SemaOverload.cpp   | 33 ---
 clang/test/AST/ast-dump-static-operators.cpp  | 55 +++
 .../CodeGenCXX/cxx2b-static-call-operator.cpp | 26 ++---
 .../cxx2b-static-subscript-operator.cpp   | 11 +++-
 9 files changed, 137 insertions(+), 42 deletions(-)
 create mode 100644 clang/test/AST/ast-dump-static-operators.cpp

diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 5a33e918db8e8c..a6c81f467fbe01 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -7806,7 +7806,8 @@ class ExprEvaluatorBase
   // Overloaded operator calls to member functions are represented as 
normal
   // calls with '*this' as the first argument.
   const CXXMethodDecl *MD = dyn_cast(FD);
-  if (MD && MD->isImplicitObjectMemberFunction()) {
+  if (MD &&
+  (MD->isImplicitObjectMemberFunction() || (OCE && MD->isStatic( {
 // FIXME: When selecting an implicit conversion for an overloaded
 // operator delete, we sometimes try to evaluate calls to conversion
 // operators without a 'this' parameter!
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 54a1d300a9ac73..19406ff174dea1 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -5070,7 +5070,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
   if (const auto *CE = dyn_cast(E))
 if (const auto *MD =
 dyn_cast_if_present(CE->getCalleeDecl());
-MD && MD->isImplicitObjectMemberFunction())
+MD && !MD->isExplicitObjectMemberFunction())
   return EmitCXXOperatorMemberCallExpr(CE, MD, ReturnValue);
 
   CGCallee callee = EmitCallee(E->getCallee());
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 2e7059cc8f5b63..a580c635998510 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -489,11 +489,42 @@ RValue
 CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
const CXXMethodDecl *MD,
ReturnValueSlot ReturnValue) {
-  assert(MD->isImplicitObjectMemberFunction() &&
- "Trying to emit a member call expr on a static method!");
-  return EmitCXXMemberOrOperatorMemberCallExpr(
-  E, MD, ReturnValue, /*HasQualifier=*/false, /*Qualifier=*/nullptr,
-  /*IsArrow=*/false, E->getArg(0));
+  assert(!MD->isExplicitObjectMemberFunction() &&
+ "Trying to emit a member call expr on an explicit object member "
+ "function!");
+
+  if (MD->isStatic())
+return EmitCXXStaticOperatorMemberCallExpr(E, MD, ReturnValue);
+  else
+return EmitCXXMemberOrOperatorMemberCallExpr(
+E, MD, ReturnValue, /*HasQualifier=*/false, /*Qualifier=*/nullptr,
+/*IsArrow=*/false, E->getArg(0));
+}
+
+RValue CodeGenFunction::EmitCXXStaticOperatorMemberCallExpr(
+const CXXOperatorCallExpr *E, const CXXMethodDecl *MD,
+ReturnValueSlot ReturnValue) {
+  assert(MD->isStatic());
+
+  CGCallee Callee = EmitCallee(E->getCallee());
+
+  // Emit and ignore `this` pointer.
+  EmitIgnoredExpr(E->getArg(0));
+
+  auto ProtoType = MD->getFunctionType()->castAs();
+
+  // Emit the rest of the call args.
+  CallArgList Args;
+  EmitCallArgs(Args, ProtoType, drop_begin(E->arguments(), 1),
+   E->getDirectCallee());
+
+  bool Chain = E == MustTailCall;
+  const CGFunctionInfo &FnInfo =
+  CGM.getTypes().arrangeFreeFunctionCall(Args, ProtoType, Chain);
+  llvm::CallBase *CallOrInvoke = nullptr;
+
+  return EmitCall(FnInfo, Callee, ReturnValue, Args, &CallOrInvoke, Chain,
+  E->getExprLoc());
 }
 
 RValue CodeGenFunction::EmitCUDAKernelCallExpr(const CUDAKernelCallExpr *E,
diff --git a/clang/lib/CodeGen/CodeGenFunction.h 
b/clang/lib/CodeGen/CodeGenFunction.h
index d5336382a2b9c9..42de125e748991 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -4163,6 +4163,9 @@ class CodeGenFunction : public CodeGenTypeCache {
   RValue EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
const CXXMethodDecl *MD,
ReturnValueSlot ReturnValue);
+  RValue EmitCXXStaticOperatorMemberCallExpr(const CXXOperatorCallExpr *C

[Lldb-commits] [llvm] [flang] [clang] [clang-tools-extra] [compiler-rt] [libc] [lldb] [lld] [libcxx] [AMDGPU] Use alias info to relax waitcounts for LDS DMA (PR #74537)

2024-01-11 Thread Stanislav Mekhanoshin via lldb-commits

rampitec wrote:

Ping

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


[Lldb-commits] [compiler-rt] [libcxx] [lld] [mlir] [clang] [llvm] [openmp] [flang] [lldb] [clang-format] SpacesInSquareBrackets not working for Java (PR #77833)

2024-01-11 Thread via lldb-commits

https://github.com/mydeveloperday created 
https://github.com/llvm/llvm-project/pull/77833

spaces in [] needs to be handled the same in Java the same as C#.


>From 4ccf762ec644b4f79b2862750035ec7a97cd74fc Mon Sep 17 00:00:00 2001
From: paul_hoad 
Date: Thu, 11 Jan 2024 20:50:48 +
Subject: [PATCH] [clang-format] SpacesInSquareBrackets not working for Java

spaces in [] needs to be handled the same in Java the same as C#.
---
 clang/lib/Format/TokenAnnotator.cpp   |  4 
 clang/unittests/Format/FormatTestJava.cpp | 15 +++
 2 files changed, 19 insertions(+)

diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 227aa0b97af6ba..bcd12ab65816b0 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -4668,6 +4668,10 @@ bool TokenAnnotator::spaceRequiredBefore(const 
AnnotatedLine &Line,
   } else if (Style.Language == FormatStyle::LK_Java) {
 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
   return true;
+// spaces inside square brackets.
+if (Left.is(tok::l_square) || Right.is(tok::r_square))
+  return Style.SpacesInSquareBrackets;
+
 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) {
   return Style.SpaceBeforeParensOptions.AfterControlStatements ||
  spaceRequiredBeforeParens(Right);
diff --git a/clang/unittests/Format/FormatTestJava.cpp 
b/clang/unittests/Format/FormatTestJava.cpp
index 202d603d057790..6da5f4fa254331 100644
--- a/clang/unittests/Format/FormatTestJava.cpp
+++ b/clang/unittests/Format/FormatTestJava.cpp
@@ -603,6 +603,21 @@ TEST_F(FormatTestJava, ShortFunctions) {
Style);
 }
 
+TEST_F(FormatTestJava, ConfigurableSpacesInSquareBrackets) {
+  FormatStyle Spaces = getLLVMStyle(FormatStyle::LK_Java);
+
+  verifyFormat("Object[] arguments", Spaces);
+  verifyFormat("final Class[] types = new Class[numElements];", Spaces);
+  verifyFormat("types[i] = arguments[i].getClass();", Spaces);
+
+  Spaces.SpacesInSquareBrackets = true;
+
+  verifyFormat("Object[ ] arguments", Spaces);
+  verifyFormat("final Class[ ] types = new Class[ numElements ];",
+   Spaces);
+  verifyFormat("types[ i ] = arguments[ i ].getClass();", Spaces);
+}
+
 } // namespace
 } // namespace test
 } // namespace format

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


[Lldb-commits] [llvm] [flang] [clang] [compiler-rt] [lldb] [mlir] [lld] [openmp] [libcxx] [clang-format] SpacesInSquareBrackets not working for Java (PR #77833)

2024-01-11 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-format

Author: MyDeveloperDay (mydeveloperday)


Changes

spaces in [] needs to be handled the same in Java the same as C#.


---
Full diff: https://github.com/llvm/llvm-project/pull/77833.diff


2 Files Affected:

- (modified) clang/lib/Format/TokenAnnotator.cpp (+4) 
- (modified) clang/unittests/Format/FormatTestJava.cpp (+15) 


``diff
diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index b31ecc840626f9..d7db3ef0027218 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -4674,6 +4674,10 @@ bool TokenAnnotator::spaceRequiredBefore(const 
AnnotatedLine &Line,
   } else if (Style.Language == FormatStyle::LK_Java) {
 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
   return true;
+// spaces inside square brackets.
+if (Left.is(tok::l_square) || Right.is(tok::r_square))
+  return Style.SpacesInSquareBrackets;
+
 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) {
   return Style.SpaceBeforeParensOptions.AfterControlStatements ||
  spaceRequiredBeforeParens(Right);
diff --git a/clang/unittests/Format/FormatTestJava.cpp 
b/clang/unittests/Format/FormatTestJava.cpp
index 202d603d057790..6da5f4fa254331 100644
--- a/clang/unittests/Format/FormatTestJava.cpp
+++ b/clang/unittests/Format/FormatTestJava.cpp
@@ -603,6 +603,21 @@ TEST_F(FormatTestJava, ShortFunctions) {
Style);
 }
 
+TEST_F(FormatTestJava, ConfigurableSpacesInSquareBrackets) {
+  FormatStyle Spaces = getLLVMStyle(FormatStyle::LK_Java);
+
+  verifyFormat("Object[] arguments", Spaces);
+  verifyFormat("final Class[] types = new Class[numElements];", Spaces);
+  verifyFormat("types[i] = arguments[i].getClass();", Spaces);
+
+  Spaces.SpacesInSquareBrackets = true;
+
+  verifyFormat("Object[ ] arguments", Spaces);
+  verifyFormat("final Class[ ] types = new Class[ numElements ];",
+   Spaces);
+  verifyFormat("types[ i ] = arguments[ i ].getClass();", Spaces);
+}
+
 } // namespace
 } // namespace test
 } // namespace format

``




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


[Lldb-commits] [compiler-rt] [libcxx] [lld] [mlir] [clang] [llvm] [openmp] [flang] [lldb] [clang-format] SpacesInSquareBrackets not working for Java (PR #77833)

2024-01-11 Thread via lldb-commits

mydeveloperday wrote:

Fixes #77740

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


[Lldb-commits] [lldb] [lldb-dap] Updating VariableDescription to use GetDescription() as a fallback. (PR #77026)

2024-01-11 Thread John Harrison via lldb-commits

ashgti wrote:

> That will work nicely.

Done, the latest revision will only use the description for hovers and repl 
contexts.


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


[Lldb-commits] [llvm] [flang] [clang] [clang-tools-extra] [compiler-rt] [libc] [lldb] [libcxxabi] [mlir] [lld] [openmp] [libcxx] [X86] Add support for indirect branch tracking in jump tables (PR #7767

2024-01-11 Thread Nicholas Mosier via lldb-commits

https://github.com/nmosier updated 
https://github.com/llvm/llvm-project/pull/77679

>From 35f91b27825a81b1ba171860b47bf8b0477fd95a Mon Sep 17 00:00:00 2001
From: Nicholas Mosier 
Date: Wed, 10 Jan 2024 19:27:30 +
Subject: [PATCH] [X86] Add support for indirect branch tracking in jump tables

This patch adds support for protecting jump tables with indirect branch 
tracking (IBT).
By default, indirect jump table branches are given a 'notrack' prefix and thus 
not protected with IBT.
This default behavior is suitable for traditional threat models, assuming the 
compiler generates correct jump table code.
However, for threat models encompassing speculative execution vulnerabilities 
(e.g., Spectre),
such notrack'ed indirect branches potentially introduce Spectre-v2-style 
vulnerabilites by allowing them to mis-speculatively jump to arbitrary target 
addresses, not just ENDBRANCH instructions.

To enable indirect branch tracking for jump tables, this patch allows the 
`cf-protection-branch` module flag's value to indicate the level of indirect 
branch protection required.
If `cf-protection-branch == 0` or `cf-protection-branch` is missing entirely, 
then branch protections are applied.
If `cf-protection-branch == 1`, then branch protections are applied for all 
indirect branches except for those that cannot under any circumstances 
non-speculatively jump to the wrong target (namely, indirect jump table 
branches).
If `cf-protection-branch >= 2`, then branch protections are applied to all 
indirect branches, including indirect jump table branches.

To summarize the new interpretation of the `cf-protection-branch` module flag 
under this patch:
* `cf-protection-branch == 1` (currently emitted by clang when passed flag 
`-fcf-protection=branch`) is suitable for hardening code against 
non-speculative control-flow hijacks.
* `cf-protection-branch >= 2` is suitable for additionally hardening code 
against speculative control-flow hijacks (e.g., Spectre v2).
---
 llvm/lib/Target/X86/X86.h |  1 +
 llvm/lib/Target/X86/X86ISelLowering.cpp   | 21 +++
 .../Target/X86/X86IndirectBranchTracking.cpp  | 29 ---
 llvm/lib/Target/X86/X86TargetMachine.cpp  |  1 +
 .../X86/indirect-branch-tracking-jt.mir   | 35 +++
 5 files changed, 77 insertions(+), 10 deletions(-)
 create mode 100644 llvm/test/CodeGen/X86/indirect-branch-tracking-jt.mir

diff --git a/llvm/lib/Target/X86/X86.h b/llvm/lib/Target/X86/X86.h
index 21623a805f5568..277259c74abae2 100644
--- a/llvm/lib/Target/X86/X86.h
+++ b/llvm/lib/Target/X86/X86.h
@@ -199,6 +199,7 @@ void initializeX86ReturnThunksPass(PassRegistry &);
 void initializeX86SpeculativeExecutionSideEffectSuppressionPass(PassRegistry 
&);
 void initializeX86SpeculativeLoadHardeningPassPass(PassRegistry &);
 void initializeX86TileConfigPass(PassRegistry &);
+void initializeX86IndirectBranchTrackingPassPass(PassRegistry &);
 
 namespace X86AS {
 enum : unsigned {
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp 
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 5f6f500e49dd2a..71a20b439b5fad 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -56365,12 +56365,21 @@ SDValue 
X86TargetLowering::expandIndirectJTBranch(const SDLoc &dl,
   int JTI,
   SelectionDAG &DAG) const {
   const Module *M = DAG.getMachineFunction().getMMI().getModule();
-  Metadata *IsCFProtectionSupported = M->getModuleFlag("cf-protection-branch");
-  if (IsCFProtectionSupported) {
-// In case control-flow branch protection is enabled, we need to add
-// notrack prefix to the indirect branch.
-// In order to do that we create NT_BRIND SDNode.
-// Upon ISEL, the pattern will convert it to jmp with NoTrack prefix.
+
+  uint64_t CFProtectionBranchLevel = 0;
+  if (Metadata *CFProtectionBranchEnabled =
+  M->getModuleFlag("cf-protection-branch"))
+CFProtectionBranchLevel =
+cast(CFProtectionBranchEnabled)
+->getValue()
+->getUniqueInteger()
+.getLimitedValue();
+
+  if (CFProtectionBranchLevel == 1) {
+// In case control-flow branch protection is enabled but we are not
+// protecting jump table branches, we need to add notrack prefix to the
+// indirect branch. In order to do that we create NT_BRIND SDNode. Upon
+// ISEL, the pattern will convert it to jmp with NoTrack prefix.
 SDValue JTInfo = DAG.getJumpTableDebugInfo(JTI, Value, dl);
 return DAG.getNode(X86ISD::NT_BRIND, dl, MVT::Other, JTInfo, Addr);
   }
diff --git a/llvm/lib/Target/X86/X86IndirectBranchTracking.cpp 
b/llvm/lib/Target/X86/X86IndirectBranchTracking.cpp
index 785bdd83cd998b..0710af3af8469a 100644
--- a/llvm/lib/Target/X86/X86IndirectBranchTracking.cpp
+++ b/llvm/lib/Target/X86/X86IndirectBranchTracking.cpp
@@ -22,11 +22,13 @@
 #include "llvm/ADT/Statistic.h"
 

[Lldb-commits] [llvm] [flang] [clang] [compiler-rt] [lldb] [mlir] [lld] [openmp] [libcxx] [clang-format] SpacesInSquareBrackets not working for Java (PR #77833)

2024-01-11 Thread Björn Schäpers via lldb-commits

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


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


[Lldb-commits] [mlir] [lldb] [clang] [flang] [libc] [llvm] [clang-tools-extra] [libcxx] [BOLT] Delta-encode offsets in BAT (PR #76900)

2024-01-11 Thread Amir Ayupov via lldb-commits

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


[Lldb-commits] [mlir] [lldb] [clang] [flang] [libc] [llvm] [clang-tools-extra] [libcxx] [BOLT] Delta-encode offsets in BAT (PR #76900)

2024-01-11 Thread Amir Ayupov via lldb-commits

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


[Lldb-commits] [lldb] [libc] [flang] [llvm] [libcxx] [mlir] [clang] [clang-tools-extra] [BOLT] Delta-encode function start addresses in BAT (PR #76902)

2024-01-11 Thread Amir Ayupov via lldb-commits

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


[Lldb-commits] [llvm] [clang-tools-extra] [lldb] [clang] [libc] [libcxx] [mlir] [openmp] [flang] [BOLT] Delta-encode function start addresses in BAT (PR #76902)

2024-01-11 Thread Amir Ayupov via lldb-commits

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


[Lldb-commits] [llvm] [clang-tools-extra] [lldb] [clang] [libc] [libcxx] [mlir] [openmp] [flang] [BOLT] Delta-encode function start addresses in BAT (PR #76902)

2024-01-11 Thread Amir Ayupov via lldb-commits

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


[Lldb-commits] [lld] [clang] [libc] [lldb] [libunwind] [llvm] [compiler-rt] [libcxxabi] [flang] [libcxx] [clang-tools-extra] [Sema] Use lexical DC for friend functions when getting constraint instanti

2024-01-11 Thread via lldb-commits

https://github.com/antangelo updated 
https://github.com/llvm/llvm-project/pull/77552

>From f9e35231207090afcda91d3cd3551d7d1639598b Mon Sep 17 00:00:00 2001
From: Antonio Abbatangelo 
Date: Tue, 9 Jan 2024 20:20:30 -0500
Subject: [PATCH] [Sema] Use lexical DC for friend functions when getting
 constraint instantiation args

Fixes a crash where the template argument depth computed in the semantic
context for a friend FunctionDecl with a constrained parameter is
compared against arguments in the lexical context for the purpose
of checking if the constraint depends on enclosing template parameters.

Since getTemplateInstantiationArgs in this case follows the semantic
DC for friend FunctionDecls, the resulting depth is incorrect and
trips an assertion.
---
 clang/docs/ReleaseNotes.rst|  4 
 clang/lib/Sema/SemaTemplateInstantiate.cpp |  3 +++
 clang/test/SemaTemplate/GH75426.cpp| 16 
 3 files changed, 23 insertions(+)
 create mode 100644 clang/test/SemaTemplate/GH75426.cpp

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 46f4b82b89e488..a3035fd07282d0 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -705,6 +705,10 @@ Bug Fixes in This Version
 - Fix assertion crash due to failed scope restoring caused by too-early VarDecl
   invalidation by invalid initializer Expr.
   Fixes (`#30908 `_)
+- Fix assertion failure when declaring a template friend function with
+  a constrained parameter in a template class that declares a class method
+  or lambda at different depth.
+  Fixes (`#75426 `_)
 
 
 Bug Fixes to Compiler Builtins
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp 
b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 7f20413c104e97..fc80515b45e35b 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -223,6 +223,9 @@ Response HandleFunction(const FunctionDecl *Function,
   (!Pattern || !Pattern->getLexicalDeclContext()->isFileContext())) {
 return Response::ChangeDecl(Function->getLexicalDeclContext());
   }
+
+  if (ForConstraintInstantiation && Function->getFriendObjectKind())
+return Response::ChangeDecl(Function->getLexicalDeclContext());
   return Response::UseNextDecl(Function);
 }
 
diff --git a/clang/test/SemaTemplate/GH75426.cpp 
b/clang/test/SemaTemplate/GH75426.cpp
new file mode 100644
index 00..faf70699f9c5f0
--- /dev/null
+++ b/clang/test/SemaTemplate/GH75426.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+template concept C = true;
+
+struct A {
+template void f();
+};
+
+auto L = []{};
+
+template
+class Friends {
+template friend void A::f();
+template friend void decltype(L)::operator()();
+};

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


[Lldb-commits] [lldb] [lldb] Adjust DynamicLoaderDarwin::GetThreadLocalData to support changes to TLS on macOS (PR #77854)

2024-01-11 Thread Alex Langford via lldb-commits

https://github.com/bulbazord created 
https://github.com/llvm/llvm-project/pull/77854

TLS implementation on Apple OSes has changed. Instead of acquiring a 
pthread_key and calling pthread_getspecific, we instead acquire a function 
pointer and perform a function call with it. This fixes accessing thread local 
storage on macOS 14 (Sonoma) and newer.

Note: Some versions of Apple's new linker do not emit debug symbols for TLS 
symbols. This causes the TLS tests to fail because LLDB and dsymutil expects 
there to be debug symbols to resolve the relevant TLS block. You may work 
around this by switching to the older linker or disabling the test until you 
have a newer version of the new linker.

rdar://120676969

>From 9dff64855a0b19f60c736b85ad091b7fd309ecf7 Mon Sep 17 00:00:00 2001
From: Alex Langford 
Date: Thu, 11 Jan 2024 15:51:04 -0800
Subject: [PATCH] [lldb] Adjust DynamicLoaderDarwin::GetThreadLocalData to
 support changes to TLS on macOS

TLS implementation on Apple OSes has changed. Instead of acquiring a
pthread_key and calling pthread_getspecific, we instead acquire a
function pointer and perform a function call with
it. This fixes accessing thread local storage on macOS 14 (Sonoma) and
newer.

Note: Some versions of Apple's new linker do not emit debug symbols for
TLS symbols. This causes the TLS tests to fail because LLDB and dsymutil
expects there to be debug symbols to resolve the relevant TLS block.
You may work around this by switching to the older linker or disabling
the test until you have a newer version of the new linker.
---
 .../MacOSX-DYLD/DynamicLoaderDarwin.cpp   | 159 +++---
 1 file changed, 98 insertions(+), 61 deletions(-)

diff --git 
a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp 
b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index 1e3e2e5641ad83..7c5c0efd9ba464 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -1048,70 +1048,107 @@ DynamicLoaderDarwin::GetThreadLocalData(const 
lldb::ModuleSP module_sp,
 
   std::lock_guard guard(m_mutex);
 
-  const uint32_t addr_size = m_process->GetAddressByteSize();
+  lldb_private::Address tls_addr;
+  if (!module_sp->ResolveFileAddress(tls_file_addr, tls_addr))
+return LLDB_INVALID_ADDRESS;
+
+  Target &target = m_process->GetTarget();
   uint8_t buf[sizeof(lldb::addr_t) * 3];
+  const uint32_t addr_size = m_process->GetAddressByteSize();
+  const size_t tls_data_size = addr_size * 3;
+  Status error;
+  const size_t bytes_read = target.ReadMemory(
+  tls_addr, buf, tls_data_size, error, /*force_live_memory = */ true);
+  if (bytes_read != tls_data_size || error.Fail())
+return LLDB_INVALID_ADDRESS;
 
-  lldb_private::Address tls_addr;
-  if (module_sp->ResolveFileAddress(tls_file_addr, tls_addr)) {
-Status error;
-const size_t tsl_data_size = addr_size * 3;
-Target &target = m_process->GetTarget();
-if (target.ReadMemory(tls_addr, buf, tsl_data_size, error, true) ==
-tsl_data_size) {
-  const ByteOrder byte_order = m_process->GetByteOrder();
-  DataExtractor data(buf, sizeof(buf), byte_order, addr_size);
-  lldb::offset_t offset = addr_size; // Skip the first pointer
-  const lldb::addr_t pthread_key = data.GetAddress(&offset);
-  const lldb::addr_t tls_offset = data.GetAddress(&offset);
-  if (pthread_key != 0) {
-// First check to see if we have already figured out the location of
-// TLS data for the pthread_key on a specific thread yet. If we have we
-// can re-use it since its location will not change unless the process
-// execs.
-const tid_t tid = thread_sp->GetID();
-auto tid_pos = m_tid_to_tls_map.find(tid);
-if (tid_pos != m_tid_to_tls_map.end()) {
-  auto tls_pos = tid_pos->second.find(pthread_key);
-  if (tls_pos != tid_pos->second.end()) {
-return tls_pos->second + tls_offset;
-  }
+  DataExtractor data(buf, sizeof(buf), m_process->GetByteOrder(), addr_size);
+  lldb::offset_t offset = 0;
+  const lldb::addr_t thunk_addr = data.GetAddress(&offset);
+  const lldb::addr_t key = data.GetAddress(&offset);
+  const lldb::addr_t tls_offset = data.GetAddress(&offset);
+
+  TypeSystemClangSP scratch_ts_sp =
+  ScratchTypeSystemClang::GetForTarget(target);
+  if (!scratch_ts_sp)
+return LLVM_INVALID_ADDRESS;
+  CompilerType clang_void_ptr_type =
+  scratch_ts_sp->GetBasicType(eBasicTypeVoid).GetPointerType();
+  EvaluateExpressionOptions options;
+  DiagnosticManager execution_errors;
+  ExecutionContext exe_ctx(thread_sp);
+
+  // On modern apple platforms, there is a small data structure that looks
+  // approximately like this:
+  // struct TLS_Thunk {
+  //  void *(*get_addr)(struct TLS_Thunk *);
+  //  size_t key;
+  //  size_t offset;
+  // }
+  //
+  // The strategy is to take get_addr f

[Lldb-commits] [lldb] [lldb] Adjust DynamicLoaderDarwin::GetThreadLocalData to support changes to TLS on macOS (PR #77854)

2024-01-11 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Alex Langford (bulbazord)


Changes

TLS implementation on Apple OSes has changed. Instead of acquiring a 
pthread_key and calling pthread_getspecific, we instead acquire a function 
pointer and perform a function call with it. This fixes accessing thread local 
storage on macOS 14 (Sonoma) and newer.

Note: Some versions of Apple's new linker do not emit debug symbols for TLS 
symbols. This causes the TLS tests to fail because LLDB and dsymutil expects 
there to be debug symbols to resolve the relevant TLS block. You may work 
around this by switching to the older linker or disabling the test until you 
have a newer version of the new linker.

rdar://120676969

---
Full diff: https://github.com/llvm/llvm-project/pull/77854.diff


1 Files Affected:

- (modified) 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp (+98-61) 


``diff
diff --git 
a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp 
b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index 1e3e2e5641ad83..7c5c0efd9ba464 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -1048,70 +1048,107 @@ DynamicLoaderDarwin::GetThreadLocalData(const 
lldb::ModuleSP module_sp,
 
   std::lock_guard guard(m_mutex);
 
-  const uint32_t addr_size = m_process->GetAddressByteSize();
+  lldb_private::Address tls_addr;
+  if (!module_sp->ResolveFileAddress(tls_file_addr, tls_addr))
+return LLDB_INVALID_ADDRESS;
+
+  Target &target = m_process->GetTarget();
   uint8_t buf[sizeof(lldb::addr_t) * 3];
+  const uint32_t addr_size = m_process->GetAddressByteSize();
+  const size_t tls_data_size = addr_size * 3;
+  Status error;
+  const size_t bytes_read = target.ReadMemory(
+  tls_addr, buf, tls_data_size, error, /*force_live_memory = */ true);
+  if (bytes_read != tls_data_size || error.Fail())
+return LLDB_INVALID_ADDRESS;
 
-  lldb_private::Address tls_addr;
-  if (module_sp->ResolveFileAddress(tls_file_addr, tls_addr)) {
-Status error;
-const size_t tsl_data_size = addr_size * 3;
-Target &target = m_process->GetTarget();
-if (target.ReadMemory(tls_addr, buf, tsl_data_size, error, true) ==
-tsl_data_size) {
-  const ByteOrder byte_order = m_process->GetByteOrder();
-  DataExtractor data(buf, sizeof(buf), byte_order, addr_size);
-  lldb::offset_t offset = addr_size; // Skip the first pointer
-  const lldb::addr_t pthread_key = data.GetAddress(&offset);
-  const lldb::addr_t tls_offset = data.GetAddress(&offset);
-  if (pthread_key != 0) {
-// First check to see if we have already figured out the location of
-// TLS data for the pthread_key on a specific thread yet. If we have we
-// can re-use it since its location will not change unless the process
-// execs.
-const tid_t tid = thread_sp->GetID();
-auto tid_pos = m_tid_to_tls_map.find(tid);
-if (tid_pos != m_tid_to_tls_map.end()) {
-  auto tls_pos = tid_pos->second.find(pthread_key);
-  if (tls_pos != tid_pos->second.end()) {
-return tls_pos->second + tls_offset;
-  }
+  DataExtractor data(buf, sizeof(buf), m_process->GetByteOrder(), addr_size);
+  lldb::offset_t offset = 0;
+  const lldb::addr_t thunk_addr = data.GetAddress(&offset);
+  const lldb::addr_t key = data.GetAddress(&offset);
+  const lldb::addr_t tls_offset = data.GetAddress(&offset);
+
+  TypeSystemClangSP scratch_ts_sp =
+  ScratchTypeSystemClang::GetForTarget(target);
+  if (!scratch_ts_sp)
+return LLVM_INVALID_ADDRESS;
+  CompilerType clang_void_ptr_type =
+  scratch_ts_sp->GetBasicType(eBasicTypeVoid).GetPointerType();
+  EvaluateExpressionOptions options;
+  DiagnosticManager execution_errors;
+  ExecutionContext exe_ctx(thread_sp);
+
+  // On modern apple platforms, there is a small data structure that looks
+  // approximately like this:
+  // struct TLS_Thunk {
+  //  void *(*get_addr)(struct TLS_Thunk *);
+  //  size_t key;
+  //  size_t offset;
+  // }
+  //
+  // The strategy is to take get_addr from the structure, call it with the
+  // address of the containing TLS_Thunk structure, and add the offset to the
+  // resulting pointer.
+
+  if (thunk_addr != 0) {
+Address thunk_load_addr;
+if (target.ResolveLoadAddress(thunk_addr, thunk_load_addr)) {
+  const lldb::addr_t tls_load_addr = tls_addr.GetLoadAddress(&target);
+  ThreadPlanSP thread_plan_sp(new ThreadPlanCallFunction(
+  *thread_sp, thunk_load_addr, clang_void_ptr_type,
+  llvm::ArrayRef(tls_load_addr), options));
+
+  lldb::ExpressionResults results = m_process->RunThreadPlan(
+  exe_ctx, thread_plan_sp, options, execution_errors);
+  if (results == lldb::eExpressionCompleted) {
+if (lldb::ValueObjectSP result_valobj_sp =
+   

[Lldb-commits] [lldb] [lldb-dap] Updating VariableDescription to use GetDescription() as a fallback. (PR #77026)

2024-01-11 Thread Greg Clayton via lldb-commits


@@ -405,6 +405,9 @@ struct VariableDescription {
   /// Create a JSON object that represents these extensions to the DAP variable
   /// response.
   llvm::json::Object GetVariableExtensionsJSON();
+
+  /// Returns a description of the value appropraite for the specified context.

clayborg wrote:

s/appropraite/appropriate/

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


[Lldb-commits] [lldb] [lldb-dap] Updating VariableDescription to use GetDescription() as a fallback. (PR #77026)

2024-01-11 Thread Greg Clayton via lldb-commits


@@ -173,21 +173,21 @@ TryCreateAutoSummaryForContainer(lldb::SBValue &v) {
 lldb::SBValue child = v.GetChildAtIndex(i);
 
 if (llvm::StringRef name = child.GetName(); !name.empty()) {
-  llvm::StringRef value;
+  llvm::StringRef desc;
   if (llvm::StringRef summary = child.GetSummary(); !summary.empty())
-value = summary;
+desc = summary;
+  else if (llvm::StringRef value = child.GetValue(); !value.empty())
+desc = value;
   else
-value = child.GetValue();
-
-  if (!value.empty()) {
-// If the child is an indexed entry, we don't show its index to save
-// characters.
-if (name.starts_with("["))
-  os << separator << value;
-else
-  os << separator << name << ":" << value;
-separator = ", ";
-  }
+desc = "{...}"; // Fallback for nested types.

clayborg wrote:

"{...}" should only be used for structs unions or classes. We are processing 
the children of an item. You will need to check the type class so I would 
recommend:
```
static bool IsClassStructOrUnionType(lldb::SBType t) {
  return (t.GetTypeClass() & (lldb::eTypeClassUnion | lldb::eTypeClassStruct | 
lldb::eTypeClassUnion)) != 0
}
```

Then in the above code:
```
  if (IsClassStructOrUnionType(child.GetType())
desc = "{...}"
```
It seems we would want this description for a top level class/struct/union as 
well

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


[Lldb-commits] [lldb] [lldb-dap] Updating VariableDescription to use GetDescription() as a fallback. (PR #77026)

2024-01-11 Thread Greg Clayton via lldb-commits


@@ -1210,15 +1210,16 @@ bool SBValue::GetDescription(SBStream &description) {
 
   ValueLocker locker;
   lldb::ValueObjectSP value_sp(GetSP(locker));
-  if (value_sp) {
-DumpValueObjectOptions options;
-options.SetUseDynamicType(m_opaque_sp->GetUseDynamic());
-options.SetUseSyntheticValue(m_opaque_sp->GetUseSynthetic());
-value_sp->Dump(strm, options);
-  } else {
+  if (!value_sp) {
 strm.PutCString("No value");

clayborg wrote:

OMG, that is horrible that we return false and yet still put "No value" into 
the stream???

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


[Lldb-commits] [lldb] [lldb] Adjust DynamicLoaderDarwin::GetThreadLocalData to support changes to TLS on macOS (PR #77854)

2024-01-11 Thread Alex Langford via lldb-commits


@@ -1048,70 +1048,107 @@ DynamicLoaderDarwin::GetThreadLocalData(const 
lldb::ModuleSP module_sp,
 
   std::lock_guard guard(m_mutex);
 
-  const uint32_t addr_size = m_process->GetAddressByteSize();
+  lldb_private::Address tls_addr;
+  if (!module_sp->ResolveFileAddress(tls_file_addr, tls_addr))
+return LLDB_INVALID_ADDRESS;
+
+  Target &target = m_process->GetTarget();
   uint8_t buf[sizeof(lldb::addr_t) * 3];
+  const uint32_t addr_size = m_process->GetAddressByteSize();
+  const size_t tls_data_size = addr_size * 3;
+  Status error;
+  const size_t bytes_read = target.ReadMemory(
+  tls_addr, buf, tls_data_size, error, /*force_live_memory = */ true);
+  if (bytes_read != tls_data_size || error.Fail())
+return LLDB_INVALID_ADDRESS;
 
-  lldb_private::Address tls_addr;
-  if (module_sp->ResolveFileAddress(tls_file_addr, tls_addr)) {
-Status error;
-const size_t tsl_data_size = addr_size * 3;
-Target &target = m_process->GetTarget();
-if (target.ReadMemory(tls_addr, buf, tsl_data_size, error, true) ==
-tsl_data_size) {
-  const ByteOrder byte_order = m_process->GetByteOrder();
-  DataExtractor data(buf, sizeof(buf), byte_order, addr_size);
-  lldb::offset_t offset = addr_size; // Skip the first pointer
-  const lldb::addr_t pthread_key = data.GetAddress(&offset);
-  const lldb::addr_t tls_offset = data.GetAddress(&offset);
-  if (pthread_key != 0) {
-// First check to see if we have already figured out the location of
-// TLS data for the pthread_key on a specific thread yet. If we have we
-// can re-use it since its location will not change unless the process
-// execs.
-const tid_t tid = thread_sp->GetID();
-auto tid_pos = m_tid_to_tls_map.find(tid);
-if (tid_pos != m_tid_to_tls_map.end()) {
-  auto tls_pos = tid_pos->second.find(pthread_key);
-  if (tls_pos != tid_pos->second.end()) {
-return tls_pos->second + tls_offset;
-  }
+  DataExtractor data(buf, sizeof(buf), m_process->GetByteOrder(), addr_size);
+  lldb::offset_t offset = 0;
+  const lldb::addr_t thunk_addr = data.GetAddress(&offset);
+  const lldb::addr_t key = data.GetAddress(&offset);
+  const lldb::addr_t tls_offset = data.GetAddress(&offset);
+
+  TypeSystemClangSP scratch_ts_sp =
+  ScratchTypeSystemClang::GetForTarget(target);
+  if (!scratch_ts_sp)
+return LLVM_INVALID_ADDRESS;
+  CompilerType clang_void_ptr_type =
+  scratch_ts_sp->GetBasicType(eBasicTypeVoid).GetPointerType();
+  EvaluateExpressionOptions options;
+  DiagnosticManager execution_errors;
+  ExecutionContext exe_ctx(thread_sp);
+
+  // On modern apple platforms, there is a small data structure that looks
+  // approximately like this:
+  // struct TLS_Thunk {
+  //  void *(*get_addr)(struct TLS_Thunk *);
+  //  size_t key;
+  //  size_t offset;
+  // }
+  //
+  // The strategy is to take get_addr from the structure, call it with the
+  // address of the containing TLS_Thunk structure, and add the offset to the
+  // resulting pointer.

bulbazord wrote:

I need to double check this actually. Not sure if we need to add the offset.

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


[Lldb-commits] [lldb] [lldb][NFCI] Remove CommandReturnObject from BreakpointIDList (PR #77858)

2024-01-11 Thread Alex Langford via lldb-commits

https://github.com/bulbazord created 
https://github.com/llvm/llvm-project/pull/77858

BreakpointIDList does not need to know about CommandReturnObject. 
BreakpointIDList::FindAndReplaceIDRanges is the last place that uses it in 
BreakpointIDList.

Instead of passing in a CommandReturnObject, it now returns an llvm::Error. The 
callsite uses the Error to populate the CommandReturnObject as needed.

>From d138a85dbddf5373e0a60d8467768c186e343f1b Mon Sep 17 00:00:00 2001
From: Alex Langford 
Date: Thu, 11 Jan 2024 16:51:03 -0800
Subject: [PATCH] [lldb][NFCI] Remove CommandReturnObject from BreakpointIDList

BreakpointIDList does not need to know about CommandReturnObject.
BreakpointIDList::FindAndReplaceIDRanges is the last place that uses it
in BreakpointIDList.

Instead of passing in a CommandReturnObject, it now returns an
llvm::Error. The callsite uses the Error to populate the
CommandReturnObject as needed.
---
 .../lldb/Breakpoint/BreakpointIDList.h| 10 ++--
 lldb/source/Breakpoint/BreakpointIDList.cpp   | 57 +--
 .../Commands/CommandObjectBreakpoint.cpp  | 54 +-
 3 files changed, 59 insertions(+), 62 deletions(-)

diff --git a/lldb/include/lldb/Breakpoint/BreakpointIDList.h 
b/lldb/include/lldb/Breakpoint/BreakpointIDList.h
index 6910024695d898..6416b2b04148a9 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointIDList.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointIDList.h
@@ -54,12 +54,10 @@ class BreakpointIDList {
   static std::pair
   SplitIDRangeExpression(llvm::StringRef in_string);
 
-  static void FindAndReplaceIDRanges(Args &old_args, Target *target,
- bool allow_locations,
- BreakpointName::Permissions
-   ::PermissionKinds purpose,
- CommandReturnObject &result,
- Args &new_args);
+  static llvm::Error
+  FindAndReplaceIDRanges(Args &old_args, Target *target, bool allow_locations,
+ BreakpointName::Permissions ::PermissionKinds purpose,
+ Args &new_args);
 
 private:
   BreakpointIDArray m_breakpoint_ids;
diff --git a/lldb/source/Breakpoint/BreakpointIDList.cpp 
b/lldb/source/Breakpoint/BreakpointIDList.cpp
index 05c461827cadd8..51185c30dabad8 100644
--- a/lldb/source/Breakpoint/BreakpointIDList.cpp
+++ b/lldb/source/Breakpoint/BreakpointIDList.cpp
@@ -11,9 +11,9 @@
 
 #include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/StreamString.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -93,12 +93,9 @@ bool BreakpointIDList::FindBreakpointID(const char 
*bp_id_str,
 //  NEW_ARGS should be a copy of OLD_ARGS, with and ID range specifiers 
replaced
 //  by the members of the range.
 
-void BreakpointIDList::FindAndReplaceIDRanges(Args &old_args, Target *target,
-  bool allow_locations,
-  BreakpointName::Permissions
-  ::PermissionKinds purpose,
-  CommandReturnObject &result,
-  Args &new_args) {
+llvm::Error BreakpointIDList::FindAndReplaceIDRanges(
+Args &old_args, Target *target, bool allow_locations,
+BreakpointName::Permissions ::PermissionKinds purpose, Args &new_args) {
   llvm::StringRef range_from;
   llvm::StringRef range_to;
   llvm::StringRef current_arg;
@@ -109,11 +106,11 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args 
&old_args, Target *target,
 
 current_arg = old_args[i].ref();
 if (!allow_locations && current_arg.contains('.')) {
-  result.AppendErrorWithFormat(
+  new_args.Clear();
+  return llvm::createStringError(
+  llvm::inconvertibleErrorCode(),
   "Breakpoint locations not allowed, saw location: %s.",
   current_arg.str().c_str());
-  new_args.Clear();
-  return;
 }
 
 Status error;
@@ -125,8 +122,8 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args 
&old_args, Target *target,
 } else if (BreakpointID::StringIsBreakpointName(current_arg, error)) {
   if (!error.Success()) {
 new_args.Clear();
-result.AppendError(error.AsCString());
-return;
+return llvm::createStringError(llvm::inconvertibleErrorCode(),
+   error.AsCString());
   } else
 names_found.insert(std::string(current_arg));
 } else if ((i + 2 < old_args.size()) &&
@@ -152,9 +149,10 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args 
&old_args, Target *target,
 breakpoint_sp = 
target->GetBreakpointByID(bp_id->GetBreakpointID());
   if (!breakpoint_sp

[Lldb-commits] [lldb] [lldb][NFCI] Remove CommandReturnObject from BreakpointIDList (PR #77858)

2024-01-11 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Alex Langford (bulbazord)


Changes

BreakpointIDList does not need to know about CommandReturnObject. 
BreakpointIDList::FindAndReplaceIDRanges is the last place that uses it in 
BreakpointIDList.

Instead of passing in a CommandReturnObject, it now returns an llvm::Error. The 
callsite uses the Error to populate the CommandReturnObject as needed.

---
Full diff: https://github.com/llvm/llvm-project/pull/77858.diff


3 Files Affected:

- (modified) lldb/include/lldb/Breakpoint/BreakpointIDList.h (+4-6) 
- (modified) lldb/source/Breakpoint/BreakpointIDList.cpp (+27-30) 
- (modified) lldb/source/Commands/CommandObjectBreakpoint.cpp (+28-26) 


``diff
diff --git a/lldb/include/lldb/Breakpoint/BreakpointIDList.h 
b/lldb/include/lldb/Breakpoint/BreakpointIDList.h
index 6910024695d898..6416b2b04148a9 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointIDList.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointIDList.h
@@ -54,12 +54,10 @@ class BreakpointIDList {
   static std::pair
   SplitIDRangeExpression(llvm::StringRef in_string);
 
-  static void FindAndReplaceIDRanges(Args &old_args, Target *target,
- bool allow_locations,
- BreakpointName::Permissions
-   ::PermissionKinds purpose,
- CommandReturnObject &result,
- Args &new_args);
+  static llvm::Error
+  FindAndReplaceIDRanges(Args &old_args, Target *target, bool allow_locations,
+ BreakpointName::Permissions ::PermissionKinds purpose,
+ Args &new_args);
 
 private:
   BreakpointIDArray m_breakpoint_ids;
diff --git a/lldb/source/Breakpoint/BreakpointIDList.cpp 
b/lldb/source/Breakpoint/BreakpointIDList.cpp
index 05c461827cadd8..51185c30dabad8 100644
--- a/lldb/source/Breakpoint/BreakpointIDList.cpp
+++ b/lldb/source/Breakpoint/BreakpointIDList.cpp
@@ -11,9 +11,9 @@
 
 #include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/Args.h"
+#include "lldb/Utility/StreamString.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -93,12 +93,9 @@ bool BreakpointIDList::FindBreakpointID(const char 
*bp_id_str,
 //  NEW_ARGS should be a copy of OLD_ARGS, with and ID range specifiers 
replaced
 //  by the members of the range.
 
-void BreakpointIDList::FindAndReplaceIDRanges(Args &old_args, Target *target,
-  bool allow_locations,
-  BreakpointName::Permissions
-  ::PermissionKinds purpose,
-  CommandReturnObject &result,
-  Args &new_args) {
+llvm::Error BreakpointIDList::FindAndReplaceIDRanges(
+Args &old_args, Target *target, bool allow_locations,
+BreakpointName::Permissions ::PermissionKinds purpose, Args &new_args) {
   llvm::StringRef range_from;
   llvm::StringRef range_to;
   llvm::StringRef current_arg;
@@ -109,11 +106,11 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args 
&old_args, Target *target,
 
 current_arg = old_args[i].ref();
 if (!allow_locations && current_arg.contains('.')) {
-  result.AppendErrorWithFormat(
+  new_args.Clear();
+  return llvm::createStringError(
+  llvm::inconvertibleErrorCode(),
   "Breakpoint locations not allowed, saw location: %s.",
   current_arg.str().c_str());
-  new_args.Clear();
-  return;
 }
 
 Status error;
@@ -125,8 +122,8 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args 
&old_args, Target *target,
 } else if (BreakpointID::StringIsBreakpointName(current_arg, error)) {
   if (!error.Success()) {
 new_args.Clear();
-result.AppendError(error.AsCString());
-return;
+return llvm::createStringError(llvm::inconvertibleErrorCode(),
+   error.AsCString());
   } else
 names_found.insert(std::string(current_arg));
 } else if ((i + 2 < old_args.size()) &&
@@ -152,9 +149,10 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args 
&old_args, Target *target,
 breakpoint_sp = 
target->GetBreakpointByID(bp_id->GetBreakpointID());
   if (!breakpoint_sp) {
 new_args.Clear();
-result.AppendErrorWithFormat("'%d' is not a valid breakpoint 
ID.\n",
- bp_id->GetBreakpointID());
-return;
+return llvm::createStringError(
+llvm::inconvertibleErrorCode(),
+"'%d' is not a valid breakpoint ID.\n",
+bp_id->GetBreakpointID());
   }
   const size_t num_locations = break

[Lldb-commits] [lldb] [lldb-dap] Updating VariableDescription to use GetDescription() as a fallback. (PR #77026)

2024-01-11 Thread John Harrison via lldb-commits


@@ -1210,15 +1210,16 @@ bool SBValue::GetDescription(SBStream &description) {
 
   ValueLocker locker;
   lldb::ValueObjectSP value_sp(GetSP(locker));
-  if (value_sp) {
-DumpValueObjectOptions options;
-options.SetUseDynamicType(m_opaque_sp->GetUseDynamic());
-options.SetUseSyntheticValue(m_opaque_sp->GetUseSynthetic());
-value_sp->Dump(strm, options);
-  } else {
+  if (!value_sp) {
 strm.PutCString("No value");

ashgti wrote:

I wasn't sure if the `No value` output was an expected behavior on the SBValue, 
so I didn't want to change that behavior.

For example:

```
$ lldb
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> lldb.SBValue() # __str__ > __repr__ > SBValue::GetDescription
No value
```

If I removed the `No value` string, then GetDescription would simply return "" 
or maybe None. I can update that if its appropriate, but I wasn't sure if that 
behavioral change was desired.

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


[Lldb-commits] [flang] [libcxx] [openmp] [llvm] [clang] [lldb] [lld] [mlir] [compiler-rt] [clang-format] SpacesInSquareBrackets not working for Java (PR #77833)

2024-01-11 Thread Emilia Kond via lldb-commits

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


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


[Lldb-commits] [flang] [libc] [libcxx] [llvm] [clang] [lldb] [lld] [clang-tools-extra] [libcxxabi] [libunwind] [libclc] [compiler-rt] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Sean Perry via lldb-commits

https://github.com/perry-ca updated 
https://github.com/llvm/llvm-project/pull/77554

>From 7ba4d61bd2beda03ba0fcefc9ca5c1ff08ffd48e Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Tue, 9 Jan 2024 20:59:28 -0600
Subject: [PATCH 1/6] Generate __multc3 for z/OS

---
 compiler-rt/lib/builtins/divtc3.c| 3 ---
 compiler-rt/lib/builtins/fp_lib.h| 8 ++--
 compiler-rt/lib/builtins/int_types.h | 6 --
 compiler-rt/lib/builtins/multc3.c| 4 
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index e970cef574b21d..6ec9c5f17d4b68 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-#if defined(CRT_HAS_TF_MODE)
 
 // Returns: the quotient of (a + ib) / (c + id)
 
@@ -52,5 +51,3 @@ COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t 
__c, fp_t __d) {
   }
   return z;
 }
-
-#endif
diff --git a/compiler-rt/lib/builtins/fp_lib.h 
b/compiler-rt/lib/builtins/fp_lib.h
index af406e760497a4..a293788fc68f56 100644
--- a/compiler-rt/lib/builtins/fp_lib.h
+++ b/compiler-rt/lib/builtins/fp_lib.h
@@ -188,6 +188,8 @@ static __inline void wideMultiply(rep_t a, rep_t b, rep_t 
*hi, rep_t *lo) {
 #undef Word_HiMask
 #undef Word_LoMask
 #undef Word_FullMask
+#else
+typedef long double fp_t;
 #endif // defined(CRT_HAS_TF_MODE)
 #else
 #error SINGLE_PRECISION, DOUBLE_PRECISION or QUAD_PRECISION must be defined.
@@ -374,10 +376,10 @@ static __inline fp_t __compiler_rt_fmax(fp_t x, fp_t y) {
 #endif
 }
 
-#elif defined(QUAD_PRECISION) && defined(CRT_HAS_TF_MODE)
+#elif defined(QUAD_PRECISION)
 // The generic implementation only works for ieee754 floating point. For other
 // floating point types, continue to rely on the libm implementation for now.
-#if defined(CRT_HAS_IEEE_TF)
+#if defined(CRT_HAS_TF_MODE) && defined(CRT_HAS_IEEE_TF)
 static __inline tf_float __compiler_rt_logbtf(tf_float x) {
   return __compiler_rt_logbX(x);
 }
@@ -405,6 +407,8 @@ static __inline tf_float __compiler_rt_fmaxtf(tf_float x, 
tf_float y) {
 #define __compiler_rt_logbl crt_logbl
 #define __compiler_rt_scalbnl crt_scalbnl
 #define __compiler_rt_fmaxl crt_fmaxl
+#define crt_fabstf crt_fabsl
+#define crt_copysigntf crt_copysignl
 #else
 #error Unsupported TF mode type
 #endif
diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index 7624c728061518..ebbc63af598b76 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -189,8 +189,10 @@ typedef long double tf_float;
 #define CRT_LDBL_IEEE_F128
 #endif
 #define TF_C(x) x##L
-#elif __LDBL_MANT_DIG__ == 113
-// Use long double instead of __float128 if it matches the IEEE 128-bit format.
+#elif __LDBL_MANT_DIG__ == 113 ||  
\
+(__FLT_RADIX__ == 16 && __LDBL_MANT_DIG__ == 28)
+// Use long double instead of __float128 if it matches the IEEE 128-bit format
+// or the IBM hexadecimal format.
 #define CRT_LDBL_128BIT
 #define CRT_HAS_F128
 #define CRT_HAS_IEEE_TF
diff --git a/compiler-rt/lib/builtins/multc3.c 
b/compiler-rt/lib/builtins/multc3.c
index f20e53ccbf233b..21c522d0330b7f 100644
--- a/compiler-rt/lib/builtins/multc3.c
+++ b/compiler-rt/lib/builtins/multc3.c
@@ -15,8 +15,6 @@
 #include "int_lib.h"
 #include "int_math.h"
 
-#if defined(CRT_HAS_TF_MODE)
-
 // Returns: the product of a + ib and c + id
 
 COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, fp_t d) {
@@ -66,5 +64,3 @@ COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, 
fp_t d) {
   }
   return z;
 }
-
-#endif

>From 81b814ccc0b216eb9464c9fa5d4d28b0511c2338 Mon Sep 17 00:00:00 2001
From: Sean Perry <39927768+perry...@users.noreply.github.com>
Date: Tue, 9 Jan 2024 23:49:29 -0500
Subject: [PATCH 2/6] formatting update

---
 compiler-rt/lib/builtins/divtc3.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index 6ec9c5f17d4b68..7d3185c9d71fbb 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-
 // Returns: the quotient of (a + ib) / (c + id)
 
 COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t __c, fp_t __d) {

>From 2cb932ab37caf472aa296f5d7c811feada8464f0 Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Wed, 10 Jan 2024 16:03:48 -0600
Subject: [PATCH 3/6] only define CRT_HAS_F128 & CRT_HAS_IEEE_TF for IEEE

---
 compiler-rt/lib/builtins/int_types.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index ebbc63af598b76..9ceced37a997f4 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -194,8 +194,10 @@ typedef long double tf_float;
 // Use long double instead of __float128 if it matches the IEEE 128-

[Lldb-commits] [compiler-rt] [libcxxabi] [lld] [lldb] [clang] [llvm] [libc] [libclc] [libunwind] [libcxx] [clang-tools-extra] [flang] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Alexander Richardson via lldb-commits

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

Thanks this looks good to me now and should not change anything for other 
targets.

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


[Lldb-commits] [compiler-rt] [libcxxabi] [lld] [lldb] [clang] [llvm] [libc] [libclc] [libunwind] [libcxx] [clang-tools-extra] [flang] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Sean Perry via lldb-commits

perry-ca wrote:

Thanks. I don't have write access yet.  Would you be able to merge this.

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


[Lldb-commits] [compiler-rt] [lld] [clang-tools-extra] [libclc] [llvm] [libcxx] [libcxxabi] [lldb] [flang] [libc] [libunwind] [clang] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Alexander Richardson via lldb-commits

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


[Lldb-commits] [flang] [clang] [lld] [compiler-rt] [libunwind] [mlir] [clang-tools-extra] [lldb] [llvm] [openmp] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread Vladimir Vereschaka via lldb-commits

vvereschaka wrote:

@HaohaiWen ,
looks like these changes break some builders with the failed test
`UNRESOLVED: LLVM::windows-seh-EHa-PreserveCFG.s`

https://lab.llvm.org/buildbot/#/builders/234
https://lab.llvm.org/buildbot/#/builders/58
https://lab.llvm.org/buildbot/#/builders/104
https://lab.llvm.org/buildbot/#/builders/235

>Oh, sorry. I fixed it in https://github.com/llvm/llvm-project/pull/77784.
it didn't fix the problem.

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


[Lldb-commits] [flang] [clang] [lld] [compiler-rt] [libunwind] [mlir] [clang-tools-extra] [lldb] [llvm] [openmp] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread via lldb-commits

HaohaiWen wrote:

> @HaohaiWen , looks like these changes break some builders with the failed 
> test `UNRESOLVED: LLVM::windows-seh-EHa-PreserveCFG.s`
> 
> https://lab.llvm.org/buildbot/#/builders/234 
> https://lab.llvm.org/buildbot/#/builders/58 
> https://lab.llvm.org/buildbot/#/builders/104 
> https://lab.llvm.org/buildbot/#/builders/235
> 
> > Oh, sorry. I fixed it in #77784.
> > it didn't fix the problem.

I saw it. I've fixed this issue.
We may need to manually delete LLVM::windows-seh-EHa-PreserveCFG.s on those 
machines.
Do you know who can help us to delete it?

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


[Lldb-commits] [flang] [clang] [lld] [mlir] [compiler-rt] [libcxxabi] [libcxx] [clang-tools-extra] [lldb] [libunwind] [libc] [llvm] [openmp] [clang] static operators should evaluate object argument (P

2024-01-11 Thread Shafik Yaghmour via lldb-commits


@@ -5678,10 +5678,15 @@ static ImplicitConversionSequence 
TryObjectArgumentInitialization(
   assert(FromType->isRecordType());
 
   QualType ClassType = S.Context.getTypeDeclType(ActingContext);
-  // [class.dtor]p2: A destructor can be invoked for a const, volatile or
-  // const volatile object.
+  // C++98 [class.dtor]p2:
+  //   A destructor can be invoked for a const, volatile or const volatile
+  //   object.
+  // C++98 [over.match.funcs]p4:
+  //   For static member functions, the implicit object parameter is considered
+  //   to match any object (since if the function is selected, the object is
+  //   discarded).
   Qualifiers Quals = Method->getMethodQualifiers();
-  if (isa(Method)) {
+  if (isa(Method) || Method->isStatic()) {

shafik wrote:

Does this change have a functional change wrt this change or is this just a 
correctness fix?

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


[Lldb-commits] [compiler-rt] [lld] [clang-tools-extra] [libcxxabi] [mlir] [libunwind] [flang] [libcxx] [llvm] [libc] [lldb] [openmp] [clang] [clang] static operators should evaluate object argument (P

2024-01-11 Thread Tianlan Zhou via lldb-commits


@@ -5678,10 +5678,15 @@ static ImplicitConversionSequence 
TryObjectArgumentInitialization(
   assert(FromType->isRecordType());
 
   QualType ClassType = S.Context.getTypeDeclType(ActingContext);
-  // [class.dtor]p2: A destructor can be invoked for a const, volatile or
-  // const volatile object.
+  // C++98 [class.dtor]p2:
+  //   A destructor can be invoked for a const, volatile or const volatile
+  //   object.
+  // C++98 [over.match.funcs]p4:
+  //   For static member functions, the implicit object parameter is considered
+  //   to match any object (since if the function is selected, the object is
+  //   discarded).
   Qualifiers Quals = Method->getMethodQualifiers();
-  if (isa(Method)) {
+  if (isa(Method) || Method->isStatic()) {

SuperSodaSea wrote:

The following code won't compile without this change:

```c++
struct Foo {
static int operator()(int a, int b) { return a + b; }
};

void f() {
const Foo foo;
foo(1, 2); // 'this' argument to member function 'operator()' has type 
'const Foo', but function is not marked const
}
```

This issue was founded in [libc++ test 
suite](https://buildkite.com/llvm-project/clang-ci/builds/9164#018cd53e-cd20-4251-8d04-ddf463079deb/6-17),
 which calls static `operator()` on a const object. Test for this situation is 
added in 
[`clang/test/SemaCXX/cxx2b-static-operator.cpp`](https://github.com/llvm/llvm-project/blob/fdfa350fc07aaa06e6d30402b0b265ba3591fa51/clang/test/SemaCXX/cxx2b-static-operator.cpp).

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


[Lldb-commits] [compiler-rt] [lld] [clang-tools-extra] [mlir] [libunwind] [flang] [llvm] [lldb] [openmp] [clang] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread Vladimir Vereschaka via lldb-commits

vvereschaka wrote:

@HaohaiWen 
>We may need to manually delete LLVM::windows-seh-EHa-PreserveCFG.s on those 
>machines.
ok, got it. I'll do it for those builders.

>Do you know who can help us to delete it?
if you see some other failed builders because of this problem you can find 
their owners on the `Workers` tab, `Admin` column
https://lab.llvm.org/buildbot/#/workers


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


[Lldb-commits] [clang] [clang-tools-extra] [flang] [mlir] [lld] [openmp] [compiler-rt] [lldb] [llvm] [libunwind] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread Vladimir Vereschaka via lldb-commits

vvereschaka wrote:

also, you can try to start a `Force Build` with cleaning of the source/build 
directories for these builders. It should clean up the current source folder 
and reload it.

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


[Lldb-commits] [compiler-rt] [lld] [clang-tools-extra] [libcxxabi] [mlir] [libunwind] [flang] [libcxx] [llvm] [libc] [lldb] [openmp] [clang] [clang] static operators should evaluate object argument (P

2024-01-11 Thread Tianlan Zhou via lldb-commits

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


[Lldb-commits] [clang] [clang-tools-extra] [libcxxabi] [flang] [mlir] [libc] [libcxx] [lld] [openmp] [compiler-rt] [lldb] [llvm] [libunwind] [clang] static operators should evaluate object argument (P

2024-01-11 Thread Tianlan Zhou via lldb-commits

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


[Lldb-commits] [llvm] [lldb] [compiler-rt] [openmp] [clang-tools-extra] [libunwind] [lld] [mlir] [flang] [clang] [BranchFolding] Fix missing predecessors of landing-pad (PR #77608)

2024-01-11 Thread via lldb-commits

HaohaiWen wrote:

> also, you can try to start a `Force Build` with cleaning of the source/build 
> directories for these builders. It should clean up the current source folder 
> and reload it.

Thanks! I saw it has been forced to do clean up build.

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