[Lldb-commits] [lldb] r343164 - llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)

2018-09-26 Thread Fangrui Song via lldb-commits
Author: maskray
Date: Wed Sep 26 20:35:05 2018
New Revision: 343164

URL: http://llvm.org/viewvc/llvm-project?rev=343164&view=rev
Log:
llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)

The convenience wrapper in STLExtras is available since rL342102.

Modified:
lldb/trunk/source/Breakpoint/Breakpoint.cpp

Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=343164&r1=343163&r2=343164&view=diff
==
--- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Wed Sep 26 20:35:05 2018
@@ -785,8 +785,8 @@ void Breakpoint::ModuleReplaced(ModuleSP
   // we go.
 
   if (old_id_vec.size() == new_id_vec.size()) {
-llvm::sort(old_id_vec.begin(), old_id_vec.end());
-llvm::sort(new_id_vec.begin(), new_id_vec.end());
+llvm::sort(old_id_vec);
+llvm::sort(new_id_vec);
 size_t num_elements = old_id_vec.size();
 for (size_t idx = 0; idx < num_elements; idx++) {
   BreakpointLocationSP old_loc_sp =


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


[Lldb-commits] [lldb] r319869 - Do not use default arguments of DataLayout::getPointer*. NFC

2018-07-06 Thread Fangrui Song via lldb-commits
Author: maskray
Date: Tue Dec  5 17:32:06 2017
New Revision: 319869

URL: http://llvm.org/viewvc/llvm-project?rev=319869&view=rev
Log:
Do not use default arguments of DataLayout::getPointer*. NFC

Summary: There are "FIXME"s in include/llvm/IR/DataLayout.h to remove the 
default arguments.

Reviewers: zturner, clayborg

Reviewed By: zturner

Subscribers: bjope

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

Modified:
lldb/trunk/source/Expression/IRInterpreter.cpp

Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=319869&r1=319868&r2=319869&view=diff
==
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Tue Dec  5 17:32:06 2017
@@ -385,11 +385,6 @@ public:
 return ret;
   }
 
-  lldb::addr_t MallocPointer() {
-return Malloc(m_target_data.getPointerSize(),
-  m_target_data.getPointerPrefAlignment());
-  }
-
   lldb::addr_t Malloc(llvm::Type *type) {
 lldb_private::Status alloc_error;
 


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


[Lldb-commits] [lldb] r334745 - Add remaining fixed-point types and saturated equivalents to fix -Wswitch of r334718

2018-07-06 Thread Fangrui Song via lldb-commits
Author: maskray
Date: Thu Jun 14 11:19:40 2018
New Revision: 334745

URL: http://llvm.org/viewvc/llvm-project?rev=334745&view=rev
Log:
Add remaining fixed-point types and saturated equivalents to fix -Wswitch of 
r334718

Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=334745&r1=334744&r2=334745&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Jun 14 11:19:40 2018
@@ -4941,6 +4941,25 @@ lldb::Encoding ClangASTContext::GetEncod
 case clang::BuiltinType::UShortAccum:
 case clang::BuiltinType::UAccum:
 case clang::BuiltinType::ULongAccum:
+case clang::BuiltinType::ShortFract:
+case clang::BuiltinType::ShortFract:
+case clang::BuiltinType::Fract:
+case clang::BuiltinType::LongFract:
+case clang::BuiltinType::UShortFract:
+case clang::BuiltinType::UFract:
+case clang::BuiltinType::ULongFract:
+case clang::BuiltinType::SatShortAccum:
+case clang::BuiltinType::SatAccum:
+case clang::BuiltinType::SatLongAccum:
+case clang::BuiltinType::SatUShortAccum:
+case clang::BuiltinType::SatUAccum:
+case clang::BuiltinType::SatULongAccum:
+case clang::BuiltinType::SatShortFract:
+case clang::BuiltinType::SatFract:
+case clang::BuiltinType::SatLongFract:
+case clang::BuiltinType::SatUShortFract:
+case clang::BuiltinType::SatUFract:
+case clang::BuiltinType::SatULongFract:
   break;
 
 case clang::BuiltinType::Half:


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


[Lldb-commits] [lldb] r337063 - Fix -Wswitch after introduction of clang; :Type::DependentVector in r337036

2018-07-13 Thread Fangrui Song via lldb-commits
Author: maskray
Date: Fri Jul 13 15:40:40 2018
New Revision: 337063

URL: http://llvm.org/viewvc/llvm-project?rev=337063&view=rev
Log:
Fix -Wswitch after introduction of clang;:Type::DependentVector in r337036

Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=337063&r1=337062&r2=337063&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Jul 13 15:40:40 2018
@@ -4166,6 +4166,8 @@ ClangASTContext::GetTypeClass(lldb::opaq
 return lldb::eTypeClassArray;
   case clang::Type::DependentSizedExtVector:
 return lldb::eTypeClassVector;
+  case clang::Type::DependentVector:
+return lldb::eTypeClassVector;
   case clang::Type::ExtVector:
 return lldb::eTypeClassVector;
   case clang::Type::Vector:
@@ -4900,6 +4902,7 @@ lldb::Encoding ClangASTContext::GetEncod
   case clang::Type::ConstantArray:
 break;
 
+  case clang::Type::DependentVector:
   case clang::Type::ExtVector:
   case clang::Type::Vector:
 // TODO: Set this to more than one???
@@ -5154,6 +5157,7 @@ lldb::Format ClangASTContext::GetFormat(
   case clang::Type::ConstantArray:
 return lldb::eFormatVoid; // no value
 
+  case clang::Type::DependentVector:
   case clang::Type::ExtVector:
   case clang::Type::Vector:
 break;


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


[Lldb-commits] [lldb] r358249 - [IRMemoryMap] Fix -Wimplicit-fallthrough in -DLLVM_ENABLE_ASSERTIONS=off build

2019-04-11 Thread Fangrui Song via lldb-commits
Author: maskray
Date: Thu Apr 11 19:38:17 2019
New Revision: 358249

URL: http://llvm.org/viewvc/llvm-project?rev=358249&view=rev
Log:
[IRMemoryMap] Fix -Wimplicit-fallthrough in -DLLVM_ENABLE_ASSERTIONS=off build

Modified:
lldb/trunk/source/Expression/IRMemoryMap.cpp

Modified: lldb/trunk/source/Expression/IRMemoryMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRMemoryMap.cpp?rev=358249&r1=358248&r2=358249&view=diff
==
--- lldb/trunk/source/Expression/IRMemoryMap.cpp (original)
+++ lldb/trunk/source/Expression/IRMemoryMap.cpp Thu Apr 11 19:38:17 2019
@@ -275,7 +275,7 @@ IRMemoryMap::Allocation::Allocation(lldb
   m_alignment(alignment) {
   switch (policy) {
   default:
-assert(0 && "We cannot reach this!");
+llvm_unreachable("Invalid AllocationPolicy");
   case eAllocationPolicyHostOnly:
   case eAllocationPolicyMirror:
 m_data.SetByteSize(size);


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


[Lldb-commits] [lldb] [LLDB] Improve ObjectFileELF files ability to load from memory. (PR #100900)

2024-07-29 Thread Fangrui Song via lldb-commits

MaskRay wrote:

I'm not familiar with lldb, but I can make some comments as @tschuett invited 
me:)

Parsing PT_NOTE is a great step, as program headers are sufficient for 
executables, shared objects, and core dumps.
The section header table isn't needed and the relevant code could be dropped 
(unless relocatable file debugging is required).

Has the code been updated to handle p_align=8 PT_LOAD correctly? 
https://reviews.llvm.org/D150022 might be a related change from LLVMObject.


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


[Lldb-commits] [lldb] [LLDB] Improve ObjectFileELF files ability to load from memory. (PR #100900)

2024-07-29 Thread Fangrui Song via lldb-commits

MaskRay wrote:

> I like this idea a lot, but I have some reservations about the implementation.
> 
> For one, I think this patch is too big. I once heard someone say "if you have 
> bullet points in your patch description, then the patch is doing too much". 
> While I don't think we should go as far as to create a separate PR for each 
> of your bullet points, I do believe that splitting it up into a couple of 
> pieces would go along way towards making it easier to review.
> 
> I also see that some of the functionality is guarded by `IsInMemory()`, which 
> doesn't sounds like the right thing to do, as the we should in principle be 
> able to use the same code for parsing parsing section-header-less object 
> files on disk. These aren't exactly common, but like @MaskRay said, section 
> headers aren't strictly needed for linked object files, and it's much easier 
> to make test using these.
> 
> Finally, I think that structuring some of this code as "fallback" is not 
> ideal, as it can cause some data can be parsed twice (I think it happens at 
> least with ELF notes in this patch). Even if that's innocuous , I don't think 
> it's right because the two mechanisms (program and section headers) are just 
> different ways of finding the same data. I think it'd be cleaner if this was 
> implemented as a two-step process:
> 
> 1. find the data (e.g., notes): This will look into section and program 
> headers to find the appropriate bytes (I might even argue it should look at 
> program headers first, as that's what the operating system will use)
> 2. use the data (regardless of where it comes from)
> 
> I realise this feedback isn't very specific, but that's because I found it 
> very hard to follow everything that's going on in this patch. I'm sure I'll 
> be able to be more specific on the partial patches (and maybe some of my 
> assumptions will turn out to be incorrect). As a first patch in the series, 
> I'd recommend teaching lldb to parse section-header-less object files. Right 
> now, if I run lldb on such a file, it will tell me that it's empty (has zero 
> sections). Making the program headers visible would lay the foundation for 
> other changes, and it would also be the smallest testable piece of 
> functionality (by dumping the section list).
> 
> @MaskRay can you recommend a good to create these kinds of files? I was 
> thinking of a combination `yaml2obj` + `llvm-objcopy --strip-sections` 
> (because IIRC yaml2obj always inserts some sections into the output), but 
> maybe there's something better (?)

yaml2obj omits the section header table when `NoHeaders: true` is specified.
```
  - Type: SectionHeaderTable
NoHeaders: true
```

However, obj2yaml doesn't create `NoHeaders: true` yet. 

If the test utilizes `ld.lld`, `llvm-objcopy --strip-sections` will be needed. 
GNU ld 2.41 supports `-z nosectionheader`, which lld doesn't support yet (if 
there is enough interest I can add it).

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


[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Fangrui Song via lldb-commits


@@ -983,6 +999,40 @@ llvm::Error 
ProcessElfCore::ParseThreadContextsFromNoteSegment(
   }
 }
 
+bool ProcessElfCore::IsElf(const NT_FILE_Entry entry) {
+  size_t size = strlen(llvm::ELF::ElfMagic);
+  uint8_t buf[size];

MaskRay wrote:

```
15: error: variable length arrays in C++ are a Clang extension 
[-Werror,-Wvla-cxx-extension]
 1004 |   uint8_t buf[size];
```

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


[Lldb-commits] [lldb] Read and store gnu build id from loaded core file (PR #92078)

2024-05-14 Thread Fangrui Song via lldb-commits


@@ -983,6 +999,40 @@ llvm::Error 
ProcessElfCore::ParseThreadContextsFromNoteSegment(
   }
 }
 
+bool ProcessElfCore::IsElf(const NT_FILE_Entry entry) {
+  size_t size = strlen(llvm::ELF::ElfMagic);
+  uint8_t buf[size];

MaskRay wrote:

We can allocate a buffer of 4 and read it.
Can ELFHeader::MagicBytesMatch be used here?

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


[Lldb-commits] [lldb] [lldb] Use operator==(StringRef, StringRef) instead of StringRef::equals (NFC) (PR #92476)

2024-05-16 Thread Fangrui Song via lldb-commits

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


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


[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)

2024-05-21 Thread Fangrui Song via lldb-commits

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

Great 👍 

https://github.com/llvm/llvm-project/pull/92953
___
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] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-05-22 Thread Fangrui Song via lldb-commits


@@ -801,7 +801,7 @@ static OutputDesc 
*addInputSec(StringMap> &map,
   auto *firstIsec = cast(
   cast(sec->commands[0])->sectionBases[0]);
   OutputSection *firstIsecOut =
-  firstIsec->flags & SHF_LINK_ORDER

MaskRay wrote:

A CppCheck issue may or may not be useful for the project. Projects have 
different code styles. Applying a random static analyzer report may not be 
useful.

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


[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] [Support] Remove terminfo dependency (PR #92865)

2024-05-22 Thread Fangrui Song via lldb-commits

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


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


[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] Reapply "[Support] Remove terminfo dependency (#92865)" (PR #93889)

2024-05-30 Thread Fangrui Song via lldb-commits

MaskRay wrote:

Consider copying the original description to ensure that the linked issues will 
be properly closed.

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


[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] Reapply "[Support] Remove terminfo dependency (#92865)" (PR #93889)

2024-05-30 Thread Fangrui Song via lldb-commits

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


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


[Lldb-commits] [clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)

2024-06-03 Thread Fangrui Song via lldb-commits

MaskRay wrote:

> Hi @Endilll
> 
> I did a git bisect that pointed to this change as the one blocking my 
> compilation on an Ubuntu docker image with clang 14.0
> 
> The error I see:
> 
> ```
> CMake Error at 
> /test_radsan/llvm-project/compiler-rt/cmake/Modules/CheckSectionExists.cmake:72
>  (message):
>   cc: error: unrecognized command-line option
>   '-Wcovered-switch-default'; did you mean
>   '-Wno-switch-default'?
> 
>   cc: error: unrecognized command-line option
>   '-Wstring-conversion'; did you mean
>   '-Wsign-conversion'?
> 
> Call Stack (most recent call first):
>   /test_radsan/llvm-project/compiler-rt/lib/builtins/CMakeLists.txt:923 
> (check_section_exists)
> ```
> 
> My compiler info, printed from CMake:
> 
> ```
>   CMAKE_CXX_COMPILER_VERSION: 14.0.0
>   CMAKE_CXX_COMPILER_ID: Clang
> ```
> 
> More info from the command line:
> 
> ```
> $ clang --version
> Ubuntu clang version 14.0.0-1ubuntu1.1
> Target: aarch64-unknown-linux-gnu
> Thread model: posix
> InstalledDir: /usr/bin
> $ uname -a
> Linux 18728bf50582 6.5.11-linuxkit #1 SMP PREEMPT Mon Dec  4 11:30:00 UTC 
> 2023 aarch64 aarch64 aarch64 GNU/Linux
> $ cmake --version
> cmake version 3.22.1
> ```
> 
> Let me know what other information may be helpful, or if this is user error. 
> It seems from your godbolt links above, clang 5.0 and higher should work, so 
> I'm surprised that 14.0 is dying in this environment

`unrecognized command-line option` is from GCC. Your build environment might 
conflate GCC with Clang (`CMAKE_CXX_COMPILER_ID: Clang`).
```
% gcc -Wx -c a.c
gcc: error: unrecognized command-line option ‘-Wx’
% clang -Wx -c a.c
warning: unknown warning option '-Wx' [-Wunknown-warning-option]
1 warning generated.
```

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


[Lldb-commits] [clang] [lldb] Use CLANG_RESOURCE_DIR more consistently (PR #103388)

2024-08-13 Thread Fangrui Song via lldb-commits

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

clangDriver changes look reasonable.

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


[Lldb-commits] [llvm] [lld] [clang-tools-extra] [lldb] [clang] [ADT] Rename SmallString::{starts, ends}with to {starts, ends}_with (PR #74916)

2023-12-08 Thread Fangrui Song via lldb-commits

MaskRay wrote:

flang and bolt are not changed?

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


[Lldb-commits] [llvm] [lldb] [clang] [lld] [clang-tools-extra] [ADT] Rename SmallString::{starts, ends}with to {starts, ends}_with (PR #74916)

2023-12-09 Thread Fangrui Song via lldb-commits

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


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


[Lldb-commits] [llvm] [lldb] [clang-tools-extra] [compiler-rt] [flang] [clang] [mlir] [Profile] Add binary profile correlation for code coverage. (PR #69493)

2023-12-11 Thread Fangrui Song via lldb-commits

MaskRay wrote:

We have this team: @llvm/pr-subscribers-pgo

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


[Lldb-commits] [libunwind] [llvm] [libc] [flang] [libcxx] [clang-tools-extra] [lldb] [clang] [compiler-rt] [libunwind] Replace process_vm_readv with SYS_rt_sigprocmask (PR #74791)

2024-01-05 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [clang-tools-extra] [libcxx] [compiler-rt] [flang] [libc] [lldb] [llvm] [polly] [mlir] [lld] [clang] [libcxxabi] Make clang report invalid target versions. (PR #75373)

2024-01-05 Thread Fangrui Song via lldb-commits


@@ -786,4 +786,7 @@ def warn_android_unversioned_fallback : Warning<
   " directories will not be used in Clang 19. Provide a versioned directory"
   " for the target version or lower instead.">,
   InGroup>;
+
+def err_android_version_invalid : Error<
+  "Version %0 in triple %1-%2-%3-%4 is invalid.">;

MaskRay wrote:

See https://llvm.org/docs/CodingStandards.html#error-and-warning-messages

We can keep just `%1` and remove 2/3/4 by using `TC.getTripleString()` in the 
call site.

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


[Lldb-commits] [lldb] [flang] [compiler-rt] [libcxxabi] [llvm] [clang] [polly] [libcxx] [libc] [mlir] [clang-tools-extra] [lld] Make clang report invalid target versions. (PR #75373)

2024-01-05 Thread Fangrui Song via lldb-commits


@@ -5,13 +5,13 @@
 // RUN: %clang -O3 -target aarch64-linux-eabi -mno-fix-cortex-a53-835769 %s -S 
-o- 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO --check-prefix=CHECK %s
 
-// RUN: %clang -O3 -target aarch64-android-eabi %s -S -o- \
+// RUN: %clang -O3 -target aarch64-linux-androideabi %s -S -o- \

MaskRay wrote:

while here, replace deprecated `-target ` with `--target=`

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


[Lldb-commits] [lld] [libcxxabi] [openmp] [flang] [clang-tools-extra] [mlir] [libc] [libcxx] [llvm] [clang] [lldb] [libunwind] [polly] [compiler-rt] Make clang report invalid target versions. (PR #753

2024-01-08 Thread Fangrui Song via lldb-commits


@@ -786,4 +786,7 @@ def warn_android_unversioned_fallback : Warning<
   " directories will not be used in Clang 19. Provide a versioned directory"
   " for the target version or lower instead.">,
   InGroup>;
+
+def err_android_version_invalid : Error<
+  "Version %0 in triple %1 is invalid.">;

MaskRay wrote:

No capitalization and drop the full stop to be consistent with other 
messages/convention.

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


[Lldb-commits] [lld] [libcxxabi] [openmp] [flang] [clang-tools-extra] [mlir] [libc] [libcxx] [llvm] [clang] [lldb] [libunwind] [polly] [compiler-rt] Make clang report invalid target versions. (PR #753

2024-01-08 Thread Fangrui Song via lldb-commits


@@ -786,4 +786,7 @@ def warn_android_unversioned_fallback : Warning<
   " directories will not be used in Clang 19. Provide a versioned directory"
   " for the target version or lower instead.">,
   InGroup>;
+
+def err_android_version_invalid : Error<

MaskRay wrote:

You can name it `err_triple_version_invalid` in case other OSes want to do the 
same checking.

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


[Lldb-commits] [lld] [libcxxabi] [openmp] [flang] [clang-tools-extra] [mlir] [libc] [libcxx] [llvm] [clang] [lldb] [libunwind] [polly] [compiler-rt] Make clang report invalid target versions. (PR #753

2024-01-08 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [mlir] [polly] [clang] [libunwind] [flang] [lld] [lldb] [compiler-rt] [clang-tools-extra] [libcxxabi] [libcxx] [openmp] [libc] [llvm] Make clang report invalid target versions. (PR #753

2024-01-08 Thread Fangrui Song via lldb-commits

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


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


[Lldb-commits] [lld] [libcxxabi] [flang] [clang-tools-extra] [libc] [libcxx] [lldb] [llvm] [clang] [compiler-rt] [RISC-V][LLD] Add Support for RISC-V TLSDESC Relocations (PR #66916)

2024-01-08 Thread Fangrui Song via lldb-commits

MaskRay wrote:

The base branch can be edited if you click "Edit" near the title, which will 
help reveal the lld side changes...

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


[Lldb-commits] [lld] [libcxxabi] [flang] [clang-tools-extra] [libc] [libcxx] [lldb] [llvm] [clang] [compiler-rt] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #66915)

2024-01-08 Thread Fangrui Song via lldb-commits


@@ -3,8 +3,8 @@
 
 # Out of range immediates
 ## simm12
-flh ft1, -2049(a0) # CHECK: :[[@LINE]]:10: error: operand must be a symbol 
with %lo/%pcrel_lo/%tprel_lo modifier or an integer in the range [-2048, 2047]
-fsh ft2, 2048(a1) # CHECK: :[[@LINE]]:10: error: operand must be a symbol with 
%lo/%pcrel_lo/%tprel_lo modifier or an integer in the range [-2048, 2047]
+flh ft1, -2049(a0) # CHECK: :[[@LINE]]:10: error: operand must be a symbol 
with %lo/%pcrel_lo/%tprel_lo/%tlsdesc_load_lo modifier or an integer in the 
range [-2048, 2047]

MaskRay wrote:

`%tlsdesc_load_lo` only makes sense for `ld`. Changing the diagnostic will 
require updates to lots of files and is misleading to a lot of instructions. 
Perhaps the initial patch can drop this message update.

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


[Lldb-commits] [lld] [libcxxabi] [flang] [clang-tools-extra] [libc] [libcxx] [lldb] [llvm] [clang] [compiler-rt] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #66915)

2024-01-08 Thread Fangrui Song via lldb-commits


@@ -0,0 +1,44 @@
+# RUN: llvm-mc -filetype=obj -triple riscv32 < %s --defsym RV32=1  | 
llvm-objdump -d -M no-aliases - | FileCheck %s --check-prefixes=INST,RV32
+# RUN: llvm-mc -filetype=obj -triple riscv64 < %s | llvm-objdump -d -M 
no-aliases - | FileCheck %s --check-prefixes=INST,RV64
+
+# RUN: not llvm-mc -triple riscv32 < %s --defsym RV32=1 --defsym ERR=1 2>&1 | 
FileCheck %s --check-prefixes=ERR
+# RUN: not llvm-mc -triple riscv64 < %s --defsym ERR=1 2>&1 | FileCheck %s 
--check-prefixes=ERR
+
+start:  # @start
+# %bb.0:# %entry
+.Ltlsdesc_hi0:
+   auipc a0, %tlsdesc_hi(a-4)
+   # INST: auipc a0, 0x0
+   auipc   a0, %tlsdesc_hi(unspecified)
+   # INST: auipc a0, 0x0
+.ifdef RV32
+   lw  a1, %tlsdesc_load_lo(.Ltlsdesc_hi0)(a0)
+   # RV32: lw a1, 0x0(a0)
+.else
+   ld  a1, %tlsdesc_load_lo(.Ltlsdesc_hi0)(a0)
+   #RV64: ld a1, 0x0(a0)
+.endif
+   addia0, a0, %tlsdesc_add_lo(.Ltlsdesc_hi0)
+   # INST: addi a0, a0, 0x0
+   jalrt0, 0(a1), %tlsdesc_call(.Ltlsdesc_hi0)
+   # INST: jalr t0, 0x0(a1)
+   add a0, a0, tp
+   # INST: add a0, a0, tp
+   ret
+
+## Check invalid usage
+.ifdef ERR
+   auipc x1, %tlsdesc_call(foo) # ERR: :[[@LINE]]:12: error: operand must 
be a symbol with a 
%pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi/%tlsdesc_hi modifier 
or an integer in the range

MaskRay wrote:

Note: `[[@LINE]]` is deprecated. Use `[[#@LINE]]`

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


[Lldb-commits] [lld] [libcxxabi] [openmp] [flang] [clang-tools-extra] [mlir] [libc] [libcxx] [llvm] [clang] [lldb] [libunwind] [polly] [compiler-rt] Make clang report invalid target versions. (PR #753

2024-01-08 Thread Fangrui Song via lldb-commits


@@ -786,4 +786,7 @@ def warn_android_unversioned_fallback : Warning<
   " directories will not be used in Clang 19. Provide a versioned directory"
   " for the target version or lower instead.">,
   InGroup>;
+
+def err_android_version_invalid : Error<
+  "Version %0 in triple %1 is invalid.">;

MaskRay wrote:

Perhaps `version '%0' in target triple '%1' is invalid`

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


[Lldb-commits] [lldb] [compiler-rt] [clang-tools-extra] [libcxxabi] [flang] [libc] [lld] [llvm] [libcxx] [clang] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #66915)

2024-01-08 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [flang] [libcxxabi] [lldb] [clang-tools-extra] [libcxx] [compiler-rt] [lld] [clang] [libc] [llvm] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #66915)

2024-01-08 Thread Fangrui Song via lldb-commits


@@ -71,6 +71,18 @@ enum Fixups {
   // Used to generate an R_RISCV_ALIGN relocation, which indicates the linker
   // should fixup the alignment after linker relaxation.
   fixup_riscv_align,
+  // 20-bit fixup corresponding to %tlsdesc_hi(foo) for instructions like
+  // auipc
+  fixup_riscv_tlsdesc_hi20,

MaskRay wrote:

> instructions like auipc

It seems that tlsdesc is auipc-style only, instead of lui-style. You can say 
that this is for auipc.

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


[Lldb-commits] [flang] [libcxxabi] [lldb] [clang-tools-extra] [libcxx] [compiler-rt] [lld] [clang] [libc] [llvm] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #66915)

2024-01-08 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lldb] [compiler-rt] [clang-tools-extra] [libcxxabi] [flang] [libc] [lld] [llvm] [libcxx] [clang] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #66915)

2024-01-08 Thread Fangrui Song via lldb-commits


@@ -188,3 +188,8 @@ addi a2, ft0, 24 # CHECK: :[[@LINE]]:10: error: invalid 
operand for instruction
 
 # fence.tso accepts no operands
 fence.tso rw, rw # CHECK: :[[@LINE]]:11: error: invalid operand for instruction
+
+.Ltlsdesc_hi0:
+jalr   x5, 0(a1), %tlsdesc_hi(.Ltlsdesc_hi0) # CHECK: :[[@LINE]]:17: error: 
operand must be a symbol with %tlsdesc_call modifier
+jalr   x1, 0(a1), %tlsdesc_call(.Ltlsdesc_hi0) # CHECK: :[[@LINE]]:12: error: 
the output operand must be t0/x5 when using %tlsdesc_call modifier

MaskRay wrote:

I think it's clearer to place these negative tests in a test named `tlsdesc*.s`

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


[Lldb-commits] [libc] [libcxxabi] [lldb] [compiler-rt] [clang-tools-extra] [clang] [llvm] [flang] [lld] [libcxx] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #66915)

2024-01-08 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lldb] [compiler-rt] [clang-tools-extra] [libcxxabi] [flang] [libc] [lld] [llvm] [libcxx] [clang] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #66915)

2024-01-08 Thread Fangrui Song via lldb-commits


@@ -71,6 +71,18 @@ enum Fixups {
   // Used to generate an R_RISCV_ALIGN relocation, which indicates the linker
   // should fixup the alignment after linker relaxation.
   fixup_riscv_align,
+  // 20-bit fixup corresponding to %tlsdesc_hi(foo) for instructions like
+  // auipc
+  fixup_riscv_tlsdesc_hi20,

MaskRay wrote:

I wonder whether we can just use `MCFixupKind(FirstLiteralRelocationKind + 
ELF::R_RISCV_TLSDESC_CALL)`

https://github.com/llvm/llvm-project/pull/66915
___
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] [lld] [libc] [lldb] [compiler-rt] [clang] [libcxx] [libcxxabi] [flang] [RISC-V][LLD] Add Support for RISC-V TLSDESC Relocations (PR #66916)

2024-01-09 Thread Fangrui Song via lldb-commits

MaskRay wrote:

> @MaskRay , do you think this is worth abandoning in favor of #77516? If so, I 
> guess I'd also need to abandon #66915, which is unfortunate.

You may abandon this in favor of #77516. For the LLVM patch, just use #66915 as 
it contains a lot of discussions.
It's fine to make the lld patch not actually stacked ...



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


[Lldb-commits] [lldb] 61d8da3 - [lldb] Replace countPopulation with popcount after D153686

2023-07-06 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2023-07-06T20:26:23-07:00
New Revision: 61d8da327cab76932e8236bbf03543c9b3f7864c

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

LOG: [lldb] Replace countPopulation with popcount after D153686

Added: 


Modified: 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp
index cb6f81b28f7cc8..29f32e97f23296 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp
@@ -651,7 +651,7 @@ 
NativeRegisterContextLinux_ppc64le::GetWatchpointSize(uint32_t wp_index) {
 
   unsigned control = (m_hwp_regs[wp_index].control >> 5) & 0xff;
   if (llvm::isPowerOf2_32(control + 1)) {
-return llvm::countPopulation(control);
+return llvm::popcount(control);
   }
 
   return 0;



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


[Lldb-commits] [lldb] 7319d7d - [lldb] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D154542

2023-07-06 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2023-07-06T20:33:09-07:00
New Revision: 7319d7dbcfa94998ae3befeff0b84140dcf29a69

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

LOG: [lldb] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after 
D154542

Added: 


Modified: 
lldb/source/Target/TargetList.cpp

Removed: 




diff  --git a/lldb/source/Target/TargetList.cpp 
b/lldb/source/Target/TargetList.cpp
index 376b15ca706bee..cb198e388011ad 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -559,15 +559,16 @@ bool TargetList::AnyTargetContainsModule(Module &module) {
 
   void TargetList::RegisterInProcessTarget(TargetSP target_sp) {
 std::lock_guard guard(m_target_list_mutex);
-std::unordered_set::iterator iter;
-bool was_added;
-std::tie(iter, was_added) = m_in_process_target_list.insert(target_sp);
+[[maybe_unused]] bool was_added;
+std::tie(std::ignore, was_added) =
+m_in_process_target_list.insert(target_sp);
 assert(was_added && "Target pointer was left in the in-process map");
   }
   
   void TargetList::UnregisterInProcessTarget(TargetSP target_sp) {
 std::lock_guard guard(m_target_list_mutex);
-bool was_present = m_in_process_target_list.erase(target_sp);
+[[maybe_unused]] bool was_present =
+m_in_process_target_list.erase(target_sp);
 assert(was_present && "Target pointer being removed was not registered");
   }
   



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


[Lldb-commits] [lldb] 5d66f9f - [gdb-remote] Sort entries in QEnvironment*

2023-07-22 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2023-07-22T16:45:32-07:00
New Revision: 5d66f9fd8e97c05a5dba317d3ad2566e61ead1ff

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

LOG: [gdb-remote] Sort entries in QEnvironment*

Similar to ae316ac66430997e342772fc4629c1acece0 for
QEMU_(UN)SET_ENV.
The iteration order of StringMap is not guaranteed to be deterministic.
Sort the entries to give deterministic packets for the tests added by
D108018.

Added: 


Modified: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 36e046d7466ebb..c6503129685ab4 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -35,6 +35,7 @@
 #include "lldb/Host/Config.h"
 #include "lldb/Utility/StringExtractorGDBRemote.h"
 
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/JSON.h"
 
@@ -826,8 +827,12 @@ llvm::Error 
GDBRemoteCommunicationClient::LaunchProcess(const Args &args) {
 }
 
 int GDBRemoteCommunicationClient::SendEnvironment(const Environment &env) {
-  for (const auto &KV : env) {
-int r = SendEnvironmentPacket(Environment::compose(KV).c_str());
+  llvm::SmallVector, 0> vec;
+  for (const auto &kv : env)
+vec.emplace_back(kv.first(), kv.second);
+  llvm::sort(vec, llvm::less_first());
+  for (const auto &[k, v] : vec) {
+int r = SendEnvironmentPacket((k + "=" + v).str().c_str());
 if (r != 0)
   return r;
   }

diff  --git 
a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py 
b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
index 65281044d93b47..2f4c8d799a6f02 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
@@ -371,12 +371,12 @@ def vRun(self, packet):
 
 self.assertPacketLogContains(
 [
+"QEnvironment:EQUALS=foo=bar",
+"QEnvironmentHexEncoded:4e45454453454e433d66726f6224",
+"QEnvironmentHexEncoded:4e45454453454e43323d66722a6f62",
 "QEnvironmentHexEncoded:4e45454453454e4d66726f7d62",
 "QEnvironmentHexEncoded:4e45454453454e43343d6623726f62",
 "QEnvironment:PLAIN=foo",
-"QEnvironmentHexEncoded:4e45454453454e43323d66722a6f62",
-"QEnvironmentHexEncoded:4e45454453454e433d66726f6224",
-"QEnvironment:EQUALS=foo=bar",
 ]
 )
 
@@ -425,12 +425,12 @@ def QEnvironment(self, packet):
 
 self.assertPacketLogContains(
 [
+"QEnvironmentHexEncoded:455155414c533d666f6f3d626172",
+"QEnvironmentHexEncoded:4e45454453454e433d66726f6224",
+"QEnvironmentHexEncoded:4e45454453454e43323d66722a6f62",
 "QEnvironmentHexEncoded:4e45454453454e4d66726f7d62",
 "QEnvironmentHexEncoded:4e45454453454e43343d6623726f62",
 "QEnvironmentHexEncoded:504c41494e3d666f6f",
-"QEnvironmentHexEncoded:4e45454453454e43323d66722a6f62",
-"QEnvironmentHexEncoded:4e45454453454e433d66726f6224",
-"QEnvironmentHexEncoded:455155414c533d666f6f3d626172",
 ]
 )
 



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


[Lldb-commits] [lldb] e126fa2 - [unittest] Fix HighlighterTest.cpp after D151683

2023-07-22 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2023-07-22T18:30:02-07:00
New Revision: e126fa27c07c83997fcdee2bd45996ffc860317b

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

LOG: [unittest] Fix HighlighterTest.cpp after D151683

:: is now parsed as tok::coloncolon even in C mode.

Added: 


Modified: 
lldb/unittests/Language/Highlighting/HighlighterTest.cpp

Removed: 




diff  --git a/lldb/unittests/Language/Highlighting/HighlighterTest.cpp 
b/lldb/unittests/Language/Highlighting/HighlighterTest.cpp
index d17fddadf96741..150b356efe5955 100644
--- a/lldb/unittests/Language/Highlighting/HighlighterTest.cpp
+++ b/lldb/unittests/Language/Highlighting/HighlighterTest.cpp
@@ -160,7 +160,7 @@ TEST_F(HighlighterTest, Colons) {
   HighlightStyle s;
   s.colon.Set("", "");
 
-  EXPECT_EQ("foo::bar:", highlightC("foo::bar:", s));
+  EXPECT_EQ("foo::bar:", highlightC("foo::bar:", s));
 }
 
 TEST_F(HighlighterTest, ClangBraces) {



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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-15 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-15 Thread Fangrui Song via lldb-commits


@@ -390,6 +390,21 @@ StringRef stem(StringRef path, Style style = 
Style::native);
 /// @result The extension of \a path.
 StringRef extension(StringRef path, Style style = Style::native);
 
+/// Get the program's name
+///
+/// If the path ends with the string .exe, returns the stem of

MaskRay wrote:

.exe => ".exe"

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


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-15 Thread Fangrui Song via lldb-commits

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

LGTM, but @jh7370 usually wants to have an eye on such changes.

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


[Lldb-commits] [lldb] 34ee53c - [lldb][test] Fix TestCallBuiltinFunction.py

2023-09-27 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2023-09-27T22:37:24-07:00
New Revision: 34ee53c9e390019d757b453ceba9cc3e47ab0df1

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

LOG: [lldb][test] Fix TestCallBuiltinFunction.py

A constant __builtin_abs(-14) cannot be evaluated without a running target
as Clang now emits llvm.abs.*

Added: 


Modified: 
lldb/test/API/commands/expression/call-function/TestCallBuiltinFunction.py

Removed: 




diff  --git 
a/lldb/test/API/commands/expression/call-function/TestCallBuiltinFunction.py 
b/lldb/test/API/commands/expression/call-function/TestCallBuiltinFunction.py
index 1f79aae139a7bf3..80163147650a0f4 100644
--- a/lldb/test/API/commands/expression/call-function/TestCallBuiltinFunction.py
+++ b/lldb/test/API/commands/expression/call-function/TestCallBuiltinFunction.py
@@ -23,4 +23,3 @@ def test(self):
 "__builtin_isnormal(0.0f)", result_type="int", result_value="0"
 )
 self.expect_expr("__builtin_constant_p(1)", result_type="int", 
result_value="1")
-self.expect_expr("__builtin_abs(-14)", result_type="int", 
result_value="14")



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


[Lldb-commits] [lldb] ebaf26d - [lldb] Fix -Wformat after #83602

2024-03-01 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2024-03-01T12:09:32-08:00
New Revision: ebaf26dabec00c32177cd4fa47f3bf5902b194b7

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

LOG: [lldb] Fix -Wformat after #83602

Added: 


Modified: 
lldb/source/Commands/CommandObjectThread.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectThread.cpp 
b/lldb/source/Commands/CommandObjectThread.cpp
index 6d84315a471d95..cf4f8ccaa0c4aa 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -280,7 +280,7 @@ class ThreadStepScopeOptionGroup : public OptionGroup {
   if (!success)
 error.SetErrorStringWithFormat(
 "invalid boolean value for option '%c': %s", short_option,
-option_arg);
+option_arg.data());
   else {
 m_step_in_avoid_no_debug = avoid_no_debug ? eLazyBoolYes : eLazyBoolNo;
   }
@@ -293,7 +293,7 @@ class ThreadStepScopeOptionGroup : public OptionGroup {
   if (!success)
 error.SetErrorStringWithFormat(
 "invalid boolean value for option '%c': %s", short_option,
-option_arg);
+option_arg.data());
   else {
 m_step_out_avoid_no_debug = avoid_no_debug ? eLazyBoolYes : 
eLazyBoolNo;
   }



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


[Lldb-commits] [lld] [lldb] [llvm] [mlir] Rename ThreadPool->DefaultThreadPool and ThreadPoolInterface->ThreadPool (NFC) (PR #83702)

2024-03-04 Thread Fangrui Song via lldb-commits

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


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


[Lldb-commits] [lld] [lldb] [lldb/test] Add basic ld.lld --debug-names tests (PR #88335)

2024-04-10 Thread Fangrui Song via lldb-commits

MaskRay wrote:

This is not for review yet. When ld.lld --debug-names is added, this PR will be 
changed to add a few lines to `lldb/test/Shell/SymbolFile/DWARF/x86` tests.

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


[Lldb-commits] [lld] [lldb] [lldb/test] Add basic ld.lld --debug-names tests (PR #88335)

2024-04-10 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lldb] [lldb/test] Add basic ld.lld --debug-names tests (PR #88335)

2024-04-19 Thread Fangrui Song via lldb-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/88335

>From 210b1e85f2d827a7c57f3b1106d876d2e0f18511 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Wed, 10 Apr 2024 18:03:57 -0700
Subject: [PATCH] [lldb/test] Add basic ld.lld --debug-names tests

Test that ld.lld --debug-names (#86508) built per-module index can be
consumed by lldb. This has uncovered a bug during the development of the
lld feature.
---
 lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp | 5 +
 lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp | 5 +
 2 files changed, 10 insertions(+)

diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp
index 30143a41d5e734..b9a63525d0711d 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-function.cpp
@@ -59,6 +59,11 @@
 // RUN: lldb-test symbols --name=not_there --find=function %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 
+/// Test a per-module index built by lld.
+// RUN: ld.lld --debug-names %t.o -o %t
+// RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t 
| \
+// RUN:   FileCheck --check-prefix=BASE %s
+
 // NAMES: Name: .debug_names
 
 // BASE: Found 4 functions:
diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp
index 98b4097cdda01f..e46fa14489d32d 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-variable.cpp
@@ -33,6 +33,11 @@
 // RUN: lldb-test symbols --name=not_there --find=variable %t | \
 // RUN:   FileCheck --check-prefix=EMPTY %s
 
+/// Test a per-module index built by lld.
+// RUN: ld.lld --debug-names %t.o -o %t
+// RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \
+// RUN:   FileCheck --check-prefix=CONTEXT %s
+
 // NAMES: Name: .debug_names
 
 // EMPTY: Found 0 variables:

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


[Lldb-commits] [lldb] [lldb/test] Add basic ld.lld --debug-names tests (PR #88335)

2024-04-19 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lldb] [lldb/test] Add basic ld.lld --debug-names tests (PR #88335)

2024-04-19 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lldb] [lldb/test] Add basic ld.lld --debug-names tests (PR #88335)

2024-04-23 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [lldb] 5a12f28 - LLVM_FALLTHROUGH => [[fallthrough]]. NFC

2024-04-25 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2024-04-25T17:50:59-07:00
New Revision: 5a12f2867a167bbe11099150f3cb6b6cb77d767c

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

LOG: LLVM_FALLTHROUGH => [[fallthrough]]. NFC

Added: 


Modified: 
clang-tools-extra/clangd/CodeCompletionStrings.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/lib/Support/regcomp.c
llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
llvm/utils/TableGen/DXILEmitter.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/CodeCompletionStrings.cpp 
b/clang-tools-extra/clangd/CodeCompletionStrings.cpp
index 2075e5965f181e..9b4442b0bb76fd 100644
--- a/clang-tools-extra/clangd/CodeCompletionStrings.cpp
+++ b/clang-tools-extra/clangd/CodeCompletionStrings.cpp
@@ -253,7 +253,7 @@ void getSignature(const CodeCompletionString &CCS, 
std::string *Signature,
   if (!IncludeFunctionArguments &&
   ResultKind == CodeCompletionResult::RK_Declaration)
 TruncateSnippetAt.emplace(Snippet->size());
-  LLVM_FALLTHROUGH;
+  [[fallthrough]];
 case CodeCompletionString::CK_RightParen:
 case CodeCompletionString::CK_LeftBracket:
 case CodeCompletionString::CK_RightBracket:

diff  --git 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index d3fc487aed4333..9409497f1c81ba 100644
--- 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -1869,15 +1869,15 @@ 
AppleObjCRuntimeV2::DynamicClassInfoExtractor::ComputeHelper(
   if (loader->IsFullyInitialized()) {
 switch (exe_ctx.GetTargetRef().GetDynamicClassInfoHelper()) {
 case eDynamicClassInfoHelperAuto:
-  LLVM_FALLTHROUGH;
+  [[fallthrough]];
 case eDynamicClassInfoHelperGetRealizedClassList:
   if (m_runtime.m_has_objc_getRealizedClassList_trylock)
 return 
DynamicClassInfoExtractor::objc_getRealizedClassList_trylock;
-  LLVM_FALLTHROUGH;
+  [[fallthrough]];
 case eDynamicClassInfoHelperCopyRealizedClassList:
   if (m_runtime.m_has_objc_copyRealizedClassList)
 return DynamicClassInfoExtractor::objc_copyRealizedClassList;
-  LLVM_FALLTHROUGH;
+  [[fallthrough]];
 case eDynamicClassInfoHelperRealizedClassesStruct:
   return DynamicClassInfoExtractor::gdb_objc_realized_classes;
 }

diff  --git a/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h 
b/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h
index a3ebde709ae6e1..7525c9eb758bef 100644
--- a/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h
+++ b/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h
@@ -76,7 +76,7 @@ void GenericConvergenceVerifier::visit(const 
InstructionT &I) {
   "Entry intrinsic cannot be preceded by a convergent operation in the 
"
   "same basic block.",
   {Context.print(&I)});
-LLVM_FALLTHROUGH;
+[[fallthrough]];
   case CONV_ANCHOR:
 Check(!TokenDef,
   "Entry or anchor intrinsic cannot have a convergencectrl token "

diff  --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp 
b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 8cf392ab0567e5..d7b0c9aa166735 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -2223,7 +2223,7 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst 
&CI, Intrinsic::ID ID,
 // addresses. We can treat it like a normal dbg_value intrinsic here; to
 // benefit from the full analysis of stack/SSA locations, GlobalISel would
 // need to register for and use the AssignmentTrackingAnalysis pass.
-LLVM_FALLTHROUGH;
+[[fallthrough]];
   case Intrinsic::dbg_value: {
 // This form of DBG_VALUE is target-independent.
 const DbgValueInst &DI = cast(CI);

diff  --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp 
b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index aefedd060f897d..ef9f7833551905 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -1424,7 +1424,7 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst 
*II) {
 // happened (such as an optimised fun

[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-05-03 Thread Fangrui Song via lldb-commits


@@ -0,0 +1 @@
+dos-style-eol.txt

MaskRay wrote:

missing text=auto eol=crlf ?

https://github.com/llvm/llvm-project/pull/86318
___
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] [compiler-rt] [flang] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-05-03 Thread Fangrui Song via lldb-commits

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


https://github.com/llvm/llvm-project/pull/86318
___
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] [compiler-rt] [flang] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-05-03 Thread Fangrui Song via lldb-commits


@@ -1,3 +1,10 @@
+# Checkout as native, commit as LF except in specific circumstances
+* text=auto
+*.bat text eol=crlf
+*.rc text eol=crlf
+*.sln text eol=crlf

MaskRay wrote:

Do we need `.sln`? There is only one file in `clang/tools/clang-format-vs`. 
There are a few other text files in this directory, so perhaps a gitattributes 
in that directory is better?

https://github.com/llvm/llvm-project/pull/86318
___
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] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-05-04 Thread Fangrui Song via lldb-commits


@@ -3802,7 +3802,7 @@ bool X86AsmParser::validateInstruction(MCInst &Inst, 
const OperandVector &Ops) {
 //VFMULCPHZrr   Dest, Src1, Src2
 //VFMULCPHZrrk  Dest, Dest, Mask, Src1, Src2
 //VFMULCPHZrrkz Dest, Mask, Src1, Src2
-for (unsigned i = TSFlags & X86II::EVEX_K ? 2 : 1;

MaskRay wrote:

I know it's subjective, but the new code with two levels of parens decreases 
readability.

https://github.com/llvm/llvm-project/pull/90391
___
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] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] Add clarifying parenthesis around non-trivial conditions in ternary expressions. (PR #90391)

2024-05-04 Thread Fangrui Song via lldb-commits


@@ -801,7 +801,7 @@ static OutputDesc 
*addInputSec(StringMap> &map,
   auto *firstIsec = cast(
   cast(sec->commands[0])->sectionBases[0]);
   OutputSection *firstIsecOut =
-  firstIsec->flags & SHF_LINK_ORDER

MaskRay wrote:

Why is random change made to lld/ELF?

`[-+*%] \w+ \?'` is extensively used and I don't see we add `)`

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


[Lldb-commits] [lldb] 385f5c4 - [lldb][CMake] Fix linking of gdb-remote when LLVM_ENABLE_ZLIB is ON

2022-02-07 Thread Fangrui Song via lldb-commits

Author: Mariusz Ceier
Date: 2022-02-07T23:26:22-08:00
New Revision: 385f5c4d33799df25a85ceb54b6232499cb8a78d

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

LOG: [lldb][CMake] Fix linking of gdb-remote when LLVM_ENABLE_ZLIB is ON

When LLVM_ENABLE_ZLIB is ON gdb-remote should link against ZLIB::ZLIB.

This fixes
```
/mnt/b/yoe/master/build/tmp/hosttools/ld: 
lib/liblldbPluginProcessGDBRemote.a(GDBRemoteCommunication.cpp.o): in function 
`lldb_private::process_gdb_remote::GDBRemoteCommunication::DecompressPacket() 
[clone .localalias]':
GDBRemoteCommunication.cpp:(.text._ZN12lldb_private18process_gdb_remote22GDBRemoteCommunication16DecompressPacketEv+0x59a):
 undefined reference to `inflateInit2_'
/mnt/b/yoe/master/build/tmp/hosttools/ld: 
GDBRemoteCommunication.cpp:(.text._ZN12lldb_private18process_gdb_remote22GDBRemoteCommunication16DecompressPacketEv+0x5af):
 undefined reference to `inflate'
```

Reviewed By: JDevlieghere, MaskRay

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

Added: 


Modified: 
lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt 
b/lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt
index 3a1a0e435ad25..e0c798187bd5b 100644
--- a/lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt
@@ -15,6 +15,10 @@ if(HAVE_LIBCOMPRESSION)
   set(LIBCOMPRESSION compression)
 endif()
 
+if(LLVM_ENABLE_ZLIB)
+  list(APPEND LLDB_SYSTEM_LIBS ZLIB::ZLIB)
+endif()
+
 add_lldb_library(lldbPluginProcessGDBRemote PLUGIN
   GDBRemoteClientBase.cpp
   GDBRemoteCommunication.cpp
@@ -39,6 +43,7 @@ add_lldb_library(lldbPluginProcessGDBRemote PLUGIN
 lldbSymbol
 lldbTarget
 lldbUtility
+${LLDB_SYSTEM_LIBS}
 ${LLDB_PLUGINS}
 ${LIBCOMPRESSION}
   LINK_COMPONENTS



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


[Lldb-commits] [lldb] d0fb3ea - [lldb] Fix use-after-move in SymbolFile/NativePDB

2022-02-14 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2022-02-14T11:03:26-08:00
New Revision: d0fb3eab74aaa357037fd2632f912e71222c5586

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

LOG: [lldb] Fix use-after-move in SymbolFile/NativePDB

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
index d8f737612c257..d15c0ee99f96c 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
@@ -162,7 +162,7 @@ CompilandIndexItem 
&CompileUnitIndex::GetOrCreateCompiland(uint16_t modi) {
   ParseExtendedInfo(m_index, *cci);
   ParseInlineeLineTableForCompileUnit(*cci);
 
-  cci->m_strings.initialize(debug_stream.getSubsectionsArray());
+  cci->m_strings.initialize(cci->m_debug_stream.getSubsectionsArray());
   PDBStringTable &strings = cantFail(m_index.pdb().getStringTable());
   cci->m_strings.setStrings(strings.getStringTable());
 



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


[Lldb-commits] [lldb] 67854f9 - Use value_or instead of getValueOr. NFC

2022-06-29 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2022-06-29T21:55:02-07:00
New Revision: 67854f9ed0cd512f59736730f4c05de25501ae54

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

LOG: Use value_or instead of getValueOr. NFC

Added: 


Modified: 
clang-tools-extra/clangd/unittests/support/FileCacheTests.cpp
clang-tools-extra/clangd/xpc/XPCTransport.cpp
lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
llvm/lib/Support/Windows/Threading.inc
llvm/unittests/Support/UnicodeTest.cpp
mlir/lib/TableGen/AttrOrTypeDef.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/support/FileCacheTests.cpp 
b/clang-tools-extra/clangd/unittests/support/FileCacheTests.cpp
index 1f554806def08..8d2bc4d15d7b9 100644
--- a/clang-tools-extra/clangd/unittests/support/FileCacheTests.cpp
+++ b/clang-tools-extra/clangd/unittests/support/FileCacheTests.cpp
@@ -42,7 +42,7 @@ class TestCache : public FileCache {
 FS, FreshTime,
 [&](llvm::Optional Data) {
   GotParse = true;
-  Value = Data.getValueOr("").str();
+  Value = Data.value_or("").str();
 },
 [&]() {
   GotRead = true;

diff  --git a/clang-tools-extra/clangd/xpc/XPCTransport.cpp 
b/clang-tools-extra/clangd/xpc/XPCTransport.cpp
index 4c6308b3acae7..9c43647c3c767 100644
--- a/clang-tools-extra/clangd/xpc/XPCTransport.cpp
+++ b/clang-tools-extra/clangd/xpc/XPCTransport.cpp
@@ -38,7 +38,7 @@ json::Object encodeError(Error E) {
 
 Error decodeError(const json::Object &O) {
   std::string Msg =
-  std::string(O.getString("message").getValueOr("Unspecified error"));
+  std::string(O.getString("message").value_or("Unspecified error"));
   if (auto Code = O.getInteger("code"))
 return make_error(std::move(Msg), ErrorCode(*Code));
   return error("{0}", Msg);

diff  --git a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp 
b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
index 3620be6f274d9..a9c7af145338e 100644
--- a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
+++ b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
@@ -154,7 +154,7 @@ bool ABISysV_arc::IsRegisterFileReduced(RegisterContext 
®_ctx) const {
 m_is_reg_file_reduced = (reg_value | rf_entries_bit) != 0;
   }
 
-  return m_is_reg_file_reduced.getValueOr(false);
+  return m_is_reg_file_reduced.value_or(false);
 }
 
 //--
@@ -458,7 +458,7 @@ ABISysV_arc::GetReturnValueObjectSimple(Thread &thread,
   const uint32_t type_flags = compiler_type.GetTypeInfo();
   // Integer return type.
   if (type_flags & eTypeIsInteger) {
-const size_t byte_size = compiler_type.GetByteSize(&thread).getValueOr(0);
+const size_t byte_size = compiler_type.GetByteSize(&thread).value_or(0);
 auto raw_value = ReadRawValue(reg_ctx, byte_size);
 
 const bool is_signed = (type_flags & eTypeIsSigned) != 0;
@@ -482,7 +482,7 @@ ABISysV_arc::GetReturnValueObjectSimple(Thread &thread,
 
 if (compiler_type.IsFloatingPointType(float_count, is_complex) &&
 1 == float_count && !is_complex) {
-  const size_t byte_size = 
compiler_type.GetByteSize(&thread).getValueOr(0);
+  const size_t byte_size = compiler_type.GetByteSize(&thread).value_or(0);
   auto raw_value = ReadRawValue(reg_ctx, byte_size);
 
   if (!SetSizedFloat(value.GetScalar(), raw_value, byte_size))

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp 
b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
index 7962302aeb327..3715e46c659cf 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
@@ -92,7 +92,7 @@ Expected
 TraceIntelPTBundleLoader::ParseProcess(const JSONProcess &process) {
   TargetSP target_sp;
   Status error = m_debugger.GetTargetList().CreateTarget(
-  m_debugger, /*user_exe_path*/ StringRef(), process.triple.getValueOr(""),
+  m_debugger, /*user_exe_path*/ StringRef(), process.triple.value_or(""),
   eLoadDependentsNo,
   /*platform_options*/ nullptr, target_sp);
 

diff  --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp 
b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 5e5ca96aeb552..93b07fc0db302 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3144,11 +3144,10 @@ Error BitcodeReader::parseConstants() {
 return error("Explicit gep operator type does not match pointee type "
  "of pointer operand");
 
-  V = BitcodeConstant::create(
-  Alloc, CurTy,
-  {Instruction::Ge

[Lldb-commits] [lldb] e690137 - [Support] Change compression::zlib::{compress, uncompress} to use uint8_t *

2022-07-13 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2022-07-13T16:26:54-07:00
New Revision: e690137dde1c9b037e0c987d393da054d86eeeab

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

LOG: [Support] Change compression::zlib::{compress,uncompress} to use uint8_t *

It's more natural to use uint8_t * (std::byte needs C++17 and llvm has
too much uint8_t *) and most callers use uint8_t * instead of char *.
The functions are recently moved into `llvm::compression::zlib::`, so
downstream projects need to make adaption anyway.

Added: 


Modified: 
clang-tools-extra/clangd/index/Serialization.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
lld/ELF/InputSection.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
llvm/include/llvm/Object/Decompressor.h
llvm/include/llvm/Support/Compression.h
llvm/lib/MC/ELFObjectWriter.cpp
llvm/lib/ObjCopy/ELF/ELFObject.cpp
llvm/lib/ObjCopy/ELF/ELFObject.h
llvm/lib/Object/Decompressor.cpp
llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/ProfileData/SampleProfReader.cpp
llvm/lib/ProfileData/SampleProfWriter.cpp
llvm/lib/Support/Compression.cpp
llvm/unittests/Support/CompressionTest.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/index/Serialization.cpp 
b/clang-tools-extra/clangd/index/Serialization.cpp
index ee86ed5714ec..9fc1567ad919 100644
--- a/clang-tools-extra/clangd/index/Serialization.cpp
+++ b/clang-tools-extra/clangd/index/Serialization.cpp
@@ -191,10 +191,11 @@ class StringTableOut {
   RawTable.push_back(0);
 }
 if (llvm::compression::zlib::isAvailable()) {
-  llvm::SmallString<1> Compressed;
-  llvm::compression::zlib::compress(RawTable, Compressed);
+  llvm::SmallVector Compressed;
+  llvm::compression::zlib::compress(llvm::arrayRefFromStringRef(RawTable),
+Compressed);
   write32(RawTable.size(), OS);
-  OS << Compressed;
+  OS << llvm::toStringRef(Compressed);
 } else {
   write32(0, OS); // No compression.
   OS << RawTable;
@@ -220,7 +221,7 @@ llvm::Expected 
readStringTable(llvm::StringRef Data) {
 return error("Truncated string table");
 
   llvm::StringRef Uncompressed;
-  llvm::SmallString<1> UncompressedStorage;
+  llvm::SmallVector UncompressedStorage;
   if (UncompressedSize == 0) // No compression
 Uncompressed = R.rest();
   else if (llvm::compression::zlib::isAvailable()) {
@@ -234,9 +235,10 @@ llvm::Expected 
readStringTable(llvm::StringRef Data) {
R.rest().size(), UncompressedSize);
 
 if (llvm::Error E = llvm::compression::zlib::uncompress(
-R.rest(), UncompressedStorage, UncompressedSize))
+llvm::arrayRefFromStringRef(R.rest()), UncompressedStorage,
+UncompressedSize))
   return std::move(E);
-Uncompressed = UncompressedStorage;
+Uncompressed = toStringRef(UncompressedStorage);
   } else
 return error("Compressed string table, but zlib is unavailable");
 

diff  --git a/clang/lib/Serialization/ASTReader.cpp 
b/clang/lib/Serialization/ASTReader.cpp
index bb98660717e7..04ade0a3b9d0 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -1466,14 +1466,15 @@ bool ASTReader::ReadSLocEntry(int ID) {
 Error("zlib is not available");
 return nullptr;
   }
-  SmallString<0> Uncompressed;
+  SmallVector Uncompressed;
   if (llvm::Error E = llvm::compression::zlib::uncompress(
-  Blob, Uncompressed, Record[0])) {
+  llvm::arrayRefFromStringRef(Blob), Uncompressed, Record[0])) {
 Error("could not decompress embedded file contents: " +
   llvm::toString(std::move(E)));
 return nullptr;
   }
-  return llvm::MemoryBuffer::getMemBufferCopy(Uncompressed, Name);
+  return llvm::MemoryBuffer::getMemBufferCopy(
+  llvm::toStringRef(Uncompressed), Name);
 } else if (RecCode == SM_SLOC_BUFFER_BLOB) {
   return llvm::MemoryBuffer::getMemBuffer(Blob.drop_back(1), Name, true);
 } else {

diff  --git a/clang/lib/Serialization/ASTWriter.cpp 
b/clang/lib/Serialization/ASTWriter.cpp
index 678105360431..fac8fc141d2c 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -2000,12 +2000,13 @@ static void emitBlob(llvm::BitstreamWriter &Stream, 
StringRef Blob,
 
   // Compress the buffer if possible. We expect that almost all PCM
   // consumers will not want its contents.
-  SmallString<0> CompressedBuffer;
+  SmallVector CompressedBuffer;
   if (llvm::compression::zlib::isAvailable()) {
- 

[Lldb-commits] [lldb] ecfaf48 - [lldb] Remove ELF .zdebug support

2022-07-14 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2022-07-14T10:12:48-07:00
New Revision: ecfaf4801cd0cc85fdced820110652f0281765fa

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

LOG: [lldb] Remove ELF .zdebug support

clang 14 removed -gz=zlib-gnu support and ld.lld/llvm-objcopy removed zlib-gnu
support recently. Remove lldb support by migrating away from
llvm::object::Decompressor::isCompressedELFSection.
The API has another user llvm-dwp, so it is not removed in this patch.

Reviewed By: labath

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

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml

Removed: 
lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml



diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp 
b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index f9fb36890d5ac..122298d87bf8d 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1607,7 +1607,7 @@ lldb::user_id_t 
ObjectFileELF::GetSectionIndexByName(const char *name) {
 }
 
 static SectionType GetSectionTypeFromName(llvm::StringRef Name) {
-  if (Name.consume_front(".debug_") || Name.consume_front(".zdebug_")) {
+  if (Name.consume_front(".debug_")) {
 return llvm::StringSwitch(Name)
 .Case("abbrev", eSectionTypeDWARFDebugAbbrev)
 .Case("abbrev.dwo", eSectionTypeDWARFDebugAbbrevDwo)
@@ -3365,8 +3365,7 @@ size_t ObjectFileELF::ReadSectionData(Section *section,
 return section->GetObjectFile()->ReadSectionData(section, section_data);
 
   size_t result = ObjectFile::ReadSectionData(section, section_data);
-  if (result == 0 || !llvm::object::Decompressor::isCompressedELFSection(
- section->Get(), section->GetName().GetStringRef()))
+  if (result == 0 || !(section->Get() & llvm::ELF::SHF_COMPRESSED))
 return result;
 
   auto Decompressor = llvm::object::Decompressor::create(

diff  --git a/lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml 
b/lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml
index e252713210e62..d4d289954801a 100644
--- a/lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml
+++ b/lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml
@@ -16,6 +16,7 @@ Sections:
 Type:SHT_PROGBITS
 Flags:   [ SHF_COMPRESSED ]
 Content: deadbeefbaadf00d
+## The legacy .zdebug format is not supported.
   - Name:.zdebug_info
 Type:SHT_PROGBITS
 Content: 5A4C49420008789c533070084828689809c802c1
@@ -37,8 +38,8 @@ Sections:
 # CHECK-NEXT: Data: ()
 
 # CHECK: Name: .zdebug_info
-# CHECK: dwarf-info
+# CHECK: regular
 # CHECK: File size: 28
 # CHECK: Data: (
-# CHECK-NEXT: 20304050 60708090
+# CHECK-NEXT: 5A4C4942  0008 789C5330 70084828 6898 09C802C1
 # CHECK-NEXT: )

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml 
b/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml
deleted file mode 100644
index 069753835474b..0
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml
+++ /dev/null
@@ -1,56 +0,0 @@
-## NB: This is a yaml file because llvm gnu-style writing support in 14.0
-## (2022, D117744). In due time we may want to remove it from lldb as well.
-
-## Debug info generated from the following sources using clang-13
-## struct A {
-##  long a = 42;
-## };
-## extern constexpr short s = 47;
-## extern constexpr A a{};
-
-# REQUIRES: zlib
-
-# RUN: yaml2obj %s > %t
-# RUN: %lldb %t -o "target var s a" -b | FileCheck %s
-
-# CHECK: (const short) s = 47
-# CHECK: (const A) a = (a = 42)
-
 !ELF
-FileHeader:
-  Class:   ELFCLASS64
-  Data:ELFDATA2LSB
-  Type:ET_EXEC
-  Machine: EM_X86_64
-  Entry:   0x401000
-Sections:
-  - Name:.rodata
-Type:SHT_PROGBITS
-Flags:   [ SHF_ALLOC ]
-Address: 0x401000
-AddressAlign:0x8
-Offset:  0x1000
-Content: 2F002A00
-  - Name:.zdebug_info
-Type:SHT_PROGBITS
-AddressAlign:0x1
-Content: 
5A4C49420077789C2B666060606100010E4610A9C820CA00012640CCE407248C81989197939941C0012CC16C01D2130024589998C280540848011F2733074C4124488E35116C28171B48493E480937505B04488A830100368605A7
-  - Name:.debug_abbrev
-Type:SHT_PROGBITS
-AddressAlign:0x1
-Content: 
011101250E1305030E10171B0E023400030E49133F193A0B3B0B02180326004913042400030E3E0B0B0B051301360B030E0B0B3A0B3B0B060D00030E49133A0B3B0B380B00
-  - Name: 

[Lldb-commits] [lldb] 3c849d0 - Modernize Optional::{getValueOr, hasValue}

2022-07-15 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2022-07-15T01:20:39-07:00
New Revision: 3c849d0aefa1101cf38586449c2105a97797c414

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

LOG: Modernize Optional::{getValueOr,hasValue}

Added: 


Modified: 
clang-tools-extra/clangd/AST.cpp
clang/lib/Analysis/FlowSensitive/DebugSupport.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
llvm/include/llvm/Support/Casting.h
llvm/lib/Target/LoongArch/LoongArchTargetMachine.cpp
mlir/include/mlir/IR/OpImplementation.h
mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/AST.cpp 
b/clang-tools-extra/clangd/AST.cpp
index 6ceff56115721..4df043d18cfb7 100644
--- a/clang-tools-extra/clangd/AST.cpp
+++ b/clang-tools-extra/clangd/AST.cpp
@@ -942,7 +942,7 @@ resolveForwardingParameters(const FunctionDecl *D, unsigned 
MaxDepth) {
   TailIt = std::copy(Info.Tail.rbegin(), Info.Tail.rend(), TailIt);
   // Prepare next recursion level
   Pack = Info.Pack;
-  CurrentFunction = Info.PackTarget.getValueOr(nullptr);
+  CurrentFunction = Info.PackTarget.value_or(nullptr);
   Depth++;
   // If we are recursing into a previously encountered function: Abort
   if (CurrentFunction) {

diff  --git a/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp 
b/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp
index 305d9d346089a..a2895d0197b1d 100644
--- a/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp
+++ b/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp
@@ -103,8 +103,7 @@ Constraints
 
 auto StatusString = debugString(Result.getStatus());
 auto Solution = Result.getSolution();
-auto SolutionString =
-Solution.hasValue() ? "\n" + debugString(Solution.value()) : "";
+auto SolutionString = Solution ? "\n" + debugString(Solution.value()) : "";
 
 return formatv(
 Template,

diff  --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp 
b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
index 825b11adad405..08fac9fb2e698 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
@@ -504,7 +504,7 @@ void ExprEngine::handleConstructor(const Expr *E,
 
 unsigned Idx = 0;
 if (CE->getType()->isArrayType()) {
-  Idx = getIndexOfElementToConstruct(State, CE, LCtx).getValueOr(0u);
+  Idx = getIndexOfElementToConstruct(State, CE, LCtx).value_or(0u);
   State = setIndexOfElementToConstruct(State, CE, LCtx, Idx + 1);
 }
 

diff  --git a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp 
b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
index 2c44683ab1356..f89936445b2ba 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
@@ -124,7 +124,7 @@ Error IntelPTCollector::TraceStart(const 
TraceIntelPTStartRequest &request) {
 
   // We try to use cgroup filtering whenever possible
   Optional cgroup_fd;
-  if (!request.disable_cgroup_filtering.getValueOr(false))
+  if (!request.disable_cgroup_filtering.value_or(false))
 cgroup_fd = GetCGroupFileDescriptor(m_process.GetID());
 
   if (Expected trace =

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index cbc24b1550c7c..8ee709db9cdb5 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3475,10 +3475,9 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const 
SymbolContext &sc,
 
   if (use_type_size_for_value && type_sp->GetType()) {
 DWARFExpression *location = location_list.GetMutableExpressionAtAddress();
-location->UpdateValue(
-const_value_form.Unsigned(),
-type_sp->GetType()->GetByteSize(nullptr).getValueOr(0),
-die.GetCU()->GetAddressByteSize());
+location->UpdateValue(const_value_form.Unsigned(),
+  type_sp->GetType()->GetByteSize(nullptr).value_or(0),
+  die.GetCU()->GetAddressByteSize());
   }
 
   return std::make_shared(

diff  --git a/llvm/include/llvm/Support/Casting.h 
b/llvm/include/llvm/Support/Casting.h
index 5444d777b7493..b6bbff8ada10b 100644
--- a/llvm/include/llvm/Support/Casting.h
+++ b/llvm/include/llvm/Support/Casting.h
@@ -265,7 +265,7 @@ struct CastIsPossible {
 template 
 struct CastIsPossible> {
   static inline bool isPossible(const Optional &f) {
-assert(f.hasValue() && "CastIsPossible::isPossible called on a nullopt!");
+assert(f && "CastIsPossible::isPossible called on

[Lldb-commits] [lldb] 59d2495 - [lldb] LLVM_FALLTHROUGH => [[fallthrough]]. NFC

2022-08-08 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2022-08-08T11:31:49-07:00
New Revision: 59d2495fe2c1254f84ad4d2bd61a41e79ff0d44d

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

LOG: [lldb] LLVM_FALLTHROUGH => [[fallthrough]]. NFC

Added: 


Modified: 
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Core/Address.cpp
lldb/source/Core/AddressRange.cpp
lldb/source/Core/Communication.cpp
lldb/source/Core/FormatEntity.cpp
lldb/source/Core/ValueObject.cpp
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Expression/REPL.cpp
lldb/source/Interpreter/OptionValueArray.cpp
lldb/source/Interpreter/OptionValueFileSpecList.cpp
lldb/source/Interpreter/OptionValuePathMappings.cpp
lldb/source/Interpreter/Options.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/Language/ObjC/Cocoa.cpp

lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/StackFrame.cpp
lldb/source/Target/StackFrameList.cpp
lldb/source/Utility/ArchSpec.cpp
lldb/tools/lldb-test/lldb-test.cpp
lldb/unittests/Expression/DWARFExpressionTest.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectMemory.cpp 
b/lldb/source/Commands/CommandObjectMemory.cpp
index 5051f9aeec851..22483e7c597c7 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -427,7 +427,7 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
   switch (type_str[type_str.size() - 1]) {
   case '*':
 ++pointer_count;
-LLVM_FALLTHROUGH;
+[[fallthrough]];
   case ' ':
   case '\t':
 type_str.erase(type_str.size() - 1);

diff  --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index b84e1ac8e1695..5969cf11d865c 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -451,7 +451,7 @@ bool Address::Dump(Stream *s, ExecutionContextScope 
*exe_scope, DumpStyle style,
   else
 s->Printf("%s[", "");
 }
-LLVM_FALLTHROUGH;
+[[fallthrough]];
   case DumpStyleFileAddress: {
 addr_t file_addr = GetFileAddress();
 if (file_addr == LLDB_INVALID_ADDRESS) {

diff  --git a/lldb/source/Core/AddressRange.cpp 
b/lldb/source/Core/AddressRange.cpp
index 66dcda574890a..1830f2ccd47fe 100644
--- a/lldb/source/Core/AddressRange.cpp
+++ b/lldb/source/Core/AddressRange.cpp
@@ -169,7 +169,7 @@ bool AddressRange::Dump(Stream *s, Target *target, 
Address::DumpStyle style,
 
   case Address::DumpStyleModuleWithFileAddress:
 show_module = true;
-LLVM_FALLTHROUGH;
+[[fallthrough]];
   case Address::DumpStyleFileAddress:
 vmaddr = m_base_addr.GetFileAddress();
 break;

diff  --git a/lldb/source/Core/Communication.cpp 
b/lldb/source/Core/Communication.cpp
index f41ce46ede88f..d5f8f8922f5e1 100644
--- a/lldb/source/Core/Communication.cpp
+++ b/lldb/source/Core/Communication.cpp
@@ -356,7 +356,7 @@ lldb::thread_result_t Communication::ReadThread() {
 case eConnectionStatusLostConnection: // Lost connection while connected to
   // a valid connection
   done = true;
-  LLVM_FALLTHROUGH;
+  [[fallthrough]];
 case eConnectionStatusTimedOut: // Request timed out
   if (error.Fail())
 LLDB_LOG(log, "error: {0}, status = {1}", error,

diff  --git a/lldb/source/Core/FormatEntity.cpp 
b/lldb/source/Core/FormatEntity.cpp
index 6e7f44e461fa6..0ac8fcabc61b9 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -696,7 +696,7 @@ static bool DumpValue(Stream &s, const SymbolContext *sc,
 

[Lldb-commits] [lldb] cdeb50c - [lldb] Remove include/lldb/lldb-private.h

2022-08-08 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2022-08-08T12:03:53-07:00
New Revision: cdeb50c3215593bffe9e5a46bdc9a9e34fd93dcc

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

LOG: [lldb] Remove include/lldb/lldb-private.h

The header from 62e0681afb478a4005efb6ba3598c24dc24866ee does something with
LLVM_FALLTHROUGH. Now that llvm-project has switched to C++17 and
LLVM_FALLTHROUGH uses have been migrated to [[fallthrough]], the header is
unneeded.

Reviewed By: JDevlieghere

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

Added: 


Modified: 
clang/docs/tools/clang-formatted-files.txt
lldb/include/lldb/lldb-private.h
lldb/include/lldb/module.modulemap

Removed: 
lldb/include/lldb/lldb-private-defines.h



diff  --git a/clang/docs/tools/clang-formatted-files.txt 
b/clang/docs/tools/clang-formatted-files.txt
index 81d0e9522e604..f89e19ca7cd3a 100644
--- a/clang/docs/tools/clang-formatted-files.txt
+++ b/clang/docs/tools/clang-formatted-files.txt
@@ -3591,7 +3591,6 @@ lldb/examples/plugins/commands/fooplugin.cpp
 lldb/examples/synthetic/bitfield/program.cpp
 lldb/include/lldb/lldb-defines.h
 lldb/include/lldb/lldb-forward.h
-lldb/include/lldb/lldb-private-defines.h
 lldb/include/lldb/lldb-private.h
 lldb/include/lldb/lldb-public.h
 lldb/include/lldb/lldb-versioning.h

diff  --git a/lldb/include/lldb/lldb-private-defines.h 
b/lldb/include/lldb/lldb-private-defines.h
deleted file mode 100644
index d66e6ef1518d7..0
--- a/lldb/include/lldb/lldb-private-defines.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//===-- lldb-private-defines.h --*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef LLDB_LLDB_PRIVATE_DEFINES_H
-#define LLDB_LLDB_PRIVATE_DEFINES_H
-
-#if defined(__cplusplus)
-
-// Include Compiler.h here so we don't define LLVM_FALLTHROUGH and then
-// Compiler.h later tries to redefine it.
-#include "llvm/Support/Compiler.h"
-
-#ifndef LLVM_FALLTHROUGH
-
-#ifndef __has_cpp_attribute
-#define __has_cpp_attribute(x) 0
-#endif
-
-/// \macro LLVM_FALLTHROUGH
-/// Marks an empty statement preceding a deliberate switch fallthrough.
-#if __has_cpp_attribute(clang::fallthrough)
-#define LLVM_FALLTHROUGH [[clang::fallthrough]]
-#else
-#define LLVM_FALLTHROUGH
-#endif
-
-#endif // ifndef LLVM_FALLTHROUGH
-
-#endif // #if defined(__cplusplus)
-
-#endif // LLDB_LLDB_PRIVATE_DEFINES_H

diff  --git a/lldb/include/lldb/lldb-private.h 
b/lldb/include/lldb/lldb-private.h
index ac07047fb4edb..f56af06ec5973 100644
--- a/lldb/include/lldb/lldb-private.h
+++ b/lldb/include/lldb/lldb-private.h
@@ -11,7 +11,6 @@
 
 #if defined(__cplusplus)
 
-#include "lldb/lldb-private-defines.h"
 #include "lldb/lldb-private-enumerations.h"
 #include "lldb/lldb-private-interfaces.h"
 #include "lldb/lldb-private-types.h"

diff  --git a/lldb/include/lldb/module.modulemap 
b/lldb/include/lldb/module.modulemap
index 303d6b15e808c..c06e026076f49 100644
--- a/lldb/include/lldb/module.modulemap
+++ b/lldb/include/lldb/module.modulemap
@@ -134,7 +134,6 @@ module lldb_Utility {
   module lldb_enumerations { header "lldb-enumerations.h" export * }
   module lldb_forward { header "lldb-forward.h" export * }
   module lldb_private_enumerations { header "lldb-private-enumerations.h" 
export * }
-  module lldb_private_defines { header "lldb-private-defines.h" export * }
   module lldb_private_forward { header "lldb-private-forward.h" export * }
   module lldb_private { header "lldb-private.h" export * }
   module lldb_private_interfaces { header "lldb-private-interfaces.h" export * 
}



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


[Lldb-commits] [lldb] 5146f84 - LLVM_NODISCARD => [[nodiscard]]. NFC

2022-08-09 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2022-08-09T07:16:34Z
New Revision: 5146f84fd616084fb63025a3e8a172179137b1ce

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

LOG: LLVM_NODISCARD => [[nodiscard]]. NFC

Added: 


Modified: 
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
mlir/include/mlir/Analysis/AliasAnalysis.h
mlir/include/mlir/Dialect/Transform/IR/TransformInterfaces.h
mlir/include/mlir/IR/OpImplementation.h
mlir/include/mlir/Support/LogicalResult.h

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index 55971136b63b..0f137a7b3c49 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -588,7 +588,7 @@ class CommandInterpreter : public Broadcaster,
   /// \return True if the exit code was successfully set; false if the
   /// interpreter doesn't allow custom exit codes.
   /// \see AllowExitCodeOnQuit
-  LLVM_NODISCARD bool SetQuitExitCode(int exit_code);
+  [[nodiscard]] bool SetQuitExitCode(int exit_code);
 
   /// Returns the exit code that the user has specified when running the
   /// 'quit' command.

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h 
b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h
index 5db8abbdbdf3..3a87570bf804 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h
@@ -30,7 +30,7 @@ class CppModuleConfiguration {
   public:
 /// Try setting the path. Returns true if the path was set and false if
 /// the path was already set.
-LLVM_NODISCARD bool TrySet(llvm::StringRef path);
+[[nodiscard]] bool TrySet(llvm::StringRef path);
 /// Return the path if there is one.
 llvm::StringRef Get() const {
   assert(m_valid && "Called Get() on an invalid SetOncePath?");

diff  --git 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index dfa2d4c05126..d71ce0faa7b2 100644
--- 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -503,7 +503,7 @@ ValueObjectSP AppleObjCRuntime::GetExceptionObjectForThread(
 /// \param msg The message to add to the log.
 /// \return An invalid ThreadSP to be returned from
 /// GetBacktraceThreadFromException.
-LLVM_NODISCARD
+[[nodiscard]]
 static ThreadSP FailExceptionParsing(llvm::StringRef msg) {
   Log *log = GetLog(LLDBLog::Language);
   LLDB_LOG(log, "Failed getting backtrace from exception: {0}", msg);

diff  --git a/mlir/include/mlir/Analysis/AliasAnalysis.h 
b/mlir/include/mlir/Analysis/AliasAnalysis.h
index fd36b2db3e50..5beae79ad1a0 100644
--- a/mlir/include/mlir/Analysis/AliasAnalysis.h
+++ b/mlir/include/mlir/Analysis/AliasAnalysis.h
@@ -87,7 +87,7 @@ inline raw_ostream &operator<<(raw_ostream &os, const 
AliasResult &result) {
 /// The possible results of whether a memory access modifies or references
 /// a memory location. The possible results are: no access at all, a
 /// modification, a reference, or both a modification and a reference.
-class LLVM_NODISCARD ModRefResult {
+class [[nodiscard]] ModRefResult {
   /// Note: This is a simplified version of the ModRefResult in
   /// `llvm/Analysis/AliasAnalysis.h`, and namely removes the `Must` concept. 
If
   /// this becomes useful/necessary we should add it here.
@@ -123,23 +123,23 @@ class LLVM_NODISCARD ModRefResult {
   static ModRefResult getModAndRef() { return Kind::ModRef; }
 
   /// Returns if this result does not modify or reference memory.
-  LLVM_NODISCARD bool isNoModRef() const { return kind == Kind::NoModRef; }
+  [[nodiscard]] bool isNoModRef() const { return kind == Kind::NoModRef; }
 
   /// Returns if this result modifies memory.
-  LLVM_NODISCARD bool isMod() const {
+  [[nodiscard]] bool isMod() const {
 return static_cast(kind) & static_cast(Kind::Mod);
   }
 
   /// Returns if this result references memory.
-  LLVM_NODISCARD bool isRef() const {
+  [[nodiscard]] bool isRef() const {
 return static_cast(kind) & static_cast(Kind::Ref);
   }
 
   /// Returns if this result modifies *or* references memory.
-  LLVM_NODISCARD bool isModOrRef() const { return kind != Kind::NoModRef; }
+  [[nodiscard]] bool isModOrRef() const { return kind != Kind::NoModRef; }
 
   /// Returns if this result modifies *and* r

[Lldb-commits] [lldb] 115b189 - [lldb][ARC] Fix -Wtautological-bitwise-compare warning

2022-08-13 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2022-08-13T00:18:37-07:00
New Revision: 115b1899a114285981814a641587e9704c2b9eb9

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

LOG: [lldb][ARC] Fix -Wtautological-bitwise-compare warning

Added: 


Modified: 
lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp 
b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
index a9c7af145338e..f202d581dd5f9 100644
--- a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
+++ b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
@@ -151,7 +151,7 @@ bool ABISysV_arc::IsRegisterFileReduced(RegisterContext 
®_ctx) const {
   /*fail_value*/ 0);
 // RF_BUILD "Number of Entries" bit.
 const uint32_t rf_entries_bit = 1U << 9U;
-m_is_reg_file_reduced = (reg_value | rf_entries_bit) != 0;
+m_is_reg_file_reduced = (reg_value & rf_entries_bit) != 0;
   }
 
   return m_is_reg_file_reduced.value_or(false);



___
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] [libcxx] [clang] [flang] [mlir] [X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (PR #77886)

2024-01-12 Thread Fangrui Song via lldb-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/77886

>From f5a33f9e6893250e3584a77630b771ee76693c20 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Thu, 11 Jan 2024 23:42:38 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 clang/lib/Basic/Targets/X86.cpp   | 11 ++
 .../test/CodeGen/X86/inline-asm-constraints.c |  8 +
 clang/test/Sema/inline-asm-validate-x86.c |  4 +++
 llvm/docs/LangRef.rst |  2 ++
 llvm/lib/Target/X86/X86AsmPrinter.cpp |  8 +
 llvm/lib/Target/X86/X86ISelLowering.cpp   | 20 ---
 .../X86/inline-asm-Ws-constraint-error.ll |  9 +
 .../CodeGen/X86/inline-asm-Ws-constraint.ll   | 34 +++
 8 files changed, 91 insertions(+), 5 deletions(-)
 create mode 100644 llvm/test/CodeGen/X86/inline-asm-Ws-constraint-error.ll
 create mode 100644 llvm/test/CodeGen/X86/inline-asm-Ws-constraint.ll

diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp
index 64e281b888a95f..a68b662d9401aa 100644
--- a/clang/lib/Basic/Targets/X86.cpp
+++ b/clang/lib/Basic/Targets/X86.cpp
@@ -1418,6 +1418,14 @@ bool X86TargetInfo::validateAsmConstraint(
   case 'O':
 Info.setRequiresImmediate(0, 127);
 return true;
+  case 'W':
+switch (*++Name) {
+default:
+  return false;
+case 's':
+  Info.setAllowsRegister();
+  return true;
+}
   // Register constraints.
   case 'Y': // 'Y' is the first character for several 2-character constraints.
 // Shift the pointer to the second character of the constraint.
@@ -1715,6 +1723,9 @@ std::string X86TargetInfo::convertConstraint(const char 
*&Constraint) const {
 return std::string("{st}");
   case 'u':// second from top of floating point stack.
 return std::string("{st(1)}"); // second from top of floating point stack.
+  case 'W':
+assert(Constraint[1] == 's');
+return '^' + std::string(Constraint++, 2);
   case 'Y':
 switch (Constraint[1]) {
 default:
diff --git a/clang/test/CodeGen/X86/inline-asm-constraints.c 
b/clang/test/CodeGen/X86/inline-asm-constraints.c
index b75a84d7a7bcbf..bfcbbca7c4f6bf 100644
--- a/clang/test/CodeGen/X86/inline-asm-constraints.c
+++ b/clang/test/CodeGen/X86/inline-asm-constraints.c
@@ -53,3 +53,11 @@ __m512 testZMM0(void) {
 #endif
   return zmm0;
 }
+
+extern int var;
+
+// CHECK-LABEL: test_Ws(
+// CHECK: call void asm sideeffect "// ${0:p} ${1:p}", 
"^Ws,^Ws,~{dirflag},~{fpsr},~{flags}"(ptr @var, ptr @test_Ws)
+void test_Ws(void) {
+  asm("// %p0 %p1" :: "Ws"(&var), "Ws"(test_Ws));
+}
diff --git a/clang/test/Sema/inline-asm-validate-x86.c 
b/clang/test/Sema/inline-asm-validate-x86.c
index 87b60a0955301a..032d76477c4ae6 100644
--- a/clang/test/Sema/inline-asm-validate-x86.c
+++ b/clang/test/Sema/inline-asm-validate-x86.c
@@ -130,3 +130,7 @@ void pr40890(void) {
   __asm__ __volatile__("\n#define BEEF abcd%0\n" : : 
"n"((int*)0xdeadbeef));
 #endif
 }
+
+void test_W() {
+  asm("" : : "Wd"(test_W)); // expected-error{{invalid input constraint 'Wd' 
in asm}}
+}
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index d881deb30049a2..076029976ffc5d 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -5336,6 +5336,7 @@ X86:
   operand in a SSE register. If AVX is also enabled, can also be a 256-bit
   vector operand in an AVX register. If AVX-512 is also enabled, can also be a
   512-bit vector operand in an AVX512 register. Otherwise, an error.
+- ``Ws``: A symbolic reference or label reference.
 - ``x``: The same as ``v``, except that when AVX-512 is enabled, the ``x`` code
   only allocates into the first 16 AVX-512 registers, while the ``v`` code
   allocates into any of the 32 AVX-512 registers.
@@ -5518,6 +5519,7 @@ X86:
   the operand. (The behavior for relocatable symbol expressions is a
   target-specific behavior for this typically target-independent modifier)
 - ``H``: Print a memory reference with additional offset +8.
+- ``p``: Print a raw symbol name (without syntax-specific prefixes).
 - ``P``: Print a memory reference used as the argument of a call instruction or
   used with explicit base reg and index reg as its offset. So it can not use
   additional regs to present the memory reference. (E.g. omit ``(rip)``, even
diff --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 15cfd247f125ca..9f0fd4d0938e97 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -774,6 +774,14 @@ bool X86AsmPrinter::PrintAsmOperand(const MachineInstr 
*MI, unsigned OpNo,
   PrintOperand(MI, OpNo, O);
   return false;
 
+case 'p': {
+  const MachineOperand &MO = MI->getOperand(OpNo);
+  if (MO.getType() != MachineOperand:

[Lldb-commits] [llvm] [clang-tools-extra] [lldb] [libcxx] [clang] [flang] [mlir] [X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (PR #77886)

2024-01-12 Thread Fangrui Song via lldb-commits


@@ -0,0 +1,34 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=i686 < %s | FileCheck %s
+; RUN: llc -mtriple=x86_64 < %s | FileCheck %s
+
+@var = external dso_local global i32, align 4
+
+define dso_local void @test() {
+; CHECK-LABEL: test:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:#APP
+; CHECK-NEXT:# var test
+; CHECK-NEXT:#NO_APP
+; CHECK-NEXT:ret{{[l|q]}}
+entry:
+  call void asm sideeffect "// ${0:p} ${1:p}", 
"^Ws,^Ws,~{dirflag},~{fpsr},~{flags}"(ptr @var, ptr @test)
+  ret void
+}
+
+define dso_local void @test_label() {
+; CHECK-LABEL: test_label:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:  .Ltmp0: # Block address taken
+; CHECK-NEXT:  # %bb.1: # %label
+; CHECK-NEXT:#APP
+; CHECK-NEXT:# .Ltmp0
+; CHECK-NEXT:#NO_APP
+; CHECK-NEXT:ret{{[l|q]}}
+entry:
+  br label %label
+
+label:
+  tail call void asm sideeffect "// ${0:p}", 
"Ws,~{dirflag},~{fpsr},~{flags}"(ptr blockaddress(@test_label, %label))

MaskRay wrote:

Thanks for spotting this. Fixed.

I think constraint validation is primarily performed in Clang Sema and it's 
easy to crash LLVM with invalid LLVM IR. In this case Ws+0:p happens to work as 
well.

https://github.com/llvm/llvm-project/pull/77886
___
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] [libcxx] [clang] [flang] [mlir] [X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (PR #77886)

2024-01-12 Thread Fangrui Song via lldb-commits


@@ -56966,6 +56965,17 @@ void 
X86TargetLowering::LowerAsmOperandForConstraint(SDValue Op,
 }
 return;
   }
+  case 'W': {
+assert(Constraint[1] == 's');
+if (const auto *GA = dyn_cast(Op)) {
+  Ops.push_back(DAG.getTargetGlobalAddress(GA->getGlobal(), SDLoc(Op),
+   GA->getValueType(0)));
+} else if (const auto *BA = dyn_cast(Op)) {
+  Ops.push_back(DAG.getTargetBlockAddress(BA->getBlockAddress(),
+  BA->getValueType(0)));
+}

MaskRay wrote:

Removed

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


[Lldb-commits] [libcxx] [mlir] [flang] [llvm] [clang-tools-extra] [clang] [lldb] [X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (PR #77886)

2024-01-13 Thread Fangrui Song via lldb-commits


@@ -5336,6 +5336,7 @@ X86:
   operand in a SSE register. If AVX is also enabled, can also be a 256-bit
   vector operand in an AVX register. If AVX-512 is also enabled, can also be a
   512-bit vector operand in an AVX512 register. Otherwise, an error.
+- ``Ws``: A symbolic reference or label reference.

MaskRay wrote:

Yes, it's supported (aarch64 "S" supports it but riscv "S" doesn't) I intend to 
support it for x86 "Ws".

OK, I've figured out how to do it in SelectionDAG... Updated.

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


[Lldb-commits] [libcxx] [mlir] [compiler-rt] [flang] [llvm] [libc] [clang-tools-extra] [clang] [lldb] [X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (PR #77886)

2024-01-13 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [flang] [libc] [clang] [libcxx] [compiler-rt] [lldb] [mlir] [llvm] [clang-tools-extra] [X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (PR #77886)

2024-01-13 Thread Fangrui Song via lldb-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/77886

>From f5a33f9e6893250e3584a77630b771ee76693c20 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Thu, 11 Jan 2024 23:42:38 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 clang/lib/Basic/Targets/X86.cpp   | 11 ++
 .../test/CodeGen/X86/inline-asm-constraints.c |  8 +
 clang/test/Sema/inline-asm-validate-x86.c |  4 +++
 llvm/docs/LangRef.rst |  2 ++
 llvm/lib/Target/X86/X86AsmPrinter.cpp |  8 +
 llvm/lib/Target/X86/X86ISelLowering.cpp   | 20 ---
 .../X86/inline-asm-Ws-constraint-error.ll |  9 +
 .../CodeGen/X86/inline-asm-Ws-constraint.ll   | 34 +++
 8 files changed, 91 insertions(+), 5 deletions(-)
 create mode 100644 llvm/test/CodeGen/X86/inline-asm-Ws-constraint-error.ll
 create mode 100644 llvm/test/CodeGen/X86/inline-asm-Ws-constraint.ll

diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp
index 64e281b888a95f..a68b662d9401aa 100644
--- a/clang/lib/Basic/Targets/X86.cpp
+++ b/clang/lib/Basic/Targets/X86.cpp
@@ -1418,6 +1418,14 @@ bool X86TargetInfo::validateAsmConstraint(
   case 'O':
 Info.setRequiresImmediate(0, 127);
 return true;
+  case 'W':
+switch (*++Name) {
+default:
+  return false;
+case 's':
+  Info.setAllowsRegister();
+  return true;
+}
   // Register constraints.
   case 'Y': // 'Y' is the first character for several 2-character constraints.
 // Shift the pointer to the second character of the constraint.
@@ -1715,6 +1723,9 @@ std::string X86TargetInfo::convertConstraint(const char 
*&Constraint) const {
 return std::string("{st}");
   case 'u':// second from top of floating point stack.
 return std::string("{st(1)}"); // second from top of floating point stack.
+  case 'W':
+assert(Constraint[1] == 's');
+return '^' + std::string(Constraint++, 2);
   case 'Y':
 switch (Constraint[1]) {
 default:
diff --git a/clang/test/CodeGen/X86/inline-asm-constraints.c 
b/clang/test/CodeGen/X86/inline-asm-constraints.c
index b75a84d7a7bcbf..bfcbbca7c4f6bf 100644
--- a/clang/test/CodeGen/X86/inline-asm-constraints.c
+++ b/clang/test/CodeGen/X86/inline-asm-constraints.c
@@ -53,3 +53,11 @@ __m512 testZMM0(void) {
 #endif
   return zmm0;
 }
+
+extern int var;
+
+// CHECK-LABEL: test_Ws(
+// CHECK: call void asm sideeffect "// ${0:p} ${1:p}", 
"^Ws,^Ws,~{dirflag},~{fpsr},~{flags}"(ptr @var, ptr @test_Ws)
+void test_Ws(void) {
+  asm("// %p0 %p1" :: "Ws"(&var), "Ws"(test_Ws));
+}
diff --git a/clang/test/Sema/inline-asm-validate-x86.c 
b/clang/test/Sema/inline-asm-validate-x86.c
index 87b60a0955301a..032d76477c4ae6 100644
--- a/clang/test/Sema/inline-asm-validate-x86.c
+++ b/clang/test/Sema/inline-asm-validate-x86.c
@@ -130,3 +130,7 @@ void pr40890(void) {
   __asm__ __volatile__("\n#define BEEF abcd%0\n" : : 
"n"((int*)0xdeadbeef));
 #endif
 }
+
+void test_W() {
+  asm("" : : "Wd"(test_W)); // expected-error{{invalid input constraint 'Wd' 
in asm}}
+}
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index d881deb30049a2..076029976ffc5d 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -5336,6 +5336,7 @@ X86:
   operand in a SSE register. If AVX is also enabled, can also be a 256-bit
   vector operand in an AVX register. If AVX-512 is also enabled, can also be a
   512-bit vector operand in an AVX512 register. Otherwise, an error.
+- ``Ws``: A symbolic reference or label reference.
 - ``x``: The same as ``v``, except that when AVX-512 is enabled, the ``x`` code
   only allocates into the first 16 AVX-512 registers, while the ``v`` code
   allocates into any of the 32 AVX-512 registers.
@@ -5518,6 +5519,7 @@ X86:
   the operand. (The behavior for relocatable symbol expressions is a
   target-specific behavior for this typically target-independent modifier)
 - ``H``: Print a memory reference with additional offset +8.
+- ``p``: Print a raw symbol name (without syntax-specific prefixes).
 - ``P``: Print a memory reference used as the argument of a call instruction or
   used with explicit base reg and index reg as its offset. So it can not use
   additional regs to present the memory reference. (E.g. omit ``(rip)``, even
diff --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 15cfd247f125ca..9f0fd4d0938e97 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -774,6 +774,14 @@ bool X86AsmPrinter::PrintAsmOperand(const MachineInstr 
*MI, unsigned OpNo,
   PrintOperand(MI, OpNo, O);
   return false;
 
+case 'p': {
+  const MachineOperand &MO = MI->getOperand(OpNo);
+  if (MO.getType() != MachineOperand:

[Lldb-commits] [libc] [lldb] [mlir] [clang-tools-extra] [flang] [clang] [llvm] [compiler-rt] [libcxx] [X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (PR #77886)

2024-01-14 Thread Fangrui Song via lldb-commits


@@ -1418,6 +1418,14 @@ bool X86TargetInfo::validateAsmConstraint(
   case 'O':
 Info.setRequiresImmediate(0, 127);
 return true;
+  case 'W':
+switch (*++Name) {
+default:
+  return false;
+case 's':
+  Info.setAllowsRegister();

MaskRay wrote:

`setAllowsRegister` is somewhat confusing but its use is correct here (also 
used by aarch64/riscv `S`).

`setAllowsMemory` seems to not add extra checks.

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


[Lldb-commits] [compiler-rt] [clang] [clang-tools-extra] [lldb] [libc] [flang] [llvm] [libcxx] [mlir] [X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (PR #77886)

2024-01-14 Thread Fangrui Song via lldb-commits


@@ -130,3 +130,7 @@ void pr40890(void) {
   __asm__ __volatile__("\n#define BEEF abcd%0\n" : : 
"n"((int*)0xdeadbeef));
 #endif
 }
+
+void test_W(int i) {
+  asm("" : : "Wd"(test_W)); // expected-error{{invalid input constraint 'Wd' 
in asm}}

MaskRay wrote:

The codegen tests  `asm("// %p0 %p1 %p2" :: "Ws"(&var), "Ws"(&arr[3]), 
"Ws"(test_Ws));` (and a struct test I am adding) provide positive tests:)

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


[Lldb-commits] [compiler-rt] [clang] [clang-tools-extra] [lldb] [libc] [lld] [flang] [llvm] [libcxx] [mlir] [X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (PR #77886)

2024-01-14 Thread Fangrui Song via lldb-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/77886

>From f5a33f9e6893250e3584a77630b771ee76693c20 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Thu, 11 Jan 2024 23:42:38 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 clang/lib/Basic/Targets/X86.cpp   | 11 ++
 .../test/CodeGen/X86/inline-asm-constraints.c |  8 +
 clang/test/Sema/inline-asm-validate-x86.c |  4 +++
 llvm/docs/LangRef.rst |  2 ++
 llvm/lib/Target/X86/X86AsmPrinter.cpp |  8 +
 llvm/lib/Target/X86/X86ISelLowering.cpp   | 20 ---
 .../X86/inline-asm-Ws-constraint-error.ll |  9 +
 .../CodeGen/X86/inline-asm-Ws-constraint.ll   | 34 +++
 8 files changed, 91 insertions(+), 5 deletions(-)
 create mode 100644 llvm/test/CodeGen/X86/inline-asm-Ws-constraint-error.ll
 create mode 100644 llvm/test/CodeGen/X86/inline-asm-Ws-constraint.ll

diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp
index 64e281b888a95f..a68b662d9401aa 100644
--- a/clang/lib/Basic/Targets/X86.cpp
+++ b/clang/lib/Basic/Targets/X86.cpp
@@ -1418,6 +1418,14 @@ bool X86TargetInfo::validateAsmConstraint(
   case 'O':
 Info.setRequiresImmediate(0, 127);
 return true;
+  case 'W':
+switch (*++Name) {
+default:
+  return false;
+case 's':
+  Info.setAllowsRegister();
+  return true;
+}
   // Register constraints.
   case 'Y': // 'Y' is the first character for several 2-character constraints.
 // Shift the pointer to the second character of the constraint.
@@ -1715,6 +1723,9 @@ std::string X86TargetInfo::convertConstraint(const char 
*&Constraint) const {
 return std::string("{st}");
   case 'u':// second from top of floating point stack.
 return std::string("{st(1)}"); // second from top of floating point stack.
+  case 'W':
+assert(Constraint[1] == 's');
+return '^' + std::string(Constraint++, 2);
   case 'Y':
 switch (Constraint[1]) {
 default:
diff --git a/clang/test/CodeGen/X86/inline-asm-constraints.c 
b/clang/test/CodeGen/X86/inline-asm-constraints.c
index b75a84d7a7bcbf..bfcbbca7c4f6bf 100644
--- a/clang/test/CodeGen/X86/inline-asm-constraints.c
+++ b/clang/test/CodeGen/X86/inline-asm-constraints.c
@@ -53,3 +53,11 @@ __m512 testZMM0(void) {
 #endif
   return zmm0;
 }
+
+extern int var;
+
+// CHECK-LABEL: test_Ws(
+// CHECK: call void asm sideeffect "// ${0:p} ${1:p}", 
"^Ws,^Ws,~{dirflag},~{fpsr},~{flags}"(ptr @var, ptr @test_Ws)
+void test_Ws(void) {
+  asm("// %p0 %p1" :: "Ws"(&var), "Ws"(test_Ws));
+}
diff --git a/clang/test/Sema/inline-asm-validate-x86.c 
b/clang/test/Sema/inline-asm-validate-x86.c
index 87b60a0955301a..032d76477c4ae6 100644
--- a/clang/test/Sema/inline-asm-validate-x86.c
+++ b/clang/test/Sema/inline-asm-validate-x86.c
@@ -130,3 +130,7 @@ void pr40890(void) {
   __asm__ __volatile__("\n#define BEEF abcd%0\n" : : 
"n"((int*)0xdeadbeef));
 #endif
 }
+
+void test_W() {
+  asm("" : : "Wd"(test_W)); // expected-error{{invalid input constraint 'Wd' 
in asm}}
+}
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index d881deb30049a2..076029976ffc5d 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -5336,6 +5336,7 @@ X86:
   operand in a SSE register. If AVX is also enabled, can also be a 256-bit
   vector operand in an AVX register. If AVX-512 is also enabled, can also be a
   512-bit vector operand in an AVX512 register. Otherwise, an error.
+- ``Ws``: A symbolic reference or label reference.
 - ``x``: The same as ``v``, except that when AVX-512 is enabled, the ``x`` code
   only allocates into the first 16 AVX-512 registers, while the ``v`` code
   allocates into any of the 32 AVX-512 registers.
@@ -5518,6 +5519,7 @@ X86:
   the operand. (The behavior for relocatable symbol expressions is a
   target-specific behavior for this typically target-independent modifier)
 - ``H``: Print a memory reference with additional offset +8.
+- ``p``: Print a raw symbol name (without syntax-specific prefixes).
 - ``P``: Print a memory reference used as the argument of a call instruction or
   used with explicit base reg and index reg as its offset. So it can not use
   additional regs to present the memory reference. (E.g. omit ``(rip)``, even
diff --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 15cfd247f125ca..9f0fd4d0938e97 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -774,6 +774,14 @@ bool X86AsmPrinter::PrintAsmOperand(const MachineInstr 
*MI, unsigned OpNo,
   PrintOperand(MI, OpNo, O);
   return false;
 
+case 'p': {
+  const MachineOperand &MO = MI->getOperand(OpNo);
+  if (MO.getType() != MachineOperand:

[Lldb-commits] [libc] [clang] [compiler-rt] [clang-tools-extra] [libcxxabi] [flang] [lldb] [lld] [llvm] [libcxx] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #66915)

2024-01-16 Thread Fangrui Song via lldb-commits


@@ -80,6 +80,11 @@ static cl::opt EnableRISCVDeadRegisterElimination(
  " them with stores to x0"),
 cl::init(true));
 
+// TODO: This should be controlled by -mtls-dialect=
+cl::opt EnableRISCVTLSDESC("riscv-enable-tlsdesc",

MaskRay wrote:

We should add an option to `codegen::InitTargetOptionsFromCodeGenFlags`, then 
reference it using something like `DAG.getTarget().useTLSDESC()`. aarch64 ELF 
only implements TLSDESC for dynamic TLS models, it is fine for it to ignore 
`useTLSDESC`.

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


[Lldb-commits] [libcxx] [clang-tools-extra] [libcxxabi] [compiler-rt] [clang] [lldb] [lld] [flang] [llvm] [libc] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #66915)

2024-01-16 Thread Fangrui Song via lldb-commits

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

LGTM once the TLSDESC option is moved to use llvm/lib/CodeGen/CommandFlags.cpp

It's worth giving others some time to respond.

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


[Lldb-commits] [libc] [clang] [compiler-rt] [clang-tools-extra] [libcxxabi] [flang] [lldb] [lld] [llvm] [libcxx] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #66915)

2024-01-16 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [llvm] [libcxx] [compiler-rt] [clang-tools-extra] [flang] [lld] [mlir] [libc] [clang] [lldb] [X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (PR #77886)

2024-01-16 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [llvm] [libcxx] [compiler-rt] [clang-tools-extra] [flang] [lld] [mlir] [libc] [clang] [lldb] [X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (PR #77886)

2024-01-16 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [compiler-rt] [lldb] [libc] [libcxx] [flang] [libcxxabi] [clang] [libclc] [lld] [mlir] [clang-tools-extra] [llvm] [ELF] Add internal InputFile (PR #78944)

2024-01-22 Thread Fangrui Song via lldb-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/78944

>From a72bbb3ae04c7be90af36d2cd025329d4ef2ab16 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Sun, 21 Jan 2024 22:18:48 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 lld/ELF/Arch/ARM.cpp  |  6 ++--
 lld/ELF/Arch/Mips.cpp |  7 ++---
 lld/ELF/Arch/PPC64.cpp|  2 +-
 lld/ELF/Config.h  |  1 +
 lld/ELF/Driver.cpp|  6 +++-
 lld/ELF/InputFiles.cpp|  4 +++
 lld/ELF/InputFiles.h  |  7 +++--
 lld/ELF/InputSection.cpp  |  4 ++-
 lld/ELF/InputSection.h|  3 +-
 lld/ELF/LTO.cpp   |  6 ++--
 lld/ELF/LinkerScript.cpp  |  8 ++---
 lld/ELF/Relocations.cpp   |  2 +-
 lld/ELF/ScriptLexer.h |  4 +--
 lld/ELF/ScriptParser.cpp  |  3 +-
 lld/ELF/SyntheticSections.cpp |  4 +--
 lld/ELF/Target.cpp|  2 +-
 lld/ELF/Writer.cpp| 31 ++-
 lld/test/ELF/cref.s   | 11 ++-
 .../ELF/linkerscript/symbol-ordering-file2.s  |  5 +--
 lld/test/ELF/x86-64-gotpc-no-relax-err.s  |  3 ++
 20 files changed, 74 insertions(+), 45 deletions(-)

diff --git a/lld/ELF/Arch/ARM.cpp b/lld/ELF/Arch/ARM.cpp
index d34e74a11c6d8d8..687f9499009d5eb 100644
--- a/lld/ELF/Arch/ARM.cpp
+++ b/lld/ELF/Arch/ARM.cpp
@@ -1381,9 +1381,9 @@ template  void 
elf::writeARMCmseImportLib() {
   // Copy the secure gateway entry symbols to the import library symbol table.
   for (auto &p : symtab.cmseSymMap) {
 Defined *d = cast(p.second.sym);
-impSymTab->addSymbol(makeDefined(nullptr, d->getName(), 
d->computeBinding(),
- /*stOther=*/0, STT_FUNC, d->getVA(),
- d->getSize(), nullptr));
+impSymTab->addSymbol(makeDefined(
+ctx.internalFile, d->getName(), d->computeBinding(),
+/*stOther=*/0, STT_FUNC, d->getVA(), d->getSize(), nullptr));
   }
 
   size_t idx = 0;
diff --git a/lld/ELF/Arch/Mips.cpp b/lld/ELF/Arch/Mips.cpp
index d6c70aeba95dd44..b02ad10649d901d 100644
--- a/lld/ELF/Arch/Mips.cpp
+++ b/lld/ELF/Arch/Mips.cpp
@@ -771,12 +771,11 @@ template  bool elf::isMipsPIC(const Defined 
*sym) {
   if (!sym->section)
 return false;
 
-  ObjFile *file =
-  cast(sym->section)->template getFile();
-  if (!file)
+  InputFile *file = cast(sym->section)->file;
+  if (!file || file->isInternal())
 return false;
 
-  return file->getObj().getHeader().e_flags & EF_MIPS_PIC;
+  return cast>(file)->getObj().getHeader().e_flags & EF_MIPS_PIC;
 }
 
 template  TargetInfo *elf::getMipsTargetInfo() {
diff --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp
index 097a57514770aaf..de52f6a79a40b99 100644
--- a/lld/ELF/Arch/PPC64.cpp
+++ b/lld/ELF/Arch/PPC64.cpp
@@ -253,7 +253,7 @@ static bool addOptional(StringRef name, uint64_t value,
   Symbol *sym = symtab.find(name);
   if (!sym || sym->isDefined())
 return false;
-  sym->resolve(Defined{/*file=*/nullptr, StringRef(), STB_GLOBAL, STV_HIDDEN,
+  sym->resolve(Defined{ctx.internalFile, StringRef(), STB_GLOBAL, STV_HIDDEN,
STT_FUNC, value,
/*size=*/0, /*section=*/nullptr});
   defined.push_back(cast(sym));
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index 56229334f9a44ae..ab15701d9b57898 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -473,6 +473,7 @@ struct Ctx {
  std::pair>
   backwardReferences;
   llvm::SmallSet auxiliaryFiles;
+  InputFile *internalFile;
   // True if SHT_LLVM_SYMPART is used.
   std::atomic hasSympart{false};
   // True if there are TLS IE relocations. Set DF_STATIC_TLS if -shared.
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index b988f4311e61b83..62e1c29504ba26c 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -105,6 +105,7 @@ void Ctx::reset() {
   whyExtractRecords.clear();
   backwardReferences.clear();
   auxiliaryFiles.clear();
+  internalFile = nullptr;
   hasSympart.store(false, std::memory_order_relaxed);
   hasTlsIe.store(false, std::memory_order_relaxed);
   needsTlsLd.store(false, std::memory_order_relaxed);
@@ -2337,7 +2338,8 @@ static void readSymbolPartitionSection(InputSectionBase 
*s) {
 
 static Symbol *addUnusedUndefined(StringRef name,
   uint8_t binding = STB_GLOBAL) {
-  return symtab.addSymbol(Undefined{nullptr, name, binding, STV_DEFAULT, 0});
+  return symtab.addSymbol(
+  Undefined{ctx.internalFile, name, binding, STV_DEFAULT, 0});
 }
 
 static 

[Lldb-commits] [compiler-rt] [lldb] [libc] [libcxx] [flang] [libcxxabi] [clang] [libclc] [lld] [mlir] [clang-tools-extra] [llvm] [ELF] Add internal InputFile (PR #78944)

2024-01-22 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [libc] [libcxxabi] [libcxx] [lld] [flang] [libclc] [clang] [compiler-rt] [clang-tools-extra] [lldb] [llvm] [Thumb, ELF] Fix access to dso_preemptable __stack_chk_guard with static reloc

2024-01-22 Thread Fangrui Song via lldb-commits

https://github.com/MaskRay edited 
https://github.com/llvm/llvm-project/pull/78950
___
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] [libc] [compiler-rt] [lldb] [libcxx] [libcxxabi] [lld] [clang] [libclc] [llvm] [Thumb, ELF] Fix access to dso_preemptable __stack_chk_guard with static reloc

2024-01-22 Thread Fangrui Song via lldb-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/78950

>From 2ce57488682873d2dc005144db57fbb555f29d8a Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Mon, 22 Jan 2024 00:29:09 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 llvm/lib/Target/ARM/Thumb1InstrInfo.cpp  |  5 ++--
 llvm/lib/Target/ARM/Thumb2InstrInfo.cpp  |  2 +-
 llvm/test/CodeGen/ARM/stack-guard-elf.ll | 30 +++-
 3 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp 
b/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp
index e2f3fad2007904..e3104e8ee765f9 100644
--- a/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp
+++ b/llvm/lib/Target/ARM/Thumb1InstrInfo.cpp
@@ -135,14 +135,15 @@ void 
Thumb1InstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
 void Thumb1InstrInfo::expandLoadStackGuard(
 MachineBasicBlock::iterator MI) const {
   MachineFunction &MF = *MI->getParent()->getParent();
-  const TargetMachine &TM = MF.getTarget();
   const ARMSubtarget &ST = MF.getSubtarget();
+  const GlobalValue *GV =
+  cast((*MI->memoperands_begin())->getValue());
 
   assert(MF.getFunction().getParent()->getStackProtectorGuard() != "tls" &&
  "TLS stack protector not supported for Thumb1 targets");
 
   unsigned Instr;
-  if (TM.isPositionIndependent())
+  if (!GV->isDSOLocal())
 Instr = ARM::tLDRLIT_ga_pcrel;
   else if (ST.genExecuteOnly() && ST.hasV8MBaselineOps())
 Instr = ARM::t2MOVi32imm;
diff --git a/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp 
b/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
index 2ea0eaa0aad8f5..9e4b51616b56ec 100644
--- a/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
+++ b/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
@@ -264,7 +264,7 @@ void Thumb2InstrInfo::expandLoadStackGuard(
   const GlobalValue *GV =
   cast((*MI->memoperands_begin())->getValue());
 
-  if (MF.getSubtarget().isGVInGOT(GV))
+  if (!GV->isDSOLocal())
 expandLoadStackGuardBase(MI, ARM::t2LDRLIT_ga_pcrel, ARM::t2LDRi12);
   else if (MF.getTarget().isPositionIndependent())
 expandLoadStackGuardBase(MI, ARM::t2MOV_ga_pcrel, ARM::t2LDRi12);
diff --git a/llvm/test/CodeGen/ARM/stack-guard-elf.ll 
b/llvm/test/CodeGen/ARM/stack-guard-elf.ll
index 250f2ad9ed1093..d0e5db7e5711b0 100644
--- a/llvm/test/CodeGen/ARM/stack-guard-elf.ll
+++ b/llvm/test/CodeGen/ARM/stack-guard-elf.ll
@@ -59,6 +59,8 @@ define i32 @test1() #0 {
 ; THUMB1-NEXT:.pad #16
 ; THUMB1-NEXT:sub sp, #16
 ; THUMB1-NEXT:ldr r0, .LCPI0_0
+; THUMB1-NEXT:  .LPC0_0:
+; THUMB1-NEXT:add r0, pc
 ; THUMB1-NEXT:ldr r0, [r0]
 ; THUMB1-NEXT:ldr r0, [r0]
 ; THUMB1-NEXT:add r1, sp, #904
@@ -67,7 +69,9 @@ define i32 @test1() #0 {
 ; THUMB1-NEXT:bl foo
 ; THUMB1-NEXT:add r0, sp, #904
 ; THUMB1-NEXT:ldr r0, [r0, #124]
-; THUMB1-NEXT:ldr r1, .LCPI0_0
+; THUMB1-NEXT:ldr r1, .LCPI0_1
+; THUMB1-NEXT:  .LPC0_1:
+; THUMB1-NEXT:add r1, pc
 ; THUMB1-NEXT:ldr r1, [r1]
 ; THUMB1-NEXT:ldr r1, [r1]
 ; THUMB1-NEXT:cmp r1, r0
@@ -83,7 +87,11 @@ define i32 @test1() #0 {
 ; THUMB1-NEXT:.p2align 2
 ; THUMB1-NEXT:  @ %bb.3:
 ; THUMB1-NEXT:  .LCPI0_0:
-; THUMB1-NEXT:.long __stack_chk_guard
+; THUMB1-NEXT:  .Ltmp0:
+; THUMB1-NEXT:.long __stack_chk_guard(GOT_PREL)-((.LPC0_0+4)-.Ltmp0)
+; THUMB1-NEXT:  .LCPI0_1:
+; THUMB1-NEXT:  .Ltmp1:
+; THUMB1-NEXT:.long __stack_chk_guard(GOT_PREL)-((.LPC0_1+4)-.Ltmp1)
 ;
 ; THUMB1-PIC-LABEL: test1:
 ; THUMB1-PIC:   @ %bb.0:
@@ -136,16 +144,18 @@ define i32 @test1() #0 {
 ; THUMB2-NEXT:push {r7, lr}
 ; THUMB2-NEXT:.pad #1032
 ; THUMB2-NEXT:sub.w sp, sp, #1032
-; THUMB2-NEXT:movw r0, :lower16:__stack_chk_guard
-; THUMB2-NEXT:movt r0, :upper16:__stack_chk_guard
+; THUMB2-NEXT:ldr r0, .LCPI0_0
+; THUMB2-NEXT:  .LPC0_0:
+; THUMB2-NEXT:add r0, pc
 ; THUMB2-NEXT:ldr r0, [r0]
 ; THUMB2-NEXT:ldr r0, [r0]
 ; THUMB2-NEXT:str.w r0, [sp, #1028]
 ; THUMB2-NEXT:add r0, sp, #4
 ; THUMB2-NEXT:bl foo
-; THUMB2-NEXT:movw r1, :lower16:__stack_chk_guard
 ; THUMB2-NEXT:ldr.w r0, [sp, #1028]
-; THUMB2-NEXT:movt r1, :upper16:__stack_chk_guard
+; THUMB2-NEXT:ldr r1, .LCPI0_1
+; THUMB2-NEXT:  .LPC0_1:
+; THUMB2-NEXT:add r1, pc
 ; THUMB2-NEXT:ldr r1, [r1]
 ; THUMB2-NEXT:ldr r1, [r1]
 ; THUMB2-NEXT:cmp r1, r0
@@ -155,6 +165,14 @@ define i32 @test1() #0 {
 ; THUMB2-NEXT:popeq {r7, pc}
 ; THUMB2-NEXT:  .LBB0_1:
 ; THUMB2-NEXT:bl __stack_chk_fail
+; THUMB2-NEXT:.p2align 2
+; THUMB2-NEXT:  @ %bb.2:
+; THUMB2-NEXT:  .LCPI0_0:
+; THUMB2-NEXT:  .Ltmp0:
+; THUMB2-NEXT:.long __stack_chk_guard(GOT_PREL)-((.LPC0_0+4)-.Ltmp0)
+; THUMB2-NEXT:  .LCPI0_1:
+; THUMB2-NEXT:  .Ltmp1:
+; THUMB2-NEXT:.long __stack_chk_guard(GOT_PREL)-((.LPC0_1+4)-.Ltmp1)
 ;
 ; THUMB2-PIC-LABEL: test1:
 ; THUMB2-PIC

[Lldb-commits] [flang] [clang-tools-extra] [libc] [compiler-rt] [lldb] [libcxx] [libcxxabi] [lld] [clang] [libclc] [llvm] [Thumb, ELF] Fix access to dso_preemptable __stack_chk_guard with static reloc

2024-01-22 Thread Fangrui Song via lldb-commits


@@ -135,14 +135,15 @@ void 
Thumb1InstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
 void Thumb1InstrInfo::expandLoadStackGuard(
 MachineBasicBlock::iterator MI) const {
   MachineFunction &MF = *MI->getParent()->getParent();
-  const TargetMachine &TM = MF.getTarget();
   const ARMSubtarget &ST = MF.getSubtarget();
+  const GlobalValue *GV =
+  cast((*MI->memoperands_begin())->getValue());

MaskRay wrote:

Thanks for the suggestion. Done

https://github.com/llvm/llvm-project/pull/78950
___
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] [libc] [compiler-rt] [lldb] [libcxx] [libcxxabi] [lld] [clang] [libclc] [llvm] [Thumb, ELF] Fix access to dso_preemptable __stack_chk_guard with static reloc

2024-01-22 Thread Fangrui Song via lldb-commits

MaskRay wrote:

> (the commit message seems odd; intentional?)

Hopefully clarified:)

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


[Lldb-commits] [clang] [libunwind] [libc] [libcxx] [clang-tools-extra] [lld] [lldb] [libclc] [flang] [llvm] [libcxxabi] [compiler-rt] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #

2024-01-22 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [clang-tools-extra] [libclc] [compiler-rt] [lldb] [libcxxabi] [libunwind] [llvm] [libcxx] [lld] [flang] [libc] [clang] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #

2024-01-22 Thread Fangrui Song via lldb-commits


@@ -89,8 +89,8 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine 
&TM,
   if ((ABI == RISCVABI::ABI_ILP32F || ABI == RISCVABI::ABI_LP64F) &&
   !Subtarget.hasStdExtF()) {
 errs() << "Hard-float 'f' ABI can't be used for a target that "
-"doesn't support the F instruction set extension (ignoring "
-  "target-abi)\n";
+  "doesn't support the F instruction set extension (ignoring "

MaskRay wrote:

Ah, I only use `git diff -U0 --no-color --relative main... -- | 
path/to/clang/tools/clang-format/clang-format-diff.py -p1  -i` :)

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


[Lldb-commits] [clang] [llvm] [libunwind] [compiler-rt] [libc] [flang] [lld] [libcxx] [lldb] [libclc] [clang-tools-extra] [libcxxabi] [RISCV] Support Global Dynamic TLSDESC in the RISC-V backend (PR #

2024-01-22 Thread Fangrui Song via lldb-commits

MaskRay wrote:

This PR needs a rebase.. There are quite a few merge commits. Hmm, I don't know 
how to squash the changes to rebase them to latest main branch. `git rebase 
--keep-base -i main` has quite a few merge conflicts.

(My lld change (https://github.com/maskray/llvm-project/tree/rv-tlsdesc) is 
almost complete. I want to rebase it onto the latest revision of this LLVM PR.)

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


[Lldb-commits] [lldb] [libclc] [libc] [clang] [compiler-rt] [mlir] [flang] [clang-tools-extra] [libcxx] [lld] [llvm] [libcxxabi] [ELF] Add internal InputFile (PR #78944)

2024-01-23 Thread Fangrui Song via lldb-commits




MaskRay wrote:

Hi, do you have more information (like a reproduce tarball) about a `file` that 
references a file of `InternalKind`? Could it be a patch in your downstream?

If `file` references a file of `InternalKind`, we probably should make it 
`nullptr` instead. But I don't know a code path where it is the case for the 
upstream lld.

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


[Lldb-commits] [clang] [libc] [lldb] [llvm] [mlir] [compiler-rt] [lld] [libcxx] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-23 Thread Fangrui Song via lldb-commits

https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/79222

>From 3a2b2a1110e7b3348a12a6476ab014a469891062 Mon Sep 17 00:00:00 2001
From: Fangrui Song 
Date: Tue, 23 Jan 2024 15:13:49 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 clang/test/Driver/unsupported-option-gpu.c | 7 +++
 1 file changed, 7 insertions(+)
 create mode 100644 clang/test/Driver/unsupported-option-gpu.c

diff --git a/clang/test/Driver/unsupported-option-gpu.c 
b/clang/test/Driver/unsupported-option-gpu.c
new file mode 100644
index 00..5713dbbfc7ae4d
--- /dev/null
+++ b/clang/test/Driver/unsupported-option-gpu.c
@@ -0,0 +1,7 @@
+/// Some target-specific options are ignored for GPU, so %clang exits with 
code 0.
+// DEFINE: %{gpu_opts} = --cuda-gpu-arch=sm_60 
--cuda-path=%S/Inputs/CUDA/usr/local/cuda --no-cuda-version-check
+// DEFINE: %{check} = %clang -### -c %{gpu_opts} -mcmodel=medium %s
+// RUN: %{check} -fbasic-block-sections=all
+
+// REDEFINE: %{gpu_opts} = -x hip --rocm-path=%S/Inputs/rocm -nogpulib
+// RUN: %{check}

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


[Lldb-commits] [clang] [libc] [lldb] [llvm] [mlir] [compiler-rt] [lld] [libcxx] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-23 Thread Fangrui Song via lldb-commits


@@ -0,0 +1,7 @@
+/// Some target-specific options are ignored for GPU, so %clang exits with 
code 0.
+// DEFINE: %{gpu_opts} = --cuda-gpu-arch=sm_60 
--cuda-path=%S/Inputs/CUDA/usr/local/cuda --no-cuda-version-check
+// DEFINE: %{check} = %clang -### -c %{gpu_opts} -mcmodel=medium %s
+// RUN: %{check} -fbasic-block-sections=all

MaskRay wrote:

Added `-x cuda`. The test is to show we don't get an error 
(`err_drv_unsupported_opt_for_target`) when compiling for x86_64 using a device 
(AMDGPU/NVPTX) when certain target-specified options are specified.

I am not familiar with offloading but specifying `--cuda-host-only` would 
defeat the purpose.

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


[Lldb-commits] [clang] [libc] [lldb] [llvm] [mlir] [compiler-rt] [lld] [libcxx] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-23 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [clang] [libc] [lldb] [llvm] [mlir] [compiler-rt] [lld] [libcxx] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-23 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [clang] [libc] [lldb] [llvm] [mlir] [compiler-rt] [lld] [libcxx] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-23 Thread Fangrui Song via lldb-commits

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


[Lldb-commits] [clang] [libc] [lldb] [llvm] [mlir] [compiler-rt] [lld] [libcxx] [Driver] Test ignored target-specific options for AMDGPU/NVPTX (PR #79222)

2024-01-23 Thread Fangrui Song via lldb-commits


@@ -0,0 +1,7 @@
+/// Some target-specific options are ignored for GPU, so %clang exits with 
code 0.
+// DEFINE: %{gpu_opts} = --cuda-gpu-arch=sm_60 
--cuda-path=%S/Inputs/CUDA/usr/local/cuda --no-cuda-version-check

MaskRay wrote:

Thanks for the suggestion. Edited

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


  1   2   3   >