[Lldb-commits] [llvm] [libc] [lldb] [compiler-rt] [libcxxabi] [flang] [lld] [libcxx] [clang] [clang-tools-extra] [llvm-exegesis] Add support for validation counters (PR #76653)

2024-01-19 Thread Aiden Grossman via lldb-commits

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


[Lldb-commits] [clang] [llvm] [compiler-rt] [lld] [libcxx] [flang] [clang-tools-extra] [libc] [lldb] [clang] Fix assertion failure with deleted overloaded unary operators (PR #78316)

2024-01-19 Thread Mariya Podchishchaeva via lldb-commits

https://github.com/Fznamznon updated 
https://github.com/llvm/llvm-project/pull/78316

>From cf33d7ce01aafe0fa29b8a38a9824a0b03d24f05 Mon Sep 17 00:00:00 2001
From: "Podchishchaeva, Mariya" 
Date: Tue, 16 Jan 2024 09:16:10 -0800
Subject: [PATCH 1/4] [clang] Fix assertion failure with deleted overloaded
 unary operators

When emitting notes related to wrong number of arguments do not consider
implicit object argument.

Fixes https://github.com/llvm/llvm-project/issues/78314
---
 clang/docs/ReleaseNotes.rst|  2 ++
 clang/lib/Sema/SemaOverload.cpp|  4 ++--
 clang/test/SemaCXX/overloaded-operator.cpp | 27 ++
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 6e31849ce16dd4..8382e5d55f6c6e 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -750,6 +750,8 @@ Bug Fixes in This Version
   Fixes (`#77583 `_)
 - Fix an issue where CTAD fails for function-type/array-type arguments.
   Fixes (`#51710 `_)
+- Fixed assertion failure with deleted overloaded unary operators.
+  Fixes (`#78314 `_)
 
 Bug Fixes to Compiler Builtins
 ^^
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 37c62b306b3cd3..83ab7cb0f3411b 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -14310,8 +14310,8 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, 
UnaryOperatorKind Opc,
 PartialDiagnosticAt(OpLoc, PDiag(diag::err_ovl_deleted_oper)
<< UnaryOperator::getOpcodeStr(Opc)
<< Input->getSourceRange()),
-*this, OCD_AllCandidates, ArgsArray, UnaryOperator::getOpcodeStr(Opc),
-OpLoc);
+*this, OCD_AllCandidates, ArgsArray.slice(1),
+UnaryOperator::getOpcodeStr(Opc), OpLoc);
 return ExprError();
   }
 
diff --git a/clang/test/SemaCXX/overloaded-operator.cpp 
b/clang/test/SemaCXX/overloaded-operator.cpp
index 83a7e65b43dd01..60332019f516cf 100644
--- a/clang/test/SemaCXX/overloaded-operator.cpp
+++ b/clang/test/SemaCXX/overloaded-operator.cpp
@@ -598,3 +598,30 @@ namespace B {
 }
 void g(B::X x) { A::f(x); }
 }
+
+namespace GH78314 {
+
+class a {
+public:
+  void operator--() = delete; // expected-note {{candidate function has been 
explicitly deleted}} \
+  // expected-note {{candidate function not 
viable: requires 0 arguments, but 1 was provided}}
+  void operator--(int) = delete; // expected-note {{candidate function has 
been explicitly deleted}} \
+ // expected-note {{candidate function not 
viable: requires 1 argument, but 0 were provided}}
+};
+
+void foo() {
+  a aa;
+  --aa; // expected-error {{overload resolution selected deleted operator 
'--'}}
+  aa--; // expected-error {{overload resolution selected deleted operator 
'--'}}
+}
+
+class b {
+  void operator++() = delete; // expected-note {{candidate function has been 
explicitly deleted}}
+  template  void operator++(int) { // expected-note {{function template 
not viable: requires 1 argument, but 0 were provided}}
+b bb;
+++bb; // expected-error {{overload resolution selected deleted operator 
'++'}}
+  }
+};
+
+
+}

>From 03daf97e74c05c1fa0c0c4b1637cbc76d3184404 Mon Sep 17 00:00:00 2001
From: "Podchishchaeva, Mariya" 
Date: Wed, 17 Jan 2024 02:30:04 -0800
Subject: [PATCH 2/4] Add a test with explicit object parameter

---
 clang/test/SemaCXX/overloaded-operator.cpp | 30 ++
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/clang/test/SemaCXX/overloaded-operator.cpp 
b/clang/test/SemaCXX/overloaded-operator.cpp
index 60332019f516cf..887848c29b83c5 100644
--- a/clang/test/SemaCXX/overloaded-operator.cpp
+++ b/clang/test/SemaCXX/overloaded-operator.cpp
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 
+// RUN: %clang_cc1 -fsyntax-only -verify=expected,precxx23 -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx23 -std=c++23 %s
+
 class X { };
 
 X operator+(X, X);
@@ -33,7 +35,9 @@ struct A {
 
 A make_A();
 
-bool operator==(A&, Z&); // expected-note 3{{candidate function}}
+bool operator==(A&, Z&); // expected-note 3{{candidate function}} \
+ // cxx23-note 2{{candidate function}}
+
 
 void h(A a, const A ac, Z z) {
   make_A() == z; // expected-warning{{equality comparison result unused}}
@@ -68,7 +72,9 @@ struct E2 {
 };
 
 // C++ [over.match.oper]p3 - enum restriction.
-float& operator==(E1, E2);  // expected-note{{candidate function}}
+float& operator==(E1, E2);  // expected-note{{candidate function}} \
+// cxx23-note{{candidate function}}
+
 
 void enum_test(Enum1 enum1, 

[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits


@@ -1618,22 +1621,25 @@ static uint32_t LookupSymbolInModule(CommandInterpreter 
&interpreter,
 for (uint32_t i = 0; i < num_matches; ++i) {
   Symbol *symbol = symtab->SymbolAtIndex(match_indexes[i]);
   if (symbol) {
+Stream::HighlightSettings pattern_info(
+name, interpreter.GetDebugger().GetRegexMatchAnsiPrefix(),
+interpreter.GetDebugger().GetRegexMatchAnsiSuffix());
 if (symbol->ValueIsAddress()) {
   DumpAddress(
   interpreter.GetExecutionContext().GetBestExecutionContextScope(),
   symbol->GetAddressRef(), verbose, all_ranges, strm,
-  use_color && name_is_regex ? name : nullptr);
+  use_color && name_is_regex
+  ? std::optional{pattern_info}
+  : std::nullopt);

DavidSpickett wrote:

I'm thinking about how to simplify the logic here. While not having to build a 
struct every single time.

First, you could move the `Stream::HighlightSettings` construction outside the 
loop ("hoist" some people call that). This means if we match 1 million symbols, 
we only construct one highlight settings object.

If we know that `use_colour && name_is_regex` is false, we could set `name` in 
the `HighlightSettings` to `""`. Then when it's passed to `DumpAddress` it will 
see the pattern is empty and print normally and exit early.

That means you could have:
```
DumpAddress(
  interpreter.GetExecutionContext().GetBestExecutionContextScope(),
  symbol->GetAddressRef(), verbose, all_ranges, strm, pattern_info);
```
Always passing it shouldn't cost that much and removing the ternary removes a 
potential branch which balances that out a bit.

However, this makes the parameter being `optional` kinda pointless, and I think 
it should still be optional for every other caller who can just use `nullopt` 
and not pay the cost of making a `HighlightSettings`.

So in summary: I would move the `HighlightSettings` construction out of the 
loop. The rest of my idea I think is marginal and risks over complicating 
things.

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits


@@ -260,10 +271,9 @@ class Stream {
   /// The ANSI color code to end colorization. This is
   /// environment-dependent.
 
-  void PutCStringColorHighlighted(llvm::StringRef text,
-  llvm::StringRef pattern = "",
-  llvm::StringRef prefix = "",
-  llvm::StringRef suffix = "");
+  void PutCStringColorHighlighted(
+  llvm::StringRef text,
+  std::optional pattern_info = std::nullopt);

DavidSpickett wrote:

`pattern_info` relates to the old way of doing it more than this.

How about `settings`? It will be obvious that it's settings for highlighting 
because it's in `PutCStringColorHighlighted`.

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits


@@ -262,14 +263,12 @@ void Symbol::GetDescription(Stream *s, 
lldb::DescriptionLevel level,
   }
   if (ConstString demangled = m_mangled.GetDemangledName()) {
 s->PutCString(", name=\"");
-s->PutCStringColorHighlighted(demangled.GetStringRef(), pattern,
-  ansi_prefix, ansi_suffix);
+s->PutCStringColorHighlighted(demangled.GetStringRef(), pattern_info);
 s->PutCString("\"");
   }
   if (ConstString mangled_name = m_mangled.GetMangledName()) {
 s->PutCString(", mangled=\"");
-s->PutCStringColorHighlighted(mangled_name.GetStringRef(), pattern,
-  ansi_prefix, ansi_suffix);
+s->PutCStringColorHighlighted(mangled_name.GetStringRef(), pattern_info);

DavidSpickett wrote:

`highlight_settings`, given that you could use any ANSII sequence. I'm sure you 
could turn the text upside down if you really wanted to :)

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits


@@ -72,23 +72,20 @@ size_t Stream::PutCString(llvm::StringRef str) {
   return bytes_written;
 }
 
-void Stream::PutCStringColorHighlighted(llvm::StringRef text,
-llvm::StringRef pattern,
-llvm::StringRef prefix,
-llvm::StringRef suffix) {
-  // Only apply color formatting when a pattern is present and both prefix and
-  // suffix are specified. In the absence of these conditions, output the text
-  // without color formatting.
-  if (pattern.empty() || (prefix.empty() && suffix.empty())) {
+void Stream::PutCStringColorHighlighted(
+llvm::StringRef text, std::optional pattern_info) {
+  // Only apply color formatting when a pattern information is specified.
+  // Otherwise, output the text without color formatting.

DavidSpickett wrote:

To link back to my earlier comment, this early exit is fine and should stay.

I think, however, that it's best for callers to pass `nullopt` for the settings 
if they want to disable highlighting. That's a much more intuitive way to do 
it, backed up by the type system.

Which is what you're doing, so don't change anything! (just wanted to explain 
my thinking here)

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


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

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

SuperSodaSea wrote:

Ping.

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> Do you think the commit message is good enough?

The commit spends a lot of time talking about the previous PR not saying what 
this PR does. "Follow up to #..." is enough to give context.

This PR puts all the highlighting settings into a single struct for easier 
handling. That's what the commit message should tell us.

> Also, kind of a git question: is it better to wait this PR conclude to open 
> the next since there will be concurrent modifications in basically the same 
> files?

So you're asking about "stacked PRs" and I myself haven't tried this. LLVM has 
recently enabled user branches on llvm/llvm-project so I think it is possible 
using some of the tools out there, but I have not tried it. I would look on the 
forums for anyone who's tried it, or ask on Discord for advice.

A half way point that you can do, is to have a local branch that has changes 
for many PRs on it. Then make a branch that only includes the changes meant for 
the first PR. Push that into review and in the meantime, you can continue to 
work on the larger branch. When the PR lands, rebase the larger branch onto 
`main`, and make another sub branch for the next PR, etc.

```
all_changes:
C
B
A
main



all_changes:
C
Bfirst_pr:
AA
main main






all_changes:
C
B
main
```

This is what I've been doing, it's got its own problems and if someone wants to 
see the whole stack, you'll have to push `all_changes` to GitHub also (but for 
me doing open source work only that's fine). Also I have decent luck with fast 
reviews, or am doing work where it needs in depth review, so it works out for 
me.

If you have 10 small changes to make and your reviewer is in the opposite time 
zone, stacked PRs can be a great benefit as the reviewer can look at all 10 in 
one session so the feedback is ready for your next working day.

Either method involves some amount rebasing and conflict resolution.

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


[Lldb-commits] [mlir] [clang] [libcxx] [flang] [libc] [llvm] [clang-tools-extra] [lldb] [compiler-rt] Added settings for DEBUGINFOD cache location and timeout (PR #78605)

2024-01-19 Thread Kevin Frei via lldb-commits

https://github.com/kevinfrei updated 
https://github.com/llvm/llvm-project/pull/78605

>From 48c6e5edc1dc5f832f8f5c922c61af9070ad341d Mon Sep 17 00:00:00 2001
From: Kevin Frei 
Date: Thu, 18 Jan 2024 09:09:50 -0800
Subject: [PATCH 1/8] Added settings for cache location and timeout

---
 .../Debuginfod/SymbolLocatorDebuginfod.cpp| 82 +++
 .../SymbolLocatorDebuginfodProperties.td  |  8 +-
 llvm/include/llvm/Debuginfod/Debuginfod.h | 13 +++
 llvm/lib/Debuginfod/Debuginfod.cpp| 31 +--
 4 files changed, 108 insertions(+), 26 deletions(-)

diff --git 
a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp 
b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
index 111be6be365240..a20437c256eb43 100644
--- a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
+++ b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
@@ -9,6 +9,7 @@
 #include "SymbolLocatorDebuginfod.h"
 
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Interpreter/OptionValueString.h"
 #include "lldb/Utility/Args.h"
 
 #include "llvm/Debuginfod/Debuginfod.h"
@@ -54,6 +55,34 @@ class PluginProperties : public Properties {
 return urls;
   }
 
+  llvm::Expected GetCachePath() {
+OptionValueString *s =
+m_collection_sp->GetPropertyAtIndexAsOptionValueString(
+ePropertySymbolCachePath);
+// If we don't have a valid cache location, use the default one.
+if (!s || !s->GetCurrentValueAsRef().size()) {
+  llvm::Expected maybeCachePath =
+  llvm::getDefaultDebuginfodCacheDirectory();
+  if (!maybeCachePath) {
+return maybeCachePath;
+  }
+  m_cache_path = *maybeCachePath;
+  return llvm::StringRef(m_cache_path);
+}
+return s->GetCurrentValueAsRef();
+  }
+
+  std::chrono::milliseconds GetTimeout() const {
+std::optional seconds =
+m_collection_sp->GetPropertyAtIndexAs(ePropertyTimeout);
+if (seconds && *seconds != 0) {
+  return std::chrono::duration_cast(
+  std::chrono::seconds(*seconds));
+} else {
+  return llvm::getDefaultDebuginfodTimeout();
+}
+  }
+
 private:
   void ServerURLsChangedCallback() {
 m_server_urls = GetDebugInfoDURLs();
@@ -65,6 +94,7 @@ class PluginProperties : public Properties {
   }
   // Storage for the StringRef's used within the Debuginfod library.
   Args m_server_urls;
+  std::string m_cache_path;
 };
 
 } // namespace
@@ -112,31 +142,49 @@ SymbolLocator *SymbolLocatorDebuginfod::CreateInstance() {
   return new SymbolLocatorDebuginfod();
 }
 
-static std::optional GetFileForModule(
-const ModuleSpec &module_spec,
-std::function(llvm::object::BuildIDRef)>
-PullFromServer) {
-  if (!ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup())
-return {};
++ static std::optional +
+GetFileForModule(
+const ModuleSpec &module_spec,
+std::function UrlBuilder) {
   const UUID &module_uuid = module_spec.GetUUID();
-  if (module_uuid.IsValid() && llvm::canUseDebuginfod()) {
-llvm::object::BuildID build_id(module_uuid.GetBytes());
-llvm::Expected result = PullFromServer(build_id);
-if (result)
-  return FileSpec(*result);
-// An error here should be logged as a failure in the Debuginfod library,
-// so just consume it here
-consumeError(result.takeError());
-  }
+  // Don't bother if we don't have a valid UUID, Debuginfod isn't available,
+  // or if the 'symbols.enable-external-lookup' setting is false
+  if (!module_uuid.IsValid() || !llvm::canUseDebuginfod() ||
+  !ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup())
+return {};
+
+  // Grab the settings values we need
+  PluginProperties &plugin_props = GetGlobalPluginProperties();
+  llvm::Expected CacheDirectoryPathOrErr =
+  plugin_props.GetCachePath();
+  // A cache location is *required*
+  if (!CacheDirectoryPathOrErr)
+return {};
+  llvm::StringRef CacheDirectoryPath = *CacheDirectoryPathOrErr;
+  llvm::SmallVector DebuginfodUrls =
+  llvm::getDefaultDebuginfodUrls();
+  std::chrono::milliseconds Timeout = plugin_props.GetTimeout();
+
+  // We're ready to ask the Debuginfod library to find our file
+  llvm::object::BuildID build_id(module_uuid.GetBytes());
+  std::string UrlPath = UrlBuilder(build_id);
+  std::string CacheKey = llvm::getDebuginfodCacheKey(UrlPath);
+  llvm::Expected result = llvm::getCachedOrDownloadArtifact(
+  CacheKey, UrlPath, CacheDirectoryPath, DebuginfodUrls, Timeout);
+  if (result)
+return FileSpec(*result);
+  // An error here should be logged as a failure in the Debuginfod library,
+  // just consume it here
+  consumeError(result.takeError());
   return {};
 }
 
 std::optional SymbolLocatorDebuginfod::LocateExecutableObjectFile(
 const ModuleSpec &module_spec) {
-  return GetFileForModule(module_spec, llvm::getCachedOrDownloadExecutable);
+  return GetFileForModule

[Lldb-commits] [llvm] [libcxxabi] [libc] [clang-tools-extra] [libunwind] [lldb] [libcxx] [clang] [lld] [flang] [compiler-rt] Fix a bug in Smith's algorithm used in complex div. (PR #78330)

2024-01-19 Thread Zahira Ammarguellat via lldb-commits

zahiraam wrote:

@rjmccall thanks for the review and clarification. @andykaylor do you have any 
other comments about this?

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


[Lldb-commits] [llvm] [libcxxabi] [libc] [clang-tools-extra] [libunwind] [lldb] [libcxx] [clang] [lld] [flang] [compiler-rt] Fix a bug in Smith's algorithm used in complex div. (PR #78330)

2024-01-19 Thread Zahira Ammarguellat via lldb-commits

zahiraam wrote:

@AaronBallman any comments about this? Thanks.

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


[Lldb-commits] [llvm] [libcxxabi] [libc] [clang-tools-extra] [libunwind] [lldb] [libcxx] [clang] [lld] [flang] [compiler-rt] Fix a bug in Smith's algorithm used in complex div. (PR #78330)

2024-01-19 Thread Aaron Ballman via lldb-commits

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


[Lldb-commits] [libcxx] [clang] [libc] [libcxxabi] [libunwind] [compiler-rt] [lld] [clang-tools-extra] [flang] [lldb] [llvm] Fix a bug in Smith's algorithm used in complex div. (PR #78330)

2024-01-19 Thread Aaron Ballman via lldb-commits

https://github.com/AaronBallman commented:

I think the current changes are reasonable to land for Clang 18 so we get the 
fix out to users. I don't have strong opinions on pushing this down into LLVM 
or outlining the function like John suggested; either approach is fine by me. I 
think outlining the function might make sense but I don't think it's a 
requirement either (perhaps add a FIXME comment suggesting it?).

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


[Lldb-commits] [libcxxabi] [libc] [compiler-rt] [flang] [llvm] [lld] [libunwind] [clang] [lldb] [clang-tools-extra] [libcxx] Fix a bug in Smith's algorithm used in complex div. (PR #78330)

2024-01-19 Thread Aaron Ballman via lldb-commits


@@ -2712,9 +2712,22 @@ static void EmitComplexRangeDiag(const Driver &D,
 << EnumComplexRangeToStr(Range1) << EnumComplexRangeToStr(Range2);
 }
 
-static std::string RenderComplexRangeOption(std::string Range) {
+static std::string
+RenderComplexRangeOption(LangOptions::ComplexRangeKind Range) {
   std::string ComplexRangeStr = "-complex-range=";
-  ComplexRangeStr += Range;
+  switch (Range) {
+  case LangOptions::ComplexRangeKind::CX_Full:
+ComplexRangeStr += "full";
+break;
+  case LangOptions::ComplexRangeKind::CX_Limited:
+ComplexRangeStr += "limited";
+break;
+  case LangOptions::ComplexRangeKind::CX_Fortran:
+ComplexRangeStr += "fortran";
+break;
+  case LangOptions::ComplexRangeKind::CX_None:
+ComplexRangeStr = "";

AaronBallman wrote:

Is it valid to pass `-complex-range=` without anything after the equals sign? 
Based on how this is called, I think this case should be an assertion instead, 
WDYT?

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


[Lldb-commits] [libc] [compiler-rt] [flang] [lld] [llvm] [clang] [lldb] [clang-tools-extra] [libcxx] [AMDGPU][GFX12] VOP encoding and codegen - add support for v_cvt fp8/… (PR #78414)

2024-01-19 Thread Jay Foad via lldb-commits

jayfoad wrote:

Can you add a GFX12 RUN line to 
clang/test/CodeGenOpenCL/builtins-amdgcn-fp8.cl? That will probably require 
adding "fp8-conversion-insts" to the GFX12 part of TargetParser.cpp. You can do 
this in a separate patch if you want.

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread José Lira Junior via lldb-commits

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


[Lldb-commits] [compiler-rt] [libcxx] [llvm] [lldb] [lld] [lld-macho] Find objects in library search path (PR #78628)

2024-01-19 Thread Vy Nguyen via lldb-commits


@@ -0,0 +1,10 @@
+# REQUIRES: x86
+# RUN: mkdir -p %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libhello.s 
-o %t/hello.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/main.o
+# RUN: %lld -L %t %t/main.o %t/hello.o -o %t/a.out

oontvoo wrote:

Should there be some basic verification of the output after the link? 

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


[Lldb-commits] [compiler-rt] [lldb] [llvm] [libcxx] [lld] [lld-macho] Find objects in library search path (PR #78628)

2024-01-19 Thread Vy Nguyen via lldb-commits


@@ -90,6 +90,9 @@ static std::optional findLibrary(StringRef name) {
 return entry->second;
 
   auto doFind = [&] {
+// Special case for Csu support files.

oontvoo wrote:

nit: would be helpful to either expand what Csu are ... (not a very common 
thing - I had  to look it up :) ) 

Thanks!

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


[Lldb-commits] [compiler-rt] [clang] [libcxx] [libcxxabi] [libunwind] [llvm] [lldb] [lld] [libc] [clang-tools-extra] [flang] Fix a bug in Smith's algorithm used in complex div. (PR #78330)

2024-01-19 Thread Zahira Ammarguellat via lldb-commits


@@ -2712,9 +2712,22 @@ static void EmitComplexRangeDiag(const Driver &D,
 << EnumComplexRangeToStr(Range1) << EnumComplexRangeToStr(Range2);
 }
 
-static std::string RenderComplexRangeOption(std::string Range) {
+static std::string
+RenderComplexRangeOption(LangOptions::ComplexRangeKind Range) {
   std::string ComplexRangeStr = "-complex-range=";
-  ComplexRangeStr += Range;
+  switch (Range) {
+  case LangOptions::ComplexRangeKind::CX_Full:
+ComplexRangeStr += "full";
+break;
+  case LangOptions::ComplexRangeKind::CX_Limited:
+ComplexRangeStr += "limited";
+break;
+  case LangOptions::ComplexRangeKind::CX_Fortran:
+ComplexRangeStr += "fortran";
+break;
+  case LangOptions::ComplexRangeKind::CX_None:
+ComplexRangeStr = "";

zahiraam wrote:

Oh! you are right. We should actually never land here because I am calling 
RenderComplexRangeOption with this condition:
if (Range != LangOptions::ComplexRangeKind::CX_None)
ComplexRangeStr = RenderComplexRangeOption(Range);
I guess an llvm-unreachable" should be added here?

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


[Lldb-commits] [compiler-rt] [libcxx] [llvm] [lldb] [lld] [lld-macho] Find objects in library search path (PR #78628)

2024-01-19 Thread Vy Nguyen via lldb-commits

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl updated 
https://github.com/llvm/llvm-project/pull/76112

From fb2383f3e6e2124e4f14e8e0f6a04df4bed15f65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= 
Date: Thu, 18 Jan 2024 20:03:25 -0300
Subject: [PATCH 1/2] refactor PutCStringColorHighlight | add struct to store
 highlight settings

---
 lldb/include/lldb/Core/Address.h |  4 +-
 lldb/include/lldb/Symbol/Symbol.h|  4 +-
 lldb/include/lldb/Symbol/SymbolContext.h |  7 +++-
 lldb/include/lldb/Utility/Stream.h   | 18 +++--
 lldb/source/Commands/CommandObjectTarget.cpp | 39 
 lldb/source/Core/Address.cpp | 22 +--
 lldb/source/Symbol/Symbol.cpp| 11 +++---
 lldb/source/Symbol/SymbolContext.cpp | 36 +++---
 lldb/source/Utility/Stream.cpp   | 17 -
 9 files changed, 85 insertions(+), 73 deletions(-)

diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h
index 725b5d9f91d3d5..f11ece414eec83 100644
--- a/lldb/include/lldb/Core/Address.h
+++ b/lldb/include/lldb/Core/Address.h
@@ -9,6 +9,7 @@
 #ifndef LLDB_CORE_ADDRESS_H
 #define LLDB_CORE_ADDRESS_H
 
+#include "lldb/Utility/Stream.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private-enumerations.h"
@@ -255,7 +256,8 @@ class Address {
   bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
 DumpStyle fallback_style = DumpStyleInvalid,
 uint32_t addr_byte_size = UINT32_MAX, bool all_ranges = false,
-llvm::StringRef pattern = "") const;
+std::optional pattern_info =
+std::nullopt) const;
 
   AddressClass GetAddressClass() const;
 
diff --git a/lldb/include/lldb/Symbol/Symbol.h 
b/lldb/include/lldb/Symbol/Symbol.h
index e6c0b495bcf28c..0da431f5ccf5da 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -13,6 +13,7 @@
 #include "lldb/Core/Mangled.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Symbol/SymbolContextScope.h"
+#include "lldb/Utility/Stream.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-private.h"
 #include "llvm/Support/JSON.h"
@@ -175,7 +176,8 @@ class Symbol : public SymbolContextScope {
   void SetFlags(uint32_t flags) { m_flags = flags; }
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
-  llvm::StringRef pattern = "") const;
+  std::optional pattern_info =
+  std::nullopt) const;
 
   bool IsSynthetic() const { return m_is_synthetic; }
 
diff --git a/lldb/include/lldb/Symbol/SymbolContext.h 
b/lldb/include/lldb/Symbol/SymbolContext.h
index 26f3bac09a9626..a089e93863a75d 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -17,6 +17,7 @@
 #include "lldb/Core/Mangled.h"
 #include "lldb/Symbol/LineEntry.h"
 #include "lldb/Utility/Iterable.h"
+#include "lldb/Utility/Stream.h"
 #include "lldb/lldb-private.h"
 
 namespace lldb_private {
@@ -157,7 +158,8 @@ class SymbolContext {
const Address &so_addr, bool show_fullpaths,
bool show_module, bool show_inlined_frames,
bool show_function_arguments, bool show_function_name,
-   llvm::StringRef pattern = "") const;
+   std::optional pattern_info =
+   std::nullopt) const;
 
   /// Get the address range contained within a symbol context.
   ///
@@ -224,7 +226,8 @@ class SymbolContext {
   const Symbol *FindBestGlobalDataSymbol(ConstString name, Status &error);
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
-  llvm::StringRef pattern = "") const;
+  std::optional pattern_info =
+  std::nullopt) const;
 
   uint32_t GetResolvedMask() const;
 
diff --git a/lldb/include/lldb/Utility/Stream.h 
b/lldb/include/lldb/Utility/Stream.h
index 20c55ac4597ae6..f2666a749d5fa1 100644
--- a/lldb/include/lldb/Utility/Stream.h
+++ b/lldb/include/lldb/Utility/Stream.h
@@ -33,6 +33,17 @@ class Stream {
/// string mode.
   };
 
+  /// Struct to store information for color highlighting in the stream.
+  struct HighlightSettings {
+llvm::StringRef pattern; ///< Regex pattern for highlighting.
+llvm::StringRef prefix;  ///< ANSI color code to start colorization.
+llvm::StringRef suffix;  ///< ANSI color code to end colorization.
+
+HighlightSettings(llvm::StringRef p, llvm::StringRef pre,
+  llvm::StringRef suf)
+: pattern(p), prefix(pre), suffix(suf) {}
+  };
+
   /// Utility class for counting the bytes that were written to a stream in a
   /// certain time span.
   ///
@@ -260,10 +271,9 @@ class Stream {
   /// The ANSI color code to end colorization. 

[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread José Lira Junior via lldb-commits


@@ -1618,22 +1621,25 @@ static uint32_t LookupSymbolInModule(CommandInterpreter 
&interpreter,
 for (uint32_t i = 0; i < num_matches; ++i) {
   Symbol *symbol = symtab->SymbolAtIndex(match_indexes[i]);
   if (symbol) {
+Stream::HighlightSettings pattern_info(
+name, interpreter.GetDebugger().GetRegexMatchAnsiPrefix(),
+interpreter.GetDebugger().GetRegexMatchAnsiSuffix());
 if (symbol->ValueIsAddress()) {
   DumpAddress(
   interpreter.GetExecutionContext().GetBestExecutionContextScope(),
   symbol->GetAddressRef(), verbose, all_ranges, strm,
-  use_color && name_is_regex ? name : nullptr);
+  use_color && name_is_regex
+  ? std::optional{pattern_info}
+  : std::nullopt);

junior-jl wrote:

Done! ✅ 

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread José Lira Junior via lldb-commits


@@ -260,10 +271,9 @@ class Stream {
   /// The ANSI color code to end colorization. This is
   /// environment-dependent.
 
-  void PutCStringColorHighlighted(llvm::StringRef text,
-  llvm::StringRef pattern = "",
-  llvm::StringRef prefix = "",
-  llvm::StringRef suffix = "");
+  void PutCStringColorHighlighted(
+  llvm::StringRef text,
+  std::optional pattern_info = std::nullopt);

junior-jl wrote:

✅ 

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


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

2024-01-19 Thread via lldb-commits

cor3ntin wrote:

@SuperSodaSea I can merge this for you if both @MitalAshok and @shafik are 
happy with it!

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


[Lldb-commits] [clang-tools-extra] [libcxx] [libunwind] [llvm] [libcxxabi] [flang] [libc] [compiler-rt] [lld] [clang] [lldb] Fix a bug in Smith's algorithm used in complex div. (PR #78330)

2024-01-19 Thread Zahira Ammarguellat via lldb-commits

https://github.com/zahiraam updated 
https://github.com/llvm/llvm-project/pull/78330

>From 8f8917528e30d2ba67f669cfd1a893bc85c21121 Mon Sep 17 00:00:00 2001
From: Ammarguellat 
Date: Tue, 16 Jan 2024 11:24:03 -0800
Subject: [PATCH 1/5] Fixed a bug in Smith's algorithm and made sure last
 option in command line rules.

---
 clang/lib/CodeGen/CGExprComplex.cpp   |  8 ++--
 clang/lib/Driver/ToolChains/Clang.cpp | 19 ++-
 clang/test/CodeGen/cx-complex-range.c | 16 
 clang/test/Driver/range.c |  7 +++
 4 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/clang/lib/CodeGen/CGExprComplex.cpp 
b/clang/lib/CodeGen/CGExprComplex.cpp
index e532794b71bdb4..6fbd8f19eeb50a 100644
--- a/clang/lib/CodeGen/CGExprComplex.cpp
+++ b/clang/lib/CodeGen/CGExprComplex.cpp
@@ -936,7 +936,7 @@ ComplexPairTy 
ComplexExprEmitter::EmitRangeReductionDiv(llvm::Value *LHSr,
   llvm::Value *RC = Builder.CreateFMul(CdD, RHSr);  // rc
   llvm::Value *DpRC = Builder.CreateFAdd(RHSi, RC); // tmp=d+rc
 
-  llvm::Value *T7 = Builder.CreateFMul(LHSr, RC);// ar
+  llvm::Value *T7 = Builder.CreateFMul(LHSr, CdD);   // ar
   llvm::Value *T8 = Builder.CreateFAdd(T7, LHSi);// ar+b
   llvm::Value *DSTFr = Builder.CreateFDiv(T8, DpRC); // (ar+b)/tmp
 
@@ -978,7 +978,11 @@ ComplexPairTy ComplexExprEmitter::EmitBinDiv(const 
BinOpInfo &Op) {
   return EmitRangeReductionDiv(LHSr, LHSi, RHSr, RHSi);
 else if (Op.FPFeatures.getComplexRange() == LangOptions::CX_Limited)
   return EmitAlgebraicDiv(LHSr, LHSi, RHSr, RHSi);
-else if (!CGF.getLangOpts().FastMath) {
+else if (!CGF.getLangOpts().FastMath ||
+ // '-ffast-math' is used in the command line but followed by an
+ // '-fno-cx-limited-range'.
+ (CGF.getLangOpts().FastMath &&
+  Op.FPFeatures.getComplexRange() == LangOptions::CX_Full)) {
   LHSi = OrigLHSi;
   // If we have a complex operand on the RHS and FastMath is not allowed, 
we
   // delegate to a libcall to handle all of the complexities and minimize
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 9edae3fec91a87..0c05d1db396071 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2753,6 +2753,7 @@ static void RenderFloatingPointOptions(const ToolChain 
&TC, const Driver &D,
   StringRef Float16ExcessPrecision = "";
   StringRef BFloat16ExcessPrecision = "";
   LangOptions::ComplexRangeKind Range = LangOptions::ComplexRangeKind::CX_Full;
+  std::string ComplexRangeStr = "";
 
   if (const Arg *A = Args.getLastArg(options::OPT_flimited_precision_EQ)) {
 CmdArgs.push_back("-mlimit-float-precision");
@@ -2768,24 +2769,24 @@ static void RenderFloatingPointOptions(const ToolChain 
&TC, const Driver &D,
 case options::OPT_fcx_limited_range: {
   EmitComplexRangeDiag(D, Range, 
LangOptions::ComplexRangeKind::CX_Limited);
   Range = LangOptions::ComplexRangeKind::CX_Limited;
-  std::string ComplexRangeStr = RenderComplexRangeOption("limited");
-  if (!ComplexRangeStr.empty())
-CmdArgs.push_back(Args.MakeArgString(ComplexRangeStr));
+  ComplexRangeStr = RenderComplexRangeOption("limited");
   break;
 }
 case options::OPT_fno_cx_limited_range:
+  EmitComplexRangeDiag(D, Range, LangOptions::ComplexRangeKind::CX_Full);
   Range = LangOptions::ComplexRangeKind::CX_Full;
+  ComplexRangeStr = RenderComplexRangeOption("full");
   break;
 case options::OPT_fcx_fortran_rules: {
   EmitComplexRangeDiag(D, Range, 
LangOptions::ComplexRangeKind::CX_Fortran);
   Range = LangOptions::ComplexRangeKind::CX_Fortran;
-  std::string ComplexRangeStr = RenderComplexRangeOption("fortran");
-  if (!ComplexRangeStr.empty())
-CmdArgs.push_back(Args.MakeArgString(ComplexRangeStr));
+  ComplexRangeStr = RenderComplexRangeOption("fortran");
   break;
 }
 case options::OPT_fno_cx_fortran_rules:
+  EmitComplexRangeDiag(D, Range, LangOptions::ComplexRangeKind::CX_Full);
   Range = LangOptions::ComplexRangeKind::CX_Full;
+  ComplexRangeStr = RenderComplexRangeOption("full");
   break;
 case options::OPT_ffp_model_EQ: {
   // If -ffp-model= is seen, reset to fno-fast-math
@@ -3056,9 +3057,7 @@ static void RenderFloatingPointOptions(const ToolChain 
&TC, const Driver &D,
   SeenUnsafeMathModeOption = true;
   // ffast-math enables fortran rules for complex multiplication and
   // division.
-  std::string ComplexRangeStr = RenderComplexRangeOption("limited");
-  if (!ComplexRangeStr.empty())
-CmdArgs.push_back(Args.MakeArgString(ComplexRangeStr));
+  ComplexRangeStr = RenderComplexRangeOption("limited");
   break;
 }
 case options::OPT_fno_fast_math:
@@ -3215,6 +3214,8 @@ static void RenderFloatingPointOptions(const ToolChain 
&TC, const Driver &D,
optio

[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread José Lira Junior via lldb-commits

junior-jl wrote:

Last commit changes:
- Renamed `pattern_info` to `settings` in all of its uses.
- Moved `HighlightSettings` declaration outside `for` loop.
- Edited commit message as suggested.

> So you're asking about "stacked PRs" and I myself haven't tried this. LLVM 
> has recently enabled user branches on llvm/llvm-project so I think it is 
> possible using some of the tools out there, but I have not tried it. I would 
> look on the forums for anyone who's tried it, or ask on Discord for advice.
...

Thanks for the detailed explanation. I'll look better into this.

Question: Would be good/necessary to refactor `LookupSymbolInModule` into some 
smaller functions? At least separating the printing part?

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 


DavidSpickett wrote:

> Question: Would be good/necessary to refactor LookupSymbolInModule into some 
> smaller functions? At least separating the printing part?

Maybe this is me being used to monster functions in lldb, but this one seems 
fine. At least the volume of code.

What you could do is "early return" (/early continue) in a couple of places to 
reduce the indentation.

1. You could early return if there are no matches.
2. You could `continue` if `Symbol *symbol` is `nullptr`.

This turns it into mostly straight line code (and from there if you did want to 
break it into functions, it would be easier).

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 



@@ -23,6 +23,16 @@
 
 namespace lldb_private {
 
+struct Information {

DavidSpickett wrote:

Looks like you already did this and yes it's a good thing, it means folks can't 
forget to give all 3 bits of information.

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 



@@ -178,8 +170,7 @@ bool SymbolContext::DumpStopContext(Stream *s, 
ExecutionContextScope *exe_scope,
 ansi_prefix = target_sp->GetDebugger().GetRegexMatchAnsiPrefix();
 ansi_suffix = target_sp->GetDebugger().GetRegexMatchAnsiSuffix();

DavidSpickett wrote:

Unused?

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 


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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 



@@ -524,8 +525,7 @@ bool Address::Dump(Stream *s, ExecutionContextScope 
*exe_scope, DumpStyle style,
 ansi_suffix =

DavidSpickett wrote:

Is this unused now?

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits
=?utf-8?q?Jos=C3=A9?= L. Junior 
Message-ID:
In-Reply-To: 


https://github.com/DavidSpickett commented:

Do a check for unused calls to getregexmatch, I found a few I think.

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


[Lldb-commits] [lldb] Clean up PlatformDarwinKernel::GetSharedModule, document (PR #78652)

2024-01-19 Thread Will Hawkins via lldb-commits


@@ -836,36 +834,18 @@ Status PlatformDarwinKernel::GetSharedModuleKernel(
   module_sp.reset(new Module(kern_spec));
   if (module_sp && module_sp->GetObjectFile() &&
   module_sp->MatchesModuleSpec(kern_spec)) {
-// module_sp is an actual kernel binary we want to add.
-if (process) {
-  const bool notify = false;
-  process->GetTarget().GetImages().AppendIfNeeded(module_sp, notify);
-  error.Clear();
-  return error;
-} else {
-  error = ModuleList::GetSharedModule(kern_spec, module_sp, nullptr,
-  nullptr, nullptr);
-  if (module_sp && module_sp->GetObjectFile() &&
-  module_sp->GetObjectFile()->GetType() !=
-  ObjectFile::Type::eTypeCoreFile) {
-return error;
-  }
-  module_sp.reset();
-}
+if (did_create_ptr)
+  *did_create_ptr = true;
+return {};
   }
 }
   }
 
   // Give the generic methods, including possibly calling into  DebugSymbols
   // framework on macOS systems, a chance.
-  error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
-  module_search_paths_ptr, old_modules,
-  did_create_ptr);
-  if (error.Success() && module_sp.get()) {
-return error;
-  }
-
-  return error;
+  return PlatformDarwin::GetSharedModule(module_spec, process, module_sp,

hawkinsw wrote:

Sorry to follow up again, @jasonmolenda, but I think that putting an assert at 
the top of `PlatformDarwin::GetSharedModule` might have exposed the curiosity 
that I am thinking about ...

Let's say that we are on the last iteration of this loop:

```C++
  // First try all kernel binaries that have a dSYM next to them
  for (auto possible_kernel : m_kernel_binaries_with_dsyms) {
if (FileSystem::Instance().Exists(possible_kernel)) {
  ModuleSpec kern_spec(possible_kernel);
  kern_spec.GetUUID() = module_spec.GetUUID();
  module_sp.reset(new Module(kern_spec));
```

`module_sp` is `reset` to point to a pointer to a new instantiation of a 
`Module`. Further, assume that

```C++
  (module_sp && module_sp->GetObjectFile() &&
  module_sp->MatchesModuleSpec(kern_spec))
```

is not true. That means that we fall out of that loop and `module_sp` still 
points to an instance of a `Module`. We proceed to the next loop and, for the 
sake of argument, let's say that `objfile_names` contains 0 entries for every 
`possible_kernel_dsym`. Effectively, then, there will be no iterations of that 
second loop. 

As a result, control will pass to `PlatformDarwin::GetSharedModule` with 
`module_sp` pointing to a leftover instance of a `Module` from the last 
iteration of the first loop. And, if you had an assertion that `module_sp` does 
not point to anything instead of a reset as the first operation in 
`PlatformDarwin::GetSharedModule` then it would certainly fail.

It seems like it should be that we reset `module_sp` before doing "the next" 
iteration on both of the loops in the function. I am sorry if it seems like I 
am being hard headed. I am just trying to understand and help! 

Thank you for your time!!


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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits
=?utf-8?q?José?= L. Junior 
Message-ID:
In-Reply-To: 



@@ -1609,6 +1612,11 @@ static uint32_t LookupSymbolInModule(CommandInterpreter 
&interpreter,
   }
 
   if (num_matches > 0) {
+llvm::StringRef ansi_prefix =
+interpreter.GetDebugger().GetRegexMatchAnsiPrefix();
+llvm::StringRef ansi_suffix =
+interpreter.GetDebugger().GetRegexMatchAnsiSuffix();
+Information info(name, ansi_prefix, ansi_suffix);

DavidSpickett wrote:

Now you're constructing these settings objects this has been addressed.

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


[Lldb-commits] [llvm] [lldb] Added settings for DEBUGINFOD cache location and timeout (PR #78605)

2024-01-19 Thread Kevin Frei via lldb-commits

https://github.com/kevinfrei updated 
https://github.com/llvm/llvm-project/pull/78605

>From 773740afcf9c54ef45a1178ee681ee46c29c9759 Mon Sep 17 00:00:00 2001
From: Kevin Frei 
Date: Thu, 18 Jan 2024 09:09:50 -0800
Subject: [PATCH 1/8] Added settings for cache location and timeout

---
 .../Debuginfod/SymbolLocatorDebuginfod.cpp| 82 +++
 .../SymbolLocatorDebuginfodProperties.td  |  8 +-
 llvm/include/llvm/Debuginfod/Debuginfod.h | 13 +++
 llvm/lib/Debuginfod/Debuginfod.cpp| 31 +--
 4 files changed, 108 insertions(+), 26 deletions(-)

diff --git 
a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp 
b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
index 111be6be365240..a20437c256eb43 100644
--- a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
+++ b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
@@ -9,6 +9,7 @@
 #include "SymbolLocatorDebuginfod.h"
 
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Interpreter/OptionValueString.h"
 #include "lldb/Utility/Args.h"
 
 #include "llvm/Debuginfod/Debuginfod.h"
@@ -54,6 +55,34 @@ class PluginProperties : public Properties {
 return urls;
   }
 
+  llvm::Expected GetCachePath() {
+OptionValueString *s =
+m_collection_sp->GetPropertyAtIndexAsOptionValueString(
+ePropertySymbolCachePath);
+// If we don't have a valid cache location, use the default one.
+if (!s || !s->GetCurrentValueAsRef().size()) {
+  llvm::Expected maybeCachePath =
+  llvm::getDefaultDebuginfodCacheDirectory();
+  if (!maybeCachePath) {
+return maybeCachePath;
+  }
+  m_cache_path = *maybeCachePath;
+  return llvm::StringRef(m_cache_path);
+}
+return s->GetCurrentValueAsRef();
+  }
+
+  std::chrono::milliseconds GetTimeout() const {
+std::optional seconds =
+m_collection_sp->GetPropertyAtIndexAs(ePropertyTimeout);
+if (seconds && *seconds != 0) {
+  return std::chrono::duration_cast(
+  std::chrono::seconds(*seconds));
+} else {
+  return llvm::getDefaultDebuginfodTimeout();
+}
+  }
+
 private:
   void ServerURLsChangedCallback() {
 m_server_urls = GetDebugInfoDURLs();
@@ -65,6 +94,7 @@ class PluginProperties : public Properties {
   }
   // Storage for the StringRef's used within the Debuginfod library.
   Args m_server_urls;
+  std::string m_cache_path;
 };
 
 } // namespace
@@ -112,31 +142,49 @@ SymbolLocator *SymbolLocatorDebuginfod::CreateInstance() {
   return new SymbolLocatorDebuginfod();
 }
 
-static std::optional GetFileForModule(
-const ModuleSpec &module_spec,
-std::function(llvm::object::BuildIDRef)>
-PullFromServer) {
-  if (!ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup())
-return {};
++ static std::optional +
+GetFileForModule(
+const ModuleSpec &module_spec,
+std::function UrlBuilder) {
   const UUID &module_uuid = module_spec.GetUUID();
-  if (module_uuid.IsValid() && llvm::canUseDebuginfod()) {
-llvm::object::BuildID build_id(module_uuid.GetBytes());
-llvm::Expected result = PullFromServer(build_id);
-if (result)
-  return FileSpec(*result);
-// An error here should be logged as a failure in the Debuginfod library,
-// so just consume it here
-consumeError(result.takeError());
-  }
+  // Don't bother if we don't have a valid UUID, Debuginfod isn't available,
+  // or if the 'symbols.enable-external-lookup' setting is false
+  if (!module_uuid.IsValid() || !llvm::canUseDebuginfod() ||
+  !ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup())
+return {};
+
+  // Grab the settings values we need
+  PluginProperties &plugin_props = GetGlobalPluginProperties();
+  llvm::Expected CacheDirectoryPathOrErr =
+  plugin_props.GetCachePath();
+  // A cache location is *required*
+  if (!CacheDirectoryPathOrErr)
+return {};
+  llvm::StringRef CacheDirectoryPath = *CacheDirectoryPathOrErr;
+  llvm::SmallVector DebuginfodUrls =
+  llvm::getDefaultDebuginfodUrls();
+  std::chrono::milliseconds Timeout = plugin_props.GetTimeout();
+
+  // We're ready to ask the Debuginfod library to find our file
+  llvm::object::BuildID build_id(module_uuid.GetBytes());
+  std::string UrlPath = UrlBuilder(build_id);
+  std::string CacheKey = llvm::getDebuginfodCacheKey(UrlPath);
+  llvm::Expected result = llvm::getCachedOrDownloadArtifact(
+  CacheKey, UrlPath, CacheDirectoryPath, DebuginfodUrls, Timeout);
+  if (result)
+return FileSpec(*result);
+  // An error here should be logged as a failure in the Debuginfod library,
+  // just consume it here
+  consumeError(result.takeError());
   return {};
 }
 
 std::optional SymbolLocatorDebuginfod::LocateExecutableObjectFile(
 const ModuleSpec &module_spec) {
-  return GetFileForModule(module_spec, llvm::getCachedOrDownloadExecutable);
+  return GetFileForModule

[Lldb-commits] [clang-tools-extra] [compiler-rt] [lldb] [clang] [libcxx] [llvm] [flang] [lld] [libc] [AMDGPU][GFX12] VOP encoding and codegen - add support for v_cvt fp8/… (PR #78414)

2024-01-19 Thread Mariusz Sikora via lldb-commits

mariusz-sikora-at-amd wrote:

> Can you add a GFX12 RUN line to 
> clang/test/CodeGenOpenCL/builtins-amdgcn-fp8.cl? That will probably require 
> adding "fp8-conversion-insts" to the GFX12 part of TargetParser.cpp. You can 
> do this in a separate patch if you want.

Done

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


[Lldb-commits] [clang-tools-extra] [lldb] [llvm] [clang] [lldb][test] Apply @expectedFailureAll/@skipIf early for debug_info tests (PR #73067)

2024-01-19 Thread Jordan Rupprecht via lldb-commits

https://github.com/rupprecht updated 
https://github.com/llvm/llvm-project/pull/73067

>From 22bfc5878f1f96b3138a03eea4dc856948185c89 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht 
Date: Tue, 21 Nov 2023 17:28:30 -0800
Subject: [PATCH 1/2] [lldb][test] Apply @expectedFailureAll/@skipIf early for
 debug_info tests

The @expectedFailureAll and @skipIf decorators will mark the test case as 
xfail/skip if _all_ conditions passed in match, including debug_info.
* If debug_info is not one of the matching conditions, we can immediately 
evaluate the check and decide if it should be decorated.
* If debug_info *is* present as a match condition, we need to defer whether or 
not to decorate until when the `LLDBTestCaseFactory` metaclass expands the test 
case into its potential variants. This is still early enough that the standard 
`unittest` framework will recognize the test as xfail/skip by the time the test 
actually runs.

TestDecorators exhibits the edge cases more thoroughly. With the exception of 
`@expectedFailureIf` (added by this commit), all those test cases pass prior to 
this commit.

This is a followup to 212a60ec37322f853e91e171b305479b1abff2f2.
---
 .../Python/lldbsuite/test/decorators.py   |  53 -
 .../Python/lldbsuite/test/lldbtest.py |  20 
 lldb/test/API/test_utils/TestDecorators.py| 110 +-
 3 files changed, 177 insertions(+), 6 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index bb06a5ee20f2532..2398892b9e14814 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -117,6 +117,21 @@ def expectedFailure(func):
 return unittest2.expectedFailure(func)
 
 
+def expectedFailureIf(condition, bugnumber=None):
+def expectedFailure_impl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+if condition:
+return expectedFailure(func)
+return func
+
+if callable(bugnumber):
+return expectedFailure_impl(bugnumber)
+else:
+return expectedFailure_impl
+
+
 def expectedFailureIfFn(expected_fn, bugnumber=None):
 def expectedFailure_impl(func):
 if isinstance(func, type) and issubclass(func, unittest2.TestCase):
@@ -178,6 +193,34 @@ def wrapper(*args, **kwargs):
 return skipTestIfFn_impl
 
 
+def _xfailForDebugInfo(expected_fn, bugnumber=None):
+def expectedFailure_impl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+func.__xfail_for_debug_info_cat_fn__ = expected_fn
+return func
+
+if callable(bugnumber):
+return expectedFailure_impl(bugnumber)
+else:
+return expectedFailure_impl
+
+
+def _skipForDebugInfo(expected_fn, bugnumber=None):
+def skipImpl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+func.__skip_for_debug_info_cat_fn__ = expected_fn
+return func
+
+if callable(bugnumber):
+return skipImpl(bugnumber)
+else:
+return skipImpl
+
+
 def _decorateTest(
 mode,
 bugnumber=None,
@@ -195,7 +238,7 @@ def _decorateTest(
 dwarf_version=None,
 setting=None,
 ):
-def fn(self):
+def fn(actual_debug_info=None):
 skip_for_os = _match_decorator_property(
 lldbplatform.translate(oslist), lldbplatformutil.getPlatform()
 )
@@ -208,7 +251,7 @@ def fn(self):
 skip_for_arch = _match_decorator_property(
 archs, lldbplatformutil.getArchitecture()
 )
-skip_for_debug_info = _match_decorator_property(debug_info, 
self.getDebugInfo())
+skip_for_debug_info = _match_decorator_property(debug_info, 
actual_debug_info)
 skip_for_triple = _match_decorator_property(
 triple, lldb.selected_platform.GetTriple()
 )
@@ -283,9 +326,13 @@ def fn(self):
 return reason_str
 
 if mode == DecorateMode.Skip:
+if debug_info:
+return _skipForDebugInfo(fn, bugnumber)
 return skipTestIfFn(fn, bugnumber)
 elif mode == DecorateMode.Xfail:
-return expectedFailureIfFn(fn, bugnumber)
+if debug_info:
+return _xfailForDebugInfo(fn, bugnumber)
+return expectedFailureIf(fn(), bugnumber)
 else:
 return None
 
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index dc4e322c675dc9d..872866655093d21 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1667,6 +1667,11 @@ def __new__(cls, name, bases, attrs

[Lldb-commits] [clang-tools-extra] [lldb] [clang] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-19 Thread Aaron Ballman via lldb-commits


@@ -4833,9 +4833,26 @@ void CXXNameMangler::mangleExpression(const Expr *E, 
unsigned Arity,
 E = cast(E)->getSubExpr();
 goto recurse;
 
-  case Expr::SubstNonTypeTemplateParmExprClass:
+  case Expr::SubstNonTypeTemplateParmExprClass: {
+// Mangle a substituted parameter the same way we mangle the template
+// argument.
+auto *SNTTPE = cast(E);
+if (auto *CE = dyn_cast(SNTTPE->getReplacement())) {
+  // Pull out the constant value and mangle it as a template argument.
+  QualType ParamType = SNTTPE->getParameterType(Context.getASTContext());
+  if (CE->hasAPValueResult())
+mangleValueInTemplateArg(ParamType, CE->getResultAsAPValue(), false,
+ /*NeedExactType=*/true);
+  else
+mangleValueInTemplateArg(ParamType, CE->getAPValueResult(), false,
+ /*NeedExactType=*/true);

AaronBallman wrote:

```suggestion
  assert(CE->hasAPValueResult() && "expected the NTTP to have an APValue");
  mangleValueInTemplateArg(ParamType, CE->getAPValueResult(), false,
 /*NeedExactType=*/true);
```
By the time we get here, we had better have an `APValue` result object already, 
but also `hasAPValueResult()` is looking at the `APValueKind` bitfield while 
`getResultAsAPValue()` is checking the `ResultKind` bitfield.

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


[Lldb-commits] [clang] [lldb] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-19 Thread Aaron Ballman via lldb-commits

https://github.com/AaronBallman commented:

Ping @rjmccall for Itanium mangling expertise to make sure we're matching the 
spec.

There are a few merge conflicts that also cropped up which need to be resolved, 
but overall I think this is pretty close to ready to try to re-land. It would 
be nice if we could get this in before the Clang 18 branch next Tue if possible 
(no pressure though).

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


[Lldb-commits] [lldb] [clang-tools-extra] [clang] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-19 Thread Aaron Ballman via lldb-commits

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


[Lldb-commits] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-19 Thread Aaron Ballman via lldb-commits


@@ -6472,7 +6494,20 @@ void CXXNameMangler::mangleValueInTemplateArg(QualType 
T, const APValue &V,
   Out << "plcvPcad";
   Kind = Offset;
 } else {
-  if (!V.getLValuePath().empty() || V.isLValueOnePastTheEnd()) {
+  // Clang 11 and before mangled an array subject to array-to-pointer decay
+  // as if it were the declaration itself.
+  bool IsArrayToPointerDecayMangledAsDecl = false;
+  if (TopLevel && Ctx.getLangOpts().getClangABICompat() <=
+  LangOptions::ClangABI::Ver11) {
+QualType BType = B.getType();
+IsArrayToPointerDecayMangledAsDecl =
+BType->isArrayType() && V.getLValuePath().size() == 1 &&
+V.getLValuePath()[0].getAsArrayIndex() == 0 &&
+Ctx.hasSimilarType(T, Ctx.getDecayedType(BType));
+  }
+

AaronBallman wrote:

I'm surprised by the Clang 11 part: I would have expected this patch to only be 
changing Clang 17 to Clang 18 behavior, right? Should this code be updated for 
Clang 17 instead of Clang 11?

Also, there's no test coverage for these changes.

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


[Lldb-commits] [clang-tools-extra] [clang] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

2024-01-19 Thread Aaron Ballman via lldb-commits


@@ -5401,6 +5409,8 @@ std::string CGDebugInfo::GetName(const Decl *D, bool 
Qualified) const {
 // feasible some day.
 return TA.getAsIntegral().getBitWidth() <= 64 &&
IsReconstitutableType(TA.getIntegralType());
+  case TemplateArgument::StructuralValue:
+return false;

AaronBallman wrote:

Ping @dwblaikie 

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


[Lldb-commits] [lld] [llvm] [libcxx] [compiler-rt] [lldb] [lld-macho] Find objects in library search path (PR #78628)

2024-01-19 Thread via lldb-commits

https://github.com/OldWorldOrdr updated 
https://github.com/llvm/llvm-project/pull/78628

>From e73fc2d0263e9e601f2964a90cfe347e8d2bb87c Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Thu, 18 Jan 2024 16:20:52 -0500
Subject: [PATCH 1/4] [lld-macho] Find objects in library search path

---
 lld/MachO/Driver.cpp | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 401459a054394e..f04165f5c02615 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -95,11 +95,16 @@ static std::optional findLibrary(StringRef name) 
{
   findPathCombination("lib" + name, config->librarySearchPaths,
   {".tbd", ".dylib", ".so"}))
 return path;
-  return findPathCombination("lib" + name, config->librarySearchPaths,
- {".a"});
+  else if (std::optional path = findPathCombination(
+   "lib" + name, config->librarySearchPaths, {".a"}))
+return path;
+  return findPathCombination(name, config->librarySearchPaths, {""});
 }
-return findPathCombination("lib" + name, config->librarySearchPaths,
-   {".tbd", ".dylib", ".so", ".a"});
+if (std::optional path =
+findPathCombination("lib" + name, config->librarySearchPaths,
+{".tbd", ".dylib", ".so", ".a"}))
+  return path;
+return findPathCombination(name, config->librarySearchPaths, {""});
   };
 
   std::optional path = doFind();

>From 5b29c5da6770982fb2f36edcd3a367893b18a19d Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Thu, 18 Jan 2024 21:16:57 -0500
Subject: [PATCH 2/4] [lld-macho] find objects in library search path version 2

---
 lld/MachO/Driver.cpp | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index f04165f5c02615..f8b01da5255c6d 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -90,21 +90,19 @@ static std::optional findLibrary(StringRef name) 
{
 return entry->second;
 
   auto doFind = [&] {
+// Special case for Csu support files.
+if (name.ends_with(".o"))
+  return findPathCombination(name, config->librarySearchPaths, {""});
 if (config->searchDylibsFirst) {
   if (std::optional path =
   findPathCombination("lib" + name, config->librarySearchPaths,
   {".tbd", ".dylib", ".so"}))
 return path;
-  else if (std::optional path = findPathCombination(
-   "lib" + name, config->librarySearchPaths, {".a"}))
-return path;
-  return findPathCombination(name, config->librarySearchPaths, {""});
+  return findPathCombination("lib" + name, config->librarySearchPaths,
+ {".a"});
 }
-if (std::optional path =
-findPathCombination("lib" + name, config->librarySearchPaths,
-{".tbd", ".dylib", ".so", ".a"}))
-  return path;
-return findPathCombination(name, config->librarySearchPaths, {""});
+return findPathCombination("lib" + name, config->librarySearchPaths,
+   {".tbd", ".dylib", ".so", ".a"});
   };
 
   std::optional path = doFind();

>From 5aab87e5c580ca1dba654fb00cf9571c7e3c7999 Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Fri, 19 Jan 2024 01:32:20 -0500
Subject: [PATCH 3/4] add test case

---
 lld/test/MachO/link-csu-obj.s | 10 ++
 1 file changed, 10 insertions(+)
 create mode 100644 lld/test/MachO/link-csu-obj.s

diff --git a/lld/test/MachO/link-csu-obj.s b/lld/test/MachO/link-csu-obj.s
new file mode 100644
index 00..00cb26bb260743
--- /dev/null
+++ b/lld/test/MachO/link-csu-obj.s
@@ -0,0 +1,10 @@
+# REQUIRES: x86
+# RUN: mkdir -p %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libhello.s 
-o %t/hello.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/main.o
+# RUN: %lld -L %t %t/main.o %t/hello.o -o %t/a.out
+
+.globl _main
+_main:
+call _print_hello
+ret

>From e5c118067bd049da924010b26fe420267567eade Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Fri, 19 Jan 2024 11:38:25 -0500
Subject: [PATCH 4/4] Update Driver.cpp

---
 lld/MachO/Driver.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index f8b01da5255c6d..97937d5107e667 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -90,7 +90,7 @@ static std::optional findLibrary(StringRef name) {
 return entry->second;
 
   auto doFind = [&] {
-// Special case for Csu support files.
+// Special case for Csu support files that are required for Mac OS X 10.7 
and older (crt1.o)
 if (name.ends_with(".o"))
   return findPathCombination(name, config->librarySearchPaths, {""});
 if (config->searchDylibsFirst) {


[Lldb-commits] [lld] [llvm] [libcxx] [compiler-rt] [lldb] [lld-macho] Find objects in library search path (PR #78628)

2024-01-19 Thread via lldb-commits


@@ -90,6 +90,9 @@ static std::optional findLibrary(StringRef name) {
 return entry->second;
 
   auto doFind = [&] {
+// Special case for Csu support files.

OldWorldOrdr wrote:

Is the new comment ok?

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


[Lldb-commits] [lld] [llvm] [libcxx] [compiler-rt] [lldb] [lld-macho] Find objects in library search path (PR #78628)

2024-01-19 Thread via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff 5c150e7eeba9db13cc65b329b3c3537b613ae61d 
e5c118067bd049da924010b26fe420267567eade -- lld/MachO/Driver.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 97937d5107..9985e1d805 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -90,7 +90,8 @@ static std::optional findLibrary(StringRef name) {
 return entry->second;
 
   auto doFind = [&] {
-// Special case for Csu support files that are required for Mac OS X 10.7 
and older (crt1.o)
+// Special case for Csu support files that are required for Mac OS X 10.7
+// and older (crt1.o)
 if (name.ends_with(".o"))
   return findPathCombination(name, config->librarySearchPaths, {""});
 if (config->searchDylibsFirst) {

``




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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread José Lira Junior via lldb-commits

junior-jl wrote:

> Maybe this is me being used to monster functions in lldb, but this one seems 
> fine. At least the volume of code.
What you could do is "early return" (/early continue) in a couple of places to 
reduce the indentation.
> 1.   You could early return if there are no matches.
> 2.   You could continue if Symbol *symbol is nullptr.

> This turns it into mostly straight line code (and from there if you did want 
> to break it into functions, it would be easier).

I see. But this would need to be in another PR, right? (checking to see if I'm 
understanding the flow of contribution)

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


[Lldb-commits] [lldb] d0d0727 - [lldb][test] Apply @expectedFailureAll/@skipIf early for debug_info tests (#73067)

2024-01-19 Thread via lldb-commits

Author: Jordan Rupprecht
Date: 2024-01-19T10:50:05-06:00
New Revision: d0d072710468316edbd4130e50f1146c5a6aca89

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

LOG: [lldb][test] Apply @expectedFailureAll/@skipIf early for debug_info tests 
(#73067)

The @expectedFailureAll and @skipIf decorators will mark the test case
as xfail/skip if _all_ conditions passed in match, including debug_info.
* If debug_info is not one of the matching conditions, we can
immediately evaluate the check and decide if it should be decorated.
* If debug_info *is* present as a match condition, we need to defer
whether or not to decorate until when the `LLDBTestCaseFactory`
metaclass expands the test case into its potential variants. This is
still early enough that the standard `unittest` framework will recognize
the test as xfail/skip by the time the test actually runs.

TestDecorators exhibits the edge cases more thoroughly. With the
exception of `@expectedFailureIf` (added by this commit), all those test
cases pass prior to this commit.

This is a followup to 212a60ec37322f853e91e171b305479b1abff2f2.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/decorators.py
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/test/API/test_utils/TestDecorators.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index a4cee1f5761625..0fb146913388e0 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -113,6 +113,21 @@ def _compiler_supports(
 return True
 
 
+def expectedFailureIf(condition, bugnumber=None):
+def expectedFailure_impl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+if condition:
+return unittest2.expectedFailure(func)
+return func
+
+if callable(bugnumber):
+return expectedFailure_impl(bugnumber)
+else:
+return expectedFailure_impl
+
+
 def expectedFailureIfFn(expected_fn, bugnumber=None):
 def expectedFailure_impl(func):
 if isinstance(func, type) and issubclass(func, unittest2.TestCase):
@@ -174,6 +189,34 @@ def wrapper(*args, **kwargs):
 return skipTestIfFn_impl
 
 
+def _xfailForDebugInfo(expected_fn, bugnumber=None):
+def expectedFailure_impl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+func.__xfail_for_debug_info_cat_fn__ = expected_fn
+return func
+
+if callable(bugnumber):
+return expectedFailure_impl(bugnumber)
+else:
+return expectedFailure_impl
+
+
+def _skipForDebugInfo(expected_fn, bugnumber=None):
+def skipImpl(func):
+if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+raise Exception("Decorator can only be used to decorate a test 
method")
+
+func.__skip_for_debug_info_cat_fn__ = expected_fn
+return func
+
+if callable(bugnumber):
+return skipImpl(bugnumber)
+else:
+return skipImpl
+
+
 def _decorateTest(
 mode,
 bugnumber=None,
@@ -191,7 +234,7 @@ def _decorateTest(
 dwarf_version=None,
 setting=None,
 ):
-def fn(self):
+def fn(actual_debug_info=None):
 skip_for_os = _match_decorator_property(
 lldbplatform.translate(oslist), lldbplatformutil.getPlatform()
 )
@@ -204,7 +247,7 @@ def fn(self):
 skip_for_arch = _match_decorator_property(
 archs, lldbplatformutil.getArchitecture()
 )
-skip_for_debug_info = _match_decorator_property(debug_info, 
self.getDebugInfo())
+skip_for_debug_info = _match_decorator_property(debug_info, 
actual_debug_info)
 skip_for_triple = _match_decorator_property(
 triple, lldb.selected_platform.GetTriple()
 )
@@ -279,9 +322,13 @@ def fn(self):
 return reason_str
 
 if mode == DecorateMode.Skip:
+if debug_info:
+return _skipForDebugInfo(fn, bugnumber)
 return skipTestIfFn(fn, bugnumber)
 elif mode == DecorateMode.Xfail:
-return expectedFailureIfFn(fn, bugnumber)
+if debug_info:
+return _xfailForDebugInfo(fn, bugnumber)
+return expectedFailureIf(fn(), bugnumber)
 else:
 return None
 

diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index dc4e322c675dc9..3abc713398490e 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/te

[Lldb-commits] [llvm] [clang-tools-extra] [clang] [libc] [mlir] [lldb] [lldb][test] Apply @expectedFailureAll/@skipIf early for debug_info tests (PR #73067)

2024-01-19 Thread Jordan Rupprecht via lldb-commits

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits
=?utf-8?q?Jos=C3=A9?= L. Junior 
Message-ID:
In-Reply-To: 


DavidSpickett wrote:

> I see. But this would need to be in another PR, right?

Yes.

https://github.com/llvm/llvm-project/pull/76112
___
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] [lldb] [lld] [lld-macho] Find objects in library search path (PR #78628)

2024-01-19 Thread via lldb-commits

https://github.com/OldWorldOrdr updated 
https://github.com/llvm/llvm-project/pull/78628

>From e73fc2d0263e9e601f2964a90cfe347e8d2bb87c Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Thu, 18 Jan 2024 16:20:52 -0500
Subject: [PATCH 1/5] [lld-macho] Find objects in library search path

---
 lld/MachO/Driver.cpp | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 401459a054394e..f04165f5c02615 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -95,11 +95,16 @@ static std::optional findLibrary(StringRef name) 
{
   findPathCombination("lib" + name, config->librarySearchPaths,
   {".tbd", ".dylib", ".so"}))
 return path;
-  return findPathCombination("lib" + name, config->librarySearchPaths,
- {".a"});
+  else if (std::optional path = findPathCombination(
+   "lib" + name, config->librarySearchPaths, {".a"}))
+return path;
+  return findPathCombination(name, config->librarySearchPaths, {""});
 }
-return findPathCombination("lib" + name, config->librarySearchPaths,
-   {".tbd", ".dylib", ".so", ".a"});
+if (std::optional path =
+findPathCombination("lib" + name, config->librarySearchPaths,
+{".tbd", ".dylib", ".so", ".a"}))
+  return path;
+return findPathCombination(name, config->librarySearchPaths, {""});
   };
 
   std::optional path = doFind();

>From 5b29c5da6770982fb2f36edcd3a367893b18a19d Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Thu, 18 Jan 2024 21:16:57 -0500
Subject: [PATCH 2/5] [lld-macho] find objects in library search path version 2

---
 lld/MachO/Driver.cpp | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index f04165f5c02615..f8b01da5255c6d 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -90,21 +90,19 @@ static std::optional findLibrary(StringRef name) 
{
 return entry->second;
 
   auto doFind = [&] {
+// Special case for Csu support files.
+if (name.ends_with(".o"))
+  return findPathCombination(name, config->librarySearchPaths, {""});
 if (config->searchDylibsFirst) {
   if (std::optional path =
   findPathCombination("lib" + name, config->librarySearchPaths,
   {".tbd", ".dylib", ".so"}))
 return path;
-  else if (std::optional path = findPathCombination(
-   "lib" + name, config->librarySearchPaths, {".a"}))
-return path;
-  return findPathCombination(name, config->librarySearchPaths, {""});
+  return findPathCombination("lib" + name, config->librarySearchPaths,
+ {".a"});
 }
-if (std::optional path =
-findPathCombination("lib" + name, config->librarySearchPaths,
-{".tbd", ".dylib", ".so", ".a"}))
-  return path;
-return findPathCombination(name, config->librarySearchPaths, {""});
+return findPathCombination("lib" + name, config->librarySearchPaths,
+   {".tbd", ".dylib", ".so", ".a"});
   };
 
   std::optional path = doFind();

>From 5aab87e5c580ca1dba654fb00cf9571c7e3c7999 Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Fri, 19 Jan 2024 01:32:20 -0500
Subject: [PATCH 3/5] add test case

---
 lld/test/MachO/link-csu-obj.s | 10 ++
 1 file changed, 10 insertions(+)
 create mode 100644 lld/test/MachO/link-csu-obj.s

diff --git a/lld/test/MachO/link-csu-obj.s b/lld/test/MachO/link-csu-obj.s
new file mode 100644
index 00..00cb26bb260743
--- /dev/null
+++ b/lld/test/MachO/link-csu-obj.s
@@ -0,0 +1,10 @@
+# REQUIRES: x86
+# RUN: mkdir -p %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libhello.s 
-o %t/hello.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/main.o
+# RUN: %lld -L %t %t/main.o %t/hello.o -o %t/a.out
+
+.globl _main
+_main:
+call _print_hello
+ret

>From e5c118067bd049da924010b26fe420267567eade Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Fri, 19 Jan 2024 11:38:25 -0500
Subject: [PATCH 4/5] Update Driver.cpp

---
 lld/MachO/Driver.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index f8b01da5255c6d..97937d5107e667 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -90,7 +90,7 @@ static std::optional findLibrary(StringRef name) {
 return entry->second;
 
   auto doFind = [&] {
-// Special case for Csu support files.
+// Special case for Csu support files that are required for Mac OS X 10.7 
and older (crt1.o)
 if (name.ends_with(".o"))
   return findPathCombination(name, config->librarySearchPaths, {""});
 if (config->searchDylibsFirst) {

>From 91572d43bb763fa03b

[Lldb-commits] [libcxxabi] [mlir] [llvm] [libc] [lldb] [libunwind] [clang] [compiler-rt] [flang] [clang-tools-extra] [libcxx] [polly] [libc++][any] LWG3305: `any_cast` (PR #78215)

2024-01-19 Thread Mark de Wever via lldb-commits

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

LGTM!

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


[Lldb-commits] [libc] [llvm] [mlir] [libcxx] [lldb] [libcxxabi] [polly] [flang] [libunwind] [compiler-rt] [clang] [clang-tools-extra] [libc++][any] LWG3305: `any_cast` (PR #78215)

2024-01-19 Thread Mark de Wever via lldb-commits


@@ -555,6 +556,7 @@ inline _LIBCPP_HIDE_FROM_ABI 
_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType
 
 template 
 inline _LIBCPP_HIDE_FROM_ABI add_pointer_t> 
any_cast(any const* __any) _NOEXCEPT {
+  static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");

mordante wrote:

Personally I dislike static assert message that are same as the test. In C++17 
the message is optional. However since the existing code already has these 
messages I'm fine to keep them.

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


[Lldb-commits] [clang-tools-extra] [llvm] [mlir] [libcxx] [compiler-rt] [clang] [libc] [lldb] [libcxxabi] [polly] [libunwind] [flang] [libc++][any] LWG3305: `any_cast` (PR #78215)

2024-01-19 Thread Mark de Wever via lldb-commits

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


[Lldb-commits] [openmp] [mlir] [llvm] [libc] [lldb] [clang] [compiler-rt] [flang] [clang-tools-extra] [libcxx] [lld] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

2024-01-19 Thread Mark de Wever via lldb-commits


@@ -144,7 +144,8 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) 
__visit_format_arg(_Visitor&& __vis, basic_
   __libcpp_unreachable();
 }
 
-#  if _LIBCPP_STD_VER >= 26
+#  if _LIBCPP_STD_VER >= 26 && (!defined(_LIBCPP_COMPILER_CLANG_BASED) || 
_LIBCPP_CLANG_VER >= 1800)

mordante wrote:

> https://clang.llvm.org/docs/ReleaseNotes.html
> 
> > Implemented P0847R7: Deducing this. Some related core issues were also 
> > implemented (CWG2553, CWG2554, CWG2653, CWG2687). Because the support for 
> > this feature is still experimental, the feature test macro 
> > __cpp_explicit_this_parameter was not set in this version.
> 
> I'll revert the change.

I looked at the status page https://clang.llvm.org/cxx_status.html which misses 
this detail. 

I would go with with a new config variable `_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER`
```
// Clang-18 has support for deducing this, but it does not set the FTM.
#if defined(__cpp_explicit_this_parameter) || (defined(_LIBCPP_CLANG_VER ) 
&&_LIBCPP_CLANG_VER >= 1800))
#  define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
#endif
```
This allows to easily add AppleClang when they support it. For the library we 
only support GCC and Clang based compilers.

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


[Lldb-commits] [lldb] [lldb][DWARFUnit] Implement PeekDIEName query (PR #78486)

2024-01-19 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan updated 
https://github.com/llvm/llvm-project/pull/78486

>From b0a33481162e24a7106cbd554b33ddb098df7612 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Thu, 7 Dec 2023 11:26:52 -0800
Subject: [PATCH 1/5] [lldb][DWARFUnit] Implement PeekDIEName query

This allows us to query the AT_Name of a DIE without parsing the entire CU.

Part of the ongoing effort to support IDX_Parent in accelerator tables [1].

[1]: 
https://discourse.llvm.org/t/rfc-improve-dwarf-5-debug-names-type-lookup-parsing-speed/74151/44
---
 .../SymbolFile/DWARF/DWARFDebugInfo.cpp   |  7 +++
 .../Plugins/SymbolFile/DWARF/DWARFDebugInfo.h |  5 ++
 .../Plugins/SymbolFile/DWARF/DWARFUnit.cpp|  8 +++
 .../Plugins/SymbolFile/DWARF/DWARFUnit.h  |  5 ++
 .../SymbolFile/DWARF/DWARFDIETest.cpp | 59 +++
 5 files changed, 84 insertions(+)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index 553b6a4c551d20..775b7a2e73f512 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -191,3 +191,10 @@ DWARFDebugInfo::GetDIE(const DIERef &die_ref) {
 return cu->GetNonSkeletonUnit().GetDIE(die_ref.die_offset());
   return DWARFDIE(); // Not found
 }
+
+llvm::StringRef
+DWARFDebugInfo::PeekDIEName(const DIERef &die_ref) {
+  if(DWARFUnit *cu = GetUnit(die_ref))
+return cu->GetNonSkeletonUnit().PeekDIEName(die_ref.die_offset());
+  return llvm::StringRef();
+}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
index d5e48f312ea0e9..a8b5abc3beed2d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -43,6 +43,11 @@ class DWARFDebugInfo {
   bool ContainsTypeUnits();
   DWARFDIE GetDIE(const DIERef &die_ref);
 
+  /// Returns the AT_Name of this DIE, if it exists, without parsing the entire
+  /// compile unit. An empty is string is returned upon error or if the
+  /// attribute is not present.
+  llvm::StringRef PeekDIEName(const DIERef &die_ref);
+
   enum {
 eDumpFlag_Verbose = (1 << 0),  // Verbose dumping
 eDumpFlag_ShowForm = (1 << 1), // Show the DW_form type
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 0e2f4d45543bb5..7db279ed37d04a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -663,6 +663,14 @@ DWARFUnit::GetDIE(dw_offset_t die_offset) {
   return DWARFDIE(); // Not found
 }
 
+llvm::StringRef DWARFUnit::PeekDIEName(dw_offset_t die_offset) {
+  const DWARFDataExtractor &data = GetData();
+  DWARFDebugInfoEntry die;
+  if (!die.Extract(data, this, &die_offset))
+return llvm::StringRef();
+  return die.GetName(this);
+}
+
 DWARFUnit &DWARFUnit::GetNonSkeletonUnit() {
   ExtractUnitDIEIfNeeded();
   if (m_dwo)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 3f528e913d8cfa..bc225a52e1d030 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -187,6 +187,11 @@ class DWARFUnit : public UserID {
 
   DWARFDIE GetDIE(dw_offset_t die_offset);
 
+  /// Returns the AT_Name of the DIE at `die_offset`, if it exists, without
+  /// parsing the entire compile unit. An empty is string is returned upon
+  /// error or if the attribute is not present.
+  llvm::StringRef PeekDIEName(dw_offset_t die_offset);
+
   DWARFUnit &GetNonSkeletonUnit();
 
   static uint8_t GetAddressByteSize(const DWARFUnit *cu);
diff --git a/lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp 
b/lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp
index 8497855b2f3db5..ff433c7a14ef7b 100644
--- a/lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp
+++ b/lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
+#include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h"
 #include "TestingSupport/Symbol/YAMLModuleTester.h"
 #include "llvm/ADT/STLExtras.h"
 #include "gmock/gmock.h"
@@ -104,3 +105,61 @@ TEST(DWARFDIETest, ChildIteration) {
   DWARFDIE no_children_die(unit, die_child0);
   EXPECT_TRUE(no_children_die.children().empty());
 }
+
+TEST(DWARFDIETest, PeekName) {
+  const char *yamldata = R"(
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_386
+DWARF:
+  debug_str:
+- 'NameType1'
+- 'NameType2'
+  debug_abbrev:
+- Table:
+- Code:0x0001
+  Tag: DW_TAG_compile_unit
+  Children:DW_CHILDREN_yes
+  Attributes:
+- Attribute:   D

[Lldb-commits] [lldb] [lldb][DWARFUnit] Implement PeekDIEName query (PR #78486)

2024-01-19 Thread Felipe de Azevedo Piovezan via lldb-commits

felipepiovezan wrote:

Make comments more grep-able.

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread José Lira Junior via lldb-commits

https://github.com/junior-jl updated 
https://github.com/llvm/llvm-project/pull/76112

From fb2383f3e6e2124e4f14e8e0f6a04df4bed15f65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= 
Date: Thu, 18 Jan 2024 20:03:25 -0300
Subject: [PATCH 1/3] refactor PutCStringColorHighlight | add struct to store
 highlight settings

---
 lldb/include/lldb/Core/Address.h |  4 +-
 lldb/include/lldb/Symbol/Symbol.h|  4 +-
 lldb/include/lldb/Symbol/SymbolContext.h |  7 +++-
 lldb/include/lldb/Utility/Stream.h   | 18 +++--
 lldb/source/Commands/CommandObjectTarget.cpp | 39 
 lldb/source/Core/Address.cpp | 22 +--
 lldb/source/Symbol/Symbol.cpp| 11 +++---
 lldb/source/Symbol/SymbolContext.cpp | 36 +++---
 lldb/source/Utility/Stream.cpp   | 17 -
 9 files changed, 85 insertions(+), 73 deletions(-)

diff --git a/lldb/include/lldb/Core/Address.h b/lldb/include/lldb/Core/Address.h
index 725b5d9f91d3d52..f11ece414eec83d 100644
--- a/lldb/include/lldb/Core/Address.h
+++ b/lldb/include/lldb/Core/Address.h
@@ -9,6 +9,7 @@
 #ifndef LLDB_CORE_ADDRESS_H
 #define LLDB_CORE_ADDRESS_H
 
+#include "lldb/Utility/Stream.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private-enumerations.h"
@@ -255,7 +256,8 @@ class Address {
   bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
 DumpStyle fallback_style = DumpStyleInvalid,
 uint32_t addr_byte_size = UINT32_MAX, bool all_ranges = false,
-llvm::StringRef pattern = "") const;
+std::optional pattern_info =
+std::nullopt) const;
 
   AddressClass GetAddressClass() const;
 
diff --git a/lldb/include/lldb/Symbol/Symbol.h 
b/lldb/include/lldb/Symbol/Symbol.h
index e6c0b495bcf28ca..0da431f5ccf5da7 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -13,6 +13,7 @@
 #include "lldb/Core/Mangled.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Symbol/SymbolContextScope.h"
+#include "lldb/Utility/Stream.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-private.h"
 #include "llvm/Support/JSON.h"
@@ -175,7 +176,8 @@ class Symbol : public SymbolContextScope {
   void SetFlags(uint32_t flags) { m_flags = flags; }
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
-  llvm::StringRef pattern = "") const;
+  std::optional pattern_info =
+  std::nullopt) const;
 
   bool IsSynthetic() const { return m_is_synthetic; }
 
diff --git a/lldb/include/lldb/Symbol/SymbolContext.h 
b/lldb/include/lldb/Symbol/SymbolContext.h
index 26f3bac09a96263..a089e93863a75d3 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -17,6 +17,7 @@
 #include "lldb/Core/Mangled.h"
 #include "lldb/Symbol/LineEntry.h"
 #include "lldb/Utility/Iterable.h"
+#include "lldb/Utility/Stream.h"
 #include "lldb/lldb-private.h"
 
 namespace lldb_private {
@@ -157,7 +158,8 @@ class SymbolContext {
const Address &so_addr, bool show_fullpaths,
bool show_module, bool show_inlined_frames,
bool show_function_arguments, bool show_function_name,
-   llvm::StringRef pattern = "") const;
+   std::optional pattern_info =
+   std::nullopt) const;
 
   /// Get the address range contained within a symbol context.
   ///
@@ -224,7 +226,8 @@ class SymbolContext {
   const Symbol *FindBestGlobalDataSymbol(ConstString name, Status &error);
 
   void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target,
-  llvm::StringRef pattern = "") const;
+  std::optional pattern_info =
+  std::nullopt) const;
 
   uint32_t GetResolvedMask() const;
 
diff --git a/lldb/include/lldb/Utility/Stream.h 
b/lldb/include/lldb/Utility/Stream.h
index 20c55ac4597ae61..f2666a749d5fa13 100644
--- a/lldb/include/lldb/Utility/Stream.h
+++ b/lldb/include/lldb/Utility/Stream.h
@@ -33,6 +33,17 @@ class Stream {
/// string mode.
   };
 
+  /// Struct to store information for color highlighting in the stream.
+  struct HighlightSettings {
+llvm::StringRef pattern; ///< Regex pattern for highlighting.
+llvm::StringRef prefix;  ///< ANSI color code to start colorization.
+llvm::StringRef suffix;  ///< ANSI color code to end colorization.
+
+HighlightSettings(llvm::StringRef p, llvm::StringRef pre,
+  llvm::StringRef suf)
+: pattern(p), prefix(pre), suffix(suf) {}
+  };
+
   /// Utility class for counting the bytes that were written to a stream in a
   /// certain time span.
   ///
@@ -260,10 +271,9 @@ class Stream {
   /// The ANSI color code to end colori

[Lldb-commits] [lld] [lldb] [compiler-rt] [libcxx] [llvm] [lld-macho] Find objects in library search path (PR #78628)

2024-01-19 Thread via lldb-commits

https://github.com/OldWorldOrdr updated 
https://github.com/llvm/llvm-project/pull/78628

>From e73fc2d0263e9e601f2964a90cfe347e8d2bb87c Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Thu, 18 Jan 2024 16:20:52 -0500
Subject: [PATCH 1/4] [lld-macho] Find objects in library search path

---
 lld/MachO/Driver.cpp | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 401459a054394e..f04165f5c02615 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -95,11 +95,16 @@ static std::optional findLibrary(StringRef name) 
{
   findPathCombination("lib" + name, config->librarySearchPaths,
   {".tbd", ".dylib", ".so"}))
 return path;
-  return findPathCombination("lib" + name, config->librarySearchPaths,
- {".a"});
+  else if (std::optional path = findPathCombination(
+   "lib" + name, config->librarySearchPaths, {".a"}))
+return path;
+  return findPathCombination(name, config->librarySearchPaths, {""});
 }
-return findPathCombination("lib" + name, config->librarySearchPaths,
-   {".tbd", ".dylib", ".so", ".a"});
+if (std::optional path =
+findPathCombination("lib" + name, config->librarySearchPaths,
+{".tbd", ".dylib", ".so", ".a"}))
+  return path;
+return findPathCombination(name, config->librarySearchPaths, {""});
   };
 
   std::optional path = doFind();

>From 5b29c5da6770982fb2f36edcd3a367893b18a19d Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Thu, 18 Jan 2024 21:16:57 -0500
Subject: [PATCH 2/4] [lld-macho] find objects in library search path version 2

---
 lld/MachO/Driver.cpp | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index f04165f5c02615..f8b01da5255c6d 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -90,21 +90,19 @@ static std::optional findLibrary(StringRef name) 
{
 return entry->second;
 
   auto doFind = [&] {
+// Special case for Csu support files.
+if (name.ends_with(".o"))
+  return findPathCombination(name, config->librarySearchPaths, {""});
 if (config->searchDylibsFirst) {
   if (std::optional path =
   findPathCombination("lib" + name, config->librarySearchPaths,
   {".tbd", ".dylib", ".so"}))
 return path;
-  else if (std::optional path = findPathCombination(
-   "lib" + name, config->librarySearchPaths, {".a"}))
-return path;
-  return findPathCombination(name, config->librarySearchPaths, {""});
+  return findPathCombination("lib" + name, config->librarySearchPaths,
+ {".a"});
 }
-if (std::optional path =
-findPathCombination("lib" + name, config->librarySearchPaths,
-{".tbd", ".dylib", ".so", ".a"}))
-  return path;
-return findPathCombination(name, config->librarySearchPaths, {""});
+return findPathCombination("lib" + name, config->librarySearchPaths,
+   {".tbd", ".dylib", ".so", ".a"});
   };
 
   std::optional path = doFind();

>From 5aab87e5c580ca1dba654fb00cf9571c7e3c7999 Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Fri, 19 Jan 2024 01:32:20 -0500
Subject: [PATCH 3/4] add test case

---
 lld/test/MachO/link-csu-obj.s | 10 ++
 1 file changed, 10 insertions(+)
 create mode 100644 lld/test/MachO/link-csu-obj.s

diff --git a/lld/test/MachO/link-csu-obj.s b/lld/test/MachO/link-csu-obj.s
new file mode 100644
index 00..00cb26bb260743
--- /dev/null
+++ b/lld/test/MachO/link-csu-obj.s
@@ -0,0 +1,10 @@
+# REQUIRES: x86
+# RUN: mkdir -p %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libhello.s 
-o %t/hello.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/main.o
+# RUN: %lld -L %t %t/main.o %t/hello.o -o %t/a.out
+
+.globl _main
+_main:
+call _print_hello
+ret

>From 6e8b321b1ed74665f26e5ee6dd0a04ec7b4dbb89 Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Fri, 19 Jan 2024 11:38:25 -0500
Subject: [PATCH 4/4] Improve comment

---
 lld/MachO/Driver.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index f8b01da5255c6d..7ac3f51cec103f 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -90,7 +90,8 @@ static std::optional findLibrary(StringRef name) {
 return entry->second;
 
   auto doFind = [&] {
-// Special case for Csu support files.
+// Special case for Csu support files required for Mac OS X 10.7 and older
+// (crt1.o)
 if (name.ends_with(".o"))
   return findPathCombination(name, config->librarySearchPaths, {""});
 if (config->searchDylibsFirst) {

__

[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread José Lira Junior via lldb-commits

junior-jl wrote:

> Do a check for unused calls to getregexmatch, I found a few I think.

Done in the last commit. There was the two you mentioned and another one.

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread David Spickett via lldb-commits
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior 
Message-ID:
In-Reply-To: 


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

LGTM.

Unless you've got commit access yourself, I can land this for you on Monday.

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


[Lldb-commits] [lldb] [llvm] [libcxx] [lld] [compiler-rt] [lld-macho] Find objects in library search path (PR #78628)

2024-01-19 Thread via lldb-commits

https://github.com/OldWorldOrdr updated 
https://github.com/llvm/llvm-project/pull/78628

>From e73fc2d0263e9e601f2964a90cfe347e8d2bb87c Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Thu, 18 Jan 2024 16:20:52 -0500
Subject: [PATCH 1/5] [lld-macho] Find objects in library search path

---
 lld/MachO/Driver.cpp | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 401459a054394e..f04165f5c02615 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -95,11 +95,16 @@ static std::optional findLibrary(StringRef name) 
{
   findPathCombination("lib" + name, config->librarySearchPaths,
   {".tbd", ".dylib", ".so"}))
 return path;
-  return findPathCombination("lib" + name, config->librarySearchPaths,
- {".a"});
+  else if (std::optional path = findPathCombination(
+   "lib" + name, config->librarySearchPaths, {".a"}))
+return path;
+  return findPathCombination(name, config->librarySearchPaths, {""});
 }
-return findPathCombination("lib" + name, config->librarySearchPaths,
-   {".tbd", ".dylib", ".so", ".a"});
+if (std::optional path =
+findPathCombination("lib" + name, config->librarySearchPaths,
+{".tbd", ".dylib", ".so", ".a"}))
+  return path;
+return findPathCombination(name, config->librarySearchPaths, {""});
   };
 
   std::optional path = doFind();

>From 5b29c5da6770982fb2f36edcd3a367893b18a19d Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Thu, 18 Jan 2024 21:16:57 -0500
Subject: [PATCH 2/5] [lld-macho] find objects in library search path version 2

---
 lld/MachO/Driver.cpp | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index f04165f5c02615..f8b01da5255c6d 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -90,21 +90,19 @@ static std::optional findLibrary(StringRef name) 
{
 return entry->second;
 
   auto doFind = [&] {
+// Special case for Csu support files.
+if (name.ends_with(".o"))
+  return findPathCombination(name, config->librarySearchPaths, {""});
 if (config->searchDylibsFirst) {
   if (std::optional path =
   findPathCombination("lib" + name, config->librarySearchPaths,
   {".tbd", ".dylib", ".so"}))
 return path;
-  else if (std::optional path = findPathCombination(
-   "lib" + name, config->librarySearchPaths, {".a"}))
-return path;
-  return findPathCombination(name, config->librarySearchPaths, {""});
+  return findPathCombination("lib" + name, config->librarySearchPaths,
+ {".a"});
 }
-if (std::optional path =
-findPathCombination("lib" + name, config->librarySearchPaths,
-{".tbd", ".dylib", ".so", ".a"}))
-  return path;
-return findPathCombination(name, config->librarySearchPaths, {""});
+return findPathCombination("lib" + name, config->librarySearchPaths,
+   {".tbd", ".dylib", ".so", ".a"});
   };
 
   std::optional path = doFind();

>From 5aab87e5c580ca1dba654fb00cf9571c7e3c7999 Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Fri, 19 Jan 2024 01:32:20 -0500
Subject: [PATCH 3/5] add test case

---
 lld/test/MachO/link-csu-obj.s | 10 ++
 1 file changed, 10 insertions(+)
 create mode 100644 lld/test/MachO/link-csu-obj.s

diff --git a/lld/test/MachO/link-csu-obj.s b/lld/test/MachO/link-csu-obj.s
new file mode 100644
index 00..00cb26bb260743
--- /dev/null
+++ b/lld/test/MachO/link-csu-obj.s
@@ -0,0 +1,10 @@
+# REQUIRES: x86
+# RUN: mkdir -p %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libhello.s 
-o %t/hello.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/main.o
+# RUN: %lld -L %t %t/main.o %t/hello.o -o %t/a.out
+
+.globl _main
+_main:
+call _print_hello
+ret

>From 6e8b321b1ed74665f26e5ee6dd0a04ec7b4dbb89 Mon Sep 17 00:00:00 2001
From: OldWorldOrdr 
Date: Fri, 19 Jan 2024 11:38:25 -0500
Subject: [PATCH 4/5] Improve comment

---
 lld/MachO/Driver.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index f8b01da5255c6d..7ac3f51cec103f 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -90,7 +90,8 @@ static std::optional findLibrary(StringRef name) {
 return entry->second;
 
   auto doFind = [&] {
-// Special case for Csu support files.
+// Special case for Csu support files required for Mac OS X 10.7 and older
+// (crt1.o)
 if (name.ends_with(".o"))
   return findPathCombination(name, config->librarySearchPaths, {""});
 if (config->searchDylibsFirst) {

>From 98506602d19602779088

[Lldb-commits] [lldb] [llvm] [libcxx] [lld] [compiler-rt] [lld-macho] Find objects in library search path (PR #78628)

2024-01-19 Thread via lldb-commits

OldWorldOrdr wrote:

Updated the test to verify the output

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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread Jonas Devlieghere via lldb-commits
=?utf-8?q?Jos=C3=A9?= L. Junior ,
=?utf-8?q?Jos=C3=A9?= L. Junior 
Message-ID:
In-Reply-To: 


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


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


[Lldb-commits] [lldb] [lldb] refactor highlighting function for image lookup command (PR #76112)

2024-01-19 Thread José Lira Junior via lldb-commits

junior-jl wrote:

> LGTM.
> 
> Unless you've got commit access yourself, I can land this for you on Monday.

Great! 

I don't have write access. So... as soon as this get merged, I'll open the 
other PR!

Thanks again for the help here!

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


[Lldb-commits] [clang] [flang] [lldb] [llvm] [clang] Split out DebugOptions.def into its own top-level options group. (PR #75530)

2024-01-19 Thread Jan Svoboda via lldb-commits

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

LGTM once CI passes and Flang conflicts are resolved.

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


[Lldb-commits] [lldb] [llvm] DEBUGINFOD based DWP acquisition for LLDB (PR #70996)

2024-01-19 Thread Michał Górny via lldb-commits

mgorny wrote:

`LLVM_DIR` and `Clang_DIR` are merely hints to `find_package()`. If you need to 
pass them, it simply means you haven't set `PATH` correctly and CMake can't 
find installed LLVM/Clang. However, that shouldn't make any difference as long 
as you provide paths to **installed** LLVM/Clang, and not to the source/build 
directory. That said, you may actually need to remove the build directory 
because I don't know if things don't leak through.

No, I don't have a "ready" configuration. You could start off `gentoo/stage3` 
and install LLVM/Clang/LLDB live ebuilds to reproduce but that's a lot of 
effort, and I don't think it's worth your time.

Perhaps I should just send the "obvious" fix without bothering you. I can 
reproduce it anytime, and I doubt there's any other fix possible than adding 
`LLVMDebuginfod` library to `libLLVM`. I just need a lot of energy to start 
contributing to LLVM because it's painful.

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


[Lldb-commits] [llvm] [lldb] [DoNotMerge] DW_IDX_parent full implementation (PR #77121)

2024-01-19 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan updated 
https://github.com/llvm/llvm-project/pull/77121

>From 6d5fec644004c4c1ad84ef29761306651f22fcf7 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Thu, 7 Dec 2023 11:24:39 -0800
Subject: [PATCH 1/3] [llvm][DebugNames] Implement Entry::GetParentEntry query

---
 .../DebugInfo/DWARF/DWARFAcceleratorTable.h | 17 +
 .../DebugInfo/DWARF/DWARFAcceleratorTable.cpp   | 15 +++
 llvm/test/CodeGen/X86/dwarf-headers.o   |  0
 3 files changed, 32 insertions(+)
 create mode 100644 llvm/test/CodeGen/X86/dwarf-headers.o

diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h 
b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
index b89536bc0c7230c..de743216677938b 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
@@ -460,6 +460,16 @@ class DWARFDebugNames : public DWARFAcceleratorTable {
 /// Returns the Offset of the DIE within the containing CU or TU.
 std::optional getDIEUnitOffset() const;
 
+/// Returns true if this Entry has information about its parent DIE (i.e. 
if
+/// it has an IDX_parent attribute)
+bool hasParentInformation() const;
+
+/// Returns the Entry corresponding to the parent of the DIE represented by
+/// `this` Entry. If the parent is not in the table, nullopt is returned.
+/// Precondition: hasParentInformation() == true.
+/// An error is returned for ill-formed tables.
+Expected> getParentDIEEntry() const;
+
 /// Return the Abbreviation that can be used to interpret the raw values of
 /// this Accelerator Entry.
 const Abbrev &getAbbrev() const { return *Abbr; }
@@ -609,6 +619,13 @@ class DWARFDebugNames : public DWARFAcceleratorTable {
 
 Expected getEntry(uint64_t *Offset) const;
 
+// Returns the Entry at the relative `Offset` from the start of the Entry
+// pool.
+Expected getEntryAtRelativeOffset(uint64_t Offset) const {
+  auto OffsetFromSection = Offset + this->EntriesBase;
+  return getEntry(&OffsetFromSection);
+}
+
 /// Look up all entries in this Name Index matching \c Key.
 iterator_range equal_range(StringRef Key) const;
 
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp 
b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
index 0f9c8ef485d456e..d09c5e541a9cc9a 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
@@ -611,6 +611,10 @@ DWARFDebugNames::Entry::lookup(dwarf::Index Index) const {
   return std::nullopt;
 }
 
+bool DWARFDebugNames::Entry::hasParentInformation() const {
+  return lookup(dwarf::DW_IDX_parent).has_value();
+}
+
 std::optional DWARFDebugNames::Entry::getDIEUnitOffset() const {
   if (std::optional Off = lookup(dwarf::DW_IDX_die_offset))
 return Off->getAsReferenceUVal();
@@ -650,6 +654,17 @@ std::optional 
DWARFDebugNames::Entry::getLocalTUIndex() const {
   return std::nullopt;
 }
 
+Expected>
+DWARFDebugNames::Entry::getParentDIEEntry() const {
+  // The offset of the accelerator table entry for the parent.
+  std::optional ParentEntryOff = lookup(dwarf::DW_IDX_parent);
+  assert(ParentEntryOff.has_value() && "hasParentInformation() must be 
called");
+
+  if (ParentEntryOff->getForm() == dwarf::Form::DW_FORM_flag_present)
+return std::nullopt;
+  return NameIdx->getEntryAtRelativeOffset(ParentEntryOff->getRawUValue());
+}
+
 void DWARFDebugNames::Entry::dump(ScopedPrinter &W) const {
   W.startLine() << formatv("Abbrev: {0:x}\n", Abbr->Code);
   W.startLine() << formatv("Tag: {0}\n", Abbr->Tag);
diff --git a/llvm/test/CodeGen/X86/dwarf-headers.o 
b/llvm/test/CodeGen/X86/dwarf-headers.o
new file mode 100644
index 000..e69de29bb2d1d64

>From d0dea8281695c7174901215fe5bfbf79270985ce Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Thu, 7 Dec 2023 11:26:52 -0800
Subject: [PATCH 2/3] [lldb][DWARFUnit] Implement PeekDIEName query

This allows us to query the AT_Name of a DIE without parsing the entire CU.

Part of the ongoing effort to support IDX_Parent in accelerator tables [1].

[1]: 
https://discourse.llvm.org/t/rfc-improve-dwarf-5-debug-names-type-lookup-parsing-speed/74151/44
---
 .../SymbolFile/DWARF/DWARFDebugInfo.cpp   |  6 ++
 .../Plugins/SymbolFile/DWARF/DWARFDebugInfo.h |  5 ++
 .../SymbolFile/DWARF/DWARFFormValue.cpp   | 24 +++---
 .../Plugins/SymbolFile/DWARF/DWARFFormValue.h |  6 ++
 .../Plugins/SymbolFile/DWARF/DWARFUnit.cpp| 24 ++
 .../Plugins/SymbolFile/DWARF/DWARFUnit.h  |  5 ++
 .../SymbolFile/DWARF/DWARFDIETest.cpp | 83 +++
 7 files changed, 143 insertions(+), 10 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index 553b6a4c551d205..340b9acf80d023b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DW

[Lldb-commits] [lldb] [lldb][NFCI] Remove EventData* param from BroadcastEvent (PR #78773)

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

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

BroadcastEvent currently takes its EventData* param and shoves it into an Event 
object, which takes ownership of the pointer and places it into a shared_ptr to 
manage the lifetime.

Instead of relying on `new` and passing raw pointers around, I think it would 
make more sense to create the shared_ptr up front.

>From c7f9f34d4134f1479bf0b32a86facafb3820d3c5 Mon Sep 17 00:00:00 2001
From: Alex Langford 
Date: Fri, 19 Jan 2024 11:58:35 -0800
Subject: [PATCH] [lldb][NFCI] Remove EventData* param from BroadcastEvent

BroadcastEvent currently takes its EventData* param and shoves it into
an Event object, which takes ownership of the pointer and places it into
a shared_ptr to manage the lifetime.

Instead of relying on `new` and passing raw pointers around, I think it
would make more sense to create the shared_ptr up front.
---
 lldb/include/lldb/Breakpoint/Watchpoint.h |  2 --
 lldb/include/lldb/Utility/Broadcaster.h   |  6 ++---
 lldb/source/Breakpoint/BreakpointList.cpp |  7 --
 lldb/source/Breakpoint/BreakpointLocation.cpp |  6 ++---
 lldb/source/Breakpoint/Watchpoint.cpp | 22 --
 lldb/source/Breakpoint/WatchpointList.cpp | 23 +++
 .../Process/gdb-remote/ProcessGDBRemote.cpp   | 17 +++---
 lldb/source/Target/Process.cpp|  6 ++---
 lldb/source/Target/Target.cpp | 15 +++-
 lldb/source/Target/Thread.cpp | 15 +++-
 lldb/source/Target/ThreadList.cpp | 10 
 lldb/source/Utility/Broadcaster.cpp   |  5 ++--
 12 files changed, 66 insertions(+), 68 deletions(-)

diff --git a/lldb/include/lldb/Breakpoint/Watchpoint.h 
b/lldb/include/lldb/Breakpoint/Watchpoint.h
index 851162af24c74e..22fdfd686c3f11 100644
--- a/lldb/include/lldb/Breakpoint/Watchpoint.h
+++ b/lldb/include/lldb/Breakpoint/Watchpoint.h
@@ -235,8 +235,6 @@ class Watchpoint : public 
std::enable_shared_from_this,
 
   void SendWatchpointChangedEvent(lldb::WatchpointEventType eventKind);
 
-  void SendWatchpointChangedEvent(WatchpointEventData *data);
-
   Watchpoint(const Watchpoint &) = delete;
   const Watchpoint &operator=(const Watchpoint &) = delete;
 };
diff --git a/lldb/include/lldb/Utility/Broadcaster.h 
b/lldb/include/lldb/Utility/Broadcaster.h
index 8444c38f6ecc65..c8127f0a921d88 100644
--- a/lldb/include/lldb/Utility/Broadcaster.h
+++ b/lldb/include/lldb/Utility/Broadcaster.h
@@ -177,8 +177,8 @@ class Broadcaster {
 m_broadcaster_sp->BroadcastEvent(event_type, event_data_sp);
   }
 
-  void BroadcastEvent(uint32_t event_type, EventData *event_data = nullptr) {
-m_broadcaster_sp->BroadcastEvent(event_type, event_data);
+  void BroadcastEvent(uint32_t event_type) {
+m_broadcaster_sp->BroadcastEvent(event_type);
   }
 
   void BroadcastEventIfUnique(uint32_t event_type,
@@ -346,7 +346,7 @@ class Broadcaster {
 
 void BroadcastEventIfUnique(lldb::EventSP &event_sp);
 
-void BroadcastEvent(uint32_t event_type, EventData *event_data = nullptr);
+void BroadcastEvent(uint32_t event_type);
 
 void BroadcastEvent(uint32_t event_type,
 const lldb::EventDataSP &event_data_sp);
diff --git a/lldb/source/Breakpoint/BreakpointList.cpp 
b/lldb/source/Breakpoint/BreakpointList.cpp
index f7c2cdb938e62a..2c47b3b1263c65 100644
--- a/lldb/source/Breakpoint/BreakpointList.cpp
+++ b/lldb/source/Breakpoint/BreakpointList.cpp
@@ -17,9 +17,12 @@ using namespace lldb_private;
 
 static void NotifyChange(const BreakpointSP &bp, BreakpointEventType event) {
   Target &target = bp->GetTarget();
-  if (target.EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged))
+  if (target.EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged)) {
+auto event_data_sp =
+std::make_shared(event, bp);
 target.BroadcastEvent(Target::eBroadcastBitBreakpointChanged,
-  new Breakpoint::BreakpointEventData(event, bp));
+  event_data_sp);
+  }
 }
 
 BreakpointList::BreakpointList(bool is_internal)
diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp 
b/lldb/source/Breakpoint/BreakpointLocation.cpp
index 99f94d04bb3184..98de059c2e2967 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -649,11 +649,11 @@ void 
BreakpointLocation::SendBreakpointLocationChangedEvent(
   if (!m_being_created && !m_owner.IsInternal() &&
   m_owner.GetTarget().EventTypeHasListeners(
   Target::eBroadcastBitBreakpointChanged)) {
-Breakpoint::BreakpointEventData *data = new 
Breakpoint::BreakpointEventData(
+auto data_sp = std::make_shared(
 eventKind, m_owner.shared_from_this());
-data->GetBreakpointLocationCollection().Add(shared_from_this());
+data_sp->GetBreakpointLocationCollection().Add(shared_from_this());
 m_owner.GetTarget().BroadcastEven

[Lldb-commits] [lldb] [lldb][NFCI] Remove EventData* param from BroadcastEvent (PR #78773)

2024-01-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Alex Langford (bulbazord)


Changes

BroadcastEvent currently takes its EventData* param and shoves it into an Event 
object, which takes ownership of the pointer and places it into a shared_ptr to 
manage the lifetime.

Instead of relying on `new` and passing raw pointers around, I think it would 
make more sense to create the shared_ptr up front.

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


12 Files Affected:

- (modified) lldb/include/lldb/Breakpoint/Watchpoint.h (-2) 
- (modified) lldb/include/lldb/Utility/Broadcaster.h (+3-3) 
- (modified) lldb/source/Breakpoint/BreakpointList.cpp (+5-2) 
- (modified) lldb/source/Breakpoint/BreakpointLocation.cpp (+3-3) 
- (modified) lldb/source/Breakpoint/Watchpoint.cpp (+5-17) 
- (modified) lldb/source/Breakpoint/WatchpointList.cpp (+13-10) 
- (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (+8-9) 
- (modified) lldb/source/Target/Process.cpp (+3-3) 
- (modified) lldb/source/Target/Target.cpp (+9-6) 
- (modified) lldb/source/Target/Thread.cpp (+9-6) 
- (modified) lldb/source/Target/ThreadList.cpp (+6-4) 
- (modified) lldb/source/Utility/Broadcaster.cpp (+2-3) 


``diff
diff --git a/lldb/include/lldb/Breakpoint/Watchpoint.h 
b/lldb/include/lldb/Breakpoint/Watchpoint.h
index 851162af24c74e0..22fdfd686c3f115 100644
--- a/lldb/include/lldb/Breakpoint/Watchpoint.h
+++ b/lldb/include/lldb/Breakpoint/Watchpoint.h
@@ -235,8 +235,6 @@ class Watchpoint : public 
std::enable_shared_from_this,
 
   void SendWatchpointChangedEvent(lldb::WatchpointEventType eventKind);
 
-  void SendWatchpointChangedEvent(WatchpointEventData *data);
-
   Watchpoint(const Watchpoint &) = delete;
   const Watchpoint &operator=(const Watchpoint &) = delete;
 };
diff --git a/lldb/include/lldb/Utility/Broadcaster.h 
b/lldb/include/lldb/Utility/Broadcaster.h
index 8444c38f6ecc650..c8127f0a921d882 100644
--- a/lldb/include/lldb/Utility/Broadcaster.h
+++ b/lldb/include/lldb/Utility/Broadcaster.h
@@ -177,8 +177,8 @@ class Broadcaster {
 m_broadcaster_sp->BroadcastEvent(event_type, event_data_sp);
   }
 
-  void BroadcastEvent(uint32_t event_type, EventData *event_data = nullptr) {
-m_broadcaster_sp->BroadcastEvent(event_type, event_data);
+  void BroadcastEvent(uint32_t event_type) {
+m_broadcaster_sp->BroadcastEvent(event_type);
   }
 
   void BroadcastEventIfUnique(uint32_t event_type,
@@ -346,7 +346,7 @@ class Broadcaster {
 
 void BroadcastEventIfUnique(lldb::EventSP &event_sp);
 
-void BroadcastEvent(uint32_t event_type, EventData *event_data = nullptr);
+void BroadcastEvent(uint32_t event_type);
 
 void BroadcastEvent(uint32_t event_type,
 const lldb::EventDataSP &event_data_sp);
diff --git a/lldb/source/Breakpoint/BreakpointList.cpp 
b/lldb/source/Breakpoint/BreakpointList.cpp
index f7c2cdb938e62af..2c47b3b1263c65b 100644
--- a/lldb/source/Breakpoint/BreakpointList.cpp
+++ b/lldb/source/Breakpoint/BreakpointList.cpp
@@ -17,9 +17,12 @@ using namespace lldb_private;
 
 static void NotifyChange(const BreakpointSP &bp, BreakpointEventType event) {
   Target &target = bp->GetTarget();
-  if (target.EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged))
+  if (target.EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged)) {
+auto event_data_sp =
+std::make_shared(event, bp);
 target.BroadcastEvent(Target::eBroadcastBitBreakpointChanged,
-  new Breakpoint::BreakpointEventData(event, bp));
+  event_data_sp);
+  }
 }
 
 BreakpointList::BreakpointList(bool is_internal)
diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp 
b/lldb/source/Breakpoint/BreakpointLocation.cpp
index 99f94d04bb31843..98de059c2e29677 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -649,11 +649,11 @@ void 
BreakpointLocation::SendBreakpointLocationChangedEvent(
   if (!m_being_created && !m_owner.IsInternal() &&
   m_owner.GetTarget().EventTypeHasListeners(
   Target::eBroadcastBitBreakpointChanged)) {
-Breakpoint::BreakpointEventData *data = new 
Breakpoint::BreakpointEventData(
+auto data_sp = std::make_shared(
 eventKind, m_owner.shared_from_this());
-data->GetBreakpointLocationCollection().Add(shared_from_this());
+data_sp->GetBreakpointLocationCollection().Add(shared_from_this());
 m_owner.GetTarget().BroadcastEvent(Target::eBroadcastBitBreakpointChanged,
-   data);
+   data_sp);
   }
 }
 
diff --git a/lldb/source/Breakpoint/Watchpoint.cpp 
b/lldb/source/Breakpoint/Watchpoint.cpp
index 4602ce4213b9cda..1a8ef87c1e67a32 100644
--- a/lldb/source/Breakpoint/Watchpoint.cpp
+++ b/lldb/source/Breakpoint/Watchpoint.cpp
@@ -462,26 +462,14 @@ const char *Watchpoint::GetConditionText() const {
 
 void Watchpoint::SendWatchp

[Lldb-commits] [lldb] [llvm] Added settings for DEBUGINFOD cache location and timeout (PR #78605)

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

https://github.com/clayborg commented:

Looks good to me on the LLDB side, but you should probably get the ok from the 
maintainers of the debug infod library for those changes.

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


[Lldb-commits] [lldb] [llvm] Added settings for DEBUGINFOD cache location and timeout (PR #78605)

2024-01-19 Thread Kevin Frei via lldb-commits

kevinfrei wrote:

> Looks good to me on the LLDB side, but you should probably get the ok from 
> the maintainers of the debug infod library for those changes.

I think that was @mysterymath

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


[Lldb-commits] [compiler-rt] [llvm] [flang] [clang-tools-extra] [clang] [lld] [libc] [libcxx] [lldb] Make clang report invalid target versions for all environment types. (PR #78655)

2024-01-19 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/78655

>From f440f44e7e270d4636ad39f4e4223c904e496d3a Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Fri, 19 Jan 2024 00:47:05 +
Subject: [PATCH] Make clang report invalid target versions for all
 environment.

Followup for https://github.com/llvm/llvm-project/pull/75373

1. Make this feature not just available for android, but everyone.
2. Correct some target triples/
3. Add opencl to the environment type list.
---
 clang/lib/Driver/Driver.cpp  | 19 ++-
 clang/test/CodeGen/fp128_complex.c   |  2 +-
 clang/test/Driver/mips-features.c|  4 ++--
 clang/test/Frontend/fixed_point_bit_widths.c |  4 ++--
 llvm/include/llvm/TargetParser/Triple.h  |  2 +-
 llvm/lib/TargetParser/Triple.cpp | 14 ++
 6 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 1889ea28079df1..2d6986d145483b 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1430,15 +1430,16 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) {
   const ToolChain &TC = getToolChain(
   *UArgs, computeTargetTriple(*this, TargetTriple, *UArgs));
 
-  if (TC.getTriple().isAndroid()) {
-llvm::Triple Triple = TC.getTriple();
-StringRef TripleVersionName = Triple.getEnvironmentVersionString();
-
-if (Triple.getEnvironmentVersion().empty() && TripleVersionName != "") {
-  Diags.Report(diag::err_drv_triple_version_invalid)
-  << TripleVersionName << TC.getTripleString();
-  ContainsError = true;
-}
+  // Check if the environment version is valid.
+  llvm::Triple Triple = TC.getTriple();
+  StringRef TripleVersionName = Triple.getEnvironmentVersionString();
+  StringRef TripleObjectFormat = 
Triple.getObjectFormatTypeName(Triple.getObjectFormat());
+
+  if (Triple.getEnvironmentVersion().empty() && TripleVersionName != ""
+&& TripleVersionName != TripleObjectFormat) {
+Diags.Report(diag::err_drv_triple_version_invalid)
+<< TripleVersionName << TC.getTripleString();
+ContainsError = true;
   }
 
   // Report warning when arm64EC option is overridden by specified target
diff --git a/clang/test/CodeGen/fp128_complex.c 
b/clang/test/CodeGen/fp128_complex.c
index 48659d22416841..0e87cbe8ce8121 100644
--- a/clang/test/CodeGen/fp128_complex.c
+++ b/clang/test/CodeGen/fp128_complex.c
@@ -1,4 +1,4 @@
-// RUN: %clang -target aarch64-linux-gnuabi %s -S -emit-llvm -o - | FileCheck 
%s
+// RUN: %clang -target aarch64-linux-gnueabi %s -S -emit-llvm -o - | FileCheck 
%s
 
 _Complex long double a, b, c, d;
 void test_fp128_compound_assign(void) {
diff --git a/clang/test/Driver/mips-features.c 
b/clang/test/Driver/mips-features.c
index fad6009ffb89ba..18edcd05ea85c9 100644
--- a/clang/test/Driver/mips-features.c
+++ b/clang/test/Driver/mips-features.c
@@ -400,12 +400,12 @@
 // LONG-CALLS-DEF-NOT: "long-calls"
 //
 // -mbranch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=BRANCH-LIKELY %s
 // BRANCH-LIKELY: argument unused during compilation: '-mbranch-likely'
 //
 // -mno-branch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=NO-BRANCH-LIKELY %s
 // NO-BRANCH-LIKELY: argument unused during compilation: '-mno-branch-likely'
 
diff --git a/clang/test/Frontend/fixed_point_bit_widths.c 
b/clang/test/Frontend/fixed_point_bit_widths.c
index ac8db49ed516ae..e56f787e824f24 100644
--- a/clang/test/Frontend/fixed_point_bit_widths.c
+++ b/clang/test/Frontend/fixed_point_bit_widths.c
@@ -1,7 +1,7 @@
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-ubuntu-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=ppc64 %s | 
FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-windows10pro-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 
 /* Primary signed _Accum */
 
diff --git a/llvm/include/llvm/TargetParser/Triple.h 
b/llvm/include/llvm/TargetParser/Triple.h
index 95014a546f7245..525ea6df3643ca 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -273,7 +273,7 @@ class Triple {
 Callable,
 Mesh,
 Amplification,
-
+OpenCL,
 OpenHOS,
 
 LastEnvironmentType = OpenHOS
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
index b9

[Lldb-commits] [libcxx] [llvm] [compiler-rt] [clang] [libc] [lld] [lldb] [clang-tools-extra] [flang] Make clang report invalid target versions for all environment types. (PR #78655)

2024-01-19 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/78655

>From f440f44e7e270d4636ad39f4e4223c904e496d3a Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Fri, 19 Jan 2024 00:47:05 +
Subject: [PATCH] Make clang report invalid target versions for all
 environment.

Followup for https://github.com/llvm/llvm-project/pull/75373

1. Make this feature not just available for android, but everyone.
2. Correct some target triples/
3. Add opencl to the environment type list.
---
 clang/lib/Driver/Driver.cpp  | 19 ++-
 clang/test/CodeGen/fp128_complex.c   |  2 +-
 clang/test/Driver/mips-features.c|  4 ++--
 clang/test/Frontend/fixed_point_bit_widths.c |  4 ++--
 llvm/include/llvm/TargetParser/Triple.h  |  2 +-
 llvm/lib/TargetParser/Triple.cpp | 14 ++
 6 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 1889ea28079df10..2d6986d145483b8 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1430,15 +1430,16 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) {
   const ToolChain &TC = getToolChain(
   *UArgs, computeTargetTriple(*this, TargetTriple, *UArgs));
 
-  if (TC.getTriple().isAndroid()) {
-llvm::Triple Triple = TC.getTriple();
-StringRef TripleVersionName = Triple.getEnvironmentVersionString();
-
-if (Triple.getEnvironmentVersion().empty() && TripleVersionName != "") {
-  Diags.Report(diag::err_drv_triple_version_invalid)
-  << TripleVersionName << TC.getTripleString();
-  ContainsError = true;
-}
+  // Check if the environment version is valid.
+  llvm::Triple Triple = TC.getTriple();
+  StringRef TripleVersionName = Triple.getEnvironmentVersionString();
+  StringRef TripleObjectFormat = 
Triple.getObjectFormatTypeName(Triple.getObjectFormat());
+
+  if (Triple.getEnvironmentVersion().empty() && TripleVersionName != ""
+&& TripleVersionName != TripleObjectFormat) {
+Diags.Report(diag::err_drv_triple_version_invalid)
+<< TripleVersionName << TC.getTripleString();
+ContainsError = true;
   }
 
   // Report warning when arm64EC option is overridden by specified target
diff --git a/clang/test/CodeGen/fp128_complex.c 
b/clang/test/CodeGen/fp128_complex.c
index 48659d224168416..0e87cbe8ce81219 100644
--- a/clang/test/CodeGen/fp128_complex.c
+++ b/clang/test/CodeGen/fp128_complex.c
@@ -1,4 +1,4 @@
-// RUN: %clang -target aarch64-linux-gnuabi %s -S -emit-llvm -o - | FileCheck 
%s
+// RUN: %clang -target aarch64-linux-gnueabi %s -S -emit-llvm -o - | FileCheck 
%s
 
 _Complex long double a, b, c, d;
 void test_fp128_compound_assign(void) {
diff --git a/clang/test/Driver/mips-features.c 
b/clang/test/Driver/mips-features.c
index fad6009ffb89bab..18edcd05ea85c9f 100644
--- a/clang/test/Driver/mips-features.c
+++ b/clang/test/Driver/mips-features.c
@@ -400,12 +400,12 @@
 // LONG-CALLS-DEF-NOT: "long-calls"
 //
 // -mbranch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=BRANCH-LIKELY %s
 // BRANCH-LIKELY: argument unused during compilation: '-mbranch-likely'
 //
 // -mno-branch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=NO-BRANCH-LIKELY %s
 // NO-BRANCH-LIKELY: argument unused during compilation: '-mno-branch-likely'
 
diff --git a/clang/test/Frontend/fixed_point_bit_widths.c 
b/clang/test/Frontend/fixed_point_bit_widths.c
index ac8db49ed516aef..e56f787e824f24a 100644
--- a/clang/test/Frontend/fixed_point_bit_widths.c
+++ b/clang/test/Frontend/fixed_point_bit_widths.c
@@ -1,7 +1,7 @@
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-ubuntu-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=ppc64 %s | 
FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-windows10pro-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 
 /* Primary signed _Accum */
 
diff --git a/llvm/include/llvm/TargetParser/Triple.h 
b/llvm/include/llvm/TargetParser/Triple.h
index 95014a546f72453..525ea6df3643ca6 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -273,7 +273,7 @@ class Triple {
 Callable,
 Mesh,
 Amplification,
-
+OpenCL,
 OpenHOS,
 
 LastEnvironmentType = OpenHOS
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cp

[Lldb-commits] [lldb] [lldb][DWARFUnit] Implement PeekDIEName query (PR #78486)

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

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

Now this is safe and all my issues are gone. Thanks for improving.

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


[Lldb-commits] [llvm] [lldb] Added settings for DEBUGINFOD cache location and timeout (PR #78605)

2024-01-19 Thread Daniel Thornburgh via lldb-commits

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


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


[Lldb-commits] [compiler-rt] [llvm] [flang] [clang-tools-extra] [clang] [lld] [libc] [libcxx] [lldb] Make clang report invalid target versions for all environment types. (PR #78655)

2024-01-19 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/78655

>From f440f44e7e270d4636ad39f4e4223c904e496d3a Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Fri, 19 Jan 2024 00:47:05 +
Subject: [PATCH 1/2] Make clang report invalid target versions for all
 environment.

Followup for https://github.com/llvm/llvm-project/pull/75373

1. Make this feature not just available for android, but everyone.
2. Correct some target triples/
3. Add opencl to the environment type list.
---
 clang/lib/Driver/Driver.cpp  | 19 ++-
 clang/test/CodeGen/fp128_complex.c   |  2 +-
 clang/test/Driver/mips-features.c|  4 ++--
 clang/test/Frontend/fixed_point_bit_widths.c |  4 ++--
 llvm/include/llvm/TargetParser/Triple.h  |  2 +-
 llvm/lib/TargetParser/Triple.cpp | 14 ++
 6 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 1889ea28079df1..2d6986d145483b 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1430,15 +1430,16 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) {
   const ToolChain &TC = getToolChain(
   *UArgs, computeTargetTriple(*this, TargetTriple, *UArgs));
 
-  if (TC.getTriple().isAndroid()) {
-llvm::Triple Triple = TC.getTriple();
-StringRef TripleVersionName = Triple.getEnvironmentVersionString();
-
-if (Triple.getEnvironmentVersion().empty() && TripleVersionName != "") {
-  Diags.Report(diag::err_drv_triple_version_invalid)
-  << TripleVersionName << TC.getTripleString();
-  ContainsError = true;
-}
+  // Check if the environment version is valid.
+  llvm::Triple Triple = TC.getTriple();
+  StringRef TripleVersionName = Triple.getEnvironmentVersionString();
+  StringRef TripleObjectFormat = 
Triple.getObjectFormatTypeName(Triple.getObjectFormat());
+
+  if (Triple.getEnvironmentVersion().empty() && TripleVersionName != ""
+&& TripleVersionName != TripleObjectFormat) {
+Diags.Report(diag::err_drv_triple_version_invalid)
+<< TripleVersionName << TC.getTripleString();
+ContainsError = true;
   }
 
   // Report warning when arm64EC option is overridden by specified target
diff --git a/clang/test/CodeGen/fp128_complex.c 
b/clang/test/CodeGen/fp128_complex.c
index 48659d22416841..0e87cbe8ce8121 100644
--- a/clang/test/CodeGen/fp128_complex.c
+++ b/clang/test/CodeGen/fp128_complex.c
@@ -1,4 +1,4 @@
-// RUN: %clang -target aarch64-linux-gnuabi %s -S -emit-llvm -o - | FileCheck 
%s
+// RUN: %clang -target aarch64-linux-gnueabi %s -S -emit-llvm -o - | FileCheck 
%s
 
 _Complex long double a, b, c, d;
 void test_fp128_compound_assign(void) {
diff --git a/clang/test/Driver/mips-features.c 
b/clang/test/Driver/mips-features.c
index fad6009ffb89ba..18edcd05ea85c9 100644
--- a/clang/test/Driver/mips-features.c
+++ b/clang/test/Driver/mips-features.c
@@ -400,12 +400,12 @@
 // LONG-CALLS-DEF-NOT: "long-calls"
 //
 // -mbranch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=BRANCH-LIKELY %s
 // BRANCH-LIKELY: argument unused during compilation: '-mbranch-likely'
 //
 // -mno-branch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=NO-BRANCH-LIKELY %s
 // NO-BRANCH-LIKELY: argument unused during compilation: '-mno-branch-likely'
 
diff --git a/clang/test/Frontend/fixed_point_bit_widths.c 
b/clang/test/Frontend/fixed_point_bit_widths.c
index ac8db49ed516ae..e56f787e824f24 100644
--- a/clang/test/Frontend/fixed_point_bit_widths.c
+++ b/clang/test/Frontend/fixed_point_bit_widths.c
@@ -1,7 +1,7 @@
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-ubuntu-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=ppc64 %s | 
FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-windows10pro-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 
 /* Primary signed _Accum */
 
diff --git a/llvm/include/llvm/TargetParser/Triple.h 
b/llvm/include/llvm/TargetParser/Triple.h
index 95014a546f7245..525ea6df3643ca 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -273,7 +273,7 @@ class Triple {
 Callable,
 Mesh,
 Amplification,
-
+OpenCL,
 OpenHOS,
 
 LastEnvironmentType = OpenHOS
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
inde

[Lldb-commits] [lldb] [lldb-dap] Add a CMake variable for defining a welcome message (PR #78811)

2024-01-19 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo created 
https://github.com/llvm/llvm-project/pull/78811

lldb-dap instances managed by other extensions benefit from having a welcome 
message with, for example, a basic user guide or a troubleshooting message.
This PR adds a cmake variable for defining such message in a simple way. This 
message appears upon initialization but before initCommands are executed, as 
they might cause a failure and prevent the message from being displayed.


>From 6ba8246e99189c29ab51293cf0b923d87d5aec16 Mon Sep 17 00:00:00 2001
From: walter erquinigo 
Date: Fri, 19 Jan 2024 18:48:12 -0500
Subject: [PATCH] [lldb-dap] Add a CMake variable for defining a welcome
 message

lldb-dap instances managed by other extensions benefit from having a welcome 
message with, for example, a basic user guide or a troubleshooting message.
This PR adds a cmake variable for defining such message in a simple way. This 
message appears upon initialization but before initCommands are executed, as 
they might cause a failure and prevent the message from being displayed.
---
 lldb/tools/lldb-dap/CMakeLists.txt |  6 ++
 lldb/tools/lldb-dap/lldb-dap.cpp   | 20 
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/lldb/tools/lldb-dap/CMakeLists.txt 
b/lldb/tools/lldb-dap/CMakeLists.txt
index c71c80981890bd5..554567eb3b0e236 100644
--- a/lldb/tools/lldb-dap/CMakeLists.txt
+++ b/lldb/tools/lldb-dap/CMakeLists.txt
@@ -46,6 +46,12 @@ add_lldb_tool(lldb-dap
 Support
   )
 
+if(LLDB_DAP_WELCOME_MESSAGE)
+  target_compile_definitions(lldb-dap
+PRIVATE
+-DLLDB_DAP_WELCOME_MESSAGE=\"${LLDB_DAP_WELCOME_MESSAGE}\")
+endif()
+
 if(LLDB_BUILD_FRAMEWORK)
   # In the build-tree, we know the exact path to the framework directory.
   # The installed framework can be in different locations.
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 0d45b0379c85261..1e1af990cca0b41 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -106,6 +106,14 @@ typedef void (*RequestCallback)(const llvm::json::Object 
&command);
 
 enum LaunchMethod { Launch, Attach, AttachForSuspendedLaunch };
 
+/// Prints a welcome message on the editor if the preprocessor variable
+/// LLDB_DAP_WELCOME_MESSAGE is defined.
+static void PrintWelcomeMessage() {
+#ifdef LLDB_DAP_WELCOME_MESSAGE
+  g_dap.SendOutput(OutputType::Console, LLDB_DAP_WELCOME_MESSAGE);
+#endif
+}
+
 lldb::SBValueList *GetTopLevelScope(int64_t variablesReference) {
   switch (variablesReference) {
   case VARREF_LOCALS:
@@ -655,6 +663,8 @@ void request_attach(const llvm::json::Object &request) {
   g_dap.SetFrameFormat(GetString(arguments, "customFrameFormat"));
   g_dap.SetThreadFormat(GetString(arguments, "customThreadFormat"));
 
+  PrintWelcomeMessage();
+
   // This is a hack for loading DWARF in .o files on Mac where the .o files
   // in the debug map of the main executable have relative paths which require
   // the lldb-dap binary to have its working directory set to that relative
@@ -664,7 +674,7 @@ void request_attach(const llvm::json::Object &request) {
 
   // Run any initialize LLDB commands the user specified in the launch.json
   if (llvm::Error err = g_dap.RunInitCommands()) {
-response["success"] = false;
+ response["success"] = false;
 EmplaceSafeString(response, "message", llvm::toString(std::move(err)));
 g_dap.SendJSON(llvm::json::Value(std::move(response)));
 return;
@@ -1824,10 +1834,12 @@ void request_launch(const llvm::json::Object &request) {
   g_dap.SetFrameFormat(GetString(arguments, "customFrameFormat"));
   g_dap.SetThreadFormat(GetString(arguments, "customThreadFormat"));
 
+  PrintWelcomeMessage();
+
   // This is a hack for loading DWARF in .o files on Mac where the .o files
-  // in the debug map of the main executable have relative paths which require
-  // the lldb-dap binary to have its working directory set to that relative
-  // root for the .o files in order to be able to load debug info.
+  // in the debug map of the main executable have relative paths which
+  // require the lldb-dap binary to have its working directory set to that
+  // relative root for the .o files in order to be able to load debug info.
   if (!debuggerRoot.empty())
 llvm::sys::fs::set_current_path(debuggerRoot);
 

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


[Lldb-commits] [lldb] [lldb-dap] Add a CMake variable for defining a welcome message (PR #78811)

2024-01-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Walter Erquinigo (walter-erquinigo)


Changes

lldb-dap instances managed by other extensions benefit from having a welcome 
message with, for example, a basic user guide or a troubleshooting message.
This PR adds a cmake variable for defining such message in a simple way. This 
message appears upon initialization but before initCommands are executed, as 
they might cause a failure and prevent the message from being displayed.


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


2 Files Affected:

- (modified) lldb/tools/lldb-dap/CMakeLists.txt (+6) 
- (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+16-4) 


``diff
diff --git a/lldb/tools/lldb-dap/CMakeLists.txt 
b/lldb/tools/lldb-dap/CMakeLists.txt
index c71c80981890bd5..554567eb3b0e236 100644
--- a/lldb/tools/lldb-dap/CMakeLists.txt
+++ b/lldb/tools/lldb-dap/CMakeLists.txt
@@ -46,6 +46,12 @@ add_lldb_tool(lldb-dap
 Support
   )
 
+if(LLDB_DAP_WELCOME_MESSAGE)
+  target_compile_definitions(lldb-dap
+PRIVATE
+-DLLDB_DAP_WELCOME_MESSAGE=\"${LLDB_DAP_WELCOME_MESSAGE}\")
+endif()
+
 if(LLDB_BUILD_FRAMEWORK)
   # In the build-tree, we know the exact path to the framework directory.
   # The installed framework can be in different locations.
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 0d45b0379c85261..1e1af990cca0b41 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -106,6 +106,14 @@ typedef void (*RequestCallback)(const llvm::json::Object 
&command);
 
 enum LaunchMethod { Launch, Attach, AttachForSuspendedLaunch };
 
+/// Prints a welcome message on the editor if the preprocessor variable
+/// LLDB_DAP_WELCOME_MESSAGE is defined.
+static void PrintWelcomeMessage() {
+#ifdef LLDB_DAP_WELCOME_MESSAGE
+  g_dap.SendOutput(OutputType::Console, LLDB_DAP_WELCOME_MESSAGE);
+#endif
+}
+
 lldb::SBValueList *GetTopLevelScope(int64_t variablesReference) {
   switch (variablesReference) {
   case VARREF_LOCALS:
@@ -655,6 +663,8 @@ void request_attach(const llvm::json::Object &request) {
   g_dap.SetFrameFormat(GetString(arguments, "customFrameFormat"));
   g_dap.SetThreadFormat(GetString(arguments, "customThreadFormat"));
 
+  PrintWelcomeMessage();
+
   // This is a hack for loading DWARF in .o files on Mac where the .o files
   // in the debug map of the main executable have relative paths which require
   // the lldb-dap binary to have its working directory set to that relative
@@ -664,7 +674,7 @@ void request_attach(const llvm::json::Object &request) {
 
   // Run any initialize LLDB commands the user specified in the launch.json
   if (llvm::Error err = g_dap.RunInitCommands()) {
-response["success"] = false;
+ response["success"] = false;
 EmplaceSafeString(response, "message", llvm::toString(std::move(err)));
 g_dap.SendJSON(llvm::json::Value(std::move(response)));
 return;
@@ -1824,10 +1834,12 @@ void request_launch(const llvm::json::Object &request) {
   g_dap.SetFrameFormat(GetString(arguments, "customFrameFormat"));
   g_dap.SetThreadFormat(GetString(arguments, "customThreadFormat"));
 
+  PrintWelcomeMessage();
+
   // This is a hack for loading DWARF in .o files on Mac where the .o files
-  // in the debug map of the main executable have relative paths which require
-  // the lldb-dap binary to have its working directory set to that relative
-  // root for the .o files in order to be able to load debug info.
+  // in the debug map of the main executable have relative paths which
+  // require the lldb-dap binary to have its working directory set to that
+  // relative root for the .o files in order to be able to load debug info.
   if (!debuggerRoot.empty())
 llvm::sys::fs::set_current_path(debuggerRoot);
 

``




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


[Lldb-commits] [lldb] [lldb-dap] Add a CMake variable for defining a welcome message (PR #78811)

2024-01-19 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

Merging this innocuous PR very quickly due to time constraints, but very happy 
to apply any feedback in a subsequent PR.

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


[Lldb-commits] [lldb] 8bef2f2 - [lldb-dap] Add a CMake variable for defining a welcome message (#78811)

2024-01-19 Thread via lldb-commits

Author: Walter Erquinigo
Date: 2024-01-19T18:55:40-05:00
New Revision: 8bef2f27a0f7df05c7879186cc50fc8ec4a81132

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

LOG: [lldb-dap] Add a CMake variable for defining a welcome message (#78811)

lldb-dap instances managed by other extensions benefit from having a
welcome message with, for example, a basic user guide or a
troubleshooting message.
This PR adds a cmake variable for defining such message in a simple way.
This message appears upon initialization but before initCommands are
executed, as they might cause a failure and prevent the message from
being displayed.

Added: 


Modified: 
lldb/tools/lldb-dap/CMakeLists.txt
lldb/tools/lldb-dap/lldb-dap.cpp

Removed: 




diff  --git a/lldb/tools/lldb-dap/CMakeLists.txt 
b/lldb/tools/lldb-dap/CMakeLists.txt
index c71c80981890bd..554567eb3b0e23 100644
--- a/lldb/tools/lldb-dap/CMakeLists.txt
+++ b/lldb/tools/lldb-dap/CMakeLists.txt
@@ -46,6 +46,12 @@ add_lldb_tool(lldb-dap
 Support
   )
 
+if(LLDB_DAP_WELCOME_MESSAGE)
+  target_compile_definitions(lldb-dap
+PRIVATE
+-DLLDB_DAP_WELCOME_MESSAGE=\"${LLDB_DAP_WELCOME_MESSAGE}\")
+endif()
+
 if(LLDB_BUILD_FRAMEWORK)
   # In the build-tree, we know the exact path to the framework directory.
   # The installed framework can be in 
diff erent locations.

diff  --git a/lldb/tools/lldb-dap/lldb-dap.cpp 
b/lldb/tools/lldb-dap/lldb-dap.cpp
index bb3500c21e7452..828cc67c42ddde 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -108,6 +108,14 @@ typedef void (*RequestCallback)(const llvm::json::Object 
&command);
 
 enum LaunchMethod { Launch, Attach, AttachForSuspendedLaunch };
 
+/// Prints a welcome message on the editor if the preprocessor variable
+/// LLDB_DAP_WELCOME_MESSAGE is defined.
+static void PrintWelcomeMessage() {
+#ifdef LLDB_DAP_WELCOME_MESSAGE
+  g_dap.SendOutput(OutputType::Console, LLDB_DAP_WELCOME_MESSAGE);
+#endif
+}
+
 lldb::SBValueList *GetTopLevelScope(int64_t variablesReference) {
   switch (variablesReference) {
   case VARREF_LOCALS:
@@ -657,6 +665,8 @@ void request_attach(const llvm::json::Object &request) {
   g_dap.SetFrameFormat(GetString(arguments, "customFrameFormat"));
   g_dap.SetThreadFormat(GetString(arguments, "customThreadFormat"));
 
+  PrintWelcomeMessage();
+
   // This is a hack for loading DWARF in .o files on Mac where the .o files
   // in the debug map of the main executable have relative paths which require
   // the lldb-dap binary to have its working directory set to that relative
@@ -666,7 +676,7 @@ void request_attach(const llvm::json::Object &request) {
 
   // Run any initialize LLDB commands the user specified in the launch.json
   if (llvm::Error err = g_dap.RunInitCommands()) {
-response["success"] = false;
+ response["success"] = false;
 EmplaceSafeString(response, "message", llvm::toString(std::move(err)));
 g_dap.SendJSON(llvm::json::Value(std::move(response)));
 return;
@@ -1838,10 +1848,12 @@ void request_launch(const llvm::json::Object &request) {
   g_dap.SetFrameFormat(GetString(arguments, "customFrameFormat"));
   g_dap.SetThreadFormat(GetString(arguments, "customThreadFormat"));
 
+  PrintWelcomeMessage();
+
   // This is a hack for loading DWARF in .o files on Mac where the .o files
-  // in the debug map of the main executable have relative paths which require
-  // the lldb-dap binary to have its working directory set to that relative
-  // root for the .o files in order to be able to load debug info.
+  // in the debug map of the main executable have relative paths which
+  // require the lldb-dap binary to have its working directory set to that
+  // relative root for the .o files in order to be able to load debug info.
   if (!debuggerRoot.empty())
 llvm::sys::fs::set_current_path(debuggerRoot);
 



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


[Lldb-commits] [lldb] [lldb-dap] Add a CMake variable for defining a welcome message (PR #78811)

2024-01-19 Thread Walter Erquinigo via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Add a CMake variable for defining a welcome message (PR #78811)

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


@@ -664,7 +674,7 @@ void request_attach(const llvm::json::Object &request) {
 
   // Run any initialize LLDB commands the user specified in the launch.json
   if (llvm::Error err = g_dap.RunInitCommands()) {
-response["success"] = false;
+ response["success"] = false;

clayborg wrote:

This won't go well! ahahah

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


[Lldb-commits] [lldb] [lldb-dap] Add a CMake variable for defining a welcome message (PR #78811)

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

https://github.com/clayborg commented:

Looks like the typo will break the buildbots and we want the welcome message to 
be printed for launches too right?

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


[Lldb-commits] [lldb] [lldb-dap] Add a CMake variable for defining a welcome message (PR #78811)

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


@@ -655,6 +663,8 @@ void request_attach(const llvm::json::Object &request) {
   g_dap.SetFrameFormat(GetString(arguments, "customFrameFormat"));
   g_dap.SetThreadFormat(GetString(arguments, "customThreadFormat"));
 
+  PrintWelcomeMessage();

clayborg wrote:

We want this in `request_launch(...)` as well as `request_attach(...)` right?

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


[Lldb-commits] [lldb] [lldb-dap] Add a CMake variable for defining a welcome message (PR #78811)

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

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


[Lldb-commits] [lldb] 904cf66 - [lldb] Fix build error in lldb-dap.cpp (NFC)

2024-01-19 Thread Jie Fu via lldb-commits

Author: Jie Fu
Date: 2024-01-20T08:09:20+08:00
New Revision: 904cf66ec1d4089e5e661eb996487ba132b97664

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

LOG: [lldb] Fix build error in lldb-dap.cpp (NFC)

llvm-project/lldb/tools/lldb-dap/lldb-dap.cpp:679:5:
 error: unknown type name ''
 response["success"] = false;
^

Added: 


Modified: 
lldb/tools/lldb-dap/lldb-dap.cpp

Removed: 




diff  --git a/lldb/tools/lldb-dap/lldb-dap.cpp 
b/lldb/tools/lldb-dap/lldb-dap.cpp
index 828cc67c42dddeb..01494dcc7da00f2 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -676,7 +676,7 @@ void request_attach(const llvm::json::Object &request) {
 
   // Run any initialize LLDB commands the user specified in the launch.json
   if (llvm::Error err = g_dap.RunInitCommands()) {
- response["success"] = false;
+response["success"] = false;
 EmplaceSafeString(response, "message", llvm::toString(std::move(err)));
 g_dap.SendJSON(llvm::json::Value(std::move(response)));
 return;



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


[Lldb-commits] [lldb] [lldb][DWARFUnit] Implement PeekDIEName query (PR #78486)

2024-01-19 Thread Felipe de Azevedo Piovezan via lldb-commits

felipepiovezan wrote:

> Now this is safe and all my issues are gone. Thanks for improving.

Thanks for spotting the issue with the first implementation! 

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


[Lldb-commits] [lldb] 4684507 - [lldb][DWARFUnit] Implement PeekDIEName query (#78486)

2024-01-19 Thread via lldb-commits

Author: Felipe de Azevedo Piovezan
Date: 2024-01-19T16:11:08-08:00
New Revision: 46845074557484a82f4dc73647dad399e1c00e89

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

LOG: [lldb][DWARFUnit] Implement PeekDIEName query (#78486)

This allows us to query the AT_Name of a DIE without parsing the entire
CU.

Part of the ongoing effort to support IDX_Parent in accelerator tables
[1].

[1]:
https://discourse.llvm.org/t/rfc-improve-dwarf-5-debug-names-type-lookup-parsing-speed/74151/44

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index 553b6a4c551d20..340b9acf80d023 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -191,3 +191,9 @@ DWARFDebugInfo::GetDIE(const DIERef &die_ref) {
 return cu->GetNonSkeletonUnit().GetDIE(die_ref.die_offset());
   return DWARFDIE(); // Not found
 }
+
+llvm::StringRef DWARFDebugInfo::PeekDIEName(const DIERef &die_ref) {
+  if (DWARFUnit *cu = GetUnit(die_ref))
+return cu->GetNonSkeletonUnit().PeekDIEName(die_ref.die_offset());
+  return llvm::StringRef();
+}

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
index d5e48f312ea0e9..a8b5abc3beed2d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -43,6 +43,11 @@ class DWARFDebugInfo {
   bool ContainsTypeUnits();
   DWARFDIE GetDIE(const DIERef &die_ref);
 
+  /// Returns the AT_Name of this DIE, if it exists, without parsing the entire
+  /// compile unit. An empty is string is returned upon error or if the
+  /// attribute is not present.
+  llvm::StringRef PeekDIEName(const DIERef &die_ref);
+
   enum {
 eDumpFlag_Verbose = (1 << 0),  // Verbose dumping
 eDumpFlag_ShowForm = (1 << 1), // Show the DW_form type

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index 0a7029a55c047b..e1f73f1997e369 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -18,8 +18,6 @@
 #include "DWARFFormValue.h"
 #include "DWARFUnit.h"
 
-class DWARFUnit;
-
 using namespace lldb_private;
 using namespace lldb_private::dwarf;
 using namespace lldb_private::plugin::dwarf;
@@ -502,7 +500,8 @@ dw_addr_t DWARFFormValue::Address() const {
   &offset, index_size);
 }
 
-DWARFDIE DWARFFormValue::Reference() const {
+std::pair
+DWARFFormValue::ReferencedUnitAndOffset() const {
   uint64_t value = m_value.value.uval;
   switch (m_form) {
   case DW_FORM_ref1:
@@ -516,9 +515,9 @@ DWARFDIE DWARFFormValue::Reference() const {
 if (!m_unit->ContainsDIEOffset(value)) {
   m_unit->GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
   "DW_FORM_ref* DIE reference {0:x16} is outside of its CU", value);
-  return {};
+  return {nullptr, 0};
 }
-return const_cast(m_unit)->GetDIE(value);
+return {const_cast(m_unit), value};
 
   case DW_FORM_ref_addr: {
 DWARFUnit *ref_cu =
@@ -527,24 +526,29 @@ DWARFDIE DWARFFormValue::Reference() const {
 if (!ref_cu) {
   m_unit->GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
   "DW_FORM_ref_addr DIE reference {0:x16} has no matching CU", value);
-  return {};
+  return {nullptr, 0};
 }
-return ref_cu->GetDIE(value);
+return {ref_cu, value};
   }
 
   case DW_FORM_ref_sig8: {
 DWARFTypeUnit *tu =
 m_unit->GetSymbolFileDWARF().DebugInfo().GetTypeUnitForHash(value);
 if (!tu)
-  return {};
-return tu->GetDIE(tu->GetTypeOffset());
+  return {nullptr, 0};
+return {tu, tu->GetTypeOffset()};
   }
 
   default:
-return {};
+return {nullptr, 0};
   }
 }
 
+DWARFDIE DWARFFormValue::Reference() const {
+  auto [unit, offset] = ReferencedUnitAndOffset();
+  return unit ? unit->GetDIE(offset) : DWARFDIE();
+}
+
 uint64_t DWARFFormValue::Reference(dw_offset_t base_offset) const {
   uint64_t value = m_value.value.uval;
   switch (m_form) {

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h

[Lldb-commits] [lldb] [lldb][DWARFUnit] Implement PeekDIEName query (PR #78486)

2024-01-19 Thread Felipe de Azevedo Piovezan via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Skip ObjC timezone tests on macOS >= 14 (NFC) (PR #78817)

2024-01-19 Thread Dave Lee via lldb-commits

https://github.com/kastiglione created 
https://github.com/llvm/llvm-project/pull/78817

None

>From 52b3baa5905b7562fc5872bae8a2f6599ec9e040 Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Fri, 19 Jan 2024 16:17:17 -0800
Subject: [PATCH] [lldb] Skip ObjC timezone tests on macOS >= 14 (NFC)

---
 .../TestDataFormatterObjCNSDate.py| 26 ---
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
index a1ffe84ad556f0..c56b887a3f5088 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
@@ -19,6 +19,11 @@ def test_nsdate_with_run_command(self):
 """Test formatters for  NSDate."""
 self.appkit_tester_impl(self.nsdate_data_formatter_commands, False)
 
+@skipIf(macos_version=[">=", "14.0"])
+def test_timezone_with_run_command(self):
+"""Test formatters for NSTimeZone and CFTimeZone."""
+self.appkit_tester_impl(self.timezone_data_formatter_commands, False)
+
 def nsdate_data_formatter_commands(self):
 self.expect(
 "frame variable date1 date2",
@@ -51,16 +56,6 @@ def nsdate_data_formatter_commands(self):
 self.expect_expr("date_1970_plus_05", result_summary="1970-01-01 
00:00:00 UTC")
 self.expect_expr("date_1970_plus_04", result_summary="1970-01-01 
00:00:00 UTC")
 
-self.expect(
-"frame variable cupertino home europe",
-substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
-)
-
-self.expect(
-"frame variable cupertino_ns home_ns europe_ns",
-substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
-)
-
 self.expect(
 "frame variable mut_bv",
 substrs=[
@@ -71,3 +66,14 @@ def nsdate_data_formatter_commands(self):
 
 self.expect_expr("distant_past", result_summary="0001-01-01 00:00:00 
UTC")
 self.expect_expr("distant_future", result_summary="4001-01-01 00:00:00 
UTC")
+
+def timezone_data_formatter_commands(self):
+self.expect(
+"frame variable cupertino home europe",
+substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
+)
+
+self.expect(
+"frame variable cupertino_ns home_ns europe_ns",
+substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
+)

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


[Lldb-commits] [lldb] [lldb] Skip ObjC timezone tests on macOS >= 14 (NFC) (PR #78817)

2024-01-19 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)


Changes



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


1 Files Affected:

- (modified) 
lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
 (+16-10) 


``diff
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
index a1ffe84ad556f0..c56b887a3f5088 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
@@ -19,6 +19,11 @@ def test_nsdate_with_run_command(self):
 """Test formatters for  NSDate."""
 self.appkit_tester_impl(self.nsdate_data_formatter_commands, False)
 
+@skipIf(macos_version=[">=", "14.0"])
+def test_timezone_with_run_command(self):
+"""Test formatters for NSTimeZone and CFTimeZone."""
+self.appkit_tester_impl(self.timezone_data_formatter_commands, False)
+
 def nsdate_data_formatter_commands(self):
 self.expect(
 "frame variable date1 date2",
@@ -51,16 +56,6 @@ def nsdate_data_formatter_commands(self):
 self.expect_expr("date_1970_plus_05", result_summary="1970-01-01 
00:00:00 UTC")
 self.expect_expr("date_1970_plus_04", result_summary="1970-01-01 
00:00:00 UTC")
 
-self.expect(
-"frame variable cupertino home europe",
-substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
-)
-
-self.expect(
-"frame variable cupertino_ns home_ns europe_ns",
-substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
-)
-
 self.expect(
 "frame variable mut_bv",
 substrs=[
@@ -71,3 +66,14 @@ def nsdate_data_formatter_commands(self):
 
 self.expect_expr("distant_past", result_summary="0001-01-01 00:00:00 
UTC")
 self.expect_expr("distant_future", result_summary="4001-01-01 00:00:00 
UTC")
+
+def timezone_data_formatter_commands(self):
+self.expect(
+"frame variable cupertino home europe",
+substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
+)
+
+self.expect(
+"frame variable cupertino_ns home_ns europe_ns",
+substrs=['"America/Los_Angeles"', '"Europe/Rome"', 
'"Europe/Paris"'],
+)

``




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


[Lldb-commits] [lldb] [lldb] Skip ObjC timezone tests on macOS >= 14 (NFC) (PR #78817)

2024-01-19 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [lldb][DWARFUnit] Implement PeekDIEName query (PR #78486)

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

clayborg wrote:

I was thinking about DIE -> name stuff, and was wondering if we would benefit 
from a cache of DIE offset to `DW_AT_name` and DIE offset to 
`DW_AT_linkage_name`. Not sure how many times we might lookup DIE names 
multiple times.

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


[Lldb-commits] [lldb] bd3838f - Skip TestThreadLocal.py on darwin temporarily for linker issue

2024-01-19 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-19T17:03:19-08:00
New Revision: bd3838ff6b4310fb8ff68649ef87e5e962bab1fd

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

LOG: Skip TestThreadLocal.py on darwin temporarily for linker issue

The new static linker in Xcode 15 does not emit the necessary
symbols for file static thread local storage, causing this test
to fail when used.  The old static linker is still available
as ld-classic in Xcode 15, but it has to be invoked specially, and
the new static linker will be fixed at some point.  I may try to
add linker name and versioning information in
lldb/packages/Python/lldbsuite/test/decorators.py like we do with
the compiler / compiler_version, so it can be xfailed for known
problematic static linker name / versions, but until I get that
sorted I'm skipping this test to unblock the CI bots.

Added: 


Modified: 
lldb/test/API/lang/cpp/thread_local/TestThreadLocal.py

Removed: 




diff  --git a/lldb/test/API/lang/cpp/thread_local/TestThreadLocal.py 
b/lldb/test/API/lang/cpp/thread_local/TestThreadLocal.py
index 636e4819ea29892..9b128ba6097acb8 100644
--- a/lldb/test/API/lang/cpp/thread_local/TestThreadLocal.py
+++ b/lldb/test/API/lang/cpp/thread_local/TestThreadLocal.py
@@ -9,6 +9,7 @@
 
 class PlatformProcessCrashInfoTestCase(TestBase):
 @expectedFailureAll(oslist=["windows", "linux", "freebsd", "netbsd"])
+@skipIfDarwin  # rdar://120795095
 def test_thread_local(self):
 # Set a breakpoint on the first instruction of the main function,
 # before the TLS initialization has run.



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


[Lldb-commits] [flang] [llvm] [libcxx] [clang] [libc] [clang-tools-extra] [compiler-rt] [mlir] [lld] [lldb] Reland "[clang] Fix CTAD for aggregates for nested template classes" (PR #78670)

2024-01-19 Thread via lldb-commits

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

>From 227504aa6da6dd2199c83563b9149dd3873e1a11 Mon Sep 17 00:00:00 2001
From: Antonio Abbatangelo 
Date: Thu, 18 Jan 2024 23:27:16 -0500
Subject: [PATCH] Reland "[clang] Fix CTAD for aggregates for nested template
 classes"

Reland of #78387

Use the template pattern in determining whether to synthesize the
aggregate deduction guide, and update DeclareImplicitDeductionGuideFromInitList
to substitute outer template arguments.

The tests in the original patch made an assumption about the size of a
pointer type, and this led to them failing on systems with 32-bit
pointers. The tests have been updated to not depend on the size of any
type. This only requires updates to the test file, no functionality has
otherwise changed between this and the original patch.
---
 clang/docs/ReleaseNotes.rst   |  3 ++
 clang/lib/Sema/SemaInit.cpp   |  9 -
 clang/lib/Sema/SemaTemplate.cpp   | 21 +---
 .../nested-implicit-deduction-guides.cpp  | 34 ---
 4 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index b400d75095421c..ee431587a7853d 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -979,6 +979,9 @@ Bug Fixes to C++ Support
 - Clang now allows parenthesized initialization of arrays in `operator new[]`.
   Fixes: (`#68198 `_)
 
+- Fixes CTAD for aggregates on nested template classes. Fixes:
+  (`#77599 `_)
+
 Bug Fixes to AST Handling
 ^
 - Fixed an import failure of recursive friend class template.
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 18440a69e3a3d9..457fa377355a97 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -10731,7 +10731,14 @@ QualType 
Sema::DeduceTemplateSpecializationFromInitializer(
 bool HasAnyDeductionGuide = false;
 
 auto SynthesizeAggrGuide = [&](InitListExpr *ListInit) {
-  auto *RD = cast(Template->getTemplatedDecl());
+  auto *Pattern = Template;
+  while (Pattern->getInstantiatedFromMemberTemplate()) {
+if (Pattern->isMemberSpecialization())
+  break;
+Pattern = Pattern->getInstantiatedFromMemberTemplate();
+  }
+
+  auto *RD = cast(Pattern->getTemplatedDecl());
   if (!(RD->getDefinition() && RD->isAggregate()))
 return;
   QualType Ty = Context.getRecordType(RD);
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 0655d363352067..839d508b911f06 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -2418,6 +2418,9 @@ struct ConvertConstructorToDeductionGuideTransform {
 QualType Result = SemaRef.BuildFunctionType(DeducedType, ParamTypes, Loc,
 DeductionGuideName, EPI);
 TypeSourceInfo *TSI = SemaRef.Context.getTrivialTypeSourceInfo(Result, 
Loc);
+if (NestedPattern)
+  TSI = SemaRef.SubstType(TSI, OuterInstantiationArgs, Loc,
+  DeductionGuideName);
 
 FunctionProtoTypeLoc FPTL =
 TSI->getTypeLoc().castAs();
@@ -2425,9 +2428,13 @@ struct ConvertConstructorToDeductionGuideTransform {
 // Build the parameters, needed during deduction / substitution.
 SmallVector Params;
 for (auto T : ParamTypes) {
-  ParmVarDecl *NewParam = ParmVarDecl::Create(
-  SemaRef.Context, DC, Loc, Loc, nullptr, T,
-  SemaRef.Context.getTrivialTypeSourceInfo(T, Loc), SC_None, nullptr);
+  auto *TSI = SemaRef.Context.getTrivialTypeSourceInfo(T, Loc);
+  if (NestedPattern)
+TSI = SemaRef.SubstType(TSI, OuterInstantiationArgs, Loc,
+DeclarationName());
+  ParmVarDecl *NewParam =
+  ParmVarDecl::Create(SemaRef.Context, DC, Loc, Loc, nullptr,
+  TSI->getType(), TSI, SC_None, nullptr);
   NewParam->setScopeInfo(0, Params.size());
   FPTL.setParam(Params.size(), NewParam);
   Params.push_back(NewParam);
@@ -2670,8 +2677,14 @@ FunctionTemplateDecl 
*Sema::DeclareImplicitDeductionGuideFromInitList(
   if (BuildingDeductionGuides.isInvalid())
 return nullptr;
 
-  return cast(
+  ClassTemplateDecl *Pattern =
+  Transform.NestedPattern ? Transform.NestedPattern : Transform.Template;
+  ContextRAII SavedContext(*this, Pattern->getTemplatedDecl());
+
+  auto *DG = cast(
   Transform.buildSimpleDeductionGuide(ParamTypes));
+  SavedContext.pop();
+  return DG;
 }
 
 void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template,
diff --git a/clang/test/SemaTemplate/nested-implicit-deduction-guides.cpp 
b/clang/test/SemaTemplate/nested-implicit-deduction-guides.cpp
index c44ec6918c7afb..38b6706595a116 100644
--- a/clang

[Lldb-commits] [clang-tools-extra] [clang] [libc] [lldb] [lld] [flang] [llvm] [compiler-rt] [libcxx] [mlir] Reland "[clang] Fix CTAD for aggregates for nested template classes" (PR #78670)

2024-01-19 Thread via lldb-commits

antangelo wrote:

Thanks for the review! Apologies for the delayed response but I'm available to 
merge this in now.

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


[Lldb-commits] [clang-tools-extra] [clang] [libc] [lldb] [lld] [flang] [llvm] [compiler-rt] [libcxx] [mlir] Reland "[clang] Fix CTAD for aggregates for nested template classes" (PR #78670)

2024-01-19 Thread via lldb-commits

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


[Lldb-commits] [clang-tools-extra] [clang] [openmp] [libc] [lldb] [lld] [flang] [llvm] [compiler-rt] [libcxx] [mlir] [libc++][memory] P2868R1: Removing deprecated typedef `std::allocator::is_always_eq

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

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


[Lldb-commits] [clang-tools-extra] [clang] [libc] [libunwind] [lldb] [polly] [flang] [llvm] [libcxxabi] [compiler-rt] [libcxx] [mlir] [libc++][any] LWG3305: `any_cast` (PR #78215)

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

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


[Lldb-commits] [clang-tools-extra] [clang] [libc] [libunwind] [lldb] [flang] [llvm] [libcxxabi] [compiler-rt] [libcxx] [libc++][span] P2447R4: `std::span` over an initializer list (PR #78157)

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

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


  1   2   >