[Lldb-commits] [lldb] [llvm] Use StringRef::starts_with (NFC) (PR #94112)

2024-06-01 Thread Kazu Hirata via lldb-commits

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


[Lldb-commits] [lldb] [llvm] Use StringRef::starts_with (NFC) (PR #94112)

2024-06-01 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/94112

None

>From 8e474178754a28e3e509be4fa42faa5b13888f66 Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Sat, 1 Jun 2024 06:55:48 -0700
Subject: [PATCH] Use StringRef::starts_with (NFC)

---
 lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp | 2 +-
 lldb/source/Utility/UriParser.cpp| 2 +-
 llvm/lib/MC/MCExpr.cpp   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 5f0684163328f..06c827c2543f4 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -152,7 +152,7 @@ static bool IsTrivialBasename(const llvm::StringRef 
) {
   // because it is significantly more efficient then using the general purpose
   // regular expression library.
   size_t idx = 0;
-  if (basename.size() > 0 && basename[0] == '~')
+  if (basename.starts_with('~'))
 idx = 1;
 
   if (basename.size() <= idx)
diff --git a/lldb/source/Utility/UriParser.cpp 
b/lldb/source/Utility/UriParser.cpp
index 432b046d008b9..1932e11acb4c0 100644
--- a/lldb/source/Utility/UriParser.cpp
+++ b/lldb/source/Utility/UriParser.cpp
@@ -47,7 +47,7 @@ std::optional URI::Parse(llvm::StringRef uri) {
   ((path_pos != std::string::npos) ? path_pos : uri.size()) - host_pos);
 
   // Extract hostname
-  if (!host_port.empty() && host_port[0] == '[') {
+  if (host_port.starts_with('[')) {
 // hostname is enclosed with square brackets.
 pos = host_port.rfind(']');
 if (pos == std::string::npos)
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index bbee2a64032a0..b065d03651c45 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -76,7 +76,7 @@ void MCExpr::print(raw_ostream , const MCAsmInfo *MAI, 
bool InParens) const {
 // Parenthesize names that start with $ so that they don't look like
 // absolute names.
 bool UseParens = MAI && MAI->useParensForDollarSignNames() && !InParens &&
- !Sym.getName().empty() && Sym.getName()[0] == '$';
+ Sym.getName().starts_with('$');
 
 if (UseParens) {
   OS << '(';

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


[Lldb-commits] [lldb] 8df5a37 - [lldb] Fix a warning

2024-05-22 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2024-05-22T10:09:10-07:00
New Revision: 8df5a37b848c6ac5a68b56eeddb4a7746b84d288

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

LOG: [lldb] Fix a warning

This patch fixes:

  lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp:839:7: error:
  ignoring return value of function declared with 'nodiscard'
  attribute [-Werror,-Wunused-result]

Added: 


Modified: 
lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp 
b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
index 3d9b4566ca1c9..7a6b7429fddbf 100644
--- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
+++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
@@ -836,7 +836,7 @@ class ReturnValueExtractor {
 for (uint32_t i = 0; i < n; i++) {
   std::string name;
   uint32_t size;
-  GetChildType(i, name, size);
+  (void)GetChildType(i, name, size);
   // NOTE: the offset returned by GetChildCompilerTypeAtIndex()
   //   can't be used because it never considers alignment bytes
   //   between struct fields.



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


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

2024-05-16 Thread Kazu Hirata via lldb-commits

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


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

2024-05-16 Thread Kazu Hirata via lldb-commits

kazutakahirata wrote:

> The change looks fine. Was this done with by hand or with the help of a 
> script? If so please put that in the commit message so we can do the same 
> downstream.

Thank you for reviewing the patch!

I did get help from a script, but it's a bit too involved for a commit message, 
so let me put the recipe here.

1. Remove `StringRef::equals` temporarily from `StringRef.h`.
2. Build llvm with lldb enabled.
3. Redirect the error messages to a file, say `tem`.
4. Post process the error messages with:
   ```
   grep "llvm-project/lldb.* error:" tem | sort | uniq | \
 line-sed "s,^([^\!]*)\.equals\(([^\)]*)\),\1 == \2,"
   ```

   where `line-sed` is a helper shell script:

```
#!/bin/sh
pat="$1"

cat /dev/stdin | while IFS= read line ; do
  file="$(echo $line | cut -d: -f1)"
  lineno="$(echo $line | cut -d: -f2)"
  echo "Processing $file:$lineno..."
  sed -Ee "${lineno}${pat}" -i "$file"
done
```

The `sed` recipe above avoids lines containing `!` before `equals` because the 
negated `equals` needs to be replaced with `!=` instead of `==`.  Remaining 
cases, including negated `equals`, are fixed manually.

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


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

2024-05-16 Thread Kazu Hirata via lldb-commits

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


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

2024-05-16 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/92476

 StringRef) instead of StringRef::equals (NFC),Note that StringRef::equals has 
been deprecated in favor of
operator==(StringRef, StringRef).

>From ec50a9b1b95ed98e0ce0b7264bd4174e965d80f5 Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Thu, 16 May 2024 13:05:10 -0700
Subject: [PATCH] [lldb] Use operator==(StringRef, StringRef) instead of
 StringRef::equals (NFC)

Note that StringRef::equals has been deprecated in favor of
operator==(StringRef, StringRef).
---
 lldb/source/Commands/CommandObjectThread.cpp  |   4 +-
 lldb/source/Core/FormatEntity.cpp |  12 +-
 lldb/source/Expression/IRExecutionUnit.cpp|  34 ++---
 .../ExpressionParser/Clang/IRForTarget.cpp|   8 +-
 lldb/source/Plugins/Language/ObjC/Cocoa.cpp   |   2 +-
 .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp  |   2 +-
 .../GDBRemoteCommunicationClient.cpp  | 133 +-
 .../GDBRemoteCommunicationServerCommon.cpp|  22 +--
 .../GDBRemoteCommunicationServerPlatform.cpp  |   4 +-
 .../Process/gdb-remote/ProcessGDBRemote.cpp   |  26 ++--
 .../Plugins/SymbolFile/PDB/PDBASTParser.cpp   |   2 +-
 .../Plugins/SymbolFile/PDB/SymbolFilePDB.cpp  |   4 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  17 ++-
 lldb/source/Target/PathMappingList.cpp|   4 +-
 14 files changed, 136 insertions(+), 138 deletions(-)

diff --git a/lldb/source/Commands/CommandObjectThread.cpp 
b/lldb/source/Commands/CommandObjectThread.cpp
index 3dbbfd4f9d344..4397ee14ea074 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -151,14 +151,14 @@ class CommandObjectThreadBacktrace : public 
CommandObjectIterateOverThreads {
 
 for (size_t idx = 0; idx < num_entries; idx++) {
   llvm::StringRef arg_string = copy_args[idx].ref();
-  if (arg_string.equals("-c") || count_opt.starts_with(arg_string)) {
+  if (arg_string == "-c" || count_opt.starts_with(arg_string)) {
 idx++;
 if (idx == num_entries)
   return std::nullopt;
 count_idx = idx;
 if (copy_args[idx].ref().getAsInteger(0, count_val))
   return std::nullopt;
-  } else if (arg_string.equals("-s") || start_opt.starts_with(arg_string)) 
{
+  } else if (arg_string == "-s" || start_opt.starts_with(arg_string)) {
 idx++;
 if (idx == num_entries)
   return std::nullopt;
diff --git a/lldb/source/Core/FormatEntity.cpp 
b/lldb/source/Core/FormatEntity.cpp
index 07978d3882961..1c3a4cb1062fe 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -1921,7 +1921,7 @@ static Status ParseEntry(const llvm::StringRef 
_str,
   const size_t n = parent->num_children;
   for (size_t i = 0; i < n; ++i) {
 const Definition *entry_def = parent->children + i;
-if (key.equals(entry_def->name) || entry_def->name[0] == '*') {
+if (key == entry_def->name || entry_def->name[0] == '*') {
   llvm::StringRef value;
   if (sep_char)
 value =
@@ -2002,7 +2002,7 @@ static const Definition *FindEntry(const llvm::StringRef 
_str,
   const size_t n = parent->num_children;
   for (size_t i = 0; i < n; ++i) {
 const Definition *entry_def = parent->children + i;
-if (p.first.equals(entry_def->name) || entry_def->name[0] == '*') {
+if (p.first == entry_def->name || entry_def->name[0] == '*') {
   if (p.second.empty()) {
 if (format_str.back() == '.')
   remainder = format_str.drop_front(format_str.size() - 1);
@@ -2351,13 +2351,13 @@ Status 
FormatEntity::ExtractVariableInfo(llvm::StringRef _str,
 bool FormatEntity::FormatFileSpec(const FileSpec _spec, Stream ,
   llvm::StringRef variable_name,
   llvm::StringRef variable_format) {
-  if (variable_name.empty() || variable_name.equals(".fullpath")) {
+  if (variable_name.empty() || variable_name == ".fullpath") {
 file_spec.Dump(s.AsRawOstream());
 return true;
-  } else if (variable_name.equals(".basename")) {
+  } else if (variable_name == ".basename") {
 s.PutCString(file_spec.GetFilename().GetStringRef());
 return true;
-  } else if (variable_name.equals(".dirname")) {
+  } else if (variable_name == ".dirname") {
 s.PutCString(file_spec.GetFilename().GetStringRef());
 return true;
   }
@@ -2440,7 +2440,7 @@ void FormatEntity::AutoComplete(CompletionRequest 
) {
   // "${thread.id" 
   request.AddCompletion(MakeMatch(str, "}"));
 }
-  } else if (remainder.equals(".")) {
+  } else if (remainder == ".") {
 // "${thread." 
 StringList new_matches;
 AddMatches(entry_def, str, llvm::StringRef(), new_matches);
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index 07df8c52a2a4f..f220704423627 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ 

[Lldb-commits] [lldb] 5f88f0c - [lldb] Fix a warning

2024-04-30 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2024-04-30T12:10:54-07:00
New Revision: 5f88f0c63fa75169665732a3377f5bb3fef6256d

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

LOG: [lldb] Fix a warning

This patch fixes:

  third-party/unittest/googletest/include/gtest/gtest.h:1379:11:
  error: comparison of integers of different signs: 'const unsigned
  int' and 'const int' [-Werror,-Wsign-compare]

Added: 


Modified: 
lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp

Removed: 




diff  --git a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp 
b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
index f7a4b8f1ac59be..ee90855437a71e 100644
--- a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
+++ b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
@@ -417,9 +417,9 @@ TEST_F(DWARFASTParserClangTests, TestPtrAuthParsing) {
   lldb::TypeSP type_sp =
   ast_parser.ParseTypeFromDWARF(sc, ptrauth_type, _type);
   CompilerType compiler_type = type_sp->GetForwardCompilerType();
-  ASSERT_EQ(compiler_type.GetPtrAuthKey(), 0);
+  ASSERT_EQ(compiler_type.GetPtrAuthKey(), 0U);
   ASSERT_EQ(compiler_type.GetPtrAuthAddressDiversity(), false);
-  ASSERT_EQ(compiler_type.GetPtrAuthDiscriminator(), 42);
+  ASSERT_EQ(compiler_type.GetPtrAuthDiscriminator(), 42U);
 }
 
 struct ExtractIntFromFormValueTest : public testing::Test {



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


[Lldb-commits] [lldb] [lldb] Handle clang::Language::CIR (PR #86234)

2024-03-21 Thread Kazu Hirata via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Handle clang::Language::CIR (PR #86234)

2024-03-21 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/86234

  commit e66b670f3bf9312f696e66c31152ae535207d6bb
  Author: Nathan Lanza 
  Date:   Thu Mar 21 19:53:48 2024 -0400

triggers:

  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:478:16:
  error: enumeration value 'CIR' not handled in switch
  [-Werror,-Wswitch]

This patch teaches lldb to handle clang::Language::CIR the same way as
clang::Language::LLVM_IR.


>From ed689ca338eca95448077582ef53b7feb15e8caa Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Thu, 21 Mar 2024 19:11:15 -0700
Subject: [PATCH] [lldb] Handle clang::Language::CIR

  commit e66b670f3bf9312f696e66c31152ae535207d6bb
  Author: Nathan Lanza 
  Date:   Thu Mar 21 19:53:48 2024 -0400

triggers:

  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:478:16:
  error: enumeration value 'CIR' not handled in switch
  [-Werror,-Wswitch]

This patch teaches lldb to handle clang::Language::CIR the same way as
clang::Language::LLVM_IR.
---
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 3ac1cf91932cca..ebcc3bc99a801f 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -477,6 +477,7 @@ static void ParseLangArgs(LangOptions , InputKind IK, 
const char *triple) {
 // Based on the base language, pick one.
 switch (IK.getLanguage()) {
 case clang::Language::Unknown:
+case clang::Language::CIR:
 case clang::Language::LLVM_IR:
 case clang::Language::RenderScript:
   llvm_unreachable("Invalid input kind!");

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


[Lldb-commits] [lldb] 89dc706 - [lldb] Fix printf format errors

2024-01-25 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2024-01-25T10:39:24-08:00
New Revision: 89dc7063f6c81d468a61b71b4ca612e22cb87a46

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

LOG: [lldb] Fix printf format errors

This patch fixes:

  lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp:1108:39: error:
  format specifies type 'long long' but the argument has type
  'std::time_t' (aka 'long') [-Werror,-Wformat]

  lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp:1116:64: error:
  format specifies type 'long long' but the argument has type
  'std::time_t' (aka 'long') [-Werror,-Wformat]

Added: 


Modified: 
lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index c5bed2cee815078..d0bdbe1fd4d91ac 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -1105,7 +1105,7 @@ bool 
lldb_private::formatters::LibcxxChronoSysSecondsSummaryProvider(
 
   const std::time_t seconds = ptr_sp->GetValueAsSigned(0);
   if (seconds < chrono_timestamp_min || seconds > chrono_timestamp_max)
-stream.Printf("timestamp=%lld s", seconds);
+stream.Printf("timestamp=%" PRIu64 " s", static_cast(seconds));
   else {
 std::array str;
 std::size_t size =
@@ -1113,7 +1113,8 @@ bool 
lldb_private::formatters::LibcxxChronoSysSecondsSummaryProvider(
 if (size == 0)
   return false;
 
-stream.Printf("date/time=%s timestamp=%lld s", str.data(), seconds);
+stream.Printf("date/time=%s timestamp=%" PRIu64 " s", str.data(),
+  static_cast(seconds));
   }
 
   return true;



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


[Lldb-commits] [lldb] 47605ff - [lldb] Fix a warning

2024-01-09 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2024-01-09T12:04:20-08:00
New Revision: 47605ffec8864e989905027b2f56277e2dc8b8fa

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

LOG: [lldb] Fix a warning

This patch fixes:

  lldb/source/Target/ProcessTrace.cpp:23:33: error: extra ';' outside
  of a function is incompatible with C++98
  [-Werror,-Wc++98-compat-extra-semi]

Added: 


Modified: 
lldb/source/Target/ProcessTrace.cpp

Removed: 




diff  --git a/lldb/source/Target/ProcessTrace.cpp 
b/lldb/source/Target/ProcessTrace.cpp
index 054e34a46de29a..3a41f257627c23 100644
--- a/lldb/source/Target/ProcessTrace.cpp
+++ b/lldb/source/Target/ProcessTrace.cpp
@@ -20,7 +20,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-LLDB_PLUGIN_DEFINE(ProcessTrace);
+LLDB_PLUGIN_DEFINE(ProcessTrace)
 
 llvm::StringRef ProcessTrace::GetPluginDescriptionStatic() {
   return "Trace process plug-in.";



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


[Lldb-commits] [lldb] 364d7e7 - [lldb] Use StringRef::starts_with (NFC)

2023-12-17 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-12-17T15:51:48-08:00
New Revision: 364d7e775fcad5ef20a5c5788586f79c467b47db

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

LOG: [lldb] Use StringRef::starts_with (NFC)

This patch replaces uses of StringRef::startswith with
StringRef::starts_with for consistency with
std::{string,string_view}::starts_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.

Added: 


Modified: 
lldb/bindings/python/python-typemaps.swig

Removed: 




diff  --git a/lldb/bindings/python/python-typemaps.swig 
b/lldb/bindings/python/python-typemaps.swig
index 7660e0282c8fcf..8d4b740e5f35ca 100644
--- a/lldb/bindings/python/python-typemaps.swig
+++ b/lldb/bindings/python/python-typemaps.swig
@@ -110,7 +110,7 @@ AND call SWIG_fail at the same time, because it will result 
in a double free.
 SWIG_fail;
   }
 
-  if (llvm::StringRef(type_name.get()).startswith("SB")) {
+  if (llvm::StringRef(type_name.get()).starts_with("SB")) {
 std::string error_msg = "Input type is invalid: " + type_name.get();
 PyErr_SetString(PyExc_TypeError, error_msg.c_str());
 SWIG_fail;



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


[Lldb-commits] [lldb] ee667db - [lldb] Use StringRef::{starts, ends}_with (NFC)

2023-12-16 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-12-16T15:02:15-08:00
New Revision: ee667db4b83eb6171bbceca1010cddd0da6f17ca

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

LOG: [lldb] Use StringRef::{starts,ends}_with (NFC)

This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.

Added: 


Modified: 
lldb/source/Host/common/Host.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp

Removed: 




diff  --git a/lldb/source/Host/common/Host.cpp 
b/lldb/source/Host/common/Host.cpp
index 8314d3581f6a47..f4cec97f5af633 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -554,7 +554,7 @@ bool Host::IsInteractiveGraphicSession() { return false; }
 
 std::unique_ptr Host::CreateDefaultConnection(llvm::StringRef url) 
{
 #if defined(_WIN32)
-  if (url.startswith("file://"))
+  if (url.starts_with("file://"))
 return std::unique_ptr(new ConnectionGenericFile());
 #endif
   return std::unique_ptr(new ConnectionFileDescriptor());

diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 58275c052f74e6..182a9f2afaeb2e 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -2868,7 +2868,7 @@ void ObjectFileMachO::ParseSymtab(Symtab ) {
 if (symbol_name && symbol_name[0] == '_' &&
 symbol_name[1] == 'O') {
   llvm::StringRef symbol_name_ref(symbol_name);
-  if (symbol_name_ref.startswith(
+  if (symbol_name_ref.starts_with(
   g_objc_v2_prefix_class)) {
 symbol_name_non_abi_mangled = symbol_name + 1;
 symbol_name =
@@ -2876,14 +2876,14 @@ void ObjectFileMachO::ParseSymtab(Symtab ) {
 type = eSymbolTypeObjCClass;
 demangled_is_synthesized = true;
 
-  } else if (symbol_name_ref.startswith(
+  } else if (symbol_name_ref.starts_with(
  g_objc_v2_prefix_metaclass)) {
 symbol_name_non_abi_mangled = symbol_name + 1;
 symbol_name =
 symbol_name + 
g_objc_v2_prefix_metaclass.size();
 type = eSymbolTypeObjCMetaClass;
 demangled_is_synthesized = true;
-  } else if (symbol_name_ref.startswith(
+  } else if (symbol_name_ref.starts_with(
  g_objc_v2_prefix_ivar)) {
 symbol_name_non_abi_mangled = symbol_name + 1;
 symbol_name =
@@ -3382,7 +3382,7 @@ void ObjectFileMachO::ParseSymtab(Symtab ) {
 
 if (symbol_name) {
   llvm::StringRef symbol_name_ref(symbol_name);
-  if (symbol_name_ref.startswith("_OBJC_")) {
+  if (symbol_name_ref.starts_with("_OBJC_")) {
 llvm::StringRef
 g_objc_v2_prefix_class(
 "_OBJC_CLASS_$_");
@@ -3391,7 +3391,7 @@ void ObjectFileMachO::ParseSymtab(Symtab ) {
 "_OBJC_METACLASS_$_");
 llvm::StringRef
 g_objc_v2_prefix_ivar("_OBJC_IVAR_$_");
-if (symbol_name_ref.startswith(
+if (symbol_name_ref.starts_with(
 g_objc_v2_prefix_class)) {
   symbol_name_non_abi_mangled =
   symbol_name + 1;
@@ -3401,7 +3401,7 @@ void ObjectFileMachO::ParseSymtab(Symtab ) {
   type = eSymbolTypeObjCClass;
   demangled_is_synthesized = true;
 } else if (
-symbol_name_ref.startswith(
+   

[Lldb-commits] [lldb] 744f389 - [lldb] Use StringRef::{starts, ends}_with (NFC)

2023-12-16 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-12-16T14:39:37-08:00
New Revision: 744f38913fa380580431df0ae89ef5fb3df30240

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

LOG: [lldb] Use StringRef::{starts,ends}_with (NFC)

This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.

Added: 


Modified: 
lldb/include/lldb/Utility/CompletionRequest.h
lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
lldb/source/Commands/CommandCompletions.cpp
lldb/source/Commands/CommandObjectCommands.cpp
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Commands/CommandObjectType.cpp
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/source/Core/Mangled.cpp
lldb/source/Core/Module.cpp
lldb/source/Core/PluginManager.cpp
lldb/source/Core/RichManglingContext.cpp
lldb/source/Core/ValueObject.cpp
lldb/source/Expression/IRExecutionUnit.cpp
lldb/source/Expression/REPL.cpp
lldb/source/Interpreter/CommandAlias.cpp
lldb/source/Interpreter/OptionArgParser.cpp
lldb/source/Interpreter/Options.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp

lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Symbol/ObjectFile.cpp
lldb/source/Symbol/Symbol.cpp
lldb/source/Symbol/Symtab.cpp
lldb/source/Symbol/Variable.cpp
lldb/source/Target/TargetList.cpp
lldb/source/Utility/Args.cpp
lldb/source/Utility/CompletionRequest.cpp
lldb/source/Utility/FileSpec.cpp
lldb/source/Utility/FileSpecList.cpp
lldb/source/Utility/NameMatches.cpp
lldb/source/Utility/StringExtractor.cpp
lldb/source/Utility/TildeExpressionResolver.cpp
lldb/source/Utility/XcodeSDK.cpp
lldb/tools/lldb-dap/IOStream.cpp
lldb/tools/lldb-dap/JSONUtils.cpp
lldb/tools/lldb-dap/lldb-dap.cpp
lldb/unittests/Expression/ClangExpressionDeclMapTest.cpp
lldb/unittests/Process/minidump/RegisterContextMinidumpTest.cpp
lldb/unittests/TestingSupport/MockTildeExpressionResolver.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/CompletionRequest.h 
b/lldb/include/lldb/Utility/CompletionRequest.h
index 1fbc96944e82d5..1a2b1d639950fc 100644
--- a/lldb/include/lldb/Utility/CompletionRequest.h
+++ b/lldb/include/lldb/Utility/CompletionRequest.h
@@ -184,7 +184,7 @@ class CompletionRequest {
 // this can be a static_assert.
 static_assert(M != CompletionMode::RewriteLine,
   "Shouldn't rewrite line with this function");
-if (completion.startswith(GetCursorArgumentPrefix()))
+if (completion.starts_with(GetCursorArgumentPrefix()))
   AddCompletion(completion, description, M);
   }
 

diff  --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp 
b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
index 61bef498438bdd..cc4e1d26724f04 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -206,7 +206,7 @@ void 

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

2023-12-09 Thread Kazu Hirata via lldb-commits

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


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

2023-12-08 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata updated 
https://github.com/llvm/llvm-project/pull/74916

>From ab33bda7fd31fbfc28344bb6f81ce08394e7c3fd Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Thu, 7 Dec 2023 23:20:42 -0800
Subject: [PATCH 1/3] [ADT] Rename SmallString::{starts,ends}with to
 {starts,ends}_with

This patch renames {starts,ends}with to {starts,ends}_with for
consistency with std::{string,string_view}::{starts,ends}_with in
C++20.  Since there are only a handful of occurrences, this patch
skips the deprecation phase and simply renames them.
---
 clang-tools-extra/clang-doc/Mapper.cpp|  2 +-
 clang-tools-extra/modularize/ModuleAssistant.cpp  |  2 +-
 clang/lib/AST/MicrosoftMangle.cpp |  8 
 clang/lib/Basic/Module.cpp|  2 +-
 clang/lib/CrossTU/CrossTranslationUnit.cpp|  2 +-
 clang/lib/Driver/Driver.cpp   |  2 +-
 clang/lib/Driver/ToolChains/Darwin.cpp|  2 +-
 clang/lib/Lex/ModuleMap.cpp   |  2 +-
 clang/lib/Sema/SemaCodeComplete.cpp   |  2 +-
 lld/COFF/PDB.cpp  |  2 +-
 lld/MachO/InputFiles.cpp  |  2 +-
 lldb/source/Commands/CommandCompletions.cpp   |  2 +-
 llvm/include/llvm/ADT/SmallString.h   | 12 
 llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp |  2 +-
 llvm/tools/dsymutil/DebugMap.cpp  |  2 +-
 llvm/tools/llvm-cov/CodeCoverage.cpp  |  2 +-
 llvm/tools/llvm-cov/CoverageReport.cpp|  2 +-
 llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp|  2 +-
 llvm/tools/llvm-ml/llvm-ml.cpp|  2 +-
 llvm/unittests/Support/Path.cpp   |  4 ++--
 20 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/clang-tools-extra/clang-doc/Mapper.cpp 
b/clang-tools-extra/clang-doc/Mapper.cpp
index 5264417748a12b..bb8b7952980ac6 100644
--- a/clang-tools-extra/clang-doc/Mapper.cpp
+++ b/clang-tools-extra/clang-doc/Mapper.cpp
@@ -103,7 +103,7 @@ llvm::SmallString<128> MapASTVisitor::getFile(const 
NamedDecl *D,
   .getPresumedLoc(D->getBeginLoc())
   .getFilename());
   IsFileInRootDir = false;
-  if (RootDir.empty() || !File.startswith(RootDir))
+  if (RootDir.empty() || !File.starts_with(RootDir))
 return File;
   IsFileInRootDir = true;
   llvm::SmallString<128> Prefix(RootDir);
diff --git a/clang-tools-extra/modularize/ModuleAssistant.cpp 
b/clang-tools-extra/modularize/ModuleAssistant.cpp
index 0d4c09987eb1cf..5c11ffdb8589d5 100644
--- a/clang-tools-extra/modularize/ModuleAssistant.cpp
+++ b/clang-tools-extra/modularize/ModuleAssistant.cpp
@@ -175,7 +175,7 @@ static bool addModuleDescription(Module *RootModule,
   llvm::SmallString<256> NativePath, NativePrefix;
   llvm::sys::path::native(HeaderFilePath, NativePath);
   llvm::sys::path::native(HeaderPrefix, NativePrefix);
-  if (NativePath.startswith(NativePrefix))
+  if (NativePath.starts_with(NativePrefix))
 FilePath = std::string(NativePath.substr(NativePrefix.size() + 1));
   else
 FilePath = std::string(HeaderFilePath);
diff --git a/clang/lib/AST/MicrosoftMangle.cpp 
b/clang/lib/AST/MicrosoftMangle.cpp
index 50ab6ea59be9d0..c59a66e103a6e3 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -3809,14 +3809,14 @@ void 
MicrosoftMangleContextImpl::mangleCXXRTTICompleteObjectLocator(
   llvm::raw_svector_ostream Stream(VFTableMangling);
   mangleCXXVFTable(Derived, BasePath, Stream);
 
-  if (VFTableMangling.startswith("??@")) {
-assert(VFTableMangling.endswith("@"));
+  if (VFTableMangling.starts_with("??@")) {
+assert(VFTableMangling.ends_with("@"));
 Out << VFTableMangling << "??_R4@";
 return;
   }
 
-  assert(VFTableMangling.startswith("??_7") ||
- VFTableMangling.startswith("??_S"));
+  assert(VFTableMangling.starts_with("??_7") ||
+ VFTableMangling.starts_with("??_S"));
 
   Out << "??_R4" << VFTableMangling.str().drop_front(4);
 }
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index e4ac1abf12a7f8..7523e509a47108 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -89,7 +89,7 @@ static bool isPlatformEnvironment(const TargetInfo , 
StringRef Feature) {
   // where both are valid examples of the same platform+environment but in the
   // variant (2) the simulator is hardcoded as part of the platform name. Both
   // forms above should match for "iossimulator" requirement.
-  if (Target.getTriple().isOSDarwin() && PlatformEnv.endswith("simulator"))
+  if (Target.getTriple().isOSDarwin() && PlatformEnv.ends_with("simulator"))
 return PlatformEnv == Feature || CmpPlatformEnv(PlatformEnv, Feature);
 
   return PlatformEnv == Feature;
diff --git a/clang/lib/CrossTU/CrossTranslationUnit.cpp 
b/clang/lib/CrossTU/CrossTranslationUnit.cpp
index 540c22d078654c..94c10e50d7d064 

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

2023-12-08 Thread Kazu Hirata via lldb-commits

kazutakahirata wrote:

> flang and bolt are not changed?

Right.  Somehow, `SmallString::{startswith,endswith}` do not occur there.  
By the way, they are not to be confused with `StringRef::{startswith,endswith}, 
which is everywhere.

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


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

2023-12-08 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata updated 
https://github.com/llvm/llvm-project/pull/74916

>From ab33bda7fd31fbfc28344bb6f81ce08394e7c3fd Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Thu, 7 Dec 2023 23:20:42 -0800
Subject: [PATCH 1/2] [ADT] Rename SmallString::{starts,ends}with to
 {starts,ends}_with

This patch renames {starts,ends}with to {starts,ends}_with for
consistency with std::{string,string_view}::{starts,ends}_with in
C++20.  Since there are only a handful of occurrences, this patch
skips the deprecation phase and simply renames them.
---
 clang-tools-extra/clang-doc/Mapper.cpp|  2 +-
 clang-tools-extra/modularize/ModuleAssistant.cpp  |  2 +-
 clang/lib/AST/MicrosoftMangle.cpp |  8 
 clang/lib/Basic/Module.cpp|  2 +-
 clang/lib/CrossTU/CrossTranslationUnit.cpp|  2 +-
 clang/lib/Driver/Driver.cpp   |  2 +-
 clang/lib/Driver/ToolChains/Darwin.cpp|  2 +-
 clang/lib/Lex/ModuleMap.cpp   |  2 +-
 clang/lib/Sema/SemaCodeComplete.cpp   |  2 +-
 lld/COFF/PDB.cpp  |  2 +-
 lld/MachO/InputFiles.cpp  |  2 +-
 lldb/source/Commands/CommandCompletions.cpp   |  2 +-
 llvm/include/llvm/ADT/SmallString.h   | 12 
 llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp |  2 +-
 llvm/tools/dsymutil/DebugMap.cpp  |  2 +-
 llvm/tools/llvm-cov/CodeCoverage.cpp  |  2 +-
 llvm/tools/llvm-cov/CoverageReport.cpp|  2 +-
 llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp|  2 +-
 llvm/tools/llvm-ml/llvm-ml.cpp|  2 +-
 llvm/unittests/Support/Path.cpp   |  4 ++--
 20 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/clang-tools-extra/clang-doc/Mapper.cpp 
b/clang-tools-extra/clang-doc/Mapper.cpp
index 5264417748a12..bb8b7952980ac 100644
--- a/clang-tools-extra/clang-doc/Mapper.cpp
+++ b/clang-tools-extra/clang-doc/Mapper.cpp
@@ -103,7 +103,7 @@ llvm::SmallString<128> MapASTVisitor::getFile(const 
NamedDecl *D,
   .getPresumedLoc(D->getBeginLoc())
   .getFilename());
   IsFileInRootDir = false;
-  if (RootDir.empty() || !File.startswith(RootDir))
+  if (RootDir.empty() || !File.starts_with(RootDir))
 return File;
   IsFileInRootDir = true;
   llvm::SmallString<128> Prefix(RootDir);
diff --git a/clang-tools-extra/modularize/ModuleAssistant.cpp 
b/clang-tools-extra/modularize/ModuleAssistant.cpp
index 0d4c09987eb1c..5c11ffdb8589d 100644
--- a/clang-tools-extra/modularize/ModuleAssistant.cpp
+++ b/clang-tools-extra/modularize/ModuleAssistant.cpp
@@ -175,7 +175,7 @@ static bool addModuleDescription(Module *RootModule,
   llvm::SmallString<256> NativePath, NativePrefix;
   llvm::sys::path::native(HeaderFilePath, NativePath);
   llvm::sys::path::native(HeaderPrefix, NativePrefix);
-  if (NativePath.startswith(NativePrefix))
+  if (NativePath.starts_with(NativePrefix))
 FilePath = std::string(NativePath.substr(NativePrefix.size() + 1));
   else
 FilePath = std::string(HeaderFilePath);
diff --git a/clang/lib/AST/MicrosoftMangle.cpp 
b/clang/lib/AST/MicrosoftMangle.cpp
index 50ab6ea59be9d..c59a66e103a6e 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -3809,14 +3809,14 @@ void 
MicrosoftMangleContextImpl::mangleCXXRTTICompleteObjectLocator(
   llvm::raw_svector_ostream Stream(VFTableMangling);
   mangleCXXVFTable(Derived, BasePath, Stream);
 
-  if (VFTableMangling.startswith("??@")) {
-assert(VFTableMangling.endswith("@"));
+  if (VFTableMangling.starts_with("??@")) {
+assert(VFTableMangling.ends_with("@"));
 Out << VFTableMangling << "??_R4@";
 return;
   }
 
-  assert(VFTableMangling.startswith("??_7") ||
- VFTableMangling.startswith("??_S"));
+  assert(VFTableMangling.starts_with("??_7") ||
+ VFTableMangling.starts_with("??_S"));
 
   Out << "??_R4" << VFTableMangling.str().drop_front(4);
 }
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index e4ac1abf12a7f..7523e509a4710 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -89,7 +89,7 @@ static bool isPlatformEnvironment(const TargetInfo , 
StringRef Feature) {
   // where both are valid examples of the same platform+environment but in the
   // variant (2) the simulator is hardcoded as part of the platform name. Both
   // forms above should match for "iossimulator" requirement.
-  if (Target.getTriple().isOSDarwin() && PlatformEnv.endswith("simulator"))
+  if (Target.getTriple().isOSDarwin() && PlatformEnv.ends_with("simulator"))
 return PlatformEnv == Feature || CmpPlatformEnv(PlatformEnv, Feature);
 
   return PlatformEnv == Feature;
diff --git a/clang/lib/CrossTU/CrossTranslationUnit.cpp 
b/clang/lib/CrossTU/CrossTranslationUnit.cpp
index 540c22d078654..94c10e50d7d06 100644
--- 

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

2023-12-08 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/74916

This patch renames {starts,ends}with to {starts,ends}_with for
consistency with std::{string,string_view}::{starts,ends}_with in
C++20.  Since there are only a handful of occurrences, this patch
skips the deprecation phase and simply renames them.


>From ab33bda7fd31fbfc28344bb6f81ce08394e7c3fd Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Thu, 7 Dec 2023 23:20:42 -0800
Subject: [PATCH] [ADT] Rename SmallString::{starts,ends}with to
 {starts,ends}_with

This patch renames {starts,ends}with to {starts,ends}_with for
consistency with std::{string,string_view}::{starts,ends}_with in
C++20.  Since there are only a handful of occurrences, this patch
skips the deprecation phase and simply renames them.
---
 clang-tools-extra/clang-doc/Mapper.cpp|  2 +-
 clang-tools-extra/modularize/ModuleAssistant.cpp  |  2 +-
 clang/lib/AST/MicrosoftMangle.cpp |  8 
 clang/lib/Basic/Module.cpp|  2 +-
 clang/lib/CrossTU/CrossTranslationUnit.cpp|  2 +-
 clang/lib/Driver/Driver.cpp   |  2 +-
 clang/lib/Driver/ToolChains/Darwin.cpp|  2 +-
 clang/lib/Lex/ModuleMap.cpp   |  2 +-
 clang/lib/Sema/SemaCodeComplete.cpp   |  2 +-
 lld/COFF/PDB.cpp  |  2 +-
 lld/MachO/InputFiles.cpp  |  2 +-
 lldb/source/Commands/CommandCompletions.cpp   |  2 +-
 llvm/include/llvm/ADT/SmallString.h   | 12 
 llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp |  2 +-
 llvm/tools/dsymutil/DebugMap.cpp  |  2 +-
 llvm/tools/llvm-cov/CodeCoverage.cpp  |  2 +-
 llvm/tools/llvm-cov/CoverageReport.cpp|  2 +-
 llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp|  2 +-
 llvm/tools/llvm-ml/llvm-ml.cpp|  2 +-
 llvm/unittests/Support/Path.cpp   |  4 ++--
 20 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/clang-tools-extra/clang-doc/Mapper.cpp 
b/clang-tools-extra/clang-doc/Mapper.cpp
index 5264417748a12b..bb8b7952980ac6 100644
--- a/clang-tools-extra/clang-doc/Mapper.cpp
+++ b/clang-tools-extra/clang-doc/Mapper.cpp
@@ -103,7 +103,7 @@ llvm::SmallString<128> MapASTVisitor::getFile(const 
NamedDecl *D,
   .getPresumedLoc(D->getBeginLoc())
   .getFilename());
   IsFileInRootDir = false;
-  if (RootDir.empty() || !File.startswith(RootDir))
+  if (RootDir.empty() || !File.starts_with(RootDir))
 return File;
   IsFileInRootDir = true;
   llvm::SmallString<128> Prefix(RootDir);
diff --git a/clang-tools-extra/modularize/ModuleAssistant.cpp 
b/clang-tools-extra/modularize/ModuleAssistant.cpp
index 0d4c09987eb1cf..5c11ffdb8589d5 100644
--- a/clang-tools-extra/modularize/ModuleAssistant.cpp
+++ b/clang-tools-extra/modularize/ModuleAssistant.cpp
@@ -175,7 +175,7 @@ static bool addModuleDescription(Module *RootModule,
   llvm::SmallString<256> NativePath, NativePrefix;
   llvm::sys::path::native(HeaderFilePath, NativePath);
   llvm::sys::path::native(HeaderPrefix, NativePrefix);
-  if (NativePath.startswith(NativePrefix))
+  if (NativePath.starts_with(NativePrefix))
 FilePath = std::string(NativePath.substr(NativePrefix.size() + 1));
   else
 FilePath = std::string(HeaderFilePath);
diff --git a/clang/lib/AST/MicrosoftMangle.cpp 
b/clang/lib/AST/MicrosoftMangle.cpp
index 50ab6ea59be9d0..c59a66e103a6e3 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -3809,14 +3809,14 @@ void 
MicrosoftMangleContextImpl::mangleCXXRTTICompleteObjectLocator(
   llvm::raw_svector_ostream Stream(VFTableMangling);
   mangleCXXVFTable(Derived, BasePath, Stream);
 
-  if (VFTableMangling.startswith("??@")) {
-assert(VFTableMangling.endswith("@"));
+  if (VFTableMangling.starts_with("??@")) {
+assert(VFTableMangling.ends_with("@"));
 Out << VFTableMangling << "??_R4@";
 return;
   }
 
-  assert(VFTableMangling.startswith("??_7") ||
- VFTableMangling.startswith("??_S"));
+  assert(VFTableMangling.starts_with("??_7") ||
+ VFTableMangling.starts_with("??_S"));
 
   Out << "??_R4" << VFTableMangling.str().drop_front(4);
 }
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index e4ac1abf12a7f8..7523e509a47108 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -89,7 +89,7 @@ static bool isPlatformEnvironment(const TargetInfo , 
StringRef Feature) {
   // where both are valid examples of the same platform+environment but in the
   // variant (2) the simulator is hardcoded as part of the platform name. Both
   // forms above should match for "iossimulator" requirement.
-  if (Target.getTriple().isOSDarwin() && PlatformEnv.endswith("simulator"))
+  if (Target.getTriple().isOSDarwin() && PlatformEnv.ends_with("simulator"))
 

[Lldb-commits] [lldb] 66a7971 - [lldb] Use llvm::is_contained (NFC)

2023-10-22 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-10-22T21:18:25-07:00
New Revision: 66a797102de4e001054c94d7c0a3f71ace0a2c1f

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

LOG: [lldb] Use llvm::is_contained (NFC)

Added: 


Modified: 
lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp 
b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
index 1348eca05e337f3..dc59d904c74d820 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
@@ -335,8 +335,7 @@ PlatformSP PlatformAppleSimulator::CreateInstance(
 
   bool create = force;
   if (!create && arch && arch->IsValid()) {
-if (std::count(supported_arch.begin(), supported_arch.end(),
-   arch->GetMachine())) {
+if (llvm::is_contained(supported_arch, arch->GetMachine())) {
   const llvm::Triple  = arch->GetTriple();
   switch (triple.getVendor()) {
   case llvm::Triple::Apple:



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


[Lldb-commits] [lldb] aaa5f34 - [lldb] Remove an unused using decl (NFC)

2023-10-22 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-10-22T11:57:23-07:00
New Revision: aaa5f34b6130cc667b6dc893db302e21bf59fd5a

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

LOG: [lldb] Remove an unused using decl (NFC)

Added: 


Modified: 
lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Removed: 




diff  --git 
a/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp 
b/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
index 34507123952760a..0b816a8ae0a587e 100644
--- a/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
+++ b/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
@@ -23,7 +23,6 @@
 
 using namespace lldb_private;
 using namespace lldb_private::python;
-using llvm::Error;
 using llvm::Expected;
 
 class PythonDataObjectsTest : public PythonTestSuite {



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


[Lldb-commits] [lldb] 6e3572c - [lldb] Use llvm::erase_if (NFC)

2023-10-20 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-10-20T00:20:30-07:00
New Revision: 6e3572ccd896573a4eb32e3fa1c874a3d947b143

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

LOG: [lldb] Use llvm::erase_if (NFC)

Added: 


Modified: 
lldb/source/Utility/Diagnostics.cpp

Removed: 




diff  --git a/lldb/source/Utility/Diagnostics.cpp 
b/lldb/source/Utility/Diagnostics.cpp
index 1632ae0f9dfd31d..b2a08165dd6ca21 100644
--- a/lldb/source/Utility/Diagnostics.cpp
+++ b/lldb/source/Utility/Diagnostics.cpp
@@ -52,10 +52,8 @@ Diagnostics::CallbackID Diagnostics::AddCallback(Callback 
callback) {
 
 void Diagnostics::RemoveCallback(CallbackID id) {
   std::lock_guard guard(m_callbacks_mutex);
-  m_callbacks.erase(
-  std::remove_if(m_callbacks.begin(), m_callbacks.end(),
- [id](const CallbackEntry ) { return e.id == id; }),
-  m_callbacks.end());
+  llvm::erase_if(m_callbacks,
+ [id](const CallbackEntry ) { return e.id == id; });
 }
 
 bool Diagnostics::Dump(raw_ostream ) {



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


[Lldb-commits] [lldb] b888592 - Use llvm::endianness::{big, little, native} (NFC)

2023-10-10 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-10-10T22:54:51-07:00
New Revision: b8885926f8115d5fe2c06907e066cae061d5f230

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

LOG: Use llvm::endianness::{big,little,native} (NFC)

Note that llvm::support::endianness has been renamed to
llvm::endianness while becoming an enum class as opposed to an enum.
This patch replaces llvm::support::{big,little,native} with
llvm::endianness::{big,little,native}.

Added: 


Modified: 
clang/lib/APINotes/APINotesWriter.cpp
clang/lib/Basic/SourceManager.cpp
clang/lib/Driver/OffloadBundler.cpp
lld/ELF/DWARF.h
lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h
llvm/include/llvm/Support/BinaryByteStream.h
llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
llvm/lib/DebugInfo/CodeView/RecordName.cpp
llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp
llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp
llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp
llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp
llvm/lib/ObjectYAML/CodeViewYAMLTypeHashing.cpp
llvm/lib/ProfileData/InstrProfReader.cpp
llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
llvm/tools/llvm-objdump/MachODump.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp
llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
llvm/tools/llvm-readobj/COFFDumper.cpp
llvm/tools/llvm-readobj/MachODumper.cpp
llvm/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp
llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
llvm/unittests/DebugInfo/MSF/MappedBlockStreamTest.cpp
llvm/unittests/Support/BinaryStreamTest.cpp
llvm/unittests/Support/HashBuilderTest.cpp
llvm/unittests/Support/YAMLIOTest.cpp

Removed: 




diff  --git a/clang/lib/APINotes/APINotesWriter.cpp 
b/clang/lib/APINotes/APINotesWriter.cpp
index a92b379a8e56acb..770d78e22050c01 100644
--- a/clang/lib/APINotes/APINotesWriter.cpp
+++ b/clang/lib/APINotes/APINotesWriter.cpp
@@ -294,7 +294,7 @@ class IdentifierTableInfo {
 uint32_t KeyLength = Key.size();
 uint32_t DataLength = sizeof(uint32_t);
 
-llvm::support::endian::Writer writer(OS, llvm::support::little);
+llvm::support::endian::Writer writer(OS, llvm::endianness::little);
 writer.write(KeyLength);
 writer.write(DataLength);
 return {KeyLength, DataLength};
@@ -303,7 +303,7 @@ class IdentifierTableInfo {
   void EmitKey(raw_ostream , key_type_ref Key, unsigned) { OS << Key; }
 
   void EmitData(raw_ostream , key_type_ref, data_type_ref Data, unsigned) {
-llvm::support::endian::Writer writer(OS, llvm::support::little);
+llvm::support::endian::Writer writer(OS, llvm::endianness::little);
 writer.write(Data);
   }
 };
@@ -326,7 +326,7 @@ void APINotesWriter::Implementation::writeIdentifierBlock(
 llvm::raw_svector_ostream BlobStream(HashTableBlob);
 // Make sure that no bucket is at offset 0
 llvm::support::endian::write(BlobStream, 0,
-   llvm::support::little);
+   llvm::endianness::little);
 Offset = Generator.Emit(BlobStream);
   }
 
@@ -354,21 +354,21 @@ class ObjCContextIDTableInfo {
 uint32_t KeyLength = sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint32_t);
 uint32_t DataLength = sizeof(uint32_t);
 
-llvm::support::endian::Writer writer(OS, llvm::support::little);
+llvm::support::endian::Writer writer(OS, llvm::endianness::little);
 writer.write(KeyLength);
 writer.write(DataLength);
 return {KeyLength, DataLength};
   }
 
   void EmitKey(raw_ostream , key_type_ref Key, unsigned) {
-llvm::support::endian::Writer writer(OS, llvm::support::little);
+llvm::support::endian::Writer writer(OS, llvm::endianness::little);
 writer.write(Key.parentContextID);
 writer.write(Key.contextKind);
 writer.write(Key.contextID);
   }
 
   void EmitData(raw_ostream , key_type_ref, data_type_ref Data, unsigned) {
-llvm::support::endian::Writer writer(OS, llvm::support::little);
+llvm::support::endian::Writer writer(OS, llvm::endianness::little);
 writer.write(Data);
   }
 };
@@ -406,7 +406,7 @@ unsigned getVersionedInfoSize(
 
 /// Emit a serialized representation of a version tuple.
 void emitVersionTuple(raw_ostream , const VersionTuple ) {
-  llvm::support::endian::Writer writer(OS, llvm::support::little);
+  

[Lldb-commits] [lldb] a9d5056 - Use llvm::endianness (NFC)

2023-10-10 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-10-10T21:54:15-07:00
New Revision: a9d50568625e4f2e021d6229f8c1c721a3d82d51

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

LOG: Use llvm::endianness (NFC)

Now that llvm::support::endianness has been renamed to
llvm::endianness, we can use the shorter form.  This patch replaces
support::endianness with llvm::endianness.

Added: 


Modified: 
lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
llvm/include/llvm/BinaryFormat/MsgPack.h
llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h
llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
llvm/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h
llvm/include/llvm/ExecutionEngine/Orc/MachOBuilder.h
llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h
llvm/include/llvm/MC/MCAsmBackend.h
llvm/include/llvm/Object/ELFTypes.h
llvm/include/llvm/Object/StackMapParser.h
llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
llvm/include/llvm/ProfileData/InstrProfData.inc
llvm/include/llvm/ProfileData/InstrProfReader.h
llvm/include/llvm/ProfileData/InstrProfWriter.h
llvm/include/llvm/Support/ELFAttributeParser.h
llvm/include/llvm/Support/HashBuilder.h
llvm/include/llvm/Support/VersionTuple.h
llvm/include/llvm/Support/YAMLTraits.h
llvm/lib/DWARFLinkerParallel/DWARFLinkerCompileUnit.h
llvm/lib/DWARFLinkerParallel/DWARFLinkerImpl.cpp
llvm/lib/DWARFLinkerParallel/OutputSections.h
llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.h
llvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
llvm/lib/ExecutionEngine/JITLink/ELF_aarch32.cpp
llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp
llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h
llvm/lib/ExecutionEngine/JITLink/aarch32.cpp
llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
llvm/lib/ExecutionEngine/Orc/Debugging/PerfSupportPlugin.cpp
llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h
llvm/lib/MC/MCAsmBackend.cpp
llvm/lib/MC/MCAssembler.cpp
llvm/lib/MC/MCDwarf.cpp
llvm/lib/ObjectYAML/ELFEmitter.cpp
llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/ProfileData/InstrProfWriter.cpp
llvm/lib/Support/ELFAttributeParser.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.h
llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackendELF.h
llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCCodeEmitter.cpp
llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVAsmBackend.cpp
llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
llvm/tools/llvm-readobj/ELFDumper.cpp
llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

Removed: 




diff  --git a/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp 
b/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
index 2c6b9a2299dd7d0..7ccc9210daad092 100644
--- a/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
+++ b/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
@@ -53,7 +53,7 @@ Expected ProcessInfo::create(StringRef response) 
{
 
 lldb::pid_t ProcessInfo::GetPid() const { return m_pid; }
 
-support::endianness ProcessInfo::GetEndian() const { return m_endian; }
+llvm::endianness ProcessInfo::GetEndian() const { return m_endian; }
 
 //== ThreadInfo 

 ThreadInfo::ThreadInfo(StringRef name, StringRef reason, RegisterMap registers,
@@ -237,7 +237,7 @@ StopReply::create(StringRef Response, llvm::endianness 
Endian,
 
 Expected StopReplyStop::parseRegisters(
 const StringMap> ,
-support::endianness Endian, ArrayRef RegInfos) 
{
+llvm::endianness Endian, ArrayRef RegInfos) {
 
   RegisterMap Result;
   for (const auto  : Elements) {
@@ -263,7 +263,7 @@ Expected StopReplyStop::parseRegisters(
 }
 
 Expected>
-StopReplyStop::create(StringRef Response, support::endianness Endian,
+StopReplyStop::create(StringRef Response, llvm::endianness Endian,
   ArrayRef RegInfos) {
   unsigned int Signal;
   StringRef SignalStr = Response.take_front(2);

diff  --git 

[Lldb-commits] [lldb] d7b18d5 - Use llvm::endianness{, ::little, ::native} (NFC)

2023-10-09 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-10-09T00:54:47-07:00
New Revision: d7b18d5083648c26b94adc2651edb87848138728

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

LOG: Use llvm::endianness{,::little,::native} (NFC)

Now that llvm::support::endianness has been renamed to
llvm::endianness, we can use the shorter form.  This patch replaces
llvm::support::endianness with llvm::endianness.

Added: 


Modified: 
clang/include/clang/Basic/ObjCRuntime.h
clang/include/clang/Basic/Sanitizers.h
clang/include/clang/Lex/HeaderSearchOptions.h
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
lld/ELF/Config.h
lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
lldb/unittests/tools/lldb-server/tests/MessageObjects.h
llvm/include/llvm/DebugInfo/GSYM/FileWriter.h
llvm/include/llvm/DebugInfo/GSYM/GsymCreator.h
llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
llvm/include/llvm/Support/BinaryByteStream.h
llvm/include/llvm/Support/BinaryItemStream.h
llvm/include/llvm/Support/BinaryStream.h
llvm/include/llvm/Support/BinaryStreamReader.h
llvm/include/llvm/Support/BinaryStreamRef.h
llvm/include/llvm/Support/BinaryStreamWriter.h
llvm/include/llvm/Support/VersionTuple.h
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
llvm/lib/ProfileData/InstrProfReader.cpp
llvm/lib/Support/BinaryStreamRef.cpp
llvm/lib/Support/BinaryStreamWriter.cpp
llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
llvm/unittests/ADT/HashingTest.cpp
llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
llvm/unittests/Support/HashBuilderTest.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/ObjCRuntime.h 
b/clang/include/clang/Basic/ObjCRuntime.h
index d783154c3f9f135..500b2462f007736 100644
--- a/clang/include/clang/Basic/ObjCRuntime.h
+++ b/clang/include/clang/Basic/ObjCRuntime.h
@@ -482,7 +482,7 @@ class ObjCRuntime {
 return llvm::hash_combine(OCR.getKind(), OCR.getVersion());
   }
 
-  template 
+  template 
   friend void addHash(llvm::HashBuilder ,
   const ObjCRuntime ) {
 HBuilder.add(OCR.getKind(), OCR.getVersion());

diff  --git a/clang/include/clang/Basic/Sanitizers.h 
b/clang/include/clang/Basic/Sanitizers.h
index 090a3a7fa907625..8fdaf2e4ba8ab18 100644
--- a/clang/include/clang/Basic/Sanitizers.h
+++ b/clang/include/clang/Basic/Sanitizers.h
@@ -77,7 +77,7 @@ class SanitizerMask {
 
   llvm::hash_code hash_value() const;
 
-  template 
+  template 
   friend void addHash(llvm::HashBuilder ,
   const SanitizerMask ) {
 HBuilder.addRange([0], [kNumElem]);

diff  --git a/clang/include/clang/Lex/HeaderSearchOptions.h 
b/clang/include/clang/Lex/HeaderSearchOptions.h
index 206bc69d7b2cdcb..c7d95006bb779ad 100644
--- a/clang/include/clang/Lex/HeaderSearchOptions.h
+++ b/clang/include/clang/Lex/HeaderSearchOptions.h
@@ -267,7 +267,7 @@ inline llvm::hash_code hash_value(const 
HeaderSearchOptions::Entry ) {
   return llvm::hash_combine(E.Path, E.Group, E.IsFramework, E.IgnoreSysRoot);
 }
 
-template 
+template 
 inline void addHash(llvm::HashBuilder ,
 const HeaderSearchOptions::Entry ) {
   HBuilder.add(E.Path, E.Group, E.IsFramework, E.IgnoreSysRoot);
@@ -278,7 +278,7 @@ hash_value(const HeaderSearchOptions::SystemHeaderPrefix 
) {
   return llvm::hash_combine(SHP.Prefix, SHP.IsSystemHeader);
 }
 
-template 
+template 
 inline void addHash(llvm::HashBuilder ,
 const HeaderSearchOptions::SystemHeaderPrefix ) {
   HBuilder.add(SHP.Prefix, SHP.IsSystemHeader);

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index f2fe9046a6c1fe2..bb442495f58359c 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -4630,7 +4630,7 @@ bool 
CompilerInvocation::CreateFromArgs(CompilerInvocation ,
 
 std::string CompilerInvocation::getModuleHash() const {
   // FIXME: Consider using SHA1 instead of MD5.
-  llvm::HashBuilder HBuilder;
+  llvm::HashBuilder HBuilder;
 
   // Note: For QoI reasons, the things we use as a hash here should all be
   // dumped via the -module-info flag.

diff  --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp 
b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index 5e028c4431fe90f..40115b7b5ae25b3 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -295,8 +295,7 @@ void 

[Lldb-commits] [lldb] 8641cdf - [lldb] Use std::enable_if_t (NFC)

2023-10-03 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-10-03T21:25:29-07:00
New Revision: 8641cdf397d86f33ac45e4c691ca4f843c359370

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

LOG: [lldb] Use std::enable_if_t (NFC)

Added: 


Modified: 
lldb/include/lldb/Utility/Instrumentation.h

Removed: 




diff  --git a/lldb/include/lldb/Utility/Instrumentation.h 
b/lldb/include/lldb/Utility/Instrumentation.h
index 13ffc0bd39d0b61..4a9ac810eb05e99 100644
--- a/lldb/include/lldb/Utility/Instrumentation.h
+++ b/lldb/include/lldb/Utility/Instrumentation.h
@@ -21,14 +21,12 @@
 namespace lldb_private {
 namespace instrumentation {
 
-template ::value, int>::type = 
0>
+template ::value, int> = 0>
 inline void stringify_append(llvm::raw_string_ostream , const T ) {
   ss << t;
 }
 
-template ::value,
-  int>::type = 0>
+template ::value, int> = 
0>
 inline void stringify_append(llvm::raw_string_ostream , const T ) {
   ss << 
 }



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


[Lldb-commits] [lldb] 3f0bddb - Use llvm::find (NFC)

2023-09-23 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-09-23T16:27:02-07:00
New Revision: 3f0bddb56ac33389e0a02444c6f67c7a42855582

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

LOG: Use llvm::find (NFC)

Added: 


Modified: 
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
lldb/source/Target/TargetList.cpp

llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
mlir/lib/Analysis/FlatLinearValueConstraints.cpp

Removed: 




diff  --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp 
b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
index ebda9b230e677a2..68e4ac0cc4007c4 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
@@ -482,7 +482,7 @@ bool DYLDRendezvous::RemoveSOEntriesFromRemote(
 
 // Only add shared libraries and not the executable.
 if (!SOEntryIsMainExecutable(entry)) {
-  auto pos = std::find(m_soentries.begin(), m_soentries.end(), entry);
+  auto pos = llvm::find(m_soentries, entry);
   if (pos == m_soentries.end())
 return false;
 

diff  --git a/lldb/source/Target/TargetList.cpp 
b/lldb/source/Target/TargetList.cpp
index cb198e388011ad2..3ec523b94101033 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -370,7 +370,7 @@ Status TargetList::CreateTargetInternal(Debugger ,
 
 bool TargetList::DeleteTarget(TargetSP _sp) {
   std::lock_guard guard(m_target_list_mutex);
-  auto it = std::find(m_target_list.begin(), m_target_list.end(), target_sp);
+  auto it = llvm::find(m_target_list, target_sp);
   if (it == m_target_list.end())
 return false;
 
@@ -506,7 +506,7 @@ lldb::TargetSP TargetList::GetTargetAtIndex(uint32_t idx) 
const {
 
 uint32_t TargetList::GetIndexOfTarget(lldb::TargetSP target_sp) const {
   std::lock_guard guard(m_target_list_mutex);
-  auto it = std::find(m_target_list.begin(), m_target_list.end(), target_sp);
+  auto it = llvm::find(m_target_list, target_sp);
   if (it != m_target_list.end())
 return std::distance(m_target_list.begin(), it);
   return UINT32_MAX;
@@ -533,7 +533,7 @@ void TargetList::SetSelectedTarget(uint32_t index) {
 
 void TargetList::SetSelectedTarget(const TargetSP _sp) {
   std::lock_guard guard(m_target_list_mutex);
-  auto it = std::find(m_target_list.begin(), m_target_list.end(), target_sp);
+  auto it = llvm::find(m_target_list, target_sp);
   SetSelectedTargetInternal(std::distance(m_target_list.begin(), it));
 }
 

diff  --git 
a/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
 
b/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
index 3f70dbf60437a5a..e8b0e240ac1fc98 100644
--- 
a/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
+++ 
b/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
@@ -194,9 +194,7 @@ Error ExecutorSharedMemoryMapperService::deinitialize(
 
   // Remove the allocation from the allocation list of its reservation
   for (auto  : Reservations) {
-auto AllocationIt =
-std::find(Reservation.second.Allocations.begin(),
-  Reservation.second.Allocations.end(), Base);
+auto AllocationIt = llvm::find(Reservation.second.Allocations, Base);
 if (AllocationIt != Reservation.second.Allocations.end()) {
   Reservation.second.Allocations.erase(AllocationIt);
   break;

diff  --git a/mlir/lib/Analysis/FlatLinearValueConstraints.cpp 
b/mlir/lib/Analysis/FlatLinearValueConstraints.cpp
index 31aff1a216bacc3..382d05f3b2d4851 100644
--- a/mlir/lib/Analysis/FlatLinearValueConstraints.cpp
+++ b/mlir/lib/Analysis/FlatLinearValueConstraints.cpp
@@ -1250,8 +1250,8 @@ AffineMap mlir::alignAffineMapWithValues(AffineMap map, 
ValueRange operands,
   for (const auto  : llvm::enumerate(operands)) {
 // Compute replacement dim/sym of operand.
 AffineExpr replacement;
-auto dimIt = std::find(dims.begin(), dims.end(), operand.value());
-auto symIt = std::find(syms.begin(), syms.end(), operand.value());
+auto dimIt = llvm::find(dims, operand.value());
+auto symIt = llvm::find(syms, operand.value());
 if (dimIt != dims.end()) {
   replacement =
   builder.getAffineDimExpr(std::distance(dims.begin(), dimIt));



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


[Lldb-commits] [lldb] 66e8398 - [lldb] Fix a warning

2023-09-22 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-09-22T11:32:14-07:00
New Revision: 66e83983491415d7431067181fd2816305f615e0

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

LOG: [lldb] Fix a warning

This patch fixes:

  lldb/include/lldb/Symbol/Function.h:270:3: error:
  'lldb_private::CallEdge' has virtual functions but non-virtual
  destructor [-Werror,-Wnon-virtual-dtor]

Added: 


Modified: 
lldb/include/lldb/Symbol/Function.h

Removed: 




diff  --git a/lldb/include/lldb/Symbol/Function.h 
b/lldb/include/lldb/Symbol/Function.h
index 0c1afd0ceb6f1f5..28afdbff1eb233e 100644
--- a/lldb/include/lldb/Symbol/Function.h
+++ b/lldb/include/lldb/Symbol/Function.h
@@ -267,7 +267,7 @@ using CallSiteParameterArray = 
llvm::SmallVector;
 class CallEdge {
 public:
   enum class AddrType : uint8_t { Call, AfterCall };
-  ~CallEdge();
+  virtual ~CallEdge();
 
   /// Get the callee's definition.
   ///



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


[Lldb-commits] [lldb] 5dd9568 - Fix typos in documentation

2023-09-02 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-09-02T09:32:48-07:00
New Revision: 5dd956871785a5b04903d6da85109c9e1052a8a8

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

LOG: Fix typos in documentation

Added: 


Modified: 
clang/docs/analyzer/checkers.rst
libc/docs/dev/code_style.rst
lldb/docs/use/tutorial.rst
llvm/docs/LangRef.rst

Removed: 




diff  --git a/clang/docs/analyzer/checkers.rst 
b/clang/docs/analyzer/checkers.rst
index ac6919e4c98297..54ea49e7426cc8 100644
--- a/clang/docs/analyzer/checkers.rst
+++ b/clang/docs/analyzer/checkers.rst
@@ -2481,13 +2481,13 @@ input refers to a valid file and removing any invalid 
user input.
 if (!filename[0])
   return -1;
 strcat(cmd, filename);
-system(cmd); // Superflous Warning: Untrusted data is passed to a system 
call
+system(cmd); // Superfluous Warning: Untrusted data is passed to a system 
call
   }
 
 Unfortunately, the checker cannot discover automatically that the programmer
 have performed data sanitation, so it still emits the warning.
 
-One can get rid of this superflous warning by telling by specifying the
+One can get rid of this superfluous warning by telling by specifying the
 sanitation functions in the taint configuration file (see
 :doc:`user-docs/TaintAnalysisConfiguration`).
 

diff  --git a/libc/docs/dev/code_style.rst b/libc/docs/dev/code_style.rst
index 0c3171b7c95027..4b03217b18c33f 100644
--- a/libc/docs/dev/code_style.rst
+++ b/libc/docs/dev/code_style.rst
@@ -39,7 +39,7 @@ We define two kinds of macros:
 
* ``src/__support/macros/properties/`` - Build related properties like
  target architecture or enabled CPU features defined by introspecting
- compiler defined preprocessor defininitions.
+ compiler defined preprocessor definitions.
 
  * ``architectures.h`` - Target architecture properties.
e.g., ``LIBC_TARGET_ARCH_IS_ARM``.

diff  --git a/lldb/docs/use/tutorial.rst b/lldb/docs/use/tutorial.rst
index ef268fff775d59..85dc173fa37cd3 100644
--- a/lldb/docs/use/tutorial.rst
+++ b/lldb/docs/use/tutorial.rst
@@ -360,7 +360,7 @@ That is better, but suffers from the problem that when new 
breakpoints get
 added, they don't pick up these modifications, and the options only exist in
 the context of actual breakpoints, so they are hard to store & reuse.
 
-A even better solution is to make a fully configured breakpoint name:
+An even better solution is to make a fully configured breakpoint name:
 
 ::
 

diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index cddb20ca6a6f06..d7fde35f63a3ee 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -7159,7 +7159,7 @@ It is illegal for the list node to be empty since it 
might be confused
 with an access group.
 
 The access group metadata node must be 'distinct' to avoid collapsing
-multiple access groups by content. A access group metadata node must
+multiple access groups by content. An access group metadata node must
 always be empty which can be used to distinguish an access group
 metadata node from a list of access groups. Being empty avoids the
 situation that the content must be updated which, because metadata is



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


[Lldb-commits] [lldb] 3a14993 - Fix typos in documentation

2023-08-27 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-08-27T00:18:14-07:00
New Revision: 3a14993fa428c67634c979107ca6ddaafeb7037b

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

LOG: Fix typos in documentation

Added: 


Modified: 

clang-tools-extra/docs/clang-tidy/checks/clang-analyzer/security.insecureAPI.DeprecatedOrUnsafeBufferHandling.rst
clang/docs/LanguageExtensions.rst
clang/docs/ReleaseNotes.rst
clang/docs/analyzer/developer-docs/nullability.rst
lldb/docs/python_api_enums.rst
llvm/docs/AMDGPUUsage.rst
llvm/docs/Atomics.rst
llvm/docs/Coroutines.rst
llvm/docs/GlobalISel/MIRPatterns.rst
llvm/docs/MyFirstTypoFix.rst

Removed: 




diff  --git 
a/clang-tools-extra/docs/clang-tidy/checks/clang-analyzer/security.insecureAPI.DeprecatedOrUnsafeBufferHandling.rst
 
b/clang-tools-extra/docs/clang-tidy/checks/clang-analyzer/security.insecureAPI.DeprecatedOrUnsafeBufferHandling.rst
index 8a8880805af702..7b365346b4b39f 100644
--- 
a/clang-tools-extra/docs/clang-tidy/checks/clang-analyzer/security.insecureAPI.DeprecatedOrUnsafeBufferHandling.rst
+++ 
b/clang-tools-extra/docs/clang-tidy/checks/clang-analyzer/security.insecureAPI.DeprecatedOrUnsafeBufferHandling.rst
@@ -5,7 +5,7 @@
 clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling
 
 
-Warn on uses of unsecure or deprecated buffer manipulating functions.
+Warn on uses of insecure or deprecated buffer manipulating functions.
 
 The `clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling` 
check is an alias, please see
 `Clang Static Analyzer Available Checkers

diff  --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index a51dea03fcb655..e739ecf3b9df4a 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -3163,7 +3163,7 @@ avoid cache misses when the developer has a good 
understanding of which data
 are going to be used next. ``addr`` is the address that needs to be brought 
into
 the cache. ``rw`` indicates the expected access mode: ``0`` for *read* and 
``1``
 for *write*. In case of *read write* access, ``1`` is to be used. ``locality``
-indicates the expected persistance of data in cache, from ``0`` which means 
that
+indicates the expected persistence of data in cache, from ``0`` which means 
that
 data can be discarded from cache after its next use to ``3`` which means that
 data is going to be reused a lot once in cache. ``1`` and ``2`` provide
 intermediate behavior between these two extremes.

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 1ba4215e603349..1ed144cea09786 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -221,7 +221,7 @@ Bug Fixes to C++ Support
 
 - Expressions producing ``nullptr`` are correctly evaluated
   by the constant interpreter when appearing as the operand
-  of a binary comparision.
+  of a binary comparison.
   (`#64923 _``)
 
 - Fix a crash when an immediate invocation is not a constant expression

diff  --git a/clang/docs/analyzer/developer-docs/nullability.rst 
b/clang/docs/analyzer/developer-docs/nullability.rst
index 70e1958634ad9f..dc24793a8f4fc0 100644
--- a/clang/docs/analyzer/developer-docs/nullability.rst
+++ b/clang/docs/analyzer/developer-docs/nullability.rst
@@ -62,7 +62,7 @@ Other Issues to keep in mind/take care of:
 * Even though the method might return a nonnull pointer, when it was sent 
to a nullable pointer the return type will be nullable.
* The result is nullable unless the receiver is known to be non null.
 
-  * Sending a message to a unspecified or nonnull pointer
+  * Sending a message to an unspecified or nonnull pointer
 
 * If the pointer is not assumed to be nil, we should be optimistic and use 
the nullability implied by the method.
 

diff  --git a/lldb/docs/python_api_enums.rst b/lldb/docs/python_api_enums.rst
index e34f4656b6ad88..b6a2497ea878e0 100644
--- a/lldb/docs/python_api_enums.rst
+++ b/lldb/docs/python_api_enums.rst
@@ -504,7 +504,7 @@ ValueType
 
 .. py:data:: eValueTypeVariableArgument
 
-   Funfction argument variable.
+   Function argument variable.
 
 .. py:data:: eValueTypeVariableLocal
 

diff  --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst
index c3b3927c4f0f7e..0db4cdf0a5db44 100644
--- a/llvm/docs/AMDGPUUsage.rst
+++ b/llvm/docs/AMDGPUUsage.rst
@@ -966,10 +966,10 @@ The AMDGPU backend implements the following LLVM IR 
intrinsics.
   LLVM Intrinsic   Description
   ==   
==
   llvm.amdgcn.sqrt

[Lldb-commits] [lldb] 11e2975 - Fx typos in documentation

2023-08-19 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-08-18T23:36:04-07:00
New Revision: 11e2975810acd6abde9071818e03634d99492b54

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

LOG: Fx typos in documentation

Added: 


Modified: 
clang-tools-extra/docs/clang-tidy/checks/objc/assert-equals.rst
clang/docs/ClangFormatStyleOptions.rst
clang/docs/DebuggingCoroutines.rst
clang/docs/LanguageExtensions.rst
clang/docs/OpenCLSupport.rst
clang/docs/ReleaseNotes.rst
libc/docs/porting.rst
libcxx/docs/DesignDocs/FileTimeType.rst
lldb/source/Plugins/TraceExporter/docs/htr.rst
llvm/docs/ScudoHardenedAllocator.rst
openmp/docs/CommandLineArgumentReference.rst
openmp/docs/design/Runtimes.rst

Removed: 




diff  --git a/clang-tools-extra/docs/clang-tidy/checks/objc/assert-equals.rst 
b/clang-tools-extra/docs/clang-tidy/checks/objc/assert-equals.rst
index b7a3e76401c468..09f5ef01c10c38 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/objc/assert-equals.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/objc/assert-equals.rst
@@ -7,5 +7,5 @@ Finds improper usages of `XCTAssertEqual` and 
`XCTAssertNotEqual` and replaces
 them with `XCTAssertEqualObjects` or `XCTAssertNotEqualObjects`.
 
 This makes tests less fragile, as many improperly rely on pointer equality for
-strings that have equal values.  This assumption is not guarantted by the
+strings that have equal values.  This assumption is not guaranteed by the
 language.

diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 651fa4436dfe78..3b3f6f2860906a 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -5097,7 +5097,7 @@ the configuration (without a prefix: ``Auto``).
   AfterControlStatements: true
   AfterFunctionDefinitionName: true
 
-  * ``bool AfterControlStatements`` If ``true``, put space betwee control 
statement keywords
+  * ``bool AfterControlStatements`` If ``true``, put space between control 
statement keywords
 (for/if/while...) and opening parentheses.
 
 .. code-block:: c++

diff  --git a/clang/docs/DebuggingCoroutines.rst 
b/clang/docs/DebuggingCoroutines.rst
index 842f7645f967bf..53bdd08fdbc02f 100644
--- a/clang/docs/DebuggingCoroutines.rst
+++ b/clang/docs/DebuggingCoroutines.rst
@@ -501,7 +501,7 @@ So we can use the ``continuation`` field to construct the 
asynchronous stack:
   # In the example, the continuation is the first field member of the 
promise_type.
   # So they have the same addresses.
   # If we want to generalize the scripts to other coroutine types, we 
need to be sure
-  # the continuation field is the first memeber of promise_type.
+  # the continuation field is the first member of promise_type.
   self.continuation_addr = self.promise_addr
 
   def next_task_addr(self):

diff  --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index c6f781dfe35e89..a51dea03fcb655 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -2410,7 +2410,7 @@ this always needs to be called to grow the table.
 It takes three arguments. The first argument is the WebAssembly table
 to grow. The second argument is the reference typed value to store in
 the new table entries (the initialization value), and the third argument
-is the amound to grow the table by. It returns the previous table size
+is the amount to grow the table by. It returns the previous table size
 or -1. It will return -1 if not enough space could be allocated.
 
 .. code-block:: c++

diff  --git a/clang/docs/OpenCLSupport.rst b/clang/docs/OpenCLSupport.rst
index 43c30970d113bf..f9b6564a9ebaac 100644
--- a/clang/docs/OpenCLSupport.rst
+++ b/clang/docs/OpenCLSupport.rst
@@ -333,7 +333,7 @@ Missing features or with limited support
 - IR generation for non-trivial global destructors is incomplete (See:
   `PR48047 `_).
 
-- Support of `destrutors with non-default address spaces
+- Support of `destructors with non-default address spaces
   
`_
   is incomplete (See: `D109609 `_).
 

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 054c06ffa0f5c9..d76005692aa809 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -173,7 +173,7 @@ Bug Fixes to C++ Support
   a Unicode character whose name contains a ``-``.
   (Fixes `#64161 `_)
 
-- Fix cases where we ignore ambiguous name lookup when looking up memebers.
+- Fix cases where we ignore ambiguous name 

[Lldb-commits] [lldb] 04da749 - [lldb] Fix warnings

2023-08-15 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-08-15T12:46:36-07:00
New Revision: 04da7490d85dab7f2f97d0a782b674088bc5a10f

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

LOG: [lldb] Fix warnings

This patch fixes warnings like:

  lldb/source/Core/ModuleList.cpp:1086:3: error: 'scoped_lock' may not
  intend to support class template argument deduction
  [-Werror,-Wctad-maybe-unsupported]

Added: 


Modified: 
lldb/source/Core/ModuleList.cpp
lldb/source/Host/posix/PipePosix.cpp

Removed: 




diff  --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 6cb086f9f55d2c..17d4560f724b84 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -1083,6 +1083,7 @@ bool ModuleList::AnyOf(
 
 void ModuleList::Swap(ModuleList ) {
   // scoped_lock locks both mutexes at once.
-  std::scoped_lock lock(m_modules_mutex, other.m_modules_mutex);
+  std::scoped_lock lock(
+  m_modules_mutex, other.m_modules_mutex);
   m_modules.swap(other.m_modules);
 }

diff  --git a/lldb/source/Host/posix/PipePosix.cpp 
b/lldb/source/Host/posix/PipePosix.cpp
index 0050731acb3fcb..c02869cbf4d730 100644
--- a/lldb/source/Host/posix/PipePosix.cpp
+++ b/lldb/source/Host/posix/PipePosix.cpp
@@ -65,8 +65,9 @@ PipePosix::PipePosix(PipePosix &_posix)
 pipe_posix.ReleaseWriteFileDescriptor()} {}
 
 PipePosix ::operator=(PipePosix &_posix) {
-  std::scoped_lock guard(m_read_mutex, m_write_mutex, pipe_posix.m_read_mutex,
- pipe_posix.m_write_mutex);
+  std::scoped_lock guard(
+  m_read_mutex, m_write_mutex, pipe_posix.m_read_mutex,
+  pipe_posix.m_write_mutex);
 
   PipeBase::operator=(std::move(pipe_posix));
   m_fds[READ] = pipe_posix.ReleaseReadFileDescriptorUnlocked();
@@ -77,7 +78,7 @@ PipePosix ::operator=(PipePosix &_posix) {
 PipePosix::~PipePosix() { Close(); }
 
 Status PipePosix::CreateNew(bool child_processes_inherit) {
-  std::scoped_lock guard(m_read_mutex, m_write_mutex);
+  std::scoped_lock guard(m_read_mutex, m_write_mutex);
   if (CanReadUnlocked() || CanWriteUnlocked())
 return Status(EINVAL, eErrorTypePOSIX);
 
@@ -107,7 +108,7 @@ Status PipePosix::CreateNew(bool child_processes_inherit) {
 }
 
 Status PipePosix::CreateNew(llvm::StringRef name, bool child_process_inherit) {
-  std::scoped_lock (m_read_mutex, m_write_mutex);
+  std::scoped_lock (m_read_mutex, m_write_mutex);
   if (CanReadUnlocked() || CanWriteUnlocked())
 return Status("Pipe is already opened");
 
@@ -145,7 +146,7 @@ Status PipePosix::CreateWithUniqueName(llvm::StringRef 
prefix,
 
 Status PipePosix::OpenAsReader(llvm::StringRef name,
bool child_process_inherit) {
-  std::scoped_lock (m_read_mutex, m_write_mutex);
+  std::scoped_lock (m_read_mutex, m_write_mutex);
 
   if (CanReadUnlocked() || CanWriteUnlocked())
 return Status("Pipe is already opened");
@@ -168,7 +169,7 @@ Status
 PipePosix::OpenAsWriterWithTimeout(llvm::StringRef name,
bool child_process_inherit,
const std::chrono::microseconds ) {
-  std::lock_guard guard(m_write_mutex);
+  std::lock_guard guard(m_write_mutex);
   if (CanReadUnlocked() || CanWriteUnlocked())
 return Status("Pipe is already opened");
 
@@ -205,7 +206,7 @@ PipePosix::OpenAsWriterWithTimeout(llvm::StringRef name,
 }
 
 int PipePosix::GetReadFileDescriptor() const {
-  std::lock_guard guard(m_read_mutex);
+  std::lock_guard guard(m_read_mutex);
   return GetReadFileDescriptorUnlocked();
 }
 
@@ -214,7 +215,7 @@ int PipePosix::GetReadFileDescriptorUnlocked() const {
 }
 
 int PipePosix::GetWriteFileDescriptor() const {
-  std::lock_guard guard(m_write_mutex);
+  std::lock_guard guard(m_write_mutex);
   return GetWriteFileDescriptorUnlocked();
 }
 
@@ -223,7 +224,7 @@ int PipePosix::GetWriteFileDescriptorUnlocked() const {
 }
 
 int PipePosix::ReleaseReadFileDescriptor() {
-  std::lock_guard guard(m_read_mutex);
+  std::lock_guard guard(m_read_mutex);
   return ReleaseReadFileDescriptorUnlocked();
 }
 
@@ -234,7 +235,7 @@ int PipePosix::ReleaseReadFileDescriptorUnlocked() {
 }
 
 int PipePosix::ReleaseWriteFileDescriptor() {
-  std::lock_guard guard(m_write_mutex);
+  std::lock_guard guard(m_write_mutex);
   return ReleaseWriteFileDescriptorUnlocked();
 }
 
@@ -245,7 +246,7 @@ int PipePosix::ReleaseWriteFileDescriptorUnlocked() {
 }
 
 void PipePosix::Close() {
-  std::scoped_lock guard(m_read_mutex, m_write_mutex);
+  std::scoped_lock guard(m_read_mutex, m_write_mutex);
   CloseUnlocked();
 }
 
@@ -259,7 +260,7 @@ Status PipePosix::Delete(llvm::StringRef name) {
 }
 
 bool PipePosix::CanRead() const {
-  std::lock_guard guard(m_read_mutex);
+  std::lock_guard guard(m_read_mutex);
   return 

[Lldb-commits] [lldb] b712061 - [lldb] Remove unused forward declaration RecordingMemoryManager

2023-06-14 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-06-14T22:04:43-07:00
New Revision: b712061441b4990c8195b940912d2a4ac0bdbee0

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

LOG: [lldb] Remove unused forward declaration RecordingMemoryManager

The corresponding class definition was removed by:

  commit 8dfb68e0398ef48d41dc8ea058e9aa750b5fc85f
  Author: Sean Callanan 
  Date:   Tue Mar 19 00:10:07 2013 +

Added: 


Modified: 
lldb/include/lldb/Expression/Expression.h
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h

Removed: 




diff  --git a/lldb/include/lldb/Expression/Expression.h 
b/lldb/include/lldb/Expression/Expression.h
index b4207de958e98..3e61d78828bbb 100644
--- a/lldb/include/lldb/Expression/Expression.h
+++ b/lldb/include/lldb/Expression/Expression.h
@@ -20,8 +20,6 @@
 
 namespace lldb_private {
 
-class RecordingMemoryManager;
-
 /// \class Expression Expression.h "lldb/Expression/Expression.h" Encapsulates
 /// a single expression for use in lldb
 ///

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h
index 41e62ae72f6ca..e66d46c21ddfa 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h
@@ -24,7 +24,6 @@ class ASTConsumer;
 namespace lldb_private {
 
 class ClangExpressionDeclMap;
-class RecordingMemoryManager;
 
 // ClangExpressionHelper
 class ClangExpressionHelper



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


[Lldb-commits] [lldb] 7d21f57 - [lldb] Fix a warning

2023-06-14 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-06-14T10:56:22-07:00
New Revision: 7d21f5714e5a040f121fa08648c748073467db82

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

LOG: [lldb] Fix a warning

This patch fixes:

  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4843:13:
  error: 225 enumeration values not handled in switch: 'RvvInt8mf8x2',
  'RvvInt8mf8x3', 'RvvInt8mf8x4'... [-Werror,-Wswitch]

Added: 


Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 6506f118f8c65..15c9729c22cfb 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -5107,7 +5107,232 @@ lldb::Encoding 
TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
 case clang::BuiltinType::RvvBool16:
 case clang::BuiltinType::RvvBool32:
 case clang::BuiltinType::RvvBool64:
+case clang::BuiltinType::RvvInt8mf8x2:
+case clang::BuiltinType::RvvInt8mf8x3:
+case clang::BuiltinType::RvvInt8mf8x4:
+case clang::BuiltinType::RvvInt8mf8x5:
+case clang::BuiltinType::RvvInt8mf8x6:
+case clang::BuiltinType::RvvInt8mf8x7:
+case clang::BuiltinType::RvvInt8mf8x8:
+case clang::BuiltinType::RvvInt8mf4x2:
+case clang::BuiltinType::RvvInt8mf4x3:
+case clang::BuiltinType::RvvInt8mf4x4:
+case clang::BuiltinType::RvvInt8mf4x5:
+case clang::BuiltinType::RvvInt8mf4x6:
+case clang::BuiltinType::RvvInt8mf4x7:
+case clang::BuiltinType::RvvInt8mf4x8:
+case clang::BuiltinType::RvvInt8mf2x2:
+case clang::BuiltinType::RvvInt8mf2x3:
+case clang::BuiltinType::RvvInt8mf2x4:
+case clang::BuiltinType::RvvInt8mf2x5:
+case clang::BuiltinType::RvvInt8mf2x6:
+case clang::BuiltinType::RvvInt8mf2x7:
+case clang::BuiltinType::RvvInt8mf2x8:
+case clang::BuiltinType::RvvInt8m1x2:
+case clang::BuiltinType::RvvInt8m1x3:
+case clang::BuiltinType::RvvInt8m1x4:
+case clang::BuiltinType::RvvInt8m1x5:
+case clang::BuiltinType::RvvInt8m1x6:
+case clang::BuiltinType::RvvInt8m1x7:
+case clang::BuiltinType::RvvInt8m1x8:
+case clang::BuiltinType::RvvInt8m2x2:
+case clang::BuiltinType::RvvInt8m2x3:
+case clang::BuiltinType::RvvInt8m2x4:
+case clang::BuiltinType::RvvInt8m4x2:
+case clang::BuiltinType::RvvUint8mf8x2:
+case clang::BuiltinType::RvvUint8mf8x3:
+case clang::BuiltinType::RvvUint8mf8x4:
+case clang::BuiltinType::RvvUint8mf8x5:
+case clang::BuiltinType::RvvUint8mf8x6:
+case clang::BuiltinType::RvvUint8mf8x7:
+case clang::BuiltinType::RvvUint8mf8x8:
+case clang::BuiltinType::RvvUint8mf4x2:
+case clang::BuiltinType::RvvUint8mf4x3:
+case clang::BuiltinType::RvvUint8mf4x4:
+case clang::BuiltinType::RvvUint8mf4x5:
+case clang::BuiltinType::RvvUint8mf4x6:
+case clang::BuiltinType::RvvUint8mf4x7:
+case clang::BuiltinType::RvvUint8mf4x8:
+case clang::BuiltinType::RvvUint8mf2x2:
+case clang::BuiltinType::RvvUint8mf2x3:
+case clang::BuiltinType::RvvUint8mf2x4:
+case clang::BuiltinType::RvvUint8mf2x5:
+case clang::BuiltinType::RvvUint8mf2x6:
+case clang::BuiltinType::RvvUint8mf2x7:
+case clang::BuiltinType::RvvUint8mf2x8:
+case clang::BuiltinType::RvvUint8m1x2:
+case clang::BuiltinType::RvvUint8m1x3:
+case clang::BuiltinType::RvvUint8m1x4:
+case clang::BuiltinType::RvvUint8m1x5:
+case clang::BuiltinType::RvvUint8m1x6:
+case clang::BuiltinType::RvvUint8m1x7:
+case clang::BuiltinType::RvvUint8m1x8:
+case clang::BuiltinType::RvvUint8m2x2:
+case clang::BuiltinType::RvvUint8m2x3:
+case clang::BuiltinType::RvvUint8m2x4:
+case clang::BuiltinType::RvvUint8m4x2:
+case clang::BuiltinType::RvvInt16mf4x2:
+case clang::BuiltinType::RvvInt16mf4x3:
+case clang::BuiltinType::RvvInt16mf4x4:
+case clang::BuiltinType::RvvInt16mf4x5:
+case clang::BuiltinType::RvvInt16mf4x6:
+case clang::BuiltinType::RvvInt16mf4x7:
+case clang::BuiltinType::RvvInt16mf4x8:
+case clang::BuiltinType::RvvInt16mf2x2:
+case clang::BuiltinType::RvvInt16mf2x3:
+case clang::BuiltinType::RvvInt16mf2x4:
+case clang::BuiltinType::RvvInt16mf2x5:
+case clang::BuiltinType::RvvInt16mf2x6:
+case clang::BuiltinType::RvvInt16mf2x7:
+case clang::BuiltinType::RvvInt16mf2x8:
+case clang::BuiltinType::RvvInt16m1x2:
+case clang::BuiltinType::RvvInt16m1x3:
+case clang::BuiltinType::RvvInt16m1x4:
+case clang::BuiltinType::RvvInt16m1x5:
+case clang::BuiltinType::RvvInt16m1x6:
+case clang::BuiltinType::RvvInt16m1x7:
+case 

[Lldb-commits] [lldb] 23e26cb - [lldb] Fix typos in documentation

2023-05-23 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-05-23T22:10:59-07:00
New Revision: 23e26cb98d5f817b951d6e7e2346246fc937ffb6

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

LOG: [lldb] Fix typos in documentation

Added: 


Modified: 
lldb/docs/resources/fuzzing.rst
lldb/docs/use/ondemand.rst
lldb/docs/use/variable.rst

Removed: 




diff  --git a/lldb/docs/resources/fuzzing.rst b/lldb/docs/resources/fuzzing.rst
index 2b1e7bd1eaafd..b827b32e74d50 100644
--- a/lldb/docs/resources/fuzzing.rst
+++ b/lldb/docs/resources/fuzzing.rst
@@ -9,7 +9,7 @@ LLDB has fuzzers that provide automated `fuzz testing 


[Lldb-commits] [lldb] e6b5235 - [lldb] Replace None with std::nullopt in comments (NFC)

2023-05-06 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-05-06T08:56:24-07:00
New Revision: e6b52355a1f3eae9310003ee714c802ac8a63b46

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

LOG: [lldb] Replace None with std::nullopt in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 


Modified: 
lldb/include/lldb/Target/Trace.h
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Plugins/Process/Linux/Perf.h
lldb/source/Plugins/TraceExporter/common/TraceHTR.h

Removed: 




diff  --git a/lldb/include/lldb/Target/Trace.h 
b/lldb/include/lldb/Target/Trace.h
index fc67a0e05ab44..987720e24e18d 100644
--- a/lldb/include/lldb/Target/Trace.h
+++ b/lldb/include/lldb/Target/Trace.h
@@ -570,7 +570,7 @@ class Trace : public PluginInterface,
 llvm::DenseMap live_process_data;
 /// \}
 
-/// The list of cpus being traced. Might be \b None depending on the
+/// The list of cpus being traced. Might be \b std::nullopt depending on 
the
 /// plug-in.
 std::optional> cpus;
 

diff  --git a/lldb/source/Commands/CommandObjectThread.cpp 
b/lldb/source/Commands/CommandObjectThread.cpp
index 052d52e2ddac9..851fc743f3895 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -2420,7 +2420,7 @@ class CommandObjectTraceDumpInstructions : public 
CommandObjectParsed {
   }
 
   CommandOptions m_options;
-  // Last traversed id used to continue a repeat command. None means
+  // Last traversed id used to continue a repeat command. std::nullopt means
   // that all the trace has been consumed.
   std::optional m_last_id;
 };

diff  --git a/lldb/source/Plugins/Process/Linux/Perf.h 
b/lldb/source/Plugins/Process/Linux/Perf.h
index 3f326212cdec6..658a5c3cd4686 100644
--- a/lldb/source/Plugins/Process/Linux/Perf.h
+++ b/lldb/source/Plugins/Process/Linux/Perf.h
@@ -122,8 +122,8 @@ class PerfEvent {
   /// Configuration information for the event.
   ///
   /// \param[in] pid
-  /// The process or thread to be monitored by the event. If \b None, then
-  /// all threads and processes are monitored.
+  /// The process or thread to be monitored by the event. If \b
+  /// std::nullopt, then all threads and processes are monitored.
   static llvm::Expected
   Init(perf_event_attr , std::optional pid,
std::optional core = std::nullopt);

diff  --git a/lldb/source/Plugins/TraceExporter/common/TraceHTR.h 
b/lldb/source/Plugins/TraceExporter/common/TraceHTR.h
index 58a9262370a83..66aa19be1a469 100644
--- a/lldb/source/Plugins/TraceExporter/common/TraceHTR.h
+++ b/lldb/source/Plugins/TraceExporter/common/TraceHTR.h
@@ -215,7 +215,7 @@ class HTRInstructionLayer : public IHTRLayer {
   ///
   /// \param[in] func_name
   /// The name of the function the 'call' instruction is calling if it can
-  /// be determined, None otherwise.
+  /// be determined, std::nullopt otherwise.
   void AddCallInstructionMetadata(lldb::addr_t load_addr,
   std::optional func_name);
 



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


[Lldb-commits] [lldb] 4bac5f8 - Apply fixes from performance-faster-string-find (NFC)

2023-04-16 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-04-16T00:51:27-07:00
New Revision: 4bac5f8344ea6405e3964141c8f591c68eefd373

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

LOG: Apply fixes from performance-faster-string-find (NFC)

Added: 


Modified: 
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
flang/lib/Semantics/check-io.cpp
lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
index eeb0642baa100..9561b2b00904f 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -337,10 +337,10 @@ std::string 
IdentifierNamingCheck::HungarianNotation::getDeclTypeName(
 Type.replace(Pos, Kw.size(), "");
   }
 }
-TypeName = Type.erase(0, Type.find_first_not_of(" "));
+TypeName = Type.erase(0, Type.find_first_not_of(' '));
 
 // Remove template parameters
-const size_t Pos = Type.find("<");
+const size_t Pos = Type.find('<');
 if (Pos != std::string::npos) {
   TypeName = Type.erase(Pos, Type.size() - Pos);
 }
@@ -377,14 +377,14 @@ std::string 
IdentifierNamingCheck::HungarianNotation::getDeclTypeName(
   }
 }
 
-TypeName = Type.erase(0, Type.find_first_not_of(" "));
+TypeName = Type.erase(0, Type.find_first_not_of(' '));
 if (!RedundantRemoved) {
-  std::size_t FoundSpace = Type.find(" ");
+  std::size_t FoundSpace = Type.find(' ');
   if (FoundSpace != std::string::npos)
 Type = Type.substr(0, FoundSpace);
 }
 
-TypeName = Type.erase(0, Type.find_first_not_of(" "));
+TypeName = Type.erase(0, Type.find_first_not_of(' '));
 
 QualType QT = VD->getType();
 if (!QT.isNull() && QT->isArrayType())
@@ -586,7 +586,7 @@ std::string 
IdentifierNamingCheck::HungarianNotation::getDataTypePrefix(
   if (PrefixStr.empty())
 PrefixStr = HNOption.DerivedType.lookup("Array");
 } else if (QT->isReferenceType()) {
-  size_t Pos = ModifiedTypeName.find_last_of("&");
+  size_t Pos = ModifiedTypeName.find_last_of('&');
   if (Pos != std::string::npos)
 ModifiedTypeName = ModifiedTypeName.substr(0, Pos);
 }
@@ -653,7 +653,7 @@ std::string 
IdentifierNamingCheck::HungarianNotation::getEnumPrefix(
   std::string Name = ED->getName().str();
   if (std::string::npos != Name.find("enum")) {
 Name = Name.substr(strlen("enum"), Name.length() - strlen("enum"));
-Name = Name.erase(0, Name.find_first_not_of(" "));
+Name = Name.erase(0, Name.find_first_not_of(' '));
   }
 
   static llvm::Regex Splitter(

diff  --git a/flang/lib/Semantics/check-io.cpp 
b/flang/lib/Semantics/check-io.cpp
index 6df5eadc8ae62..1c1b07c422bac 100644
--- a/flang/lib/Semantics/check-io.cpp
+++ b/flang/lib/Semantics/check-io.cpp
@@ -101,7 +101,7 @@ void IoChecker::Enter(const parser::ConnectSpec ) {
 // Ignore trailing spaces (12.5.6.2 p1) and convert to upper case
 static std::string Normalize(const std::string ) {
   auto upper{parser::ToUpperCaseLetters(value)};
-  std::size_t lastNonBlank{upper.find_last_not_of(" ")};
+  std::size_t lastNonBlank{upper.find_last_not_of(' ')};
   upper.resize(lastNonBlank == std::string::npos ? 0 : lastNonBlank + 1);
   return upper;
 }

diff  --git a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp 
b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
index 277fec9f7116e..a38b75c9e615f 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
@@ -81,7 +81,7 @@ static std::optional GetCGroupFileDescriptor(lldb::pid_t 
pid) {
 if (line.find("0:") != 0)
   continue;
 
-std::string slice = line.substr(line.find_first_of("/"));
+std::string slice = line.substr(line.find_first_of('/'));
 if (slice.empty())
   return std::nullopt;
 std::string cgroup_file = formatv("/sys/fs/cgroup/{0}", slice);

diff  --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp 
b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index bfa748e7a6950..ccb7a37c83d54 100644
--- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -1256,7 +1256,7 @@ void DataFlowSanitizer::addGlobalNameSuffix(GlobalValue 
*GV) {
   size_t Pos = Asm.find(SearchStr);
   if (Pos != std::string::npos) {
 Asm.replace(Pos, SearchStr.size(), ".symver " + GVName + Suffix + ",");
-Pos = Asm.find("@");
+Pos = Asm.find('@');
 
 if (Pos == std::string::npos)
  

[Lldb-commits] [lldb] 1ca496b - Remove redundant initialization of std::optional (NFC)

2023-04-16 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-04-16T00:40:05-07:00
New Revision: 1ca496bd611591193432aee2d913a4db3618db45

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

LOG: Remove redundant initialization of std::optional (NFC)

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
llvm/include/llvm/Transforms/Scalar/JumpThreading.h
llvm/lib/Transforms/Scalar/SROA.cpp
mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp
mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index d685e4df6d85..c0f0cb6c5fd2 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -575,7 +575,7 @@ class SymbolFileDWARF : public 
lldb_private::SymbolFileCommon {
   /// no dSYM file is being used, this file index will be set to a
   /// valid value that can be used in DIERef objects which will contain
   /// an index that identifies the .DWO or .o file.
-  std::optional m_file_index = std::nullopt;
+  std::optional m_file_index;
 };
 
 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARF_H

diff  --git a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h 
b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h
index e1ff43a6093c..3364d7eaee42 100644
--- a/llvm/include/llvm/Transforms/Scalar/JumpThreading.h
+++ b/llvm/include/llvm/Transforms/Scalar/JumpThreading.h
@@ -83,8 +83,8 @@ class JumpThreadingPass : public 
PassInfoMixin {
   LazyValueInfo *LVI = nullptr;
   AAResults *AA = nullptr;
   std::unique_ptr DTU;
-  std::optional BFI = std::nullopt;
-  std::optional BPI = std::nullopt;
+  std::optional BFI;
+  std::optional BPI;
   bool ChangedSinceLastAnalysisUpdate = false;
   bool HasGuards = false;
 #ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS

diff  --git a/llvm/lib/Transforms/Scalar/SROA.cpp 
b/llvm/lib/Transforms/Scalar/SROA.cpp
index a58dcff466e3..d533f8f6191c 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -241,7 +241,7 @@ static void migrateDebugInfo(AllocaInst *OldAlloca, bool 
IsSplit,
 bool SetKillLocation = false;
 
 if (IsSplit) {
-  std::optional BaseFragment = std::nullopt;
+  std::optional BaseFragment;
   {
 auto R = BaseFragments.find(getAggregateVariable(DbgAssign));
 if (R == BaseFragments.end())

diff  --git a/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h 
b/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
index 0c55abccd1bb..b4d070a42d98 100644
--- a/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
+++ b/mlir/include/mlir/Interfaces/ValueBoundsOpInterface.h
@@ -77,7 +77,7 @@ class ValueBoundsConstraintSet {
 
 ValueBoundsConstraintSet 
 Value value;
-std::optional dim = std::nullopt;
+std::optional dim;
   };
 
 public:

diff  --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp 
b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index c593f848a5e3..9595c1851952 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -732,7 +732,7 @@ static bool isTypeCompatibleWithAtomicOp(Type type, bool 
isPointerTypeAllowed) {
   if (type.isa())
 return isPointerTypeAllowed;
 
-  std::optional bitWidth = std::nullopt;
+  std::optional bitWidth;
   if (auto floatType = type.dyn_cast()) {
 if (!isCompatibleFloatingPointType(type))
   return false;

diff  --git a/mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp 
b/mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp
index 668629ac7451..cc6541e02f9c 100644
--- a/mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/SCF/IR/ValueBoundsOpInterfaceImpl.cpp
@@ -77,7 +77,7 @@ struct ForOpInterface
 
 // Check if computed bound equals the corresponding iter_arg.
 Value singleValue = nullptr;
-std::optional singleDim = std::nullopt;
+std::optional singleDim;
 if (auto dimExpr = bound.getResult(0).dyn_cast()) {
   int64_t idx = dimExpr.getPosition();
   singleValue = boundOperands[idx].first;

diff  --git a/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp 
b/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
index 0fe1801f629e..9c2baa3d41c2 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
@@ -495,7 +495,7 @@ void 
transform::TransformState::recordValueHandleInvalidationByOpHandleOne(
 
   for (Operation *ancestor : potentialAncestors) {
 Operation *definingOp;
-std::optional 

[Lldb-commits] [lldb] fcc04de - [lldb] Use StringMap::contains (NFC)

2023-04-15 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-04-15T14:22:13-07:00
New Revision: fcc04de5766ac8f02baded1f0d0822a36a343dde

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

LOG: [lldb] Use StringMap::contains (NFC)

Added: 


Modified: 
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 
b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 95bc79ebdfc9d..ab5e19da32911 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4201,8 +4201,7 @@ void ParseFlags(
 
 // If no fields overlap, use them.
 if (overlap == fields.end()) {
-  if (registers_flags_types.find(*id) !=
-  registers_flags_types.end()) {
+  if (registers_flags_types.contains(*id)) {
 // In theory you could define some flag set, use it with a
 // register then redefine it. We do not know if anyone does
 // that, or what they would expect to happen in that case.



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


[Lldb-commits] [lldb] 65a2d6d - [lldb] Use *{Set, Map}::contains (NFC)

2023-03-14 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-03-14T21:41:40-07:00
New Revision: 65a2d6d6904f0b06f0d0cfdfbfa67dbe6599f081

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

LOG: [lldb] Use *{Set,Map}::contains (NFC)

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
index c084c3fbefc5d..2826b102625fe 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
@@ -113,7 +113,7 @@ class DeclContextOverride {
   llvm::DenseMap m_backups;
 
   void OverrideOne(clang::Decl *decl) {
-if (m_backups.find(decl) != m_backups.end()) {
+if (m_backups.contains(decl)) {
   return;
 }
 

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
index cc3abfdfde394..527055024a768 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
@@ -212,7 +212,7 @@ class TokenVerifier {
   /// Returns true iff the given expression body contained a token with the
   /// given content.
   bool hasToken(llvm::StringRef token) const {
-return m_tokens.find(token) != m_tokens.end();
+return m_tokens.contains(token);
   }
 };
 

diff  --git a/lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp 
b/lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
index 6b78ce5de697a..6e56e29f8c31c 100644
--- a/lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
+++ b/lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
@@ -23,7 +23,7 @@
 using namespace lldb_private;
 
 bool ClangHighlighter::isKeyword(llvm::StringRef token) const {
-  return keywords.find(token) != keywords.end();
+  return keywords.contains(token);
 }
 
 ClangHighlighter::ClangHighlighter() {

diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 391ed99607f77..1f89db0cb5ca0 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -4556,7 +4556,7 @@ void ObjectFileMachO::ParseSymtab(Symtab ) {
   // Count how many trie symbols we'll add to the symbol table
   int trie_symbol_table_augment_count = 0;
   for (auto  : external_sym_trie_entries) {
-if (symbols_added.find(e.entry.address) == symbols_added.end())
+if (!symbols_added.contains(e.entry.address))
   trie_symbol_table_augment_count++;
   }
 
@@ -4603,8 +4603,7 @@ void ObjectFileMachO::ParseSymtab(Symtab ) {
   if (function_starts_count > 0) {
 uint32_t num_synthetic_function_symbols = 0;
 for (i = 0; i < function_starts_count; ++i) {
-  if (symbols_added.find(function_starts.GetEntryRef(i).addr) ==
-  symbols_added.end())
+  if (!symbols_added.contains(function_starts.GetEntryRef(i).addr))
 ++num_synthetic_function_symbols;
 }
 
@@ -4616,7 +4615,7 @@ void ObjectFileMachO::ParseSymtab(Symtab ) {
   for (i = 0; i < function_starts_count; ++i) {
 const FunctionStarts::Entry *func_start_entry =
 function_starts.GetEntryAtIndex(i);
-if (symbols_added.find(func_start_entry->addr) == symbols_added.end()) 
{
+if (!symbols_added.contains(func_start_entry->addr)) {
   addr_t symbol_file_addr = func_start_entry->addr;
   uint32_t symbol_flags = 0;
   if (func_start_entry->data)

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index b99e9ec82f126..075d4b042d2aa 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -1392,7 +1392,7 @@ bool SymbolFileNativePDB::ParseImportedModules(
 void SymbolFileNativePDB::ParseInlineSite(PdbCompilandSymId id,
   Address func_addr) {
   lldb::user_id_t opaque_uid = toOpaqueUid(id);
-  if (m_inline_sites.find(opaque_uid) != m_inline_sites.end())
+  if (m_inline_sites.contains(opaque_uid))
 return;
 
   addr_t func_base = func_addr.GetFileAddress();




[Lldb-commits] [lldb] bf874eb - [lldb] Use llvm::rotr (NFC)

2023-02-20 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-02-20T10:38:18-08:00
New Revision: bf874eb09bf3fb9ff13b6a06ec653acc5c041af0

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

LOG: [lldb] Use llvm::rotr (NFC)

Added: 


Modified: 
lldb/source/Plugins/Process/Utility/ARMUtils.h

Removed: 




diff  --git a/lldb/source/Plugins/Process/Utility/ARMUtils.h 
b/lldb/source/Plugins/Process/Utility/ARMUtils.h
index a7aaa5ac7a1ff..9256f926275b8 100644
--- a/lldb/source/Plugins/Process/Utility/ARMUtils.h
+++ b/lldb/source/Plugins/Process/Utility/ARMUtils.h
@@ -11,6 +11,7 @@
 
 #include "ARMDefines.h"
 #include "InstructionUtils.h"
+#include "llvm/ADT/bit.h"
 #include "llvm/Support/MathExtras.h"
 
 // Common utilities for the ARM/Thumb Instruction Set Architecture.
@@ -173,8 +174,7 @@ static inline uint32_t ROR_C(const uint32_t value, const 
uint32_t amount,
 return 0;
   }
   *success = true;
-  uint32_t amt = amount % 32;
-  uint32_t result = Rotr32(value, amt);
+  uint32_t result = llvm::rotr(value, amount);
   carry_out = Bit32(value, 31);
   return result;
 }



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


[Lldb-commits] [lldb] 5e111eb - Migrate away from the soft-deprecated functions in APInt.h (NFC)

2023-02-20 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-02-20T00:58:29-08:00
New Revision: 5e111eb275eee3bec1123b4b85606328017e5ee5

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

LOG: Migrate away from the soft-deprecated functions in APInt.h (NFC)

Note that those functions on the left hand side are soft-deprecated in
favor of those on the right hand side:

  getMinSignedBits -> getSignificantBits
  getNullValue -> getZero
  isNullValue  -> isZero
  isOneValue   -> isOne

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Utility/Scalar.cpp
llvm/unittests/ADT/APIntTest.cpp
llvm/unittests/IR/ConstantRangeTest.cpp
polly/unittests/Isl/IslTest.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 717456698eb23..362ce2b200ae1 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2707,7 +2707,7 @@ llvm::Expected 
DWARFASTParserClang::ExtractIntFromFormValue(
   // For signed types, ask APInt how many bits are required to represent the
   // signed integer.
   const unsigned required_bits =
-  is_unsigned ? result.getActiveBits() : result.getMinSignedBits();
+  is_unsigned ? result.getActiveBits() : result.getSignificantBits();
 
   // If the input value doesn't fit into the integer type, return an error.
   if (required_bits > type_bits) {

diff  --git a/lldb/source/Utility/Scalar.cpp b/lldb/source/Utility/Scalar.cpp
index 19e00e111be52..4b80f6adca06a 100644
--- a/lldb/source/Utility/Scalar.cpp
+++ b/lldb/source/Utility/Scalar.cpp
@@ -145,7 +145,7 @@ bool Scalar::IsZero() const {
   case e_void:
 break;
   case e_int:
-return m_integer.isNullValue();
+return m_integer.isZero();
   case e_float:
 return m_float.isZero();
   }

diff  --git a/llvm/unittests/ADT/APIntTest.cpp 
b/llvm/unittests/ADT/APIntTest.cpp
index ad0a280ae2a26..d8d7bfa27a3f3 100644
--- a/llvm/unittests/ADT/APIntTest.cpp
+++ b/llvm/unittests/ADT/APIntTest.cpp
@@ -166,7 +166,7 @@ TEST(APIntTest, i128_PositiveCount) {
   EXPECT_EQ(96u, s128.countl_zero());
   EXPECT_EQ(0u, s128.countl_one());
   EXPECT_EQ(32u, s128.getActiveBits());
-  EXPECT_EQ(33u, s128.getMinSignedBits());
+  EXPECT_EQ(33u, s128.getSignificantBits());
   EXPECT_EQ(1u, s128.countr_zero());
   EXPECT_EQ(0u, s128.countr_one());
   EXPECT_EQ(30u, s128.popcount());
@@ -176,7 +176,7 @@ TEST(APIntTest, i128_PositiveCount) {
   EXPECT_EQ(0u, s128.countl_zero());
   EXPECT_EQ(66u, s128.countl_one());
   EXPECT_EQ(128u, s128.getActiveBits());
-  EXPECT_EQ(63u, s128.getMinSignedBits());
+  EXPECT_EQ(63u, s128.getSignificantBits());
   EXPECT_EQ(1u, s128.countr_zero());
   EXPECT_EQ(0u, s128.countr_one());
   EXPECT_EQ(96u, s128.popcount());
@@ -200,7 +200,7 @@ TEST(APIntTest, i256) {
   EXPECT_EQ(190u, s256.countl_zero());
   EXPECT_EQ(0u, s256.countl_one());
   EXPECT_EQ(66u, s256.getActiveBits());
-  EXPECT_EQ(67u, s256.getMinSignedBits());
+  EXPECT_EQ(67u, s256.getSignificantBits());
   EXPECT_EQ(0u, s256.countr_zero());
   EXPECT_EQ(4u, s256.countr_one());
   EXPECT_EQ(8u, s256.popcount());
@@ -209,7 +209,7 @@ TEST(APIntTest, i256) {
   EXPECT_EQ(0u, s256.countl_zero());
   EXPECT_EQ(196u, s256.countl_one());
   EXPECT_EQ(256u, s256.getActiveBits());
-  EXPECT_EQ(61u, s256.getMinSignedBits());
+  EXPECT_EQ(61u, s256.getSignificantBits());
   EXPECT_EQ(0u, s256.countr_zero());
   EXPECT_EQ(4u, s256.countr_one());
   EXPECT_EQ(200u, s256.popcount());
@@ -2759,7 +2759,7 @@ TEST(APIntTest, RoundingSDiv) {
   APInt QuoTowardZero = A.sdiv(B);
   {
 APInt Quo = APIntOps::RoundingSDiv(A, B, APInt::Rounding::UP);
-if (A.srem(B).isNullValue()) {
+if (A.srem(B).isZero()) {
   EXPECT_EQ(QuoTowardZero, Quo);
 } else if (A.isNegative() !=
B.isNegative()) { // if the math quotient is negative.
@@ -2770,7 +2770,7 @@ TEST(APIntTest, RoundingSDiv) {
   }
   {
 APInt Quo = APIntOps::RoundingSDiv(A, B, APInt::Rounding::DOWN);
-if (A.srem(B).isNullValue()) {
+if (A.srem(B).isZero()) {
   EXPECT_EQ(QuoTowardZero, Quo);
 } else if (A.isNegative() !=
B.isNegative()) { // if the math quotient is negative.
@@ -2929,12 +2929,12 @@ TEST(APIntTest, MultiplicativeInverseExaustive) {
   .multiplicativeInverse(APInt::getSignedMinValue(BitWidth + 1))
   .trunc(BitWidth);
   APInt One = V * MulInv;
-  if (!V.isNullValue() && V.countr_zero() == 0) {
+  if (!V.isZero() && V.countr_zero() == 0) {
 // Multiplicative inverse exists for all odd 

[Lldb-commits] [lldb] 81d665f - Revert "[lldb] Fix warning about unhandled enum value `WasmExternRef` (NFC)."

2023-02-05 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-02-05T22:45:46-08:00
New Revision: 81d665fb1b6453329cacde0a89f722a73d128b54

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

LOG: Revert "[lldb] Fix warning about unhandled enum value `WasmExternRef` 
(NFC)."

This reverts commit b27e4f72213e78cacf0ce5bfd127261ec0b9309b.

bccf5999d38f14552f449618c1d72d18613f4285 necessitates this revert.

Added: 


Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 30b4f800a48e4..3c1fc4093c3b1 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -5121,10 +5121,6 @@ lldb::Encoding 
TypeSystemClang::GetEncoding(lldb::opaque_compiler_type_t type,
 
 case clang::BuiltinType::IncompleteMatrixIdx:
   break;
-
-// WASM.
-case clang::BuiltinType::WasmExternRef:
-  break;
 }
 break;
   // All pointer types are represented as unsigned integer encodings. We may



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


[Lldb-commits] [lldb] f6b8f05 - Use llvm::byteswap instead of ByteSwap_{16, 32, 64} (NFC)

2023-01-28 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-01-28T15:22:37-08:00
New Revision: f6b8f05bb399e8f5fd176b2c9dd383cd029467f1

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

LOG: Use llvm::byteswap instead of ByteSwap_{16,32,64} (NFC)

Added: 


Modified: 
clang/lib/Lex/HeaderMap.cpp
lld/COFF/DebugTypes.cpp
lldb/include/lldb/Core/Opcode.h
lldb/source/Core/Opcode.cpp

lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
lldb/source/Symbol/ArmUnwindInfo.cpp
lldb/source/Utility/DataExtractor.cpp
llvm/lib/ExecutionEngine/JITLink/MachO.cpp
llvm/lib/Support/APInt.cpp
llvm/lib/Support/ConvertUTFWrapper.cpp

Removed: 




diff  --git a/clang/lib/Lex/HeaderMap.cpp b/clang/lib/Lex/HeaderMap.cpp
index bb50a4eef65c1..da0b8898f6900 100644
--- a/clang/lib/Lex/HeaderMap.cpp
+++ b/clang/lib/Lex/HeaderMap.cpp
@@ -77,8 +77,8 @@ bool HeaderMapImpl::checkHeader(const llvm::MemoryBuffer 
,
   if (Header->Magic == HMAP_HeaderMagicNumber &&
   Header->Version == HMAP_HeaderVersion)
 NeedsByteSwap = false;
-  else if (Header->Magic == llvm::ByteSwap_32(HMAP_HeaderMagicNumber) &&
-   Header->Version == llvm::ByteSwap_16(HMAP_HeaderVersion))
+  else if (Header->Magic == llvm::byteswap(HMAP_HeaderMagicNumber) &&
+   Header->Version == llvm::byteswap(HMAP_HeaderVersion))
 NeedsByteSwap = true;  // Mixed endianness headermap.
   else
 return false;  // Not a header map.
@@ -113,7 +113,7 @@ StringRef HeaderMapImpl::getFileName() const {
 
 unsigned HeaderMapImpl::getEndianAdjustedWord(unsigned X) const {
   if (!NeedsBSwap) return X;
-  return llvm::ByteSwap_32(X);
+  return llvm::byteswap(X);
 }
 
 /// getHeader - Return a reference to the file header, in unbyte-swapped form.

diff  --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp
index 7bbce84b2d548..95d4e53bb7707 100644
--- a/lld/COFF/DebugTypes.cpp
+++ b/lld/COFF/DebugTypes.cpp
@@ -1021,7 +1021,8 @@ uint32_t GHashTable::insert(COFFLinkerContext , 
GloballyHashedType ghash,
   // type records are. Swap the byte order for better entropy. A better ghash
   // won't need this.
   uint32_t startIdx =
-  ByteSwap_64(*reinterpret_cast()) % tableSize;
+  llvm::byteswap(*reinterpret_cast()) %
+  tableSize;
 
   // Do a linear probe starting at startIdx.
   uint32_t idx = startIdx;

diff  --git a/lldb/include/lldb/Core/Opcode.h b/lldb/include/lldb/Core/Opcode.h
index 70f2dbdf639f4..f72f2687b54fe 100644
--- a/lldb/include/lldb/Core/Opcode.h
+++ b/lldb/include/lldb/Core/Opcode.h
@@ -99,7 +99,8 @@ class Opcode {
 case Opcode::eType8:
   return m_data.inst8;
 case Opcode::eType16:
-  return GetEndianSwap() ? llvm::ByteSwap_16(m_data.inst16) : 
m_data.inst16;
+  return GetEndianSwap() ? llvm::byteswap(m_data.inst16)
+ : m_data.inst16;
 case Opcode::eType16_2:
   break;
 case Opcode::eType32:
@@ -119,10 +120,12 @@ class Opcode {
 case Opcode::eType8:
   return m_data.inst8;
 case Opcode::eType16:
-  return GetEndianSwap() ? llvm::ByteSwap_16(m_data.inst16) : 
m_data.inst16;
+  return GetEndianSwap() ? llvm::byteswap(m_data.inst16)
+ : m_data.inst16;
 case Opcode::eType16_2: // passthrough
 case Opcode::eType32:
-  return GetEndianSwap() ? llvm::ByteSwap_32(m_data.inst32) : 
m_data.inst32;
+  return GetEndianSwap() ? llvm::byteswap(m_data.inst32)
+ : m_data.inst32;
 case Opcode::eType64:
   break;
 case Opcode::eTypeBytes:
@@ -138,12 +141,15 @@ class Opcode {
 case Opcode::eType8:
   return m_data.inst8;
 case Opcode::eType16:
-  return GetEndianSwap() ? llvm::ByteSwap_16(m_data.inst16) : 
m_data.inst16;
+  return GetEndianSwap() ? llvm::byteswap(m_data.inst16)
+ : m_data.inst16;
 case Opcode::eType16_2: // passthrough
 case Opcode::eType32:
-  return GetEndianSwap() ? llvm::ByteSwap_32(m_data.inst32) : 
m_data.inst32;
+  return GetEndianSwap() ? llvm::byteswap(m_data.inst32)
+ : m_data.inst32;
 case Opcode::eType64:
-  return GetEndianSwap() ? llvm::ByteSwap_64(m_data.inst64) : 
m_data.inst64;
+  return GetEndianSwap() ? llvm::byteswap(m_data.inst64)
+ : m_data.inst64;
 case Opcode::eTypeBytes:
   break;
 }

diff  --git a/lldb/source/Core/Opcode.cpp b/lldb/source/Core/Opcode.cpp
index a3fc97f95266d..3e30d98975d8a 100644
--- a/lldb/source/Core/Opcode.cpp
+++ b/lldb/source/Core/Opcode.cpp
@@ -103,7 +103,7 @@ uint32_t Opcode::GetData(DataExtractor ) 

[Lldb-commits] [lldb] 55e2cd1 - Use llvm::count{lr}_{zero, one} (NFC)

2023-01-28 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-01-28T12:41:20-08:00
New Revision: 55e2cd16095d64e9afca6e109e40ed95d735dc7f

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

LOG: Use llvm::count{lr}_{zero,one} (NFC)

Added: 


Modified: 
clang-tools-extra/clangd/SourceCode.cpp
clang/include/clang/Basic/TargetBuiltins.h
clang/include/clang/CodeGen/CGFunctionInfo.h
clang/lib/AST/Interp/Integral.h
clang/lib/Basic/SourceManager.cpp
clang/lib/Lex/Lexer.cpp
clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
clang/utils/TableGen/SveEmitter.cpp
lld/ELF/Arch/ARM.cpp
lld/ELF/InputFiles.cpp
lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h
lld/ELF/Writer.cpp
lld/MachO/SyntheticSections.cpp
lld/MachO/UnwindInfoSection.cpp
lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
lldb/source/Symbol/CompactUnwindInfo.cpp
llvm/include/llvm/ADT/APInt.h
llvm/include/llvm/ADT/BitVector.h
llvm/include/llvm/ADT/SmallBitVector.h
llvm/include/llvm/ADT/SparseBitVector.h
llvm/include/llvm/CodeGen/ExecutionDomainFix.h
llvm/include/llvm/CodeGen/TargetRegisterInfo.h
llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
llvm/include/llvm/Support/ScaledNumber.h
llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp
llvm/lib/Analysis/ValueTracking.cpp
llvm/lib/Analysis/VectorUtils.cpp
llvm/lib/CodeGen/ExecutionDomainFix.cpp
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/TargetRegisterInfo.cpp
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
llvm/lib/Object/ELFObjectFile.cpp
llvm/lib/Object/MachOUniversalWriter.cpp
llvm/lib/Support/APInt.cpp
llvm/lib/Support/ScaledNumber.cpp
llvm/lib/Transforms/IPO/LowerTypeTests.cpp
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp
llvm/tools/llvm-mca/Views/ResourcePressureView.cpp
llvm/tools/llvm-objdump/ELFDump.cpp
mlir/lib/Bytecode/Reader/BytecodeReader.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/SourceCode.cpp 
b/clang-tools-extra/clangd/SourceCode.cpp
index b53e9adeef6aa..d0140a7e0d01b 100644
--- a/clang-tools-extra/clangd/SourceCode.cpp
+++ b/clang-tools-extra/clangd/SourceCode.cpp
@@ -72,7 +72,7 @@ static bool iterateCodepoints(llvm::StringRef U8, const 
Callback ) {
   continue;
 }
 // This convenient property of UTF-8 holds for all non-ASCII characters.
-size_t UTF8Length = llvm::countLeadingOnes(C);
+size_t UTF8Length = llvm::countl_one(C);
 // 0xxx is ASCII, handled above. 10xxx is a trailing byte, invalid here.
 // 1xxx is not valid UTF-8 at all, maybe some ISO-8859-*.
 if (LLVM_UNLIKELY(UTF8Length < 2 || UTF8Length > 4)) {

diff  --git a/clang/include/clang/Basic/TargetBuiltins.h 
b/clang/include/clang/Basic/TargetBuiltins.h
index 2f94e839768cd..9adbec14b33a0 100644
--- a/clang/include/clang/Basic/TargetBuiltins.h
+++ b/clang/include/clang/Basic/TargetBuiltins.h
@@ -243,10 +243,10 @@ namespace clang {
 };
 
 SVETypeFlags(uint64_t F) : Flags(F) {
-  EltTypeShift = llvm::countTrailingZeros(EltTypeMask);
-  MemEltTypeShift = llvm::countTrailingZeros(MemEltTypeMask);
-  MergeTypeShift = llvm::countTrailingZeros(MergeTypeMask);
-  SplatOperandMaskShift = llvm::countTrailingZeros(SplatOperandMask);
+  EltTypeShift = llvm::countr_zero(EltTypeMask);
+  MemEltTypeShift = llvm::countr_zero(MemEltTypeMask);
+  MergeTypeShift = llvm::countr_zero(MergeTypeMask);
+  SplatOperandMaskShift = llvm::countr_zero(SplatOperandMask);
 }
 
 EltType getEltType() const {

diff  --git a/clang/include/clang/CodeGen/CGFunctionInfo.h 
b/clang/include/clang/CodeGen/CGFunctionInfo.h
index c042bcd9fc5f3..39c7a578c8c4e 100644
--- a/clang/include/clang/CodeGen/CGFunctionInfo.h
+++ b/clang/include/clang/CodeGen/CGFunctionInfo.h
@@ -742,7 +742,7 @@ class CGFunctionInfo final
   /// Set the maximum vector width in the arguments.
   void setMaxVectorWidth(unsigned Width) {
 assert(llvm::isPowerOf2_32(Width) && "Expected power of 2 vector");
-MaxVectorWidth = llvm::countTrailingZeros(Width) + 1;
+MaxVectorWidth = llvm::countr_zero(Width) + 1;
   }
 
   void Profile(llvm::FoldingSetNodeID ) {

diff  

[Lldb-commits] [lldb] caa99a0 - Use llvm::popcount instead of llvm::countPopulation(NFC)

2023-01-22 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-01-22T12:48:51-08:00
New Revision: caa99a01f5dd2f865df318a2f93abc811273a25d

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

LOG: Use llvm::popcount instead of llvm::countPopulation(NFC)

Added: 


Modified: 
clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
clang/lib/Basic/Sanitizers.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Symbol/CompactUnwindInfo.cpp
llvm/include/llvm/ADT/APInt.h
llvm/include/llvm/ADT/BitVector.h
llvm/include/llvm/ADT/SmallBitVector.h
llvm/include/llvm/ADT/SparseBitVector.h
llvm/include/llvm/CodeGen/TargetLowering.h
llvm/include/llvm/MC/LaneBitmask.h
llvm/include/llvm/MC/SubtargetFeature.h
llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h
llvm/lib/Analysis/MemoryProfileInfo.cpp
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/lib/CodeGen/MachinePipeliner.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
llvm/lib/MC/MCSchedule.cpp
llvm/lib/MCA/HardwareUnits/ResourceManager.cpp
llvm/lib/MCA/InstrBuilder.cpp
llvm/lib/MCA/Stages/ExecuteStage.cpp
llvm/lib/Support/APInt.cpp
llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
llvm/lib/Target/AMDGPU/EvergreenInstructions.td
llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
llvm/lib/Target/AMDGPU/SIInstructions.td
llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp
llvm/lib/Target/AMDGPU/SIRegisterInfo.h
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp
llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp
llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.h
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp
llvm/lib/Target/X86/X86FloatingPoint.cpp
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86InstrInfo.cpp
llvm/tools/llvm-exegesis/lib/SchedClassResolution.cpp
llvm/tools/llvm-readobj/ARMWinEHPrinter.cpp
llvm/utils/TableGen/CodeGenDAGPatterns.h
mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp

Removed: 




diff  --git a/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h 
b/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
index 9fc4689da22b7..1706b6936c9ea 100644
--- a/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
+++ b/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
@@ -226,7 +226,7 @@ class LRTable {
   // Count the number of values since the checkpoint.
   Word BelowKeyMask = KeyMask - 1;
   unsigned CountSinceCheckpoint =
-  llvm::countPopulation(HasValue[KeyWord] & BelowKeyMask);
+  llvm::popcount(HasValue[KeyWord] & BelowKeyMask);
   // Find the value relative to the last checkpoint.
   return Values[Checkpoints[KeyWord] + CountSinceCheckpoint];
 }

diff  --git a/clang/lib/Basic/Sanitizers.cpp b/clang/lib/Basic/Sanitizers.cpp
index 7d903c8fdf5ec..62ccdf8e9bbf2 100644
--- a/clang/lib/Basic/Sanitizers.cpp
+++ b/clang/lib/Basic/Sanitizers.cpp
@@ -61,7 +61,7 @@ namespace clang {
 unsigned SanitizerMask::countPopulation() const {
   unsigned total = 0;
   for (const auto  : maskLoToHigh)
-total += llvm::countPopulation(Val);
+total += llvm::popcount(Val);
   return total;
 }
 

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 2716cf0cc56a8..d1745d970c441 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -8970,7 +8970,7 @@ static bool DumpEnumValue(const clang::QualType 
_type, Stream *s,
   for (auto *enumerator : enum_decl->enumerators()) {
 uint64_t val = enumerator->getInitVal().getSExtValue();
 val = llvm::SignExtend64(val, 8*byte_size);
-if (llvm::countPopulation(val) != 1 && (val & ~covered_bits) != 0)
+if (llvm::popcount(val) != 1 && (val & ~covered_bits) != 0)
   can_be_bitfield = false;
 covered_bits |= val;
 ++num_enumerators;
@@ -9006,9 +9006,10 @@ static 

[Lldb-commits] [lldb] 9ce7b40 - Use the default parameters of countTrailingZeros and find{First, Last}Set (NFC)

2023-01-15 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-01-15T09:04:57-08:00
New Revision: 9ce7b40ad49f4e16c74d0a181c5cd25d21e417c8

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

LOG: Use the default parameters of countTrailingZeros and find{First,Last}Set 
(NFC)

This patch uses the default parameters of countTrailingZeros,
findFirstSet, and findLastSet, which are ZB_Width, ZB_Max, and ZB_Max,
respectively.

Added: 


Modified: 
lldb/source/Symbol/CompactUnwindInfo.cpp
llvm/lib/Support/APInt.cpp

Removed: 




diff  --git a/lldb/source/Symbol/CompactUnwindInfo.cpp 
b/lldb/source/Symbol/CompactUnwindInfo.cpp
index 822ac7b8fbe90..b82ead94faa1a 100644
--- a/lldb/source/Symbol/CompactUnwindInfo.cpp
+++ b/lldb/source/Symbol/CompactUnwindInfo.cpp
@@ -155,8 +155,7 @@ FLAGS_ANONYMOUS_ENUM(){
 #endif
 
 #define EXTRACT_BITS(value, mask)  
\
-  ((value >>   
\
-llvm::countTrailingZeros(static_cast(mask), llvm::ZB_Width)) &   
\
+  ((value >> llvm::countTrailingZeros(static_cast(mask))) &  
\
(((1 << llvm::countPopulation(static_cast(mask - 1))
 
 // constructor

diff  --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 3351c9127ee27..3b89b01f1dfd5 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -2293,13 +2293,13 @@ static inline APInt::WordType highHalf(APInt::WordType 
part) {
 /// Returns the bit number of the most significant set bit of a part.
 /// If the input number has no bits set -1U is returned.
 static unsigned partMSB(APInt::WordType value) {
-  return findLastSet(value, ZB_Max);
+  return findLastSet(value);
 }
 
 /// Returns the bit number of the least significant set bit of a part.  If the
 /// input number has no bits set -1U is returned.
 static unsigned partLSB(APInt::WordType value) {
-  return findFirstSet(value, ZB_Max);
+  return findFirstSet(value);
 }
 
 /// Sets the least significant part of a bignum to the input value, and zeroes



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


[Lldb-commits] [lldb] 91682b2 - Remove redundant initialization of std::optional (NFC)

2023-01-14 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-01-14T14:06:18-08:00
New Revision: 91682b2631b224a9f6dca9512b5e0951cc4a7762

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

LOG: Remove redundant initialization of std::optional (NFC)

Added: 


Modified: 
clang-tools-extra/clangd/ClangdServer.h
flang/include/flang/Lower/ComponentPath.h
flang/lib/Lower/Bridge.cpp
flang/lib/Lower/CallInterface.cpp
lld/MachO/LTO.cpp
lldb/include/lldb/Core/DataFileCache.h
lldb/include/lldb/Host/File.h
lldb/include/lldb/Target/TraceDumper.h
lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
mlir/lib/Dialect/SparseTensor/Transforms/SparseStorageSpecifierToLLVM.cpp
mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/ClangdServer.h 
b/clang-tools-extra/clangd/ClangdServer.h
index 360967de40ada..b87ff0bf54b70 100644
--- a/clang-tools-extra/clangd/ClangdServer.h
+++ b/clang-tools-extra/clangd/ClangdServer.h
@@ -142,7 +142,7 @@ class ClangdServer {
 /// defaults and -resource-dir compiler flag).
 /// If None, ClangdServer calls CompilerInvocation::GetResourcePath() to
 /// obtain the standard resource directory.
-std::optional ResourceDir = std::nullopt;
+std::optional ResourceDir;
 
 /// Time to wait after a new file version before computing diagnostics.
 DebouncePolicy UpdateDebounce = DebouncePolicy{

diff  --git a/flang/include/flang/Lower/ComponentPath.h 
b/flang/include/flang/Lower/ComponentPath.h
index 69960bad4e056..daf65db79dc7e 100644
--- a/flang/include/flang/Lower/ComponentPath.h
+++ b/flang/include/flang/Lower/ComponentPath.h
@@ -69,7 +69,7 @@ class ComponentPath {
   /// This optional continuation allows the generation of those dereferences.
   /// These accesses are always on Fortran entities of record types, which are
   /// implicitly in-memory objects.
-  std::optional extendCoorRef = std::nullopt;
+  std::optional extendCoorRef;
 
 private:
   void setPC(bool isImplicit);

diff  --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index b729b47465709..71e06ed347cdc 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -1043,7 +1043,7 @@ class FirConverter : public 
Fortran::lower::AbstractConverter {
 assert(stmt.typedCall && "Call was not analyzed");
 mlir::Value res{};
 if (bridge.getLoweringOptions().getLowerToHighLevelFIR()) {
-  std::optional resultType = std::nullopt;
+  std::optional resultType;
   if (stmt.typedCall->hasAlternateReturns())
 resultType = builder->getIndexType();
   auto hlfirRes = Fortran::lower::convertCallToHLFIR(

diff  --git a/flang/lib/Lower/CallInterface.cpp 
b/flang/lib/Lower/CallInterface.cpp
index 2034c7c6055e1..bc9967f3e64e6 100644
--- a/flang/lib/Lower/CallInterface.cpp
+++ b/flang/lib/Lower/CallInterface.cpp
@@ -108,7 +108,7 @@ bool Fortran::lower::CallerInterface::requireDispatchCall() 
const {
 std::optional
 Fortran::lower::CallerInterface::getPassArgIndex() const {
   unsigned passArgIdx = 0;
-  std::optional passArg = std::nullopt;
+  std::optional passArg;
   for (const auto  : getCallDescription().arguments()) {
 if (arg && arg->isPassedObject()) {
   passArg = passArgIdx;

diff  --git a/lld/MachO/LTO.cpp b/lld/MachO/LTO.cpp
index 565a66df38b97..2f5e9d06f396f 100644
--- a/lld/MachO/LTO.cpp
+++ b/lld/MachO/LTO.cpp
@@ -278,7 +278,7 @@ std::vector BitcodeCompiler::compile() {
 // not use the cached MemoryBuffer directly to ensure dsymutil does not
 // race with the cache pruner.
 StringRef objBuf;
-std::optional cachePath = std::nullopt;
+std::optional cachePath;
 if (files[i]) {
   objBuf = files[i]->getBuffer();
   cachePath = files[i]->getBufferIdentifier();

diff  --git a/lldb/include/lldb/Core/DataFileCache.h 
b/lldb/include/lldb/Core/DataFileCache.h
index 5b634435ad768..8a233afaff386 100644
--- a/lldb/include/lldb/Core/DataFileCache.h
+++ b/lldb/include/lldb/Core/DataFileCache.h
@@ -108,13 +108,13 @@ class DataFileCache {
 /// it is out of date.
 struct CacheSignature {
   /// UUID of object file or module.
-  std::optional m_uuid = std::nullopt;
+  std::optional m_uuid;
   /// Modification time of file on disk.
-  std::optional m_mod_time = std::nullopt;
+  std::optional m_mod_time;
   /// If this describes a .o file with a BSD archive, the BSD archive's
   /// modification time will be in m_mod_time, and the .o file's modification
   

[Lldb-commits] [lldb] 570117b - [lldb] Remove remaining uses of llvm::Optional (NFC)

2023-01-07 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-01-07T14:36:35-08:00
New Revision: 570117b6a5c8d1bd4e611aa3087794c215753ab7

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

LOG: [lldb] Remove remaining uses of llvm::Optional (NFC)

This patch removes the unused "using" declarations, updates comments,
and removes #include "llvm/ADT/Optional.h".

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 


Modified: 
lldb/include/lldb/Breakpoint/BreakpointID.h
lldb/include/lldb/Core/SourceLocationSpec.h
lldb/include/lldb/Core/ValueObject.h
lldb/include/lldb/Core/ValueObjectChild.h
lldb/include/lldb/Host/FileSystem.h
lldb/include/lldb/Host/linux/Host.h
lldb/include/lldb/Symbol/ObjectFile.h
lldb/include/lldb/Target/MemoryRegionInfo.h
lldb/include/lldb/Target/MemoryTagMap.h
lldb/include/lldb/Target/UnixSignals.h
lldb/include/lldb/Utility/Diagnostics.h
lldb/include/lldb/Utility/SelectHelper.h
lldb/include/lldb/Utility/Timeout.h
lldb/include/lldb/Utility/UriParser.h
lldb/include/lldb/Utility/UserIDResolver.h
lldb/source/Core/DumpDataExtractor.cpp
lldb/source/Core/IOHandler.cpp
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Plugins/ABI/ARC/ABISysV_arc.h
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h
lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h

lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
lldb/source/Plugins/Process/minidump/MinidumpParser.h
lldb/source/Plugins/Process/minidump/MinidumpTypes.h
lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h
lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Utility/SelectHelper.cpp
lldb/tools/lldb-vscode/JSONUtils.cpp
lldb/unittests/DataFormatter/StringPrinterTests.cpp
lldb/unittests/Process/minidump/MinidumpParserTest.cpp
lldb/unittests/tools/lldb-server/tests/TestClient.h

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/BreakpointID.h 
b/lldb/include/lldb/Breakpoint/BreakpointID.h
index dff901163cb0..a62323061b75 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointID.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointID.h
@@ -12,7 +12,6 @@
 #include "lldb/lldb-private.h"
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include 
 

diff  --git a/lldb/include/lldb/Core/SourceLocationSpec.h 
b/lldb/include/lldb/Core/SourceLocationSpec.h
index 3550dc02f654..9c2512bff4b7 100644
--- a/lldb/include/lldb/Core/SourceLocationSpec.h
+++ b/lldb/include/lldb/Core/SourceLocationSpec.h
@@ -11,7 +11,6 @@
 
 #include "lldb/Core/Declaration.h"
 #include "lldb/lldb-defines.h"
-#include "llvm/ADT/Optional.h"
 
 #include 
 #include 

diff  --git a/lldb/include/lldb/Core/ValueObject.h 
b/lldb/include/lldb/Core/ValueObject.h
index 398c6e914cbb..a666d0bab173 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -26,7 +26,6 @@
 #include "lldb/lldb-types.h"
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 

diff  --git a/lldb/include/lldb/Core/ValueObjectChild.h 
b/lldb/include/lldb/Core/ValueObjectChild.h
index a655911bf7bd..07b37aa8a405 100644
--- a/lldb/include/lldb/Core/ValueObjectChild.h
+++ b/lldb/include/lldb/Core/ValueObjectChild.h
@@ -18,8 +18,6 @@
 #include "lldb/lldb-private-enumerations.h"
 #include "lldb/lldb-types.h"
 
-#include "llvm/ADT/Optional.h"
-
 #include 
 #include 
 #include 

diff  --git a/lldb/include/lldb/Host/FileSystem.h 

[Lldb-commits] [lldb] 1e56f7a - [lldb] clang-format PathMappingList.cpp

2023-01-07 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-01-07T09:38:44-08:00
New Revision: 1e56f7a064099a36ddb8c7930de78fdbaab1f6cc

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

LOG: [lldb] clang-format PathMappingList.cpp

This patch clang-formats AppendPathComponents in PathMappingList.cpp.

Without this patch, clang-format would indent the body of the
following function by four spaces.

Added: 


Modified: 
lldb/source/Target/PathMappingList.cpp

Removed: 




diff  --git a/lldb/source/Target/PathMappingList.cpp 
b/lldb/source/Target/PathMappingList.cpp
index 61a4841fbe5f4..82bba8a4b1f97 100644
--- a/lldb/source/Target/PathMappingList.cpp
+++ b/lldb/source/Target/PathMappingList.cpp
@@ -174,13 +174,13 @@ bool PathMappingList::RemapPath(ConstString path,
 /// Append components to path, applying style.
 static void AppendPathComponents(FileSpec , llvm::StringRef components,
  llvm::sys::path::Style style) {
-auto component = llvm::sys::path::begin(components, style);
-auto e = llvm::sys::path::end(components);
-while (component != e &&
-llvm::sys::path::is_separator(*component->data(), style))
-  ++component;
-for (; component != e; ++component)
-  path.AppendPathComponent(*component);
+  auto component = llvm::sys::path::begin(components, style);
+  auto e = llvm::sys::path::end(components);
+  while (component != e &&
+ llvm::sys::path::is_separator(*component->data(), style))
+++component;
+  for (; component != e; ++component)
+path.AppendPathComponent(*component);
 }
 
 llvm::Optional



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


[Lldb-commits] [lldb] 81d1b61 - [lldb] Fix a warning

2022-12-22 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-12-22T12:01:35-08:00
New Revision: 81d1b61e900cefc67d59fcd3ba55e5a01e3fba78

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

LOG: [lldb] Fix a warning

This patch fixes:

  lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp:1378:16:
  warning: control reaches end of non-void function [-Wreturn-type]

Added: 


Modified: 
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp 
b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
index b78fbf7b750e6..d3b98ac7d382d 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
@@ -1399,6 +1399,7 @@ class Executor {
return inst.rd.Write(m_emu, rs1.compare(rs2) !=
APFloat::cmpGreaterThan);
  }
+ llvm_unreachable("unsupported F_CMP");
})
 .value_or(false);
   }



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


[Lldb-commits] [lldb] c12c90d - [lldb] Fix a warning

2022-12-15 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-12-15T09:18:55-08:00
New Revision: c12c90d8f599dbbe423459d2b0f08b95fc7428be

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

LOG: [lldb] Fix a warning

This patch fixes:

  lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp:1402:18:
  error: default label in switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]

Added: 


Modified: 
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp 
b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
index cb54097b52f5b..a3e604916a0ea 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
@@ -1399,8 +1399,6 @@ class Executor {
  case FLE:
return inst.rd.Write(m_emu, rs1.compare(rs2) !=
APFloat::cmpGreaterThan);
- default:
-   llvm_unreachable("Invalid F_CMP");
  }
})
 .value_or(false);



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


[Lldb-commits] [lldb] 230df79 - [lldb] Use llvm::transformOptional (NFC)

2022-12-14 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-12-14T18:36:49-08:00
New Revision: 230df792e17519071a9ef4dc0fb10132540dfbb8

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

LOG: [lldb] Use llvm::transformOptional (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 


Modified: 
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp 
b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
index b3fefb2f481fa..42b3c56dfe9f0 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
@@ -138,18 +138,18 @@ llvm::Optional Rs::Read(EmulateInstructionRISCV 
) {
 }
 
 llvm::Optional Rs::ReadI32(EmulateInstructionRISCV ) {
-  return Read(emulator).transform(
-  [](uint64_t value) { return int32_t(uint32_t(value)); });
+  return llvm::transformOptional(
+  Read(emulator), [](uint64_t value) { return int32_t(uint32_t(value)); });
 }
 
 llvm::Optional Rs::ReadI64(EmulateInstructionRISCV ) {
-  return Read(emulator).transform(
-  [](uint64_t value) { return int64_t(value); });
+  return llvm::transformOptional(Read(emulator),
+ [](uint64_t value) { return int64_t(value); 
});
 }
 
 llvm::Optional Rs::ReadU32(EmulateInstructionRISCV ) {
-  return Read(emulator).transform(
-  [](uint64_t value) { return uint32_t(value); });
+  return llvm::transformOptional(
+  Read(emulator), [](uint64_t value) { return uint32_t(value); });
 }
 
 llvm::Optional Rs::ReadAPFloat(EmulateInstructionRISCV 
,
@@ -217,8 +217,9 @@ constexpr bool is_amo_cmp =
 template 
 static std::enable_if_t || is_store, llvm::Optional>
 LoadStoreAddr(EmulateInstructionRISCV , I inst) {
-  return inst.rs1.Read(emulator).transform(
-  [&](uint64_t rs1) { return rs1 + uint64_t(SignExt(inst.imm)); });
+  return llvm::transformOptional(inst.rs1.Read(emulator), [&](uint64_t rs1) {
+return rs1 + uint64_t(SignExt(inst.imm));
+  });
 }
 
 // Read T from memory, then load its sign-extended value m_emu to register.
@@ -228,8 +229,9 @@ Load(EmulateInstructionRISCV , I inst, uint64_t 
(*extend)(E)) {
   auto addr = LoadStoreAddr(emulator, inst);
   if (!addr)
 return false;
-  return emulator.ReadMem(*addr)
-  .transform([&](T t) { return inst.rd.Write(emulator, extend(E(t))); })
+  return llvm::transformOptional(
+ emulator.ReadMem(*addr),
+ [&](T t) { return inst.rd.Write(emulator, extend(E(t))); })
   .value_or(false);
 }
 
@@ -239,8 +241,9 @@ Store(EmulateInstructionRISCV , I inst) {
   auto addr = LoadStoreAddr(emulator, inst);
   if (!addr)
 return false;
-  return inst.rs2.Read(emulator)
-  .transform([&](uint64_t rs2) { return emulator.WriteMem(*addr, rs2); 
})
+  return llvm::transformOptional(
+ inst.rs2.Read(emulator),
+ [&](uint64_t rs2) { return emulator.WriteMem(*addr, rs2); })
   .value_or(false);
 }
 
@@ -249,10 +252,12 @@ static std::enable_if_t || is_amo_bit_op 
|| is_amo_swap ||
 is_amo_cmp,
 llvm::Optional>
 AtomicAddr(EmulateInstructionRISCV , I inst, unsigned int align) {
-  return inst.rs1.Read(emulator)
-  .transform([&](uint64_t rs1) {
-return rs1 % align == 0 ? llvm::Optional(rs1) : std::nullopt;
-  })
+  return llvm::transformOptional(inst.rs1.Read(emulator),
+ [&](uint64_t rs1) {
+   return rs1 % align == 0
+  ? llvm::Optional(rs1)
+  : std::nullopt;
+ })
   .value_or(std::nullopt);
 }
 
@@ -263,12 +268,13 @@ AtomicSwap(EmulateInstructionRISCV , I inst, int 
align,
   auto addr = AtomicAddr(emulator, inst, align);
   if (!addr)
 return false;
-  return zipOpt(emulator.ReadMem(*addr), inst.rs2.Read(emulator))
-  .transform([&](auto &) {
-auto [tmp, rs2] = tup;
-return emulator.WriteMem(*addr, T(rs2)) &&
-   inst.rd.Write(emulator, extend(tmp));
-  })
+  return llvm::transformOptional(
+ zipOpt(emulator.ReadMem(*addr), inst.rs2.Read(emulator)),
+ [&](auto &) {
+   auto [tmp, rs2] = tup;
+   return emulator.WriteMem(*addr, T(rs2)) &&
+  inst.rd.Write(emulator, extend(tmp));
+ 

[Lldb-commits] [lldb] 8b5c302 - [lldb] Use std::optional instead of None in comments (NFC)

2022-12-10 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-12-10T17:06:43-08:00
New Revision: 8b5c302efb26634126bb57c20727a13ec2237558

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

LOG: [lldb] Use std::optional instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 


Modified: 
lldb/include/lldb/Target/TraceCursor.h
lldb/include/lldb/Target/UnixSignals.h
lldb/include/lldb/Utility/Predicate.h
lldb/include/lldb/Utility/TraceGDBRemotePackets.h
lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h
lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h
lldb/source/Plugins/TraceExporter/common/TraceHTR.h
lldb/source/Target/TraceDumper.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/TraceCursor.h 
b/lldb/include/lldb/Target/TraceCursor.h
index ee5014f375beb..dfb113fa8b900 100644
--- a/lldb/include/lldb/Target/TraceCursor.h
+++ b/lldb/include/lldb/Target/TraceCursor.h
@@ -278,7 +278,8 @@ class TraceCursor {
   ///
   /// \return
   /// A string representing some metadata associated with a
-  /// \a eTraceEventSyncPoint event. \b None if no metadata is available.
+  /// \a eTraceEventSyncPoint event. \b std::nullopt if no metadata is
+  /// available.
   virtual llvm::Optional GetSyncPointMetadata() const = 0;
   /// \}
 

diff  --git a/lldb/include/lldb/Target/UnixSignals.h 
b/lldb/include/lldb/Target/UnixSignals.h
index 34f4e30d13505..6646078d78352 100644
--- a/lldb/include/lldb/Target/UnixSignals.h
+++ b/lldb/include/lldb/Target/UnixSignals.h
@@ -101,8 +101,8 @@ class UnixSignals {
   uint64_t GetVersion() const;
 
   // Returns a vector of signals that meet criteria provided in arguments. Each
-  // should_[suppress|stop|notify] flag can be None  - no filtering by this
-  // flag true  - only signals that have it set to true are returned false -
+  // should_[suppress|stop|notify] flag can be std::nullopt - no filtering by
+  // this flag true - only signals that have it set to true are returned false 
-
   // only signals that have it set to true are returned
   std::vector GetFilteredSignals(llvm::Optional should_suppress,
   llvm::Optional should_stop,

diff  --git a/lldb/include/lldb/Utility/Predicate.h 
b/lldb/include/lldb/Utility/Predicate.h
index 3496aff8ee95c..9b65ec1a0094e 100644
--- a/lldb/include/lldb/Utility/Predicate.h
+++ b/lldb/include/lldb/Utility/Predicate.h
@@ -116,7 +116,8 @@ template  class Predicate {
   /// How long to wait for the condition to hold.
   ///
   /// \return
-  /// m_value if Cond(m_value) is true, None otherwise (timeout occurred).
+  /// m_value if Cond(m_value) is true, std::nullopt otherwise (timeout
+  /// occurred).
   template 
   llvm::Optional WaitFor(C Cond, const Timeout ) {
 std::unique_lock lock(m_mutex);
@@ -177,7 +178,8 @@ template  class Predicate {
   /// How long to wait for the condition to hold.
   ///
   /// \return
-  /// m_value if m_value != value, None otherwise (timeout occurred).
+  /// m_value if m_value != value, std::nullopt otherwise (timeout
+  /// occurred).
   llvm::Optional
   WaitForValueNotEqualTo(T value,
  const Timeout  = std::nullopt) {

diff  --git a/lldb/include/lldb/Utility/TraceGDBRemotePackets.h 
b/lldb/include/lldb/Utility/TraceGDBRemotePackets.h
index bfa68219ab4ef..1b35b051e438e 100644
--- a/lldb/include/lldb/Utility/TraceGDBRemotePackets.h
+++ b/lldb/include/lldb/Utility/TraceGDBRemotePackets.h
@@ -49,7 +49,7 @@ struct TraceStartRequest {
   llvm::Optional> tids;
 
   /// \return
-  /// \b true if \a tids is \a None, i.e. whole process tracing.
+  /// \b true if \a tids is \a std::nullopt, i.e. whole process tracing.
   bool IsProcessTracing() const;
 };
 

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
index 65ad74862467a..36ecc592547e9 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
@@ -46,7 +46,7 @@ getTargetIncludePaths(const llvm::Triple ) {
 }
 
 /// Returns the include path matching the given pattern for the given file
-/// path (or None if the path 

[Lldb-commits] [lldb] e0fdc56 - [lldb] Don't use Optional::getPointer (NFC)

2022-12-07 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-12-07T17:42:59-08:00
New Revision: e0fdc563585f38e7b20507b541dacbfe58aa904b

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

LOG: [lldb] Don't use Optional::getPointer (NFC)

Note that Optional::getPointer has been deprecated since commit
80145dcb011b03a7c54fdfaa3a7beeaf5c18863a on November 23, 2022.

Added: 


Modified: 

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index 6047ae5a115e8..0c2e5237f600c 100644
--- 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -194,7 +194,7 @@ Status 
GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
 #if !defined(__APPLE__)
   url << m_socket_scheme << "://";
 #endif
-  uint16_t *port_ptr = port.getPointer();
+  uint16_t *port_ptr = &*port;
   if (m_socket_protocol == Socket::ProtocolTcp) {
 std::string platform_uri = GetConnection()->GetURI();
 llvm::Optional parsed_uri = URI::Parse(platform_uri);



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


[Lldb-commits] [lldb] d920ab4 - [lldb] Use std::nullopt instead of llvm::None (NFC)

2022-12-05 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-12-05T23:32:18-08:00
New Revision: d920ab4a8bf26d3201e08460bea542fcd5ea

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

LOG: [lldb] Use std::nullopt instead of llvm::None (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 


Modified: 
lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp 
b/lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
index 0a84906641a4..a290257cb199 100644
--- a/lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
@@ -158,7 +158,7 @@ Optional
 DecodedThread::GetTSCRangeByIndex(uint64_t item_index) const {
   auto next_it = m_tscs.upper_bound(item_index);
   if (next_it == m_tscs.begin())
-return None;
+return std::nullopt;
   return prev(next_it)->second;
 }
 
@@ -166,7 +166,7 @@ Optional
 DecodedThread::GetNanosecondsRangeByIndex(uint64_t item_index) {
   auto next_it = m_nanoseconds.upper_bound(item_index);
   if (next_it == m_nanoseconds.begin())
-return None;
+return std::nullopt;
   return prev(next_it)->second;
 }
 

diff  --git a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp 
b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
index c636847714ef..cfae7b708b74 100644
--- a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
@@ -228,15 +228,15 @@ class PSBBlockAnomalyDetector {
   return item_index;
 }
 if (item_index == 0)
-  return None;
+  return std::nullopt;
 item_index--;
   }
-  return None;
+  return std::nullopt;
 };
 // Similar to most_recent_insn_index but skips the starting position.
 auto prev_insn_index = [&](uint64_t item_index) -> Optional {
   if (item_index == 0)
-return None;
+return std::nullopt;
   return most_recent_insn_index(item_index - 1);
 };
 
@@ -244,7 +244,7 @@ class PSBBlockAnomalyDetector {
 Optional last_insn_index_opt =
 *prev_insn_index(m_decoded_thread.GetItemsCount());
 if (!last_insn_index_opt)
-  return None;
+  return std::nullopt;
 uint64_t last_insn_index = *last_insn_index_opt;
 
 // We then find the most recent previous occurrence of that last
@@ -258,7 +258,7 @@ class PSBBlockAnomalyDetector {
   loop_size++;
 }
 if (!last_insn_copy_index)
-  return None;
+  return std::nullopt;
 
 // Now we check if the segment between these last positions of the last
 // instruction address is in fact a repeating loop.
@@ -269,14 +269,14 @@ class PSBBlockAnomalyDetector {
   if (Optional prev = prev_insn_index(insn_index_a))
 insn_index_a = *prev;
   else
-return None;
+return std::nullopt;
   if (Optional prev = prev_insn_index(insn_index_b))
 insn_index_b = *prev;
   else
-return None;
+return std::nullopt;
   if (m_decoded_thread.GetInstructionLoadAddress(insn_index_a) !=
   m_decoded_thread.GetInstructionLoadAddress(insn_index_b))
-return None;
+return std::nullopt;
   loop_elements_visited++;
 }
 return loop_size;
@@ -766,15 +766,15 @@ 
lldb_private::trace_intel_pt::FindLowestTSCInTrace(TraceIntelPT _intel_pt,
   uint64_t ip = LLDB_INVALID_ADDRESS;
   int status = pt_qry_sync_forward(decoder, );
   if (IsLibiptError(status))
-return None;
+return std::nullopt;
 
   while (HasEvents(status)) {
 pt_event event;
 status = pt_qry_event(decoder, , sizeof(event));
 if (IsLibiptError(status))
-  return None;
+  return std::nullopt;
 if (event.has_tsc)
   return event.tsc;
   }
-  return None;
+  return std::nullopt;
 }

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp 
b/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
index fe734c0375df..d50a73ea 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
@@ -105,7 +105,7 @@ lldb::addr_t TraceCursorIntelPT::GetLoadAddress() const {
 Optional TraceCursorIntelPT::GetHWClock() const {
   if (const Optional  = GetTSCRange())
 return range->tsc;
-  return None;
+  return 

[Lldb-commits] [lldb] 529ca5a - [lldb] Use std::nullopt instead of llvm::None (NFC)

2022-12-05 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-12-05T23:18:15-08:00
New Revision: 529ca5ad07d5b872b7c0a8e8d27ce559a5bde4f7

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

LOG: [lldb] Use std::nullopt instead of llvm::None (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 


Modified: 
lldb/source/Host/freebsd/HostInfoFreeBSD.cpp
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
lldb/source/Host/netbsd/HostInfoNetBSD.cpp
lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
lldb/source/Host/windows/HostInfoWindows.cpp
lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp
lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h
lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp

Removed: 




diff  --git a/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp 
b/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp
index f9ff45666c1e0..40efe69004439 100644
--- a/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp
+++ b/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp
@@ -38,7 +38,7 @@ llvm::Optional 
HostInfoFreeBSD::GetOSBuildString() {
   if (::sysctl(mib, 2, , _len, NULL, 0) == 0)
 return llvm::formatv("{0,8:8}", osrev).str();
 
-  return llvm::None;
+  return std::nullopt;
 }
 
 FileSpec HostInfoFreeBSD::GetProgramFileSpec() {

diff  --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm 
b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
index ddc66c8f5b50b..8dacc872d9bf2 100644
--- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -68,7 +68,7 @@
   if (::sysctl(mib, 2, cstr, _len, NULL, 0) == 0)
 return std::string(cstr, cstr_len - 1);
 
-  return llvm::None;
+  return std::nullopt;
 }
 
 static void ParseOSVersion(llvm::VersionTuple , NSString *Key) {

diff  --git a/lldb/source/Host/netbsd/HostInfoNetBSD.cpp 
b/lldb/source/Host/netbsd/HostInfoNetBSD.cpp
index 234dd3d5e1039..ad0ee20e91c37 100644
--- a/lldb/source/Host/netbsd/HostInfoNetBSD.cpp
+++ b/lldb/source/Host/netbsd/HostInfoNetBSD.cpp
@@ -51,7 +51,7 @@ llvm::Optional 
HostInfoNetBSD::GetOSBuildString() {
   if (::sysctl(mib, 2, , _len, NULL, 0) == 0)
 return llvm::formatv("{0,10:10}", osrev).str();
 
-  return llvm::None;
+  return std::nullopt;
 }
 
 FileSpec HostInfoNetBSD::GetProgramFileSpec() {

diff  --git a/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp 
b/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
index 5db843ff628d6..033685a40f5c1 100644
--- a/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
+++ b/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
@@ -38,7 +38,7 @@ llvm::Optional 
HostInfoOpenBSD::GetOSBuildString() {
   if (::sysctl(mib, 2, , _len, NULL, 0) == 0)
 return llvm::formatv("{0,8:8}", osrev).str();
 
-  return llvm::None;
+  return std::nullopt;
 }
 
 FileSpec HostInfoOpenBSD::GetProgramFileSpec() {

diff  --git a/lldb/source/Host/windows/HostInfoWindows.cpp 
b/lldb/source/Host/windows/HostInfoWindows.cpp
index c6fa96d674bb7..48b3e10984adf 100644
--- a/lldb/source/Host/windows/HostInfoWindows.cpp
+++ b/lldb/source/Host/windows/HostInfoWindows.cpp
@@ -29,10 +29,10 @@ namespace {
 class WindowsUserIDResolver : public UserIDResolver {
 protected:
   llvm::Optional DoGetUserName(id_t uid) override {
-return llvm::None;
+return std::nullopt;
   }
   llvm::Optional DoGetGroupName(id_t gid) override {
-return llvm::None;
+return std::nullopt;
   }
 };
 } // namespace
@@ -77,7 +77,7 @@ llvm::VersionTuple HostInfoWindows::GetOSVersion() {
 llvm::Optional HostInfoWindows::GetOSBuildString() {
   llvm::VersionTuple version = GetOSVersion();
   if (version.empty())
-return llvm::None;
+return std::nullopt;
 
   return "Windows NT " + version.getAsString();
 }

diff  --git 
a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp 
b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp
index 5910980a889e9..80a7303f79aef 100644
--- 
a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_x86_64.cpp
+++ 

[Lldb-commits] [lldb] 1d0ba31 - [lldb] Use std::nullopt instead of llvm::None (NFC)

2022-12-05 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-12-05T22:43:53-08:00
New Revision: 1d0ba311d88d02caa6b5e1607047fdb6c909b705

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

LOG: [lldb] Use std::nullopt instead of llvm::None (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 


Modified: 
lldb/bindings/python/python-wrapper.swig

Removed: 




diff  --git a/lldb/bindings/python/python-wrapper.swig 
b/lldb/bindings/python/python-wrapper.swig
index adac8a405ab9c..7342d9d7e82f8 100644
--- a/lldb/bindings/python/python-wrapper.swig
+++ b/lldb/bindings/python/python-wrapper.swig
@@ -946,7 +946,7 @@ llvm::Optional 
lldb_private::LLDBSWIGPythonRunScriptKeywordThread(
 lldb::ThreadSP thread) {
   if (python_function_name == NULL || python_function_name[0] == '\0' ||
   !session_dictionary_name)
-return llvm::None;
+return std::nullopt;
 
   PyErr_Cleaner py_err_cleaner(true);
 
@@ -956,7 +956,7 @@ llvm::Optional 
lldb_private::LLDBSWIGPythonRunScriptKeywordThread(
   python_function_name, dict);
 
   if (!pfunc.IsAllocated())
-return llvm::None;
+return std::nullopt;
 
   auto result = pfunc(ToSWIGWrapper(std::move(thread)), dict);
 
@@ -993,7 +993,7 @@ llvm::Optional 
lldb_private::LLDBSWIGPythonRunScriptKeywordFrame(
 lldb::StackFrameSP frame) {
   if (python_function_name == NULL || python_function_name[0] == '\0' ||
   !session_dictionary_name)
-return llvm::None;
+return std::nullopt;
 
   PyErr_Cleaner py_err_cleaner(true);
 
@@ -1003,7 +1003,7 @@ llvm::Optional 
lldb_private::LLDBSWIGPythonRunScriptKeywordFrame(
   python_function_name, dict);
 
   if (!pfunc.IsAllocated())
-return llvm::None;
+return std::nullopt;
 
   auto result = pfunc(ToSWIGWrapper(std::move(frame)), dict);
 



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


[Lldb-commits] [lldb] d5c6dc8 - [lldb] Use std::nullopt instead of None (NFC)

2022-12-05 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-12-05T20:54:05-08:00
New Revision: d5c6dc8f0269067f39c6ce6f37639dd6d8879582

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

LOG: [lldb] Use std::nullopt instead of None (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 


Modified: 
lldb/source/Plugins/ABI/X86/ABIX86.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ABI/X86/ABIX86.cpp 
b/lldb/source/Plugins/ABI/X86/ABIX86.cpp
index ee568310d387e..1306bded5f37b 100644
--- a/lldb/source/Plugins/ABI/X86/ABIX86.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABIX86.cpp
@@ -13,6 +13,7 @@
 #include "ABIX86.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/Process.h"
+#include 
 
 using namespace lldb;
 using namespace lldb_private;
@@ -130,42 +131,44 @@ typedef llvm::SmallDenseMap, 64>
 
 #define GPRh(l)
\
   {
\
-is64bit
\
-? BaseRegToRegsMap::value_type("r" l "x",  
\
-   {{GPR32, "e" l "x", llvm::None},
\
-{GPR16, l "x", llvm::None},
\
-{GPR8h, l "h", llvm::None},
\
-{GPR8, l "l", llvm::None}})
\
-: BaseRegToRegsMap::value_type("e" l "x", {{GPR16, l "x", llvm::None}, 
\
-   {GPR8h, l "h", llvm::None}, 
\
-   {GPR8, l "l", llvm::None}}) 
\
+is64bit ? BaseRegToRegsMap::value_type("r" l "x",  
\
+   {{GPR32, "e" l "x", std::nullopt},  
\
+{GPR16, l "x", std::nullopt},  
\
+{GPR8h, l "h", std::nullopt},  
\
+{GPR8, l "l", std::nullopt}})  
\
+: BaseRegToRegsMap::value_type("e" l "x",  
\
+   {{GPR16, l "x", std::nullopt},  
\
+{GPR8h, l "h", std::nullopt},  
\
+{GPR8, l "l", std::nullopt}})  
\
   }
 
 #define GPR(r16)   
\
   {
\
-is64bit
\
-? BaseRegToRegsMap::value_type("r" r16, {{GPR32, "e" r16, llvm::None}, 
\
- {GPR16, r16, llvm::None}, 
\
- {GPR8, r16 "l", llvm::None}}) 
\
-: BaseRegToRegsMap::value_type("e" r16, {{GPR16, r16, llvm::None}, 
\
- {GPR8, r16 "l", llvm::None}}) 
\
+is64bit ? BaseRegToRegsMap::value_type("r" r16,
\
+   {{GPR32, "e" r16, std::nullopt},
\
+{GPR16, r16, std::nullopt},
\
+{GPR8, r16 "l", std::nullopt}})
\
+: BaseRegToRegsMap::value_type(
\
+  "e" r16, 
\
+  {{GPR16, r16, std::nullopt}, {GPR8, r16 "l", std::nullopt}}) 
\
   }
 
 #define GPR64(n)   
\
   {
\
-BaseRegToRegsMap::value_type("r" #n, {{GPR32, "r" #n "d", llvm::None}, 
\
-  {GPR16, "r" #n "w", llvm::None}, 
\
-  {GPR8, "r" #n "l", llvm::None}}) 
\
+BaseRegToRegsMap::value_type("r" #n, {{GPR32, "r" #n "d", std::nullopt},   
\
+  {GPR16, "r" #n "w", std::nullopt},   
\
+  {GPR8, "r" #n "l", std::nullopt}})   
\
   }
 
 #define STMM(n)
\
-  { BaseRegToRegsMap::value_type("st" #n, {{MM, "mm" #n, llvm::None}}) }
+  { BaseRegToRegsMap::value_type("st" #n, {{MM, "mm" #n, std::nullopt}}) }
 
 #define YMM(n)   

[Lldb-commits] [lldb] 9ba308f - Remove "using llvm::None; " in *.cpp

2022-12-05 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-12-05T20:39:10-08:00
New Revision: 9ba308f71c92a228120f084ba0fa740b4c61247f

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

LOG: Remove "using llvm::None;" in *.cpp

These .cpp files do not use llvm::None anymore.

Since these are not header files, we can remove them pretty safely
without deprecating them first.

Added: 


Modified: 
lldb/source/Core/IOHandler.cpp
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
lldb/unittests/Signals/UnixSignalsTest.cpp

Removed: 




diff  --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index 597c423b01a7c..256feeaad279c 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lldb/source/Core/IOHandler.cpp
@@ -49,7 +49,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using llvm::None;
 using llvm::Optional;
 using llvm::StringRef;
 

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
index 419e1d7c5e4f4..cf543ce48439f 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
@@ -16,7 +16,6 @@
 using namespace lldb;
 using namespace lldb_private;
 using llvm::Optional;
-using llvm::None;
 using ParsedFunction = lldb_private::CPlusPlusNameParser::ParsedFunction;
 using ParsedName = lldb_private::CPlusPlusNameParser::ParsedName;
 namespace tok = clang::tok;

diff  --git a/lldb/unittests/Signals/UnixSignalsTest.cpp 
b/lldb/unittests/Signals/UnixSignalsTest.cpp
index 6439e9e8ad700..e4c4634862449 100644
--- a/lldb/unittests/Signals/UnixSignalsTest.cpp
+++ b/lldb/unittests/Signals/UnixSignalsTest.cpp
@@ -14,7 +14,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using llvm::None;
 
 class TestSignals : public UnixSignals {
 public:



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


[Lldb-commits] [lldb] 7760971 - Forward-declare raw_ostream (NFC)

2022-12-04 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-12-04T21:43:10-08:00
New Revision: 77609717410372e8c43aca49a268511378f58297

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

LOG: Forward-declare raw_ostream (NFC)

This patch adds forward declarations of raw_ostream to those header
files that are relying on the forward declaration of raw_ostream in
llvm/include/llvm/ADT/Optional.h.

I'm planning to move operator<< for Optional and std::optional
from Optional.h to llvm/include/llvm/Support/raw_ostream.h.  Once I do
so, we no longer need to forward-declare raw_ostream in Optional.h.

Added: 


Modified: 
clang/include/clang/APINotes/Types.h
lldb/include/lldb/Utility/UriParser.h
llvm/include/llvm/IR/Attributes.h
llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h

Removed: 




diff  --git a/clang/include/clang/APINotes/Types.h 
b/clang/include/clang/APINotes/Types.h
index eb27ffccc17f..8dfc3bf4f1e5 100644
--- a/clang/include/clang/APINotes/Types.h
+++ b/clang/include/clang/APINotes/Types.h
@@ -15,6 +15,10 @@
 #include 
 #include 
 
+namespace llvm {
+class raw_ostream;
+} // namespace llvm
+
 namespace clang {
 namespace api_notes {
 enum class RetainCountConventionKind {

diff  --git a/lldb/include/lldb/Utility/UriParser.h 
b/lldb/include/lldb/Utility/UriParser.h
index 3c0f8d2273d0..035e44d6a23c 100644
--- a/lldb/include/lldb/Utility/UriParser.h
+++ b/lldb/include/lldb/Utility/UriParser.h
@@ -12,6 +12,10 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 
+namespace llvm {
+class raw_ostream;
+} // namespace llvm
+
 namespace lldb_private {
 
 struct URI {

diff  --git a/llvm/include/llvm/IR/Attributes.h 
b/llvm/include/llvm/IR/Attributes.h
index cb7900343d67..c4e12a673ed2 100644
--- a/llvm/include/llvm/IR/Attributes.h
+++ b/llvm/include/llvm/IR/Attributes.h
@@ -44,6 +44,7 @@ class Function;
 class LLVMContext;
 class MemoryEffects;
 class Type;
+class raw_ostream;
 
 enum class AllocFnKind : uint64_t {
   Unknown = 0,

diff  --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h 
b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
index 3b4ff548360f..90c771513a61 100644
--- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
+++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
@@ -31,6 +31,7 @@ class MCRegisterInfo;
 class MCSubtargetInfo;
 class StringRef;
 class Triple;
+class raw_ostream;
 
 namespace amdhsa {
 struct kernel_descriptor_t;



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


[Lldb-commits] [lldb] 768cae4 - [lldb] Use std::nullopt instead of None in comments (NFC)

2022-12-04 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-12-04T20:11:39-08:00
New Revision: 768cae4a5ab3a564b25ed36c379423f71b42d9d0

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

LOG: [lldb] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 


Modified: 
lldb/include/lldb/Breakpoint/BreakpointID.h
lldb/include/lldb/Core/Communication.h
lldb/include/lldb/Core/SourceLocationSpec.h
lldb/include/lldb/Core/ThreadedCommunication.h
lldb/include/lldb/Interpreter/CommandObject.h
lldb/include/lldb/Symbol/Function.h
lldb/include/lldb/Target/MemoryTagMap.h
lldb/include/lldb/Target/PathMappingList.h
lldb/include/lldb/Target/TraceCursor.h
lldb/include/lldb/Target/TraceDumper.h
lldb/include/lldb/Utility/FileSpec.h
lldb/include/lldb/Utility/StringExtractorGDBRemote.h
lldb/include/lldb/Utility/Timeout.h
lldb/include/lldb/Utility/TraceGDBRemotePackets.h
lldb/source/API/SBCommandInterpreter.cpp
lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
lldb/source/Expression/Materializer.cpp
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h
lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h
lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h
lldb/source/Target/MemoryTagMap.cpp

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/BreakpointID.h 
b/lldb/include/lldb/Breakpoint/BreakpointID.h
index 64432f2d3cd5c..d3d75f81fd34e 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointID.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointID.h
@@ -55,7 +55,7 @@ class BreakpointID {
   /// A string containing JUST the breakpoint description.
   /// \return
   /// If \p input was not a valid breakpoint ID string, returns
-  /// \b llvm::None.  Otherwise returns a BreakpointID with members filled
+  /// \b std::nullopt.  Otherwise returns a BreakpointID with members 
filled
   /// out accordingly.
   static llvm::Optional
   ParseCanonicalReference(llvm::StringRef input);

diff  --git a/lldb/include/lldb/Core/Communication.h 
b/lldb/include/lldb/Core/Communication.h
index a0151527fe5de..f5f636816cb4f 100644
--- a/lldb/include/lldb/Core/Communication.h
+++ b/lldb/include/lldb/Core/Communication.h
@@ -100,7 +100,7 @@ class Communication {
   /// number of bytes that can be placed into \a dst.
   ///
   /// \param[in] timeout
-  /// A timeout value or llvm::None for no timeout.
+  /// A timeout value or std::nullopt for no timeout.
   ///
   /// \return
   /// The number of bytes actually read.

diff  --git a/lldb/include/lldb/Core/SourceLocationSpec.h 
b/lldb/include/lldb/Core/SourceLocationSpec.h
index 3b58b2818d22f..5463b402e6d5a 100644
--- a/lldb/include/lldb/Core/SourceLocationSpec.h
+++ b/lldb/include/lldb/Core/SourceLocationSpec.h
@@ -29,7 +29,7 @@ class SourceLocationSpec {
   /// Constructor.
   ///
   /// Takes a \a file_spec with a \a line number and a \a column number. If
-  /// \a column is null or not provided, it is set to llvm::None.
+  /// \a column is null or not provided, it is set to std::nullopt.
   ///
   /// \param[in] file_spec
   /// The full or partial path to a file.

diff  --git a/lldb/include/lldb/Core/ThreadedCommunication.h 
b/lldb/include/lldb/Core/ThreadedCommunication.h
index b7412c796f107..2e3afde3c0582 100644
--- a/lldb/include/lldb/Core/ThreadedCommunication.h
+++ b/lldb/include/lldb/Core/ThreadedCommunication.h
@@ -131,7 +131,7 @@ class ThreadedCommunication : public Communication, public 
Broadcaster {
   /// number of bytes that can be placed into \a dst.
   ///
   /// \param[in] timeout
-  /// A timeout value or llvm::None for no timeout.
+  /// A timeout value or std::nullopt for no timeout.
   ///
   /// \return
   /// The number of bytes actually read.

diff  --git a/lldb/include/lldb/Interpreter/CommandObject.h 

[Lldb-commits] [lldb] d2a6114 - [lldb/unittests] Use std::nullopt instead of None (NFC)

2022-12-04 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-12-04T16:51:27-08:00
New Revision: d2a6114f27016065f6c7e7d39c0412e7d8d5e03b

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

LOG: [lldb/unittests] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 


Modified: 
lldb/unittests/Core/SourceLocationSpecTest.cpp
lldb/unittests/DataFormatter/StringPrinterTests.cpp
lldb/unittests/Host/SocketTest.cpp
lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp
lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
lldb/unittests/Process/minidump/MinidumpParserTest.cpp
lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
lldb/unittests/Signals/UnixSignalsTest.cpp
lldb/unittests/Symbol/TestLineEntry.cpp
lldb/unittests/Symbol/TestTypeSystemClang.cpp
lldb/unittests/SymbolFile/DWARF/DWARFIndexCachingTest.cpp
lldb/unittests/Target/MemoryTagMapTest.cpp
lldb/unittests/Utility/FileSpecTest.cpp
lldb/unittests/Utility/ListenerTest.cpp
lldb/unittests/Utility/PredicateTest.cpp
lldb/unittests/Utility/ProcessInstanceInfoTest.cpp
lldb/unittests/Utility/RegisterValueTest.cpp
lldb/unittests/Utility/StringExtractorGDBRemoteTest.cpp
lldb/unittests/Utility/TimeoutTest.cpp
lldb/unittests/Utility/UriParserTest.cpp
lldb/unittests/Utility/UserIDResolverTest.cpp
lldb/unittests/tools/lldb-server/tests/TestClient.cpp

Removed: 




diff  --git a/lldb/unittests/Core/SourceLocationSpecTest.cpp 
b/lldb/unittests/Core/SourceLocationSpecTest.cpp
index 089c7640cc010..0cf1683906eed 100644
--- a/lldb/unittests/Core/SourceLocationSpecTest.cpp
+++ b/lldb/unittests/Core/SourceLocationSpecTest.cpp
@@ -51,7 +51,7 @@ TEST(SourceLocationSpecTest, FileLineColumnComponents) {
   EXPECT_TRUE(without_column);
   EXPECT_EQ(fs, without_column.GetFileSpec());
   EXPECT_EQ(line, without_column.GetLine().value_or(0));
-  EXPECT_EQ(llvm::None, without_column.GetColumn());
+  EXPECT_EQ(std::nullopt, without_column.GetColumn());
   EXPECT_FALSE(without_column.GetCheckInlines());
   EXPECT_TRUE(without_column.GetExactMatch());
   EXPECT_STREQ("check inlines = false, exact match = true, decl = /foo/bar:19",

diff  --git a/lldb/unittests/DataFormatter/StringPrinterTests.cpp 
b/lldb/unittests/DataFormatter/StringPrinterTests.cpp
index a7fa6e8a13190..24c0ff41b5db2 100644
--- a/lldb/unittests/DataFormatter/StringPrinterTests.cpp
+++ b/lldb/unittests/DataFormatter/StringPrinterTests.cpp
@@ -41,7 +41,7 @@ static Optional format(StringRef input,
  endian::InlHostByteOrder(), sizeof(void *)));
   const bool success = StringPrinter::ReadBufferAndDumpToStream(opts);
   if (!success)
-return llvm::None;
+return std::nullopt;
   return out.GetString().str();
 }
 

diff  --git a/lldb/unittests/Host/SocketTest.cpp 
b/lldb/unittests/Host/SocketTest.cpp
index a209600141ff3..78e1e11df0656 100644
--- a/lldb/unittests/Host/SocketTest.cpp
+++ b/lldb/unittests/Host/SocketTest.cpp
@@ -179,7 +179,7 @@ TEST_P(SocketTest, DomainGetConnectURI) {
   CreateDomainConnectedSockets(domain_path, _a_up, _b_up);
 
   std::string uri(socket_a_up->GetRemoteConnectionURI());
-  EXPECT_EQ((URI{"unix-connect", "", llvm::None, domain_path}),
+  EXPECT_EQ((URI{"unix-connect", "", std::nullopt, domain_path}),
 URI::Parse(uri));
 
   EXPECT_EQ(socket_b_up->GetRemoteConnectionURI(), "");

diff  --git a/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp 
b/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
index 519dbd22a0b81..68a8980d692a4 100644
--- a/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
+++ b/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp
@@ -25,9 +25,9 @@ TEST(Record, classify) {
   EXPECT_EQ(Record::StackWin, Record::classify("STACK WIN"));
 
   // Any obviously incorrect lines will be classified as such.
-  EXPECT_EQ(llvm::None, Record::classify("STACK"));
-  EXPECT_EQ(llvm::None, Record::classify("STACK CODE_ID"));
-  EXPECT_EQ(llvm::None, Record::classify("CODE_ID"));
+  EXPECT_EQ(std::nullopt, Record::classify("STACK"));
+  EXPECT_EQ(std::nullopt, Record::classify("STACK CODE_ID"));
+  EXPECT_EQ(std::nullopt, Record::classify("CODE_ID"));
 
   // Any line which does not start with a known keyword will be classified as a
   // line record, as those are the 

[Lldb-commits] [lldb] a2f1879 - [lldb] Fix a warning

2022-11-23 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-11-23T15:55:05-08:00
New Revision: a2f1879c2d8ad5e6c2773d77d9f6d3fdaffbe3ea

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

LOG: [lldb] Fix a warning

This patch fixes:

  lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp:105:18:
  warning: comparison of unsigned expression in ‘>= 0’ is always true
  [-Wtype-limits]

Added: 


Modified: 
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp 
b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
index ca7adff785d99..7c29bce147715 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
@@ -102,7 +102,7 @@ static uint32_t GPREncodingToLLDB(uint32_t reg_encode) {
 }
 
 static uint32_t FPREncodingToLLDB(uint32_t reg_encode) {
-  if (reg_encode >= 0 && reg_encode <= 31)
+  if (reg_encode <= 31)
 return fpr_f0_riscv + reg_encode;
   return LLDB_INVALID_REGNUM;
 }



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


[Lldb-commits] [lldb] 34bcadc - Use std::nullopt_t instead of NoneType (NFC)

2022-11-23 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-11-23T14:16:04-08:00
New Revision: 34bcadc38c2240807cd079fd03b93fc96cf64c84

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

LOG: Use std::nullopt_t instead of NoneType (NFC)

This patch replaces those occurrences of NoneType that would trigger
an error if the definition of NoneType were missing in None.h.

To keep this patch focused, I am deliberately not replacing None with
std::nullopt in this patch or updating comments.  They will be
addressed in subsequent patches.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

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

Added: 


Modified: 
bolt/lib/Profile/DataAggregator.cpp
bolt/lib/Profile/YAMLProfileWriter.cpp
clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
clang-tools-extra/clangd/support/ThreadsafeFS.h
clang/include/clang/Analysis/Analyses/PostOrderCFGView.h
clang/include/clang/Basic/DirectoryEntry.h
clang/include/clang/Basic/FileEntry.h
clang/include/clang/Sema/Template.h
clang/lib/AST/ExprConstant.cpp
clang/lib/Tooling/Transformer/Parsing.cpp
lldb/include/lldb/Utility/Timeout.h
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
llvm/include/llvm/ADT/ArrayRef.h
llvm/include/llvm/ADT/Optional.h
llvm/include/llvm/ADT/StringMapEntry.h
llvm/include/llvm/ADT/StringSet.h
llvm/include/llvm/FuzzMutate/OpDescriptor.h
llvm/include/llvm/Support/SMLoc.h
llvm/lib/CodeGen/MIRParser/MILexer.cpp
llvm/lib/Support/Optional.cpp
mlir/include/mlir/IR/OpDefinition.h
mlir/include/mlir/IR/OperationSupport.h
mlir/include/mlir/Support/Timing.h
mlir/lib/Support/Timing.cpp

Removed: 




diff  --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 1cf2e72fba8d2..3befa8bac2d98 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2233,7 +2233,7 @@ DataAggregator::writeAggregatedFile(StringRef 
OutputFilename) const {
 OutFile << "boltedcollection\n";
   if (opts::BasicAggregation) {
 OutFile << "no_lbr";
-for (const StringMapEntry  : EventNames)
+for (const StringMapEntry  : EventNames)
   OutFile << " " << Entry.getKey();
 OutFile << "\n";
 

diff  --git a/bolt/lib/Profile/YAMLProfileWriter.cpp 
b/bolt/lib/Profile/YAMLProfileWriter.cpp
index 03f3ac36f373f..84c060fef136a 100644
--- a/bolt/lib/Profile/YAMLProfileWriter.cpp
+++ b/bolt/lib/Profile/YAMLProfileWriter.cpp
@@ -161,7 +161,7 @@ std::error_code YAMLProfileWriter::writeProfile(const 
RewriteInstance ) {
   StringSet<> EventNames = RI.getProfileReader()->getEventNames();
   if (!EventNames.empty()) {
 std::string Sep;
-for (const StringMapEntry  : EventNames) {
+for (const StringMapEntry  : EventNames) {
   BP.Header.EventNames += Sep + EventEntry.first().str();
   Sep = ",";
 }

diff  --git a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp 
b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
index 73b47dca20930..ba1f4d4ebe2ef 100644
--- a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
@@ -214,7 +214,7 @@ class NameLookup {
 
 public:
   explicit NameLookup(const NamedDecl *ND) : Data(ND, false) {}
-  explicit NameLookup(llvm::NoneType) : Data(nullptr, true) {}
+  explicit NameLookup(std::nullopt_t) : Data(nullptr, true) {}
   explicit NameLookup(std::nullptr_t) : Data(nullptr, false) {}
   NameLookup() : NameLookup(nullptr) {}
 

diff  --git a/clang-tools-extra/clangd/support/ThreadsafeFS.h 
b/clang-tools-extra/clangd/support/ThreadsafeFS.h
index b518c03e36969..7268ac742ce36 100644
--- a/clang-tools-extra/clangd/support/ThreadsafeFS.h
+++ b/clang-tools-extra/clangd/support/ThreadsafeFS.h
@@ -30,7 +30,7 @@ class ThreadsafeFS {
 
   /// Obtain a vfs::FileSystem with an arbitrary initial working directory.
   llvm::IntrusiveRefCntPtr
-  view(llvm::NoneType CWD) const {
+  view(std::nullopt_t CWD) const {
 return viewImpl();
   }
 

diff  --git a/clang/include/clang/Analysis/Analyses/PostOrderCFGView.h 
b/clang/include/clang/Analysis/Analyses/PostOrderCFGView.h
index 1000298945602..0b306d14be4d8 100644
--- a/clang/include/clang/Analysis/Analyses/PostOrderCFGView.h
+++ b/clang/include/clang/Analysis/Analyses/PostOrderCFGView.h
@@ -48,7 +48,7 @@ class PostOrderCFGView : public ManagedAnalysis {
 
 /// Set the bit associated with a particular CFGBlock.
 /// This is the important method for the SetType template parameter.
-std::pair 

[Lldb-commits] [lldb] c903136 - [lldb] Use Optional::has_value instead of Optional::hasValue (NFC)

2022-11-19 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-11-19T23:22:48-08:00
New Revision: c903136f195b65f175797eaf856213b1a6826fa2

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

LOG: [lldb] Use Optional::has_value instead of Optional::hasValue (NFC)

Added: 


Modified: 
lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp 
b/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
index 21b1aacfccc62..0a819916fc75b 100644
--- a/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.cpp
@@ -36,7 +36,7 @@ Expected> ThreadDecoder::FindLowestTSC() {
 }
 
 Expected ThreadDecoder::Decode() {
-  if (!m_decoded_thread.hasValue()) {
+  if (!m_decoded_thread.has_value()) {
 if (Expected decoded_thread = DoDecode()) {
   m_decoded_thread = *decoded_thread;
 } else {

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp 
b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
index 0e664fd91d80f..c30d6adf3e0f5 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleLoader.cpp
@@ -34,14 +34,14 @@ Error TraceIntelPTBundleLoader::ParseModule(Target ,
   auto do_parse = [&]() -> Error {
 FileSpec system_file_spec(module.system_path);
 
-FileSpec local_file_spec(module.file.hasValue() ? *module.file
-: module.system_path);
+FileSpec local_file_spec(module.file.has_value() ? *module.file
+ : module.system_path);
 
 ModuleSpec module_spec;
 module_spec.GetFileSpec() = local_file_spec;
 module_spec.GetPlatformFileSpec() = system_file_spec;
 
-if (module.uuid.hasValue())
+if (module.uuid.has_value())
   module_spec.GetUUID().SetFromStringRef(*module.uuid);
 
 Status error;



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


[Lldb-commits] [lldb] 39f0124 - [lldb] Fix a warning

2022-10-15 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-10-15T12:32:20-07:00
New Revision: 39f01240e76678fa6385d36e7a96670677a26d65

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

LOG: [lldb] Fix a warning

This patch fixes:

  lldb/source/Commands/CommandObjectThread.cpp:66:61: warning:
  comparison of unsigned expression in ‘< 0’ is always false
  [-Wtype-limits]

Added: 


Modified: 
lldb/source/Commands/CommandObjectThread.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectThread.cpp 
b/lldb/source/Commands/CommandObjectThread.cpp
index 7b739fef0a7a4..2a22900793ce5 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -63,7 +63,7 @@ class CommandObjectThreadBacktrace : public 
CommandObjectIterateOverThreads {
 
   switch (short_option) {
   case 'c':
-if (option_arg.getAsInteger(0, m_count) || (m_count < 0)) {
+if (option_arg.getAsInteger(0, m_count)) {
   m_count = UINT32_MAX;
   error.SetErrorStringWithFormat(
   "invalid integer value for option '%c'", short_option);



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


[Lldb-commits] [lldb] 921a4d5 - [lldb] Use std::underlying_type_t (NFC)

2022-10-15 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-10-15T12:11:56-07:00
New Revision: 921a4d5be4bbe3c337419dfcc313b3eb892c2870

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

LOG: [lldb] Use std::underlying_type_t (NFC)

Added: 


Modified: 
lldb/include/lldb/lldb-enumerations.h
lldb/source/Breakpoint/BreakpointResolverName.cpp

Removed: 




diff  --git a/lldb/include/lldb/lldb-enumerations.h 
b/lldb/include/lldb/lldb-enumerations.h
index 2ac1a74214b4..9f1183a06b53 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -20,18 +20,15 @@
 // this entire block, as it is not necessary for swig processing.
 #define LLDB_MARK_AS_BITMASK_ENUM(Enum)
\
   constexpr Enum operator|(Enum a, Enum b) {   
\
-return static_cast(  
\
-static_cast::type>(a) | 
\
-static_cast::type>(b)); 
\
+return static_cast(static_cast>(a) |
\
+ static_cast>(b));
\
   }
\
   constexpr Enum operator&(Enum a, Enum b) {   
\
-return static_cast(  
\
-static_cast::type>(a) & 
\
-static_cast::type>(b)); 
\
+return static_cast(static_cast>(a) &
\
+ static_cast>(b));
\
   }
\
   constexpr Enum operator~(Enum a) {   
\
-return static_cast(  
\
-~static_cast::type>(a));
\
+return static_cast(~static_cast>(a));   
\
   }
\
   inline Enum |=(Enum , Enum b) {   
\
 a = a | b; 
\

diff  --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp 
b/lldb/source/Breakpoint/BreakpointResolverName.cpp
index dbaeec9c9afb..5f42a96cd8c2 100644
--- a/lldb/source/Breakpoint/BreakpointResolverName.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp
@@ -164,7 +164,7 @@ BreakpointResolver 
*BreakpointResolverName::CreateFromStructuredData(
 error.SetErrorString("BRN::CFSD: name entry is not a string.");
 return nullptr;
   }
-  std::underlying_type::type fnt;
+  std::underlying_type_t fnt;
   success = names_mask_array->GetItemAtIndexAsInteger(i, fnt);
   if (!success) {
 error.SetErrorString("BRN::CFSD: name mask entry is not an integer.");



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


[Lldb-commits] [lldb] 8600014 - [lldb] Use Optional::{has_value, value, value_or}

2022-09-23 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-09-23T09:10:40-07:00
New Revision: 8600014b78d314e53fd941f93811492caeba2d0f

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

LOG: [lldb] Use Optional::{has_value,value,value_or}

Added: 


Modified: 
lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
lldb/source/Target/PathMappingList.cpp

Removed: 




diff  --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp 
b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
index f911697f5ddc5..9e1fbcb70dc19 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -240,13 +240,13 @@ void BreakpointResolverFileLine::DeduceSourceMapping(
 
 // Adding back any potentially reverse mapping stripped prefix.
 // for new_mapping_to.
-if (m_removed_prefix_opt.hasValue())
-  llvm::sys::path::append(new_mapping_to, m_removed_prefix_opt.getValue());
+if (m_removed_prefix_opt.has_value())
+  llvm::sys::path::append(new_mapping_to, m_removed_prefix_opt.value());
 
 llvm::Optional new_mapping_from_opt =
 check_suffix(sc_file_dir, request_file_dir, case_sensitive);
 if (new_mapping_from_opt) {
-  new_mapping_from = new_mapping_from_opt.getValue();
+  new_mapping_from = new_mapping_from_opt.value();
   if (new_mapping_to.empty())
 new_mapping_to = ".";
 } else {
@@ -254,7 +254,7 @@ void BreakpointResolverFileLine::DeduceSourceMapping(
   check_suffix(request_file_dir, sc_file_dir, case_sensitive);
   if (new_mapping_to_opt) {
 new_mapping_from = ".";
-llvm::sys::path::append(new_mapping_to, new_mapping_to_opt.getValue());
+llvm::sys::path::append(new_mapping_to, new_mapping_to_opt.value());
   }
 }
 

diff  --git a/lldb/source/Target/PathMappingList.cpp 
b/lldb/source/Target/PathMappingList.cpp
index d2d60822b237e..cbee5934846a0 100644
--- a/lldb/source/Target/PathMappingList.cpp
+++ b/lldb/source/Target/PathMappingList.cpp
@@ -229,7 +229,7 @@ PathMappingList::ReverseRemapPath(const FileSpec , 
FileSpec ) const {
 if (!path_ref.consume_front(it.second.GetStringRef()))
   continue;
 auto orig_file = it.first.GetStringRef();
-auto orig_style = FileSpec::GuessPathStyle(orig_file).getValueOr(
+auto orig_style = FileSpec::GuessPathStyle(orig_file).value_or(
 llvm::sys::path::Style::native);
 fixed.SetFile(orig_file, orig_style);
 AppendPathComponents(fixed, path_ref, orig_style);



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


[Lldb-commits] [lldb] 2078350 - Use std::make_unsigned_t (NFC)

2022-09-18 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-09-18T18:41:02-07:00
New Revision: 207835064514e968e40685bdc48b7bb0fc5c2779

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

LOG: Use std::make_unsigned_t (NFC)

Added: 


Modified: 

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
llvm/include/llvm/ADT/Bitfields.h

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
index 7ee15fd7af4e5..c2c01d1e46053 100644
--- 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -772,7 +772,7 @@ template 
 static void fill_clamp(T , U src, typename T::value_type fallback) {
   static_assert(std::is_unsigned::value,
 "Destination type must be unsigned.");
-  using UU = typename std::make_unsigned::type;
+  using UU = std::make_unsigned_t;
   constexpr auto T_max = std::numeric_limits::max();
   dest = src >= 0 && static_cast(src) <= T_max ? src : fallback;
 }

diff  --git a/llvm/include/llvm/ADT/Bitfields.h 
b/llvm/include/llvm/ADT/Bitfields.h
index aaf876d896d4c..045704a470b9c 100644
--- a/llvm/include/llvm/ADT/Bitfields.h
+++ b/llvm/include/llvm/ADT/Bitfields.h
@@ -96,7 +96,7 @@ template  struct BitPatterns {
   /// undefined operations over signed types (e.g. Bitwise shift operators).
   /// Moreover same size casting from unsigned to signed is well defined but 
not
   /// the other way around.
-  using Unsigned = typename std::make_unsigned::type;
+  using Unsigned = std::make_unsigned_t;
   static_assert(sizeof(Unsigned) == sizeof(T), "Types must have same size");
 
   static constexpr unsigned TypeBits = sizeof(Unsigned) * CHAR_BIT;



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


[Lldb-commits] [lldb] 4535dbd - [lldb] Fix a warning

2022-09-01 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-09-01T22:14:25-07:00
New Revision: 4535dbd55962989e16f0f7208fae9ce75ed9863c

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

LOG: [lldb] Fix a warning

This patch fixes:

  lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h:51:5:
  error: default label in switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]

Added: 


Modified: 
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h

Removed: 




diff  --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h 
b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
index 2ed049ffac990..07dfcf692fca8 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
@@ -48,8 +48,6 @@ class EmulateInstructionRISCV : public EmulateInstruction {
 case eInstructionTypePrologueEpilogue:
 case eInstructionTypeAll:
   return false;
-default:
-  llvm_unreachable("Unhandled instruction type");
 }
 llvm_unreachable("Fully covered switch above!");
   }



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


[Lldb-commits] [lldb] 0660249 - [lldb] Remove a redundaunt return statement (NFC)

2022-08-27 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-08-27T21:21:05-07:00
New Revision: 0660249cca89208f042b13913bf0bb5485527ec1

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

LOG: [lldb] Remove a redundaunt return statement (NFC)

Identified with readability-redundant-control-flow.

Added: 


Modified: 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 2178db8e9b7c5..7717f22f97885 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -1259,8 +1259,6 @@ void 
ScriptInterpreterPythonImpl::SetWatchpointCommandCallback(
 wp_options->SetCallback(
 ScriptInterpreterPythonImpl::WatchpointCallbackFunction, baton_sp);
   }
-
-  return;
 }
 
 Status ScriptInterpreterPythonImpl::ExportFunctionDefinitionToInterpreter(



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


[Lldb-commits] [lldb] 920ffab - [lldb] Use nullptr instead of NULL (NFC)

2022-08-27 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-08-27T21:21:07-07:00
New Revision: 920ffab9cccfe1a5dde0368d252ed50e5dbcd6a5

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

LOG: [lldb] Use nullptr instead of NULL (NFC)

Identified with modernize-use-nullptr.

Added: 


Modified: 
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index ae61736fbbb3..f0f5debcab8f 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -923,7 +923,7 @@ const char *PythonException::toCString() const {
 
 PythonException::PythonException(const char *caller) {
   assert(PyErr_Occurred());
-  m_exception_type = m_exception = m_traceback = m_repr_bytes = NULL;
+  m_exception_type = m_exception = m_traceback = m_repr_bytes = nullptr;
   PyErr_Fetch(_exception_type, _exception, _traceback);
   PyErr_NormalizeException(_exception_type, _exception, _traceback);
   PyErr_Clear();
@@ -951,7 +951,7 @@ void PythonException::Restore() {
   } else {
 PyErr_SetString(PyExc_Exception, toCString());
   }
-  m_exception_type = m_exception = m_traceback = NULL;
+  m_exception_type = m_exception = m_traceback = nullptr;
 }
 
 PythonException::~PythonException() {

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
index 2753847f39f8..3cbd3b5efecc 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
@@ -40,7 +40,7 @@ static char *simple_readline(FILE *stdin, FILE *stdout, const 
char *prompt) {
   char *line = readline(prompt);
   if (!line) {
 char *ret = (char *)PyMem_RawMalloc(1);
-if (ret != NULL)
+if (ret != nullptr)
   *ret = '\0';
 return ret;
   }

diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 7717f22f9788..d530936484b9 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -96,7 +96,7 @@ struct InitializePythonRAII {
 // Python's readline is incompatible with libedit being linked into lldb.
 // Provide a patched version local to the embedded interpreter.
 bool ReadlinePatched = false;
-for (auto *p = PyImport_Inittab; p->name != NULL; p++) {
+for (auto *p = PyImport_Inittab; p->name != nullptr; p++) {
   if (strcmp(p->name, "readline") == 0) {
 p->initfunc = initlldb_readline;
 break;



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


[Lldb-commits] [lldb] ce377df - Ensure newlines at the end of files (NFC)

2022-08-20 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-08-20T21:18:23-07:00
New Revision: ce377df57ee5c72f05f2d60d4850de01a5456685

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

LOG: Ensure newlines at the end of files (NFC)

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp
llvm/include/llvm/ExecutionEngine/JITLink/i386.h
llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
llvm/lib/ExecutionEngine/JITLink/i386.cpp
llvm/lib/Support/ARMBuildAttrs.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp
index d98e3c4c761a3..3c10d4aa314b2 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.cpp
@@ -745,4 +745,4 @@ 
lldb_private::npdb::GetRegisterSize(llvm::codeview::RegisterId register_id) {
 default:
   return 0;
   }
-}
\ No newline at end of file
+}

diff  --git a/llvm/include/llvm/ExecutionEngine/JITLink/i386.h 
b/llvm/include/llvm/ExecutionEngine/JITLink/i386.h
index c43f32b9016fd..b8671168bd8a5 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/i386.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/i386.h
@@ -35,4 +35,4 @@ const char *getEdgeKindName(Edge::Kind K);
 } // namespace jitlink
 } // namespace llvm
 
-#endif // LLVM_EXECUTIONENGINE_JITLINK_I386_H
\ No newline at end of file
+#endif // LLVM_EXECUTIONENGINE_JITLINK_I386_H

diff  --git a/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp 
b/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
index 456a80e1efba5..3994c2223a7c7 100644
--- a/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp
@@ -111,4 +111,4 @@ void link_ELF_i386(std::unique_ptr G,
 }
 
 } // namespace jitlink
-} // namespace llvm
\ No newline at end of file
+} // namespace llvm

diff  --git a/llvm/lib/ExecutionEngine/JITLink/i386.cpp 
b/llvm/lib/ExecutionEngine/JITLink/i386.cpp
index ef5b7a0ba8fc7..c086830827fbe 100644
--- a/llvm/lib/ExecutionEngine/JITLink/i386.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/i386.cpp
@@ -27,4 +27,4 @@ const char *getEdgeKindName(Edge::Kind K) {
 }
 } // namespace i386
 } // namespace jitlink
-} // namespace llvm
\ No newline at end of file
+} // namespace llvm

diff  --git a/llvm/lib/Support/ARMBuildAttrs.cpp 
b/llvm/lib/Support/ARMBuildAttrs.cpp
index 11fe0c6d49979..26f189302e373 100644
--- a/llvm/lib/Support/ARMBuildAttrs.cpp
+++ b/llvm/lib/Support/ARMBuildAttrs.cpp
@@ -75,4 +75,4 @@ static const TagNameItem tagData[] = {
 constexpr TagNameMap ARMAttributeTags{tagData};
 const TagNameMap ::ARMBuildAttrs::getARMAttributeTags() {
   return ARMAttributeTags;
-}
\ No newline at end of file
+}



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


[Lldb-commits] [lldb] 347c462 - [lldb] Use Any::has_value instead of ANy::hasValue (NFC)

2022-08-20 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-08-20T07:28:06-07:00
New Revision: 347c462e97bbb22ef9d95ef2f161e2eb82843f8e

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

LOG: [lldb] Use Any::has_value instead of ANy::hasValue (NFC)

Added: 


Modified: 
lldb/include/lldb/Core/RichManglingContext.h
lldb/source/Core/RichManglingContext.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/RichManglingContext.h 
b/lldb/include/lldb/Core/RichManglingContext.h
index ecd11e93f044d..9636b7898f8f5 100644
--- a/lldb/include/lldb/Core/RichManglingContext.h
+++ b/lldb/include/lldb/Core/RichManglingContext.h
@@ -86,7 +86,7 @@ class RichManglingContext {
   /// trait to deduce \a ParserT from a given InfoProvider, but unfortunately 
we
   /// can't access CPlusPlusLanguage::MethodName from within the header.
   template  static ParserT *get(llvm::Any parser) {
-assert(parser.hasValue());
+assert(parser.has_value());
 assert(llvm::any_isa(parser));
 return llvm::any_cast(parser);
   }

diff  --git a/lldb/source/Core/RichManglingContext.cpp 
b/lldb/source/Core/RichManglingContext.cpp
index 64b18b401f2d6..08c9b280b8ccb 100644
--- a/lldb/source/Core/RichManglingContext.cpp
+++ b/lldb/source/Core/RichManglingContext.cpp
@@ -24,7 +24,7 @@ RichManglingContext::~RichManglingContext() {
 void RichManglingContext::ResetCxxMethodParser() {
   // If we want to support parsers for other languages some day, we need a
   // switch here to delete the correct parser type.
-  if (m_cxx_method_parser.hasValue()) {
+  if (m_cxx_method_parser.has_value()) {
 assert(m_provider == PluginCxxLanguage);
 delete get(m_cxx_method_parser);
 m_cxx_method_parser.reset();



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


[Lldb-commits] [lldb] c38bc42 - [lldb] Use Optional::value instead of Optional::getValue (NFC)

2022-08-19 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-08-19T21:40:48-07:00
New Revision: c38bc421b1268ca371cdbb54e470d758968ce67a

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

LOG: [lldb] Use Optional::value instead of Optional::getValue (NFC)

Added: 


Modified: 
lldb/source/Host/common/Editline.cpp
lldb/tools/lldb-test/lldb-test.cpp

Removed: 




diff  --git a/lldb/source/Host/common/Editline.cpp 
b/lldb/source/Host/common/Editline.cpp
index cee7a3655046a..c46e69d9be7ff 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -1086,7 +1086,7 @@ unsigned char Editline::TypedCharacter(int ch) {
   m_color_prompts ? m_suggestion_ansi_suffix.c_str() : "";
 
   if (llvm::Optional to_add = m_suggestion_callback(line)) {
-std::string to_add_color = ansi_prefix + to_add.getValue() + ansi_suffix;
+std::string to_add_color = ansi_prefix + to_add.value() + ansi_suffix;
 fputs(typed.c_str(), m_output_file);
 fputs(to_add_color.c_str(), m_output_file);
 size_t new_autosuggestion_size = line.size() + to_add->length();

diff  --git a/lldb/tools/lldb-test/lldb-test.cpp 
b/lldb/tools/lldb-test/lldb-test.cpp
index 466e082534e58..b3651314b7f22 100644
--- a/lldb/tools/lldb-test/lldb-test.cpp
+++ b/lldb/tools/lldb-test/lldb-test.cpp
@@ -884,7 +884,7 @@ static Mangled::NamePreference 
opts::symtab::getNamePreference() {
 
 int opts::symtab::handleSymtabCommand(Debugger ) {
   if (auto error = validate()) {
-logAllUnhandledErrors(std::move(error.getValue()), WithColor::error(), "");
+logAllUnhandledErrors(std::move(error.value()), WithColor::error(), "");
 return 1;
   }
 



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


[Lldb-commits] [lldb] 2b46625 - [lldb] Use Optional::transform instead of Optional::map (NFC)

2022-08-19 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-08-19T21:40:47-07:00
New Revision: 2b4662551603d59e1d425494cd13452c42e5c366

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

LOG: [lldb] Use Optional::transform instead of Optional::map (NFC)

Added: 


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

Removed: 




diff  --git a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp 
b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
index 03cfb1e0a3eee..0ce901e7becb6 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
@@ -251,7 +251,7 @@ Expected 
IntelPTSingleBufferTrace::Start(
   (request.ipt_trace_size + page_size - 1) / page_size));
 
   Expected attr = CreateIntelPTPerfEventConfiguration(
-  request.enable_tsc, request.psb_period.map([](int value) {
+  request.enable_tsc, request.psb_period.transform([](int value) {
 return static_cast(value);
   }));
   if (!attr)



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


[Lldb-commits] [lldb] 50630dc - [lldb] Fix warnings

2022-08-16 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-08-16T12:33:21-07:00
New Revision: 50630dcc4c8ab5de26e153a948577c4cc743b722

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

LOG: [lldb] Fix warnings

This patch fixes:

  lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h:34:5:
  error: default label in switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]

and:

  lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp:194:21:
  error: comparison of integers of different signs: 'int' and 'size_t'
  (aka 'unsigned long') [-Werror,-Wsign-compare]

Added: 


Modified: 
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h

Removed: 




diff  --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp 
b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
index 458b996d6ff62..10aefc6d9dc08 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
@@ -191,8 +191,7 @@ static InstrPattern PATTERNS[] = {
 bool EmulateInstructionRISCV::DecodeAndExecute(uint32_t inst,
bool ignore_cond) {
   Log *log = GetLog(LLDBLog::Process | LLDBLog::Breakpoints);
-  for (int i = 0; i < llvm::array_lengthof(PATTERNS); ++i) {
-const InstrPattern  = PATTERNS[i];
+  for (const InstrPattern  : PATTERNS) {
 if ((inst & pat.type_mask) == pat.eigen) {
   LLDB_LOGF(log, "EmulateInstructionRISCV::%s: inst(%x) was decoded to %s",
 __FUNCTION__, inst, pat.name);

diff  --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h 
b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
index 6df9a7d409a75..39f7c429106bc 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
@@ -31,7 +31,6 @@ class EmulateInstructionRISCV : public EmulateInstruction {
   return true;
 case eInstructionTypePrologueEpilogue:
 case eInstructionTypeAll:
-default:
   return false;
 }
   }



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


[Lldb-commits] [lldb] 7542e72 - Use llvm::is_contained (NFC)

2022-08-07 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-08-07T00:16:17-07:00
New Revision: 7542e72188cb05b22523cc58ea4223951399520d

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

LOG: Use llvm::is_contained (NFC)

Added: 


Modified: 
clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
clang-tools-extra/clang-tidy/cert/ProperlySeededRandomGeneratorCheck.cpp
clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp
clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.cpp
clang/lib/AST/ASTContext.cpp
clang/lib/Sema/SemaOpenMP.cpp
lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
index 399e393a36fdd..f1b78883aece7 100644
--- a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
@@ -1512,12 +1512,10 @@ static bool isIgnoredParameter(const TheCheck , 
const ParmVarDecl *Node) {
   << "' is ignored.\n");
 
   if (!Node->getIdentifier())
-return llvm::find(Check.IgnoredParameterNames, "\"\"") !=
-   Check.IgnoredParameterNames.end();
+return llvm::is_contained(Check.IgnoredParameterNames, "\"\"");
 
   StringRef NodeName = Node->getName();
-  if (llvm::find(Check.IgnoredParameterNames, NodeName) !=
-  Check.IgnoredParameterNames.end()) {
+  if (llvm::is_contained(Check.IgnoredParameterNames, NodeName)) {
 LLVM_DEBUG(llvm::dbgs() << "\tName ignored.\n");
 return true;
   }
@@ -1584,7 +1582,7 @@ bool lazyMapOfSetsIntersectionExists(const MapTy , 
const ElemTy ,
 return false;
 
   for (const auto  : E1Iterator->second)
-if (llvm::find(E2Iterator->second, E1SetElem) != E2Iterator->second.end())
+if (llvm::is_contained(E2Iterator->second, E1SetElem))
   return true;
 
   return false;
@@ -1746,8 +1744,8 @@ class Returned {
   }
 
   bool operator()(const ParmVarDecl *Param1, const ParmVarDecl *Param2) const {
-return llvm::find(ReturnedParams, Param1) != ReturnedParams.end() &&
-   llvm::find(ReturnedParams, Param2) != ReturnedParams.end();
+return llvm::is_contained(ReturnedParams, Param1) &&
+   llvm::is_contained(ReturnedParams, Param2);
   }
 };
 

diff  --git 
a/clang-tools-extra/clang-tidy/cert/ProperlySeededRandomGeneratorCheck.cpp 
b/clang-tools-extra/clang-tidy/cert/ProperlySeededRandomGeneratorCheck.cpp
index 1165eb9a38a56..d35ddd021401b 100644
--- a/clang-tools-extra/clang-tidy/cert/ProperlySeededRandomGeneratorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cert/ProperlySeededRandomGeneratorCheck.cpp
@@ -112,7 +112,7 @@ void ProperlySeededRandomGeneratorCheck::checkSeed(
 
   const std::string SeedType(
   Func->getArg(0)->IgnoreCasts()->getType().getAsString());
-  if (llvm::find(DisallowedSeedTypes, SeedType) != DisallowedSeedTypes.end()) {
+  if (llvm::is_contained(DisallowedSeedTypes, SeedType)) {
 diag(Func->getExprLoc(),
  "random number generator seeded with a disallowed source of seed "
  "value will generate a predictable sequence of values");

diff  --git a/clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp 
b/clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp
index e818237954891..3cd019d0c386b 100644
--- a/clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp
@@ -60,7 +60,7 @@ template  class 
ImmutableSmallSet {
   size_type count(const T ) const {
 if (isSmall()) {
   // Since the collection is small, just do a linear search.
-  return llvm::find(Vector, V) == Vector.end() ? 0 : 1;
+  return llvm::is_contained(Vector, V) ? 1 : 0;
 }
 
 return Set.count(V);
@@ -106,7 +106,7 @@ template  class 
SmartSmallSetVector {
   size_type count(const T ) const {
 if (isSmall()) {
   // Since the collection is small, just do a linear search.
-  return llvm::find(Vector, V) == Vector.end() ? 0 : 1;
+  return llvm::is_contained(Vector, V) ? 1 : 0;
 }
 // Look-up in the Set.
 return Set.count(V);

diff  --git 
a/clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.cpp
index 9815952f81759..22a4e4eeec6d7 100644
--- a/clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.cpp
@@ 

[Lldb-commits] [lldb] acf648b - Use llvm::less_first and llvm::less_second (NFC)

2022-07-24 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-07-24T16:21:29-07:00
New Revision: acf648b5e91b6ccbb6e29a6db344e8d8ae0fbdb7

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

LOG: Use llvm::less_first and llvm::less_second (NFC)

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
llvm/lib/Analysis/LoopAccessAnalysis.cpp
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
llvm/lib/Target/DirectX/DXILWriter/DXILValueEnumerator.cpp
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/lib/Transforms/IPO/GlobalOpt.cpp
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index f8443d608ac3a..26775e72669f8 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -1430,9 +1430,7 @@ static bool ImportOffsetMap(llvm::DenseMap 
_map,
   std::vector sorted_items;
   sorted_items.reserve(source_map.size());
   sorted_items.assign(source_map.begin(), source_map.end());
-  llvm::sort(sorted_items, [](const PairType , const PairType ) {
-return lhs.second < rhs.second;
-  });
+  llvm::sort(sorted_items, llvm::less_second());
 
   for (const auto  : sorted_items) {
 DeclFromUser user_decl(const_cast(item.first));

diff  --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp 
b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index bed684b7652a3..aa35f253bc5f0 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -1500,9 +1500,7 @@ bool llvm::sortPtrAccesses(ArrayRef VL, Type 
*ElemTy,
   Value *Ptr0 = VL[0];
 
   using DistOrdPair = std::pair;
-  auto Compare = [](const DistOrdPair , const DistOrdPair ) {
-return L.first < R.first;
-  };
+  auto Compare = llvm::less_first();
   std::set Offsets(Compare);
   Offsets.emplace(0, 0);
   int Cnt = 1;

diff  --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp 
b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index 83336e69a7bd8..191596dbf53e6 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -3136,8 +3136,7 @@ bool InstrRefBasedLDV::emitTransfers(
 MI->getDebugLoc()->getInlinedAt());
   Insts.emplace_back(AllVarsNumbering.find(Var)->second, MI);
 }
-llvm::sort(Insts,
-   [](const auto , const auto ) { return A.first < B.first; });
+llvm::sort(Insts, llvm::less_first());
 
 // Insert either before or after the designated point...
 if (P.MBB) {

diff  --git a/llvm/lib/Target/DirectX/DXILWriter/DXILValueEnumerator.cpp 
b/llvm/lib/Target/DirectX/DXILWriter/DXILValueEnumerator.cpp
index e2a41515de389..a873662f730d6 100644
--- a/llvm/lib/Target/DirectX/DXILWriter/DXILValueEnumerator.cpp
+++ b/llvm/lib/Target/DirectX/DXILWriter/DXILValueEnumerator.cpp
@@ -260,9 +260,7 @@ static void predictValueUseListOrderImpl(const Value *V, 
const Function *F,
 return LU->getOperandNo() > RU->getOperandNo();
   });
 
-  if (llvm::is_sorted(List, [](const Entry , const Entry ) {
-return L.second < R.second;
-  }))
+  if (llvm::is_sorted(List, llvm::less_second()))
 // Order is already correct.
 return;
 

diff  --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp 
b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index 62cfc32949681..48ec7eb9191ed 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -631,8 +631,7 @@ static bool findArgParts(Argument *Arg, const DataLayout 
, AAResults ,
 
   // Sort parts by offset.
   append_range(ArgPartsVec, ArgParts);
-  sort(ArgPartsVec,
-   [](const auto , const auto ) { return A.first < B.first; });
+  sort(ArgPartsVec, llvm::less_first());
 
   // Make sure the parts are non-overlapping.
   int64_t Offset = ArgPartsVec[0].first;

diff  --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp 
b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
index ec26db8bfc0b4..6df0409256bbd 100644
--- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -470,8 +470,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const 
DataLayout ) {
   // Sort by offset.
   SmallVector, 16> TypesVector;
   append_range(TypesVector, Types);
-  sort(TypesVector,
-   [](const auto , const auto ) { return A.first < B.first; });
+  sort(TypesVector, llvm::less_first());
 
   // Check that the types are non-overlapping.
   uint64_t Offset = 0;

diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp 
b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 

[Lldb-commits] [lldb] 1d9231d - [lldb] Remove redundant member initialization (NFC)

2022-07-24 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-07-24T12:27:09-07:00
New Revision: 1d9231de70faa69625216a53cd306f20be4cfa75

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

LOG: [lldb] Remove redundant member initialization (NFC)

Identified with readability-redundant-member-init.

Added: 


Modified: 
lldb/source/Commands/CommandObjectDisassemble.cpp
lldb/source/Commands/CommandObjectExpression.cpp
lldb/source/Commands/CommandObjectMemory.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectDisassemble.cpp 
b/lldb/source/Commands/CommandObjectDisassemble.cpp
index a11e2b7197270..e65e12fe557a9 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -216,8 +216,7 @@ CommandObjectDisassemble::CommandObjectDisassemble(
   "Disassemble specified instructions in the current target.  "
   "Defaults to the current function for the current thread and "
   "stack frame.",
-  "disassemble []", eCommandRequiresTarget),
-  m_options() {}
+  "disassemble []", eCommandRequiresTarget) {}
 
 CommandObjectDisassemble::~CommandObjectDisassemble() = default;
 

diff  --git a/lldb/source/Commands/CommandObjectExpression.cpp 
b/lldb/source/Commands/CommandObjectExpression.cpp
index 0fb50420f70f9..083309121b668 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -187,7 +187,7 @@ CommandObjectExpression::CommandObjectExpression(
   m_format_options(eFormatDefault),
   m_repl_option(LLDB_OPT_SET_1, false, "repl", 'r', "Drop into REPL", 
false,
 true),
-  m_command_options(), m_expr_line_count(0) {
+  m_expr_line_count(0) {
   SetHelpLong(
   R"(
 Single and multi-line expressions:

diff  --git a/lldb/source/Commands/CommandObjectMemory.cpp 
b/lldb/source/Commands/CommandObjectMemory.cpp
index ca0384cf9453d..5051f9aeec851 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -1659,7 +1659,7 @@ class CommandObjectMemoryRegion : public 
CommandObjectParsed {
 public:
   class OptionGroupMemoryRegion : public OptionGroup {
   public:
-OptionGroupMemoryRegion() : OptionGroup(), m_all(false, false) {}
+OptionGroupMemoryRegion() : m_all(false, false) {}
 
 ~OptionGroupMemoryRegion() override = default;
 



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


[Lldb-commits] [lldb] 4f8a219 - [lldb] Use nullptr instead of NULL (NFC)

2022-07-24 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-07-24T12:27:08-07:00
New Revision: 4f8a2194c995acfb4514df39d04c918095f6cd4b

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

LOG: [lldb] Use nullptr instead of NULL (NFC)

Identified with modernize-use-nullptr.

Added: 


Modified: 
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp 
b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index af3430115c16b..f7f0104c27ea6 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -135,8 +135,8 @@ class PlatformDarwinProperties : public Properties {
   const char *GetIgnoredExceptions() const {
 const uint32_t idx = ePropertyIgnoredExceptions;
 const OptionValueString *option_value =
-m_collection_sp->GetPropertyAtIndexAsOptionValueString(
-NULL, false, idx);
+m_collection_sp->GetPropertyAtIndexAsOptionValueString(nullptr, false,
+   idx);
 assert(option_value);
 return option_value->GetCurrentValue();
   }
@@ -144,8 +144,8 @@ class PlatformDarwinProperties : public Properties {
   OptionValueString *GetIgnoredExceptionValue() {
 const uint32_t idx = ePropertyIgnoredExceptions;
 OptionValueString *option_value =
-m_collection_sp->GetPropertyAtIndexAsOptionValueString(
-NULL, false, idx);
+m_collection_sp->GetPropertyAtIndexAsOptionValueString(nullptr, false,
+   idx);
 assert(option_value);
 return option_value;
   }



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


[Lldb-commits] [lldb] 559463e - [lldb] Use true instead of 0 (NFC)

2022-07-24 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-07-24T12:27:06-07:00
New Revision: 559463e94ee38a48eed5c24fb4a1a4f379720fd2

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

LOG: [lldb] Use true instead of 0 (NFC)

Identified with modernize-use-bool-literals.

Added: 


Modified: 
lldb/source/Host/common/Host.cpp

Removed: 




diff  --git a/lldb/source/Host/common/Host.cpp 
b/lldb/source/Host/common/Host.cpp
index f35eb47ff6830..4a0f0240bd19c 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -172,7 +172,7 @@ MonitorChildProcessThreadFunction(::pid_t pid,
   ::sigaction(SIGUSR1, , nullptr);
 #endif // __linux__
 
-  while(1) {
+  while (true) {
 log = GetLog(LLDBLog::Process);
 LLDB_LOG(log, "::waitpid({0}, , 0)...", pid);
 



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


[Lldb-commits] [lldb] 360c111 - Use llvm::is_contained (NFC)

2022-07-20 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-07-20T09:09:19-07:00
New Revision: 360ce358c4c7e8591953ce9548d60c9410a6

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

LOG: Use llvm::is_contained (NFC)

Added: 


Modified: 
lld/MachO/Driver.cpp
lldb/source/API/SBBreakpoint.cpp
lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
lldb/source/Target/TargetList.cpp
llvm/lib/Support/CommandLine.cpp
mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp
mlir/lib/IR/AffineExpr.cpp
polly/include/polly/ScopInfo.h

Removed: 




diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 63a0e7f3a8434..f5c4e82c5b4c3 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -503,8 +503,7 @@ static bool markReexport(StringRef searchName, 
ArrayRef extensions) {
 if (auto *dylibFile = dyn_cast(file)) {
   StringRef filename = path::filename(dylibFile->getName());
   if (filename.consume_front(searchName) &&
-  (filename.empty() ||
-   find(extensions, filename) != extensions.end())) {
+  (filename.empty() || llvm::is_contained(extensions, filename))) {
 dylibFile->reexport = true;
 return true;
   }

diff  --git a/lldb/source/API/SBBreakpoint.cpp 
b/lldb/source/API/SBBreakpoint.cpp
index 5fe8f7fe05837..19b2a4376cf8a 100644
--- a/lldb/source/API/SBBreakpoint.cpp
+++ b/lldb/source/API/SBBreakpoint.cpp
@@ -835,8 +835,7 @@ class SBBreakpointListImpl {
 if (bkpt->GetTargetSP() != target_sp)
   return false;
 lldb::break_id_t bp_id = bkpt->GetID();
-if (find(m_break_ids.begin(), m_break_ids.end(), bp_id) ==
-m_break_ids.end())
+if (!llvm::is_contained(m_break_ids, bp_id))
   return false;
 
 m_break_ids.push_back(bkpt->GetID());

diff  --git a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
index 579ac6e36d0ba..4db7abe603d4c 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
@@ -396,15 +396,11 @@ bool RegisterInfoPOSIX_arm64::IsSVERegVG(unsigned reg) 
const {
 }
 
 bool RegisterInfoPOSIX_arm64::IsPAuthReg(unsigned reg) const {
-  return std::find(pauth_regnum_collection.begin(),
-   pauth_regnum_collection.end(),
-   reg) != pauth_regnum_collection.end();
+  return llvm::is_contained(pauth_regnum_collection, reg);
 }
 
 bool RegisterInfoPOSIX_arm64::IsMTEReg(unsigned reg) const {
-  return std::find(m_mte_regnum_collection.begin(),
-   m_mte_regnum_collection.end(),
-   reg) != m_mte_regnum_collection.end();
+  return llvm::is_contained(m_mte_regnum_collection, reg);
 }
 
 uint32_t RegisterInfoPOSIX_arm64::GetRegNumSVEZ0() const { return sve_z0; }

diff  --git a/lldb/source/Target/TargetList.cpp 
b/lldb/source/Target/TargetList.cpp
index 214e98ee91edb..829036976a219 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -509,8 +509,7 @@ uint32_t TargetList::GetIndexOfTarget(lldb::TargetSP 
target_sp) const {
 }
 
 void TargetList::AddTargetInternal(TargetSP target_sp, bool do_select) {
-  lldbassert(std::find(m_target_list.begin(), m_target_list.end(), target_sp) 
==
- m_target_list.end() &&
+  lldbassert(!llvm::is_contained(m_target_list, target_sp) &&
  "target already exists it the list");
   m_target_list.push_back(std::move(target_sp));
   if (do_select)

diff  --git a/llvm/lib/Support/CommandLine.cpp 
b/llvm/lib/Support/CommandLine.cpp
index e3df172ef1133..5e7d631651300 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -2382,7 +2382,7 @@ class CategorizedHelpPrinter : public HelpPrinter {
 for (size_t I = 0, E = Opts.size(); I != E; ++I) {
   Option *Opt = Opts[I].second;
   for (auto  : Opt->Categories) {
-assert(find(SortedCategories, Cat) != SortedCategories.end() &&
+assert(llvm::is_contained(SortedCategories, Cat) &&
"Option has an unregistered category");
 CategorizedOptions[Cat].push_back(Opt);
   }

diff  --git a/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp 
b/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp
index d5e85519a09a0..0147da813dfb7 100644
--- a/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp
+++ b/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp
@@ -84,7 +84,7 @@ void IntegerRangeAnalysis::visitOperation(
 auto result = v.dyn_cast();
 if (!result)
   return;
-assert(llvm::find(op->getResults(), result) != op->result_end());
+assert(llvm::is_contained(op->getResults(), result));
 
 LLVM_DEBUG(llvm::dbgs() << 

[Lldb-commits] [lldb] 8b3ed1f - Remove redundant return statements (NFC)

2022-07-17 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-07-17T15:37:46-07:00
New Revision: 8b3ed1fa984b07c88f218d0ddc6b3e2c0629a9fa

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

LOG: Remove redundant return statements (NFC)

Identified with readability-redundant-control-flow.

Added: 


Modified: 
clang/lib/Sema/SemaExpr.cpp
flang/lib/Frontend/TextDiagnosticPrinter.cpp
flang/lib/Lower/Allocatable.cpp
flang/lib/Lower/ConvertType.cpp
flang/lib/Optimizer/Transforms/AffinePromotion.cpp
flang/lib/Semantics/check-directive-structure.h
lldb/include/lldb/Symbol/SymbolFile.h
llvm/lib/Transforms/Scalar/LoopInterchange.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index c04186dea43eb..0b4c450f76e0d 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -19721,7 +19721,6 @@ class EvaluatedExprMarker : public 
UsedDeclVisitor {
   void VisitConstantExpr(ConstantExpr *E) {
 // Don't mark declarations within a ConstantExpression, as this expression
 // will be evaluated and folded to a value.
-return;
   }
 
   void VisitDeclRefExpr(DeclRefExpr *E) {

diff  --git a/flang/lib/Frontend/TextDiagnosticPrinter.cpp 
b/flang/lib/Frontend/TextDiagnosticPrinter.cpp
index 5ee4122af1053..12c41d77ba467 100644
--- a/flang/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/flang/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -56,5 +56,4 @@ void TextDiagnosticPrinter::HandleDiagnostic(
   diagMessageStream.str(), diagOpts->ShowColors);
 
   os.flush();
-  return;
 }

diff  --git a/flang/lib/Lower/Allocatable.cpp b/flang/lib/Lower/Allocatable.cpp
index 01a13b8555fa8..08a90f168 100644
--- a/flang/lib/Lower/Allocatable.cpp
+++ b/flang/lib/Lower/Allocatable.cpp
@@ -500,7 +500,6 @@ void Fortran::lower::genAllocateStmt(
 Fortran::lower::AbstractConverter ,
 const Fortran::parser::AllocateStmt , mlir::Location loc) {
   AllocateStmtHelper{converter, stmt, loc}.lower();
-  return;
 }
 
 
//===--===//

diff  --git a/flang/lib/Lower/ConvertType.cpp b/flang/lib/Lower/ConvertType.cpp
index 0ab9d2d1b48e0..772c8508b7c05 100644
--- a/flang/lib/Lower/ConvertType.cpp
+++ b/flang/lib/Lower/ConvertType.cpp
@@ -368,7 +368,6 @@ struct TypeBuilder {
   params.push_back(getCharacterLength(exprOrSym));
 else if (category == Fortran::common::TypeCategory::Derived)
   TODO(converter.getCurrentLocation(), "derived type length parameters");
-return;
   }
   Fortran::lower::LenParameterTy
   getCharacterLength(const Fortran::semantics::Symbol ) {

diff  --git a/flang/lib/Optimizer/Transforms/AffinePromotion.cpp 
b/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
index c6df98769a64b..90b4364866c96 100644
--- a/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
+++ b/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
@@ -242,7 +242,6 @@ struct AffineIfCondition {
 integerSet = mlir::IntegerSet::get(dimCount, symCount,
{constraintPair.getValue().first},
{constraintPair.getValue().second});
-return;
   }
 
   llvm::Optional>
@@ -392,7 +391,6 @@ static void populateIndexArgs(fir::ArrayCoorOp acoOp,
 return populateIndexArgs(acoOp, shapeShift, indexArgs, rewriter);
   if (auto slice = acoOp.getShape().getDefiningOp())
 return populateIndexArgs(acoOp, slice, indexArgs, rewriter);
-  return;
 }
 
 /// Returns affine.apply and fir.convert from array_coor and gendims

diff  --git a/flang/lib/Semantics/check-directive-structure.h 
b/flang/lib/Semantics/check-directive-structure.h
index 6444e839967df..3fdcbf2b88ec4 100644
--- a/flang/lib/Semantics/check-directive-structure.h
+++ b/flang/lib/Semantics/check-directive-structure.h
@@ -142,7 +142,6 @@ template  class NoBranchingEnforce {
 // did not found an enclosing looping construct within the OpenMP/OpenACC
 // directive
 EmitUnlabelledBranchOutError(stmt);
-return;
   }
 
   SemanticsContext _;

diff  --git a/lldb/include/lldb/Symbol/SymbolFile.h 
b/lldb/include/lldb/Symbol/SymbolFile.h
index 1470b96f24917..ed0de1b5bce6b 100644
--- a/lldb/include/lldb/Symbol/SymbolFile.h
+++ b/lldb/include/lldb/Symbol/SymbolFile.h
@@ -132,7 +132,7 @@ class SymbolFile : public PluginInterface {
   /// Specify debug info should be loaded.
   ///
   /// It will be no-op for most implementations except SymbolFileOnDemand.
-  virtual void SetLoadDebugInfoEnabled() { return; }
+  virtual void SetLoadDebugInfoEnabled() {}
 
   // Compile Unit function calls
   // Approach 1 - iterator

diff  --git a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp 
b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp
index 1d3023d04463f..18daa42952242 

[Lldb-commits] [lldb] 96d1b4d - [lld] Don't use Optional::hasValue (NFC)

2022-06-26 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-06-26T19:29:40-07:00
New Revision: 96d1b4ddb2cc37b900692215f7598ff5970b0baa

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

LOG: [lld] Don't use Optional::hasValue (NFC)

This patch replaces x.hasValue() with x where x is contextually
convertible to bool.

Added: 


Modified: 
lldb/include/lldb/Target/MemoryRegionInfo.h
lldb/source/API/SBMemoryRegionInfo.cpp
lldb/source/Breakpoint/BreakpointIDList.cpp
lldb/source/Commands/CommandObjectFrame.cpp
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Core/DataFileCache.cpp
lldb/source/Core/DumpDataExtractor.cpp
lldb/source/Core/ValueObjectChild.cpp
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/source/Target/UnixSignals.cpp
lldb/source/Utility/SelectHelper.cpp
lldb/unittests/tools/lldb-server/tests/TestClient.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/MemoryRegionInfo.h 
b/lldb/include/lldb/Target/MemoryRegionInfo.h
index acca66e838337..4e978d33b05dd 100644
--- a/lldb/include/lldb/Target/MemoryRegionInfo.h
+++ b/lldb/include/lldb/Target/MemoryRegionInfo.h
@@ -124,7 +124,7 @@ class MemoryRegionInfo {
   void SetPageSize(int pagesize) { m_pagesize = pagesize; }
 
   void SetDirtyPageList(std::vector pagelist) {
-if (m_dirty_pages.hasValue())
+if (m_dirty_pages)
   m_dirty_pages.getValue().clear();
 m_dirty_pages = std::move(pagelist);
   }

diff  --git a/lldb/source/API/SBMemoryRegionInfo.cpp 
b/lldb/source/API/SBMemoryRegionInfo.cpp
index d0f74374476e0..e811bf31c7223 100644
--- a/lldb/source/API/SBMemoryRegionInfo.cpp
+++ b/lldb/source/API/SBMemoryRegionInfo.cpp
@@ -135,7 +135,7 @@ uint32_t SBMemoryRegionInfo::GetNumDirtyPages() {
   uint32_t num_dirty_pages = 0;
   const llvm::Optional> _page_list =
   m_opaque_up->GetDirtyPageList();
-  if (dirty_page_list.hasValue())
+  if (dirty_page_list)
 num_dirty_pages = dirty_page_list.getValue().size();
 
   return num_dirty_pages;
@@ -147,7 +147,7 @@ addr_t 
SBMemoryRegionInfo::GetDirtyPageAddressAtIndex(uint32_t idx) {
   addr_t dirty_page_addr = LLDB_INVALID_ADDRESS;
   const llvm::Optional> _page_list =
   m_opaque_up->GetDirtyPageList();
-  if (dirty_page_list.hasValue() && idx < dirty_page_list.getValue().size())
+  if (dirty_page_list && idx < dirty_page_list.getValue().size())
 dirty_page_addr = dirty_page_list.getValue()[idx];
 
   return dirty_page_addr;

diff  --git a/lldb/source/Breakpoint/BreakpointIDList.cpp 
b/lldb/source/Breakpoint/BreakpointIDList.cpp
index b434056993640..dd16d3b6388c4 100644
--- a/lldb/source/Breakpoint/BreakpointIDList.cpp
+++ b/lldb/source/Breakpoint/BreakpointIDList.cpp
@@ -192,7 +192,7 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args 
_args, Target *target,
 auto start_bp = BreakpointID::ParseCanonicalReference(range_from);
 auto end_bp = BreakpointID::ParseCanonicalReference(range_to);
 
-if (!start_bp.hasValue() ||
+if (!start_bp ||
 !target->GetBreakpointByID(start_bp->GetBreakpointID())) {
   new_args.Clear();
   result.AppendErrorWithFormat("'%s' is not a valid breakpoint ID.\n",
@@ -200,7 +200,7 @@ void BreakpointIDList::FindAndReplaceIDRanges(Args 
_args, Target *target,
   return;
 }
 
-if (!end_bp.hasValue() ||
+if (!end_bp ||
 !target->GetBreakpointByID(end_bp->GetBreakpointID())) {
   new_args.Clear();
   result.AppendErrorWithFormat("'%s' is not a valid breakpoint ID.\n",

diff  --git a/lldb/source/Commands/CommandObjectFrame.cpp 
b/lldb/source/Commands/CommandObjectFrame.cpp
index 4081e87f2ddb9..93c41ee5a0be3 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -137,14 +137,14 @@ class CommandObjectFrameDiagnose : public 
CommandObjectParsed {
 
 ValueObjectSP valobj_sp;
 
-if (m_options.address.hasValue()) {
-  if (m_options.reg.hasValue() || m_options.offset.hasValue()) {
+if (m_options.address) {
+  if (m_options.reg || m_options.offset) {
 result.AppendError(
 "`frame diagnose --address` is incompatible with other 
arguments.");
 return false;
   }
   valobj_sp = frame_sp->GuessValueForAddress(m_options.address.getValue());
-} else if (m_options.reg.hasValue()) {
+} else if (m_options.reg) {
   valobj_sp = frame_sp->GuessValueForRegisterAndOffset(
   m_options.reg.getValue(), m_options.offset.value_or(0));
 } else {

diff  --git a/lldb/source/Commands/CommandObjectMemory.cpp 

[Lldb-commits] [lldb] ed8fcea - Don't use Optional::getValue (NFC)

2022-06-21 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-06-20T23:35:53-07:00
New Revision: ed8fceaa09cd66324c6efc1070f962731a62e2dc

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

LOG: Don't use Optional::getValue (NFC)

Added: 


Modified: 
clang-tools-extra/clang-doc/BitcodeWriter.cpp
clang-tools-extra/clang-doc/HTMLGenerator.cpp
clang-tools-extra/clang-doc/MDGenerator.cpp
clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp

clang-tools-extra/clang-tidy/cppcoreguidelines/VirtualClassDestructorCheck.cpp
clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
clang-tools-extra/clangd/ConfigYAML.cpp
clang-tools-extra/clangd/Diagnostics.cpp
clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
clang-tools-extra/clangd/index/YAMLSerialization.cpp
clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
clang-tools-extra/clangd/refactor/tweaks/ObjCMemberwiseInitializer.cpp
flang/include/flang/Lower/IterationSpace.h
flang/lib/Lower/Bridge.cpp
flang/lib/Lower/ComponentPath.cpp
flang/lib/Lower/ConvertExpr.cpp
flang/lib/Lower/CustomIntrinsicCall.cpp
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp
lld/COFF/Driver.cpp
lld/ELF/InputFiles.cpp
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Core/IOHandler.cpp
lldb/source/Core/ValueObject.cpp
lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
lldb/source/Plugins/ABI/X86/ABIX86.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Target/TraceInstructionDumper.cpp
lldb/source/Utility/UriParser.cpp
polly/lib/Exchange/JSONExporter.cpp

Removed: 




diff  --git a/clang-tools-extra/clang-doc/BitcodeWriter.cpp 
b/clang-tools-extra/clang-doc/BitcodeWriter.cpp
index 33a7814e1f483..f02906e5498a4 100644
--- a/clang-tools-extra/clang-doc/BitcodeWriter.cpp
+++ b/clang-tools-extra/clang-doc/BitcodeWriter.cpp
@@ -478,7 +478,7 @@ void ClangDocBitcodeWriter::emitBlock(const EnumInfo ) {
   for (const auto  : I.Description)
 emitBlock(CI);
   if (I.DefLoc)
-emitRecord(I.DefLoc.getValue(), ENUM_DEFLOCATION);
+emitRecord(*I.DefLoc, ENUM_DEFLOCATION);
   for (const auto  : I.Loc)
 emitRecord(L, ENUM_LOCATION);
   emitRecord(I.Scoped, ENUM_SCOPED);
@@ -496,7 +496,7 @@ void ClangDocBitcodeWriter::emitBlock(const RecordInfo ) {
   for (const auto  : I.Description)
 emitBlock(CI);
   if (I.DefLoc)
-emitRecord(I.DefLoc.getValue(), RECORD_DEFLOCATION);
+emitRecord(*I.DefLoc, RECORD_DEFLOCATION);
   for (const auto  : I.Loc)
 emitRecord(L, RECORD_LOCATION);
   emitRecord(I.TagType, RECORD_TAG_TYPE);
@@ -543,7 +543,7 @@ void ClangDocBitcodeWriter::emitBlock(const FunctionInfo 
) {
   emitRecord(I.Access, FUNCTION_ACCESS);
   emitRecord(I.IsMethod, FUNCTION_IS_METHOD);
   if (I.DefLoc)
-emitRecord(I.DefLoc.getValue(), FUNCTION_DEFLOCATION);
+emitRecord(*I.DefLoc, FUNCTION_DEFLOCATION);
   for (const auto  : I.Loc)
 emitRecord(L, FUNCTION_LOCATION);
   emitBlock(I.Parent, FieldId::F_parent);

diff  --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp 
b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
index 4ab962be7864d..3e5a5331b7906 100644
--- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -312,7 +312,7 @@ genReference(const Reference , StringRef 
CurrentDirectory,
 if (!JumpToSection)
   return std::make_unique(Type.Name);
 else
-  return genLink(Type.Name, "#" + JumpToSection.getValue());
+  return genLink(Type.Name, "#" + *JumpToSection);
   }
   llvm::SmallString<64> Path = Type.getRelativeFilePath(CurrentDirectory);
   llvm::sys::path::append(Path, Type.getFileBaseName() + ".html");
@@ -320,7 +320,7 @@ genReference(const Reference , StringRef 
CurrentDirectory,
   // Paths in HTML must be in posix-style
   llvm::sys::path::native(Path, llvm::sys::path::Style::posix);
   if (JumpToSection)
-Path += ("#" + JumpToSection.getValue()).str();
+Path += ("#" + *JumpToSection).str();
  

[Lldb-commits] [lldb] d66cbc5 - Don't use Optional::hasValue (NFC)

2022-06-20 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-06-20T20:26:05-07:00
New Revision: d66cbc565adbea8b7362349e527ac7aa2c75788f

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

LOG: Don't use Optional::hasValue (NFC)

Added: 


Modified: 
clang/include/clang/APINotes/Types.h
clang/include/clang/Basic/DarwinSDKInfo.h
clang/lib/Lex/MacroInfo.cpp
lldb/tools/lldb-vscode/FifoFiles.cpp
llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
llvm/include/llvm/ProfileData/MemProf.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/lib/Target/SystemZ/SystemZISelLowering.h
llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
llvm/tools/llvm-cov/CodeCoverage.cpp
mlir/include/mlir/TableGen/CodeGenHelpers.h
mlir/lib/Analysis/Presburger/IntegerRelation.cpp
mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
mlir/lib/Dialect/Affine/Analysis/Utils.cpp
mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp

Removed: 




diff  --git a/clang/include/clang/APINotes/Types.h 
b/clang/include/clang/APINotes/Types.h
index cd02db3da185c..ed5250f3d5b4e 100644
--- a/clang/include/clang/APINotes/Types.h
+++ b/clang/include/clang/APINotes/Types.h
@@ -440,8 +440,7 @@ class ParamInfo : public VariableInfo {
   }
   void
   setRetainCountConvention(llvm::Optional Value) {
-RawRetainCountConvention =
-Value.hasValue() ? static_cast(Value.getValue()) + 1 : 0;
+RawRetainCountConvention = Value ? static_cast(*Value) + 1 : 0;
 assert(getRetainCountConvention() == Value && "bitfield too small");
   }
 
@@ -559,8 +558,7 @@ class FunctionInfo : public CommonEntityInfo {
   }
   void
   setRetainCountConvention(llvm::Optional Value) {
-RawRetainCountConvention =
-Value.hasValue() ? static_cast(Value.getValue()) + 1 : 0;
+RawRetainCountConvention = Value ? static_cast(*Value) + 1 : 0;
 assert(getRetainCountConvention() == Value && "bitfield too small");
   }
 

diff  --git a/clang/include/clang/Basic/DarwinSDKInfo.h 
b/clang/include/clang/Basic/DarwinSDKInfo.h
index df16827debfc0..728bbc17c3acb 100644
--- a/clang/include/clang/Basic/DarwinSDKInfo.h
+++ b/clang/include/clang/Basic/DarwinSDKInfo.h
@@ -142,8 +142,7 @@ class DarwinSDKInfo {
 auto Mapping = VersionMappings.find(Kind.Value);
 if (Mapping == VersionMappings.end())
   return nullptr;
-return Mapping->getSecond().hasValue() ? Mapping->getSecond().getPointer()
-   : nullptr;
+return Mapping->getSecond() ? Mapping->getSecond().getPointer() : nullptr;
   }
 
   static Optional

diff  --git a/clang/lib/Lex/MacroInfo.cpp b/clang/lib/Lex/MacroInfo.cpp
index f5702130d1819..4a8127d29a459 100644
--- a/clang/lib/Lex/MacroInfo.cpp
+++ b/clang/lib/Lex/MacroInfo.cpp
@@ -201,8 +201,7 @@ MacroDirective::DefInfo MacroDirective::getDefinition() {
   Optional isPublic;
   for (; MD; MD = MD->getPrevious()) {
 if (DefMacroDirective *DefMD = dyn_cast(MD))
-  return DefInfo(DefMD, UndefLoc,
- !isPublic.hasValue() || isPublic.getValue());
+  return DefInfo(DefMD, UndefLoc, !isPublic || *isPublic);
 
 if (UndefMacroDirective *UndefMD = dyn_cast(MD)) {
   UndefLoc = UndefMD->getLocation();

diff  --git a/lldb/tools/lldb-vscode/FifoFiles.cpp 
b/lldb/tools/lldb-vscode/FifoFiles.cpp
index e37f2020d8f19..b97455ba953fb 100644
--- a/lldb/tools/lldb-vscode/FifoFiles.cpp
+++ b/lldb/tools/lldb-vscode/FifoFiles.cpp
@@ -61,8 +61,7 @@ Expected 
FifoFileIO::ReadJSON(std::chrono::milliseconds timeout) {
 if (!buffer.empty())
   line = buffer;
   }));
-  if (future->wait_for(timeout) == std::future_status::timeout ||
-  !line.hasValue())
+  if (future->wait_for(timeout) == std::future_status::timeout || !line)
 return createStringError(inconvertibleErrorCode(),
  "Timed out trying to get messages from the " +
  m_other_endpoint_name);

diff  --git a/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h 
b/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
index ed41d2b5b9d4c..a41b2fe2a6e76 100644
--- a/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
+++ b/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
@@ -102,9 +102,7 @@ struct FunctionInfo {
   /// debug info, we might end up with multiple FunctionInfo objects for the
   /// same range and we need to be able to tell which one is the better object
   /// to use.
-  bool hasRichInfo() const {
-return OptLineTable.hasValue() || Inline.hasValue();
-  }
+  bool hasRichInfo() const { return OptLineTable || Inline; }
 
   /// Query if a FunctionInfo object is valid.
   ///

diff 

[Lldb-commits] [lldb] 064a08c - Don't use Optional::hasValue (NFC)

2022-06-20 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-06-20T20:05:16-07:00
New Revision: 064a08cd955019da9130f1109bfa534e79b8ec7c

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

LOG: Don't use Optional::hasValue (NFC)

Added: 


Modified: 
clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp
clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
clang-tools-extra/clangd/TUScheduler.cpp
clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
clang/include/clang/ASTMatchers/Dynamic/VariantValue.h
clang/include/clang/Basic/DirectoryEntry.h
clang/include/clang/Basic/FileEntry.h
clang/include/clang/Lex/Preprocessor.h
clang/include/clang/Sema/Sema.h
clang/lib/ASTMatchers/Dynamic/Marshallers.h
clang/lib/CodeGen/CGExprScalar.cpp
clang/lib/CodeGen/CoverageMappingGen.cpp
clang/lib/Lex/PPMacroExpansion.cpp
clang/lib/Sema/SemaTemplateDeduction.cpp
clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
flang/include/flang/Lower/ComponentPath.h
lld/wasm/Writer.cpp
lldb/include/lldb/Core/DataFileCache.h
lldb/source/API/SBMemoryRegionInfo.cpp
lldb/source/Breakpoint/BreakpointID.cpp
llvm/include/llvm/Analysis/LazyCallGraph.h
llvm/include/llvm/CodeGen/SelectionDAGAddressAnalysis.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/include/llvm/IR/Function.h
llvm/include/llvm/ObjectYAML/ELFYAML.h
llvm/include/llvm/Support/Alignment.h
llvm/lib/Analysis/ProfileSummaryInfo.cpp
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/lib/IR/LLVMContext.cpp
llvm/lib/ObjectYAML/COFFEmitter.cpp
llvm/lib/Remarks/RemarkLinker.cpp
llvm/lib/Remarks/RemarkParser.cpp
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
llvm/tools/llvm-reduce/deltas/ReduceGlobalObjects.cpp
mlir/include/mlir/Analysis/DataFlowAnalysis.h
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
mlir/include/mlir/IR/Diagnostics.h
mlir/include/mlir/Support/StorageUniquer.h
mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h
mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
mlir/lib/Dialect/Affine/IR/AffineOps.cpp
mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
mlir/lib/IR/AsmPrinter.cpp
mlir/lib/IR/MLIRContext.cpp
mlir/lib/Support/Timing.cpp
mlir/lib/TableGen/Pattern.cpp
mlir/test/lib/Dialect/Test/TestDialect.cpp
mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp 
b/clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp
index 4eaf8bc6f392f..f7b4c3ef57938 100644
--- a/clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp
+++ b/clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp
@@ -66,7 +66,7 @@ getFileExtension(StringRef FileName, const FileExtensionsSet 
) {
 
 bool isFileExtension(StringRef FileName,
  const FileExtensionsSet ) {
-  return getFileExtension(FileName, FileExtensions).hasValue();
+  return getFileExtension(FileName, FileExtensions).has_value();
 }
 
 } // namespace utils

diff  --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp 
b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
index ce31f366cf174..2684b0de53bdb 100644
--- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
+++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
@@ -530,7 +530,7 @@ class 
DirectoryBasedGlobalCompilationDatabase::BroadcastThread {
   bool blockUntilIdle(Deadline Timeout) {
 std::unique_lock Lock(Mu);
 return wait(Lock, CV, Timeout,
-[&] { return Queue.empty() && !ActiveTask.hasValue(); });
+[&] { return Queue.empty() && !ActiveTask; });
   }
 
   ~BroadcastThread() {

diff  --git a/clang-tools-extra/clangd/TUScheduler.cpp 
b/clang-tools-extra/clangd/TUScheduler.cpp
index f60fbfaa479f9..4bdcf0f3c80cd 100644
--- a/clang-tools-extra/clangd/TUScheduler.cpp
+++ b/clang-tools-extra/clangd/TUScheduler.cpp
@@ -1196,7 +1196,7 @@ std::shared_ptr 
ASTWorker::getPossiblyStalePreamble(
 
 void ASTWorker::waitForFirstPreamble() const {
   std::unique_lock Lock(Mutex);
-  PreambleCV.wait(Lock, [this] { return LatestPreamble.hasValue() || Done; });
+  PreambleCV.wait(Lock, [this] { return LatestPreamble || Done; });
 }
 
 tooling::CompileCommand ASTWorker::getCurrentCompileCommand() const {

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp 

[Lldb-commits] [lldb] ad7ce1e - Don't use Optional::hasValue (NFC)

2022-06-20 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-06-20T11:49:10-07:00
New Revision: ad7ce1e7696148d093b96a6262ebc8fd5e216187

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

LOG: Don't use Optional::hasValue (NFC)

Added: 


Modified: 
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/Driver/Driver.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/lib/Sema/TreeTransform.h
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
llvm/lib/IR/Attributes.cpp
llvm/lib/Remarks/YAMLRemarkSerializer.cpp
llvm/lib/Target/MSP430/MSP430TargetMachine.cpp
llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
mlir/lib/Analysis/IntRangeAnalysis.cpp
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CodeGenFunction.h 
b/clang/lib/CodeGen/CodeGenFunction.h
index 938db2a887c59..a7de87b552d28 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -1529,10 +1529,7 @@ class CodeGenFunction : public CodeGenTypeCache {
 
   /// Get the profiler's count for the given statement.
   uint64_t getProfileCount(const Stmt *S) {
-Optional Count = PGO.getStmtCount(S);
-if (!Count.hasValue())
-  return 0;
-return *Count;
+return PGO.getStmtCount(S).value_or(0);
   }
 
   /// Set the profiler's current count.

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index cbde26668b78c..167c726c53919 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -3282,8 +3282,7 @@ class OffloadingActionBuilder final {
   DDep, CudaDeviceActions[I]->getType());
 }
 
-if (!CompileDeviceOnly || !BundleOutput.hasValue() ||
-BundleOutput.getValue()) {
+if (!CompileDeviceOnly || !BundleOutput || *BundleOutput) {
   // Create HIP fat binary with a special "link" action.
   CudaFatBinary = C.MakeAction(CudaDeviceActions,
   types::TY_HIP_FATBIN);
@@ -3383,8 +3382,7 @@ class OffloadingActionBuilder final {
   // in a fat binary for mixed host-device compilation. For device-only
   // compilation, creates a fat binary.
   OffloadAction::DeviceDependences DDeps;
-  if (!CompileDeviceOnly || !BundleOutput.hasValue() ||
-  BundleOutput.getValue()) {
+  if (!CompileDeviceOnly || !BundleOutput || *BundleOutput) {
 auto *TopDeviceLinkAction = C.MakeAction(
 Actions,
 CompileDeviceOnly ? types::TY_HIP_FATBIN : types::TY_Object);

diff  --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp 
b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 62478e7129695..8e59c449ae656 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1996,8 +1996,7 @@ 
TemplateInstantiator::TransformExprRequirement(concepts::ExprRequirement *Req) {
   TransRetReq.emplace(TPL);
 }
   }
-  assert(TransRetReq.hasValue() &&
- "All code paths leading here must set TransRetReq");
+  assert(TransRetReq && "All code paths leading here must set TransRetReq");
   if (Expr *E = TransExpr.dyn_cast())
 return RebuildExprRequirement(E, Req->isSimple(), Req->getNoexceptLoc(),
   std::move(*TransRetReq));

diff  --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 03f147480421a..ef09352551044 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -12634,8 +12634,7 @@ 
TreeTransform::TransformExprRequirement(concepts::ExprRequirement *Req)
   return nullptr;
 TransRetReq.emplace(TPL);
   }
-  assert(TransRetReq.hasValue() &&
- "All code paths leading here must set TransRetReq");
+  assert(TransRetReq && "All code paths leading here must set TransRetReq");
   if (Expr *E = TransExpr.dyn_cast())
 return getDerived().RebuildExprRequirement(E, Req->isSimple(),
Req->getNoexceptLoc(),

diff  --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp 
b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
index 58e581fce728d..16d84fb01f610 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -698,8 +698,7 @@ SymbolFileBreakpad::ParseWinUnwindPlan(const Bookmark 
,
 
   LineIterator It(*m_objfile_sp, Record::StackWin, 

[Lldb-commits] [lldb] 5413bf1 - Don't use Optional::hasValue (NFC)

2022-06-20 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-06-20T11:33:56-07:00
New Revision: 5413bf1bac2abb9e06901686cdc959e92940143a

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

LOG: Don't use Optional::hasValue (NFC)

Added: 


Modified: 
clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp
clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
clang-tools-extra/clang-tidy/bugprone/UncheckedOptionalAccessCheck.cpp
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/CodeComplete.cpp
clang-tools-extra/clangd/IncludeFixer.cpp
clang-tools-extra/clangd/Protocol.cpp
clang-tools-extra/clangd/SemanticSelection.cpp
clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
clang-tools-extra/clangd/tool/Check.cpp
clang-tools-extra/pseudo/lib/DirectiveTree.cpp
clang-tools-extra/pseudo/lib/Forest.cpp
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
clang/lib/Lex/PPDirectives.cpp
clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
flang/include/flang/Lower/IterationSpace.h
flang/lib/Lower/Bridge.cpp
flang/lib/Lower/ConvertExpr.cpp
flang/lib/Lower/IO.cpp
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
flang/lib/Optimizer/Support/InternalNames.cpp
lld/COFF/Driver.cpp
lld/ELF/Driver.cpp
lld/ELF/InputFiles.cpp
lld/ELF/LinkerScript.cpp
lld/wasm/Driver.cpp
lld/wasm/InputFiles.cpp
lld/wasm/Writer.cpp
lldb/source/Breakpoint/BreakpointIDList.cpp
lldb/source/Commands/CommandObjectFrame.cpp
lldb/source/Core/Debugger.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Utility/SelectHelper.cpp
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
llvm/include/llvm/IR/IRBuilder.h
llvm/lib/Analysis/IRSimilarityIdentifier.cpp
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
llvm/lib/DWARFLinker/DWARFLinker.cpp
llvm/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cpp
llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp
llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
llvm/lib/IR/Function.cpp
llvm/lib/IR/IntrinsicInst.cpp
llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/lib/Target/Mips/MipsTargetStreamer.h
llvm/lib/Transforms/IPO/IROutliner.cpp
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
llvm/utils/TableGen/GlobalISelEmitter.cpp
mlir/lib/Analysis/Presburger/Simplex.cpp
mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
mlir/lib/Dialect/Affine/Utils/Utils.cpp

mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp
mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
mlir/lib/Tools/lsp-server-support/Protocol.cpp
mlir/test/lib/IR/TestSymbolUses.cpp
mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
mlir/tools/mlir-tblgen/RewriterGen.cpp

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp 
b/clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp
index b107dd7385c65..6c5d86a69821b 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp
@@ -53,7 +53,7 @@ void ClangTidyProfiling::printAsJSON(llvm::raw_ostream ) {
 }
 
 void ClangTidyProfiling::storeProfileData() {
-  assert(Storage.hasValue() && "We should have a filename.");
+  assert(Storage && "We should have a filename.");
 
   llvm::SmallString<256> OutputDirectory(Storage->StoreFilename);
   llvm::sys::path::remove_filename(OutputDirectory);
@@ -80,7 +80,7 @@ 
ClangTidyProfiling::ClangTidyProfiling(llvm::Optional Storage)
 ClangTidyProfiling::~ClangTidyProfiling() {
   TG.emplace("clang-tidy", "clang-tidy checks profiling", Records);
 
-  if (!Storage.hasValue())
+  if (!Storage)
 printUserFriendlyTable(llvm::errs());
   else
 storeProfileData();

diff  --git 

[Lldb-commits] [lldb] 30c6758 - Use value_or instead of getValueOr (NFC)

2022-06-19 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-06-19T10:34:41-07:00
New Revision: 30c675878c21be9973faabddc38ebf1b4c603b7d

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

LOG: Use value_or instead of getValueOr (NFC)

Added: 


Modified: 
clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
clang-tools-extra/clangd/unittests/HeadersTests.cpp
clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
flang/include/flang/Optimizer/Dialect/FIROps.td
lldb/unittests/Core/SourceLocationSpecTest.cpp
llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/include/mlir/ExecutionEngine/MemRefUtils.h
mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h
mlir/lib/Analysis/Presburger/Simplex.cpp
mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
mlir/lib/Dialect/Affine/Analysis/AffineAnalysis.cpp
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
mlir/lib/IR/BuiltinTypes.cpp
mlir/lib/Pass/Pass.cpp
mlir/lib/Rewrite/ByteCode.cpp
mlir/lib/TableGen/AttrOrTypeDef.cpp
mlir/lib/TableGen/Constraint.cpp
mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
mlir/lib/Tools/PDLL/AST/Types.cpp
mlir/lib/Tools/lsp-server-support/Transport.cpp
mlir/lib/Transforms/Utils/DialectConversion.cpp
mlir/test/lib/Dialect/Test/TestDialect.cpp
mlir/test/mlir-tblgen/attr-or-type-format.td
mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
polly/lib/Support/ScopHelper.cpp
polly/lib/Transform/ManualOptimizer.cpp
polly/lib/Transform/ScheduleTreeTransform.cpp

Removed: 




diff  --git 
a/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp 
b/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
index 6480f2f3f39bb..3fc45edd16dec 100644
--- a/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
+++ b/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
@@ -300,7 +300,7 @@ TEST(GlobalCompilationDatabaseTest, BuildDir) {
 DirectoryBasedGlobalCompilationDatabase::Options Opts(FS);
 return DirectoryBasedGlobalCompilationDatabase(Opts)
 .getCompileCommand(testPath(Relative))
-.getValueOr(tooling::CompileCommand())
+.value_or(tooling::CompileCommand())
 .CommandLine;
   };
   EXPECT_THAT(Command("x/foo.cc"), IsEmpty());

diff  --git a/clang-tools-extra/clangd/unittests/HeadersTests.cpp 
b/clang-tools-extra/clangd/unittests/HeadersTests.cpp
index a9872cfae2a02..69fcadcf0674a 100644
--- a/clang-tools-extra/clangd/unittests/HeadersTests.cpp
+++ b/clang-tools-extra/clangd/unittests/HeadersTests.cpp
@@ -112,7 +112,7 @@ class HeadersTest : public ::testing::Test {
   return "";
 auto Path = Inserter.calculateIncludePath(Inserted, MainFile);
 Action.EndSourceFile();
-return Path.getValueOr("");
+return Path.value_or("");
   }
 
   llvm::Optional insert(llvm::StringRef VerbatimHeader) {

diff  --git a/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp 
b/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
index 96e0c8cd6b1d5..d7fd1a09e85d3 100644
--- a/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
@@ -376,7 +376,7 @@ class SpelledWordsTest : public ::testing::Test {
   SpelledWord word(const char *Text) {
 auto Result = tryWord(Text);
 EXPECT_TRUE(Result) << Text;
-return Result.getValueOr(SpelledWord());
+return Result.value_or(SpelledWord());
   }
 
   void noWord(const char *Text) { EXPECT_FALSE(tryWord(Text)) << Text; }

diff  --git a/flang/include/flang/Optimizer/Dialect/FIROps.td 
b/flang/include/flang/Optimizer/Dialect/FIROps.td
index bb652c10016e0..b9ba0a7a2cd24 100644
--- a/flang/include/flang/Optimizer/Dialect/FIROps.td
+++ b/flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -2686,7 +2686,7 @@ def fir_GlobalOp : fir_Op<"global", [IsolatedFromAbove, 
Symbol]> {
 mlir::Type resultType();
 
 /// Return the initializer attribute if it exists, or a null attribute.
-mlir::Attribute getValueOrNull() { return 
getInitVal().getValueOr(mlir::Attribute()); }
+mlir::Attribute getValueOrNull() { return 
getInitVal().value_or(mlir::Attribute()); }
 
 /// Append the next initializer value to the `GlobalOp` to construct
 /// the variable's initial value.

diff  --git a/lldb/unittests/Core/SourceLocationSpecTest.cpp 
b/lldb/unittests/Core/SourceLocationSpecTest.cpp
index b79662f865f6b..089c7640cc010 100644
--- a/lldb/unittests/Core/SourceLocationSpecTest.cpp
+++ b/lldb/unittests/Core/SourceLocationSpecTest.cpp
@@ -50,7 +50,7 @@ TEST(SourceLocationSpecTest, FileLineColumnComponents) {
   

[Lldb-commits] [lldb] aa88161 - [lldb] Use value_or instead of getValueOr (NFC)

2022-06-19 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-06-19T09:12:01-07:00
New Revision: aa88161b378ecb49388eefc28abe2926a229bcfc

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

LOG: [lldb] Use value_or instead of getValueOr (NFC)

Added: 


Modified: 
lldb/include/lldb/Symbol/LineTable.h
lldb/source/API/SBModule.cpp
lldb/source/API/SBPlatform.cpp
lldb/source/API/SBValue.cpp
lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
lldb/source/Commands/CommandObjectFrame.cpp
lldb/source/Commands/CommandObjectWatchpoint.cpp
lldb/source/Core/AddressResolverFileLine.cpp
lldb/source/Core/SourceLocationSpec.cpp
lldb/source/Core/ValueObject.cpp
lldb/source/Expression/Materializer.cpp
lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
lldb/source/Plugins/Process/Linux/Perf.cpp
lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp
lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
lldb/source/Symbol/CompileUnit.cpp
lldb/source/Symbol/Type.cpp
lldb/source/Target/PathMappingList.cpp
lldb/source/Target/StackFrame.cpp
lldb/source/Utility/ProcessInfo.cpp
lldb/source/Utility/TraceIntelPTGDBRemotePackets.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/LineTable.h 
b/lldb/include/lldb/Symbol/LineTable.h
index b5121b29fe028..7fca44b5930b7 100644
--- a/lldb/include/lldb/Symbol/LineTable.h
+++ b/lldb/include/lldb/Symbol/LineTable.h
@@ -350,9 +350,9 @@ class LineTable {
 if (!line_entry_ptr)
   return best_match;
 
-const uint32_t line = src_location_spec.GetLine().getValueOr(0);
+const uint32_t line = src_location_spec.GetLine().value_or(0);
 const uint16_t column =
-src_location_spec.GetColumn().getValueOr(LLDB_INVALID_COLUMN_NUMBER);
+src_location_spec.GetColumn().value_or(LLDB_INVALID_COLUMN_NUMBER);
 const bool exact_match = src_location_spec.GetExactMatch();
 
 for (size_t idx = start_idx; idx < count; ++idx) {

diff  --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp
index 1454012d3eb9a..c4e876eb15de5 100644
--- a/lldb/source/API/SBModule.cpp
+++ b/lldb/source/API/SBModule.cpp
@@ -617,9 +617,9 @@ uint32_t SBModule::GetVersion(uint32_t *versions, uint32_t 
num_versions) {
   if (num_versions > 0)
 versions[0] = version.empty() ? UINT32_MAX : version.getMajor();
   if (num_versions > 1)
-versions[1] = version.getMinor().getValueOr(UINT32_MAX);
+versions[1] = version.getMinor().value_or(UINT32_MAX);
   if (num_versions > 2)
-versions[2] = version.getSubminor().getValueOr(UINT32_MAX);
+versions[2] = version.getSubminor().value_or(UINT32_MAX);
   for (uint32_t i = 3; i < num_versions; ++i)
 versions[i] = UINT32_MAX;
   return result;

diff  --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp
index ac767f740a305..ba18ba6d187f0 100644
--- a/lldb/source/API/SBPlatform.cpp
+++ b/lldb/source/API/SBPlatform.cpp
@@ -424,7 +424,7 @@ const char *SBPlatform::GetOSBuild() {
 
   PlatformSP platform_sp(GetSP());
   if (platform_sp) {
-std::string s = platform_sp->GetOSBuildString().getValueOr("");
+std::string s = platform_sp->GetOSBuildString().value_or("");
 if (!s.empty()) {
   // Const-ify the string so we don't need to worry about the lifetime of
   // the string
@@ -439,7 +439,7 @@ const char *SBPlatform::GetOSDescription() {
 
   PlatformSP platform_sp(GetSP());
   if (platform_sp) {
-std::string s = platform_sp->GetOSKernelDescription().getValueOr("");
+std::string s = platform_sp->GetOSKernelDescription().value_or("");
 if (!s.empty()) {
   // Const-ify the string so we don't need to worry about the lifetime of
   // the string
@@ -473,7 +473,7 @@ uint32_t 

[Lldb-commits] [lldb] 8cc9fa6 - Use static_cast from SmallString to std::string (NFC)

2022-06-04 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-06-04T22:09:27-07:00
New Revision: 8cc9fa6f78237a5771a5f85eb9ef129ea85a54cf

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

LOG: Use static_cast from SmallString to std::string (NFC)

Added: 


Modified: 
clang/lib/Driver/Driver.cpp
clang/tools/libclang/CIndexer.cpp
lldb/source/Utility/FileSpec.cpp

Removed: 




diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 3185ebcd46a4e..8e698a2a7cbef 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -973,7 +973,7 @@ bool Driver::loadConfigFile() {
 if (llvm::sys::fs::make_absolute(CfgDir).value() != 0)
   SystemConfigDir.clear();
 else
-  SystemConfigDir = std::string(CfgDir.begin(), CfgDir.end());
+  SystemConfigDir = static_cast(CfgDir);
   }
 }
 if (CLOptions->hasArg(options::OPT_config_user_dir_EQ)) {
@@ -984,7 +984,7 @@ bool Driver::loadConfigFile() {
 if (llvm::sys::fs::make_absolute(CfgDir).value() != 0)
   UserConfigDir.clear();
 else
-  UserConfigDir = std::string(CfgDir.begin(), CfgDir.end());
+  UserConfigDir = static_cast(CfgDir);
   }
 }
   }

diff  --git a/clang/tools/libclang/CIndexer.cpp 
b/clang/tools/libclang/CIndexer.cpp
index dab3fc4e201d0..77da2e4fa5ead 100644
--- a/clang/tools/libclang/CIndexer.cpp
+++ b/clang/tools/libclang/CIndexer.cpp
@@ -176,7 +176,7 @@ LibclangInvocationReporter::LibclangInvocationReporter(
   if (llvm::sys::fs::createUniqueFile(TempPath, FD, TempPath,
   llvm::sys::fs::OF_Text))
 return;
-  File = std::string(TempPath.begin(), TempPath.end());
+  File = static_cast(TempPath);
   llvm::raw_fd_ostream OS(FD, /*ShouldClose=*/true);
 
   // Write out the information about the invocation to it.

diff  --git a/lldb/source/Utility/FileSpec.cpp 
b/lldb/source/Utility/FileSpec.cpp
index eed3bbd46026f..c0dbc29bcd1f1 100644
--- a/lldb/source/Utility/FileSpec.cpp
+++ b/lldb/source/Utility/FileSpec.cpp
@@ -357,7 +357,7 @@ size_t FileSpec::GetPath(char *path, size_t path_max_len,
 std::string FileSpec::GetPath(bool denormalize) const {
   llvm::SmallString<64> result;
   GetPath(result, denormalize);
-  return std::string(result.begin(), result.end());
+  return static_cast(result);
 }
 
 const char *FileSpec::GetCString(bool denormalize) const {



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


[Lldb-commits] [lldb] 4969a69 - Use llvm::less_first (NFC)

2022-06-04 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-06-04T21:23:18-07:00
New Revision: 4969a6924dc1644d4fa6cf89a33b598e647f5513

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

LOG: Use llvm::less_first (NFC)

Added: 


Modified: 
clang/lib/AST/Interp/Function.cpp
clang/lib/Frontend/FrontendAction.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaStmtAsm.cpp
clang/lib/StaticAnalyzer/Frontend/AnalyzerHelpFlags.cpp
lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
llvm/include/llvm/ExecutionEngine/Orc/Core.h
llvm/lib/CodeGen/MIRCanonicalizerPass.cpp
llvm/lib/IR/Attributes.cpp
llvm/lib/ObjCopy/MachO/MachOWriter.cpp
llvm/lib/ObjectYAML/MachOEmitter.cpp
llvm/tools/dsymutil/DebugMap.cpp
llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp

Removed: 




diff  --git a/clang/lib/AST/Interp/Function.cpp 
b/clang/lib/AST/Interp/Function.cpp
index 0ed13a92aa38d..6ba97df1cd30e 100644
--- a/clang/lib/AST/Interp/Function.cpp
+++ b/clang/lib/AST/Interp/Function.cpp
@@ -34,8 +34,7 @@ Function::ParamDescriptor 
Function::getParamDescriptor(unsigned Offset) const {
 SourceInfo Function::getSource(CodePtr PC) const {
   unsigned Offset = PC - getCodeBegin();
   using Elem = std::pair;
-  auto It = std::lower_bound(SrcMap.begin(), SrcMap.end(), Elem{Offset, {}},
- [](Elem A, Elem B) { return A.first < B.first; });
+  auto It = llvm::lower_bound(SrcMap, Elem{Offset, {}}, llvm::less_first());
   if (It == SrcMap.end() || It->first != Offset)
 llvm::report_fatal_error("missing source location");
   return It->second;

diff  --git a/clang/lib/Frontend/FrontendAction.cpp 
b/clang/lib/Frontend/FrontendAction.cpp
index 68c70dda12b9e..6b1f6364b13c3 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -413,11 +413,7 @@ static std::error_code collectModuleHeaderIncludes(
 
 // Sort header paths and make the header inclusion order deterministic
 // across 
diff erent OSs and filesystems.
-llvm::sort(Headers.begin(), Headers.end(), [](
-  const std::pair ,
-  const std::pair ) {
-return LHS.first < RHS.first;
-});
+llvm::sort(Headers.begin(), Headers.end(), llvm::less_first());
 for (auto  : Headers) {
   // Include this header as part of the umbrella directory.
   Module->addTopHeader(H.second);

diff  --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index c470a46f58477..569b226da9233 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -5430,8 +5430,7 @@ static void DiagnoseBaseOrMemInitializerOrder(
 return;
 
   // Sort based on the ideal order, first in the pair.
-  llvm::sort(CorrelatedInitOrder,
- [](auto , auto ) { return LHS.first < RHS.first; });
+  llvm::sort(CorrelatedInitOrder, llvm::less_first());
 
   // Introduce a new scope as SemaDiagnosticBuilder needs to be destroyed to
   // emit the diagnostic before we can try adding notes.

diff  --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp
index fbca36b1216a8..c147d26b2dff3 100644
--- a/clang/lib/Sema/SemaStmtAsm.cpp
+++ b/clang/lib/Sema/SemaStmtAsm.cpp
@@ -716,10 +716,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, 
bool IsSimple,
   NamedOperandList.emplace_back(
   std::make_pair(Names[i]->getName(), Exprs[i]));
   // Sort NamedOperandList.
-  std::stable_sort(NamedOperandList.begin(), NamedOperandList.end(),
-  [](const NamedOperand , const NamedOperand ) {
-return LHS.first < RHS.first;
-  });
+  llvm::stable_sort(NamedOperandList, llvm::less_first());
   // Find adjacent duplicate operand.
   SmallVector::iterator Found =
   std::adjacent_find(begin(NamedOperandList), end(NamedOperandList),

diff  --git a/clang/lib/StaticAnalyzer/Frontend/AnalyzerHelpFlags.cpp 
b/clang/lib/StaticAnalyzer/Frontend/AnalyzerHelpFlags.cpp
index eb6014a0629df..7cd15f0f65954 100644
--- a/clang/lib/StaticAnalyzer/Frontend/AnalyzerHelpFlags.cpp
+++ b/clang/lib/StaticAnalyzer/Frontend/AnalyzerHelpFlags.cpp
@@ -101,10 +101,7 @@ USAGE: -analyzer-config 
 #undef ANALYZER_OPTION_DEPENDS_ON_USER_MODE
   };
 
-  llvm::sort(PrintableOptions, [](const OptionAndDescriptionTy ,
-  const OptionAndDescriptionTy ) {
-return LHS.first < RHS.first;
-  });
+  llvm::sort(PrintableOptions, llvm::less_first());
 
   for (const auto  : PrintableOptions) {
 AnalyzerOptions::printFormattedEntry(out, Pair, /*InitialPad*/ 2,

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp 

[Lldb-commits] [lldb] 4391625 - [lldb] Fix an unused function warning

2022-05-25 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-05-25T09:49:05-07:00
New Revision: 4391625255c62074037d95a55232a87eae70c60b

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

LOG: [lldb] Fix an unused function warning

This patch fixes:

  .../llvm-project/lldb/source/Host/common/PseudoTerminal.cpp:106:20:
  error: unused function 'use_ptsname' [-Werror,-Wunused-function]

Added: 


Modified: 
lldb/source/Host/common/PseudoTerminal.cpp

Removed: 




diff  --git a/lldb/source/Host/common/PseudoTerminal.cpp 
b/lldb/source/Host/common/PseudoTerminal.cpp
index 13c82e8b1ea91..be4c3c7928dfd 100644
--- a/lldb/source/Host/common/PseudoTerminal.cpp
+++ b/lldb/source/Host/common/PseudoTerminal.cpp
@@ -103,6 +103,7 @@ llvm::Error PseudoTerminal::OpenSecondary(int oflag) {
   std::error_code(errno, std::generic_category()));
 }
 
+#if !HAVE_PTSNAME_R || defined(__APPLE__)
 static std::string use_ptsname(int fd) {
   static std::mutex mutex;
   std::lock_guard guard(mutex);
@@ -110,6 +111,7 @@ static std::string use_ptsname(int fd) {
   assert(r != nullptr);
   return r;
 }
+#endif
 
 std::string PseudoTerminal::GetSecondaryName() const {
   assert(m_primary_fd >= 0);



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


[Lldb-commits] [lldb] ee4b6cf - [Breakpoint] Remove redundant member initialization (NFC)

2022-02-06 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-02-06T10:54:46-08:00
New Revision: ee4b6cf5387b1b9eef7f21ae93a868b1aded4b08

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

LOG: [Breakpoint] Remove redundant member initialization (NFC)

Identified with readability-redundant-member-init.

Added: 


Modified: 
lldb/source/Breakpoint/Breakpoint.cpp
lldb/source/Breakpoint/BreakpointList.cpp
lldb/source/Breakpoint/BreakpointLocation.cpp
lldb/source/Breakpoint/BreakpointLocationCollection.cpp
lldb/source/Breakpoint/BreakpointLocationList.cpp
lldb/source/Breakpoint/BreakpointOptions.cpp
lldb/source/Breakpoint/BreakpointResolverAddress.cpp
lldb/source/Breakpoint/BreakpointResolverName.cpp
lldb/source/Breakpoint/BreakpointSite.cpp
lldb/source/Breakpoint/BreakpointSiteList.cpp
lldb/source/Breakpoint/StoppointCallbackContext.cpp
lldb/source/Breakpoint/Watchpoint.cpp
lldb/source/Breakpoint/WatchpointList.cpp
lldb/source/Breakpoint/WatchpointOptions.cpp

Removed: 




diff  --git a/lldb/source/Breakpoint/Breakpoint.cpp 
b/lldb/source/Breakpoint/Breakpoint.cpp
index 8cbc79c243700..050457986eba6 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -1012,8 +1012,7 @@ void 
Breakpoint::SendBreakpointChangedEvent(BreakpointEventData *data) {
 
 Breakpoint::BreakpointEventData::BreakpointEventData(
 BreakpointEventType sub_type, const BreakpointSP _breakpoint_sp)
-: EventData(), m_breakpoint_event(sub_type),
-  m_new_breakpoint_sp(new_breakpoint_sp) {}
+: m_breakpoint_event(sub_type), m_new_breakpoint_sp(new_breakpoint_sp) {}
 
 Breakpoint::BreakpointEventData::~BreakpointEventData() = default;
 

diff  --git a/lldb/source/Breakpoint/BreakpointList.cpp 
b/lldb/source/Breakpoint/BreakpointList.cpp
index ca181ee306a4e..f4d4b2edbf08b 100644
--- a/lldb/source/Breakpoint/BreakpointList.cpp
+++ b/lldb/source/Breakpoint/BreakpointList.cpp
@@ -23,8 +23,7 @@ static void NotifyChange(const BreakpointSP , 
BreakpointEventType event) {
 }
 
 BreakpointList::BreakpointList(bool is_internal)
-: m_mutex(), m_breakpoints(), m_next_break_id(0),
-  m_is_internal(is_internal) {}
+: m_next_break_id(0), m_is_internal(is_internal) {}
 
 BreakpointList::~BreakpointList() = default;
 

diff  --git a/lldb/source/Breakpoint/BreakpointLocation.cpp 
b/lldb/source/Breakpoint/BreakpointLocation.cpp
index 0b73d7cc890dd..0ee8bcf491ead 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -34,8 +34,7 @@ BreakpointLocation::BreakpointLocation(break_id_t loc_id, 
Breakpoint ,
bool hardware, bool check_for_resolver)
 : m_being_created(true), m_should_resolve_indirect_functions(false),
   m_is_reexported(false), m_is_indirect(false), m_address(addr),
-  m_owner(owner), m_options_up(), m_bp_site_sp(), m_condition_mutex(),
-  m_condition_hash(0), m_loc_id(loc_id), m_hit_counter() {
+  m_owner(owner), m_condition_hash(0), m_loc_id(loc_id), m_hit_counter() {
   if (check_for_resolver) {
 Symbol *symbol = m_address.CalculateSymbolContextSymbol();
 if (symbol && symbol->IsIndirect()) {

diff  --git a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp 
b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp
index 6c55629b5aadb..7efb2870e87e9 100644
--- a/lldb/source/Breakpoint/BreakpointLocationCollection.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocationCollection.cpp
@@ -17,8 +17,7 @@ using namespace lldb;
 using namespace lldb_private;
 
 // BreakpointLocationCollection constructor
-BreakpointLocationCollection::BreakpointLocationCollection()
-: m_break_loc_collection(), m_collection_mutex() {}
+BreakpointLocationCollection::BreakpointLocationCollection() = default;
 
 // Destructor
 BreakpointLocationCollection::~BreakpointLocationCollection() = default;

diff  --git a/lldb/source/Breakpoint/BreakpointLocationList.cpp 
b/lldb/source/Breakpoint/BreakpointLocationList.cpp
index 6d271864c445a..46f66276d28d9 100644
--- a/lldb/source/Breakpoint/BreakpointLocationList.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocationList.cpp
@@ -20,8 +20,7 @@ using namespace lldb;
 using namespace lldb_private;
 
 BreakpointLocationList::BreakpointLocationList(Breakpoint )
-: m_owner(owner), m_locations(), m_address_to_location(), m_mutex(),
-  m_next_id(0), m_new_location_recorder(nullptr) {}
+: m_owner(owner), m_next_id(0), m_new_location_recorder(nullptr) {}
 
 BreakpointLocationList::~BreakpointLocationList() = default;
 

diff  --git a/lldb/source/Breakpoint/BreakpointOptions.cpp 
b/lldb/source/Breakpoint/BreakpointOptions.cpp
index 86a7c483df83e..3dcb1904c8f8f 100644
--- 

[Lldb-commits] [lldb] 5423839 - [lldb] Forward-declare ClangExpressionParser (NFC)

2022-01-30 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-01-30T12:32:53-08:00
New Revision: 5423839929e2d07d2cc5b7a497772074ec13df12

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

LOG: [lldb] Forward-declare ClangExpressionParser (NFC)

ClangUserExpression.h is relying on the forward declaration of
ClangExpressionParser in ClangFunctionCaller.h.  This patch moves the
forward declaration to ClangUserExpression.h.

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h

Removed: 




diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
index 8060b8c0aedc1..151935b0ce68f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
@@ -21,7 +21,6 @@
 namespace lldb_private {
 
 class ASTStructExtractor;
-class ClangExpressionParser;
 
 /// \class ClangFunctionCaller ClangFunctionCaller.h
 /// "lldb/Expression/ClangFunctionCaller.h" Encapsulates a function that can

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
index b628f6debf661..30cdd2f3e990e 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
@@ -28,6 +28,8 @@
 
 namespace lldb_private {
 
+class ClangExpressionParser;
+
 /// \class ClangUserExpression ClangUserExpression.h
 /// "lldb/Expression/ClangUserExpression.h" Encapsulates a single expression
 /// for use with Clang



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


[Lldb-commits] [lldb] abb0ed4 - [Commands] Remove redundant member initialization (NFC)

2022-01-23 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2022-01-23T11:07:14-08:00
New Revision: abb0ed44957cb4ba1bc94d19202860f10369cea1

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

LOG: [Commands] Remove redundant member initialization (NFC)

Identified with readability-redundant-member-init.

Added: 


Modified: 
lldb/source/Commands/CommandCompletions.cpp
lldb/source/Commands/CommandObjectBreakpoint.cpp
lldb/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/source/Commands/CommandObjectCommands.cpp
lldb/source/Commands/CommandObjectDisassemble.cpp
lldb/source/Commands/CommandObjectExpression.cpp
lldb/source/Commands/CommandObjectFrame.cpp
lldb/source/Commands/CommandObjectHelp.cpp
lldb/source/Commands/CommandObjectHelp.h
lldb/source/Commands/CommandObjectLog.cpp
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Commands/CommandObjectMemoryTag.cpp
lldb/source/Commands/CommandObjectPlatform.cpp
lldb/source/Commands/CommandObjectProcess.cpp
lldb/source/Commands/CommandObjectRegexCommand.cpp
lldb/source/Commands/CommandObjectRegister.cpp
lldb/source/Commands/CommandObjectReproducer.cpp
lldb/source/Commands/CommandObjectScript.h
lldb/source/Commands/CommandObjectSession.cpp
lldb/source/Commands/CommandObjectSettings.cpp
lldb/source/Commands/CommandObjectSource.cpp
lldb/source/Commands/CommandObjectStats.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Commands/CommandObjectTrace.cpp
lldb/source/Commands/CommandObjectType.cpp
lldb/source/Commands/CommandObjectWatchpoint.cpp
lldb/source/Commands/CommandObjectWatchpointCommand.cpp
lldb/source/Commands/CommandOptionsProcessLaunch.h

Removed: 




diff  --git a/lldb/source/Commands/CommandCompletions.cpp 
b/lldb/source/Commands/CommandCompletions.cpp
index ff825cce813ec..ae1ee1fdd30b8 100644
--- a/lldb/source/Commands/CommandCompletions.cpp
+++ b/lldb/source/Commands/CommandCompletions.cpp
@@ -129,7 +129,7 @@ class SourceFileCompleter : public Completer {
 public:
   SourceFileCompleter(CommandInterpreter ,
   CompletionRequest )
-  : Completer(interpreter, request), m_matching_files() {
+  : Completer(interpreter, request) {
 FileSpec partial_spec(m_request.GetCursorArgumentPrefix());
 m_file_name = partial_spec.GetFilename().GetCString();
 m_dir_name = partial_spec.GetDirectory().GetCString();

diff  --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp 
b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index 3f88a2fa63780..c4e55fdb3b9c0 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -49,7 +49,7 @@ static void AddBreakpointDescription(Stream *s, Breakpoint 
*bp,
 
 class lldb_private::BreakpointOptionGroup : public OptionGroup {
 public:
-  BreakpointOptionGroup() : OptionGroup(), m_bp_opts(false) {}
+  BreakpointOptionGroup() : m_bp_opts(false) {}
 
   ~BreakpointOptionGroup() override = default;
 
@@ -179,7 +179,7 @@ class lldb_private::BreakpointOptionGroup : public 
OptionGroup {
 
 class BreakpointDummyOptionGroup : public OptionGroup {
 public:
-  BreakpointDummyOptionGroup() : OptionGroup() {}
+  BreakpointDummyOptionGroup() {}
 
   ~BreakpointDummyOptionGroup() override = default;
 
@@ -234,8 +234,7 @@ class CommandObjectBreakpointSet : public 
CommandObjectParsed {
 interpreter, "breakpoint set",
 "Sets a breakpoint or set of breakpoints in the executable.",
 "breakpoint set "),
-m_bp_opts(), m_python_class_options("scripted breakpoint", true, 'P'),
-m_options() {
+m_python_class_options("scripted breakpoint", true, 'P') {
 // We're picking up all the normal options, commands and disable.
 m_all_options.Append(_python_class_options,
  LLDB_OPT_SET_1 | LLDB_OPT_SET_2, LLDB_OPT_SET_11);
@@ -253,9 +252,7 @@ class CommandObjectBreakpointSet : public 
CommandObjectParsed {
 
   class CommandOptions : public OptionGroup {
   public:
-CommandOptions()
-: OptionGroup(), m_condition(), m_filenames(), m_func_names(),
-  m_func_regexp(), m_source_text_regexp(), m_modules() {}
+CommandOptions() {}
 
 ~CommandOptions() override = default;
 
@@ -809,8 +806,7 @@ class CommandObjectBreakpointModify : public 
CommandObjectParsed {
 "created breakpoint.  "
 "With the exception of -e, -d and -i, passing an "
 "empty argument clears the modification.",
-nullptr),
-m_options() {
+nullptr) {
 

  1   2   >