[Lldb-commits] [lldb] b135650 - [LLVM] Update C++ standard to 17

2022-08-06 Thread Tobias Hieta via lldb-commits

Author: Tobias Hieta
Date: 2022-08-06T09:42:10+02:00
New Revision: b1356504e63ae821cccf1e051a0d2526bdfef2b0

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

LOG: [LLVM] Update C++ standard to 17

Also make the soft toolchain requirements hard. This allows
us to use C++17 features in LLVM now.

If we find patterns with C++17 that improve readability
it should be recommended in the coding standards.

Reviewed By: jhenderson, cor3ntin, MaskRay

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

Added: 


Modified: 
bolt/runtime/CMakeLists.txt
clang/CMakeLists.txt
lld/CMakeLists.txt
lldb/CMakeLists.txt
llvm/CMakeLists.txt
llvm/cmake/modules/CheckCompilerVersion.cmake
llvm/docs/CodingStandards.rst
llvm/docs/ReleaseNotes.rst

Removed: 




diff  --git a/bolt/runtime/CMakeLists.txt b/bolt/runtime/CMakeLists.txt
index 7c1b79af4d2cf..ef7ad02c98c77 100644
--- a/bolt/runtime/CMakeLists.txt
+++ b/bolt/runtime/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.13.4)
 include(CheckIncludeFiles)
 
 set(CMAKE_CXX_EXTENSIONS OFF)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 17)
 
 project(libbolt_rt_project)
 

diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 82207fae0c015..bf1268c08420c 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -11,7 +11,7 @@ endif()
 include(GNUInstallDirs)
 
 if(CLANG_BUILT_STANDALONE)
-  set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
   set(CMAKE_CXX_STANDARD_REQUIRED YES)
   set(CMAKE_CXX_EXTENSIONS NO)
 

diff  --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 58dca54642e4d..22aa84ffc1862 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -11,7 +11,7 @@ endif()
 include(GNUInstallDirs)
 
 if(LLD_BUILT_STANDALONE)
-  set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
   set(CMAKE_CXX_STANDARD_REQUIRED YES)
   set(CMAKE_CXX_EXTENSIONS NO)
 

diff  --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index edb4c513a64d2..fff25c344708a 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -20,7 +20,7 @@ include(GNUInstallDirs)
 if(LLDB_BUILT_STANDALONE)
   include(LLDBStandalone)
 
-  set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
   set(CMAKE_CXX_STANDARD_REQUIRED YES)
   set(CMAKE_CXX_EXTENSIONS NO)
 endif()

diff  --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index c3172d6b81721..b0c6a15ef0e8a 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -58,7 +58,7 @@ project(LLVM
 # Must go after project(..)
 include(GNUInstallDirs)
 
-set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
 set(CMAKE_CXX_STANDARD_REQUIRED YES)
 if (CYGWIN)
   # Cygwin is a bit stricter and lack things like 'strdup', 'stricmp', etc in

diff  --git a/llvm/cmake/modules/CheckCompilerVersion.cmake 
b/llvm/cmake/modules/CheckCompilerVersion.cmake
index c73135864c9ea..efe403f7f168a 100644
--- a/llvm/cmake/modules/CheckCompilerVersion.cmake
+++ b/llvm/cmake/modules/CheckCompilerVersion.cmake
@@ -4,21 +4,19 @@
 
 include(CheckCXXSourceCompiles)
 
-set(GCC_MIN 5.1)
+set(GCC_MIN 7.1)
 set(GCC_SOFT_ERROR 7.1)
-set(CLANG_MIN 3.5)
+set(CLANG_MIN 5.0)
 set(CLANG_SOFT_ERROR 5.0)
-set(APPLECLANG_MIN 6.0)
+set(APPLECLANG_MIN 9.3)
 set(APPLECLANG_SOFT_ERROR 9.3)
 
 # https://en.wikipedia.org/wiki/Microsoft_Visual_C#Internal_version_numbering
-# _MSC_VER == 1920 MSVC++ 14.20 Visual Studio 2019 Version 16.0
 # _MSC_VER == 1927 MSVC++ 14.27 Visual Studio 2019 Version 16.7
-set(MSVC_MIN 19.20)
+set(MSVC_MIN 19.27)
 set(MSVC_SOFT_ERROR 19.27)
 
-# Map the above GCC versions to dates: 
https://gcc.gnu.org/develop.html#timeline
-set(GCC_MIN_DATE 20150422)
+set(LIBSTDCXX_MIN 7)
 set(LIBSTDCXX_SOFT_ERROR 7)
 
 
@@ -76,22 +74,14 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
 set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x")
-# Test for libstdc++ version of at least 4.8 by checking for 
_ZNKSt17bad_function_call4whatEv.
-# Note: We should check _GLIBCXX_RELEASE when possible (i.e., for GCC 7.1 
and up).
 check_cxx_source_compiles("
 #include 
 #if defined(__GLIBCXX__)
-#if __GLIBCXX__ < ${GCC_MIN_DATE}
+#if !defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE < ${LIBSTDCXX_MIN}
 #error Unsupported libstdc++ version
 #endif
 #endif
-#if defined(__GLIBCXX__)
-extern const char _ZNKSt17bad_function_call4wh

[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-08-06 Thread Tobias Hieta via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb1356504e63a: [LLVM] Update C++ standard to 17 (authored by 
thieta).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

Files:
  bolt/runtime/CMakeLists.txt
  clang/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/modules/CheckCompilerVersion.cmake
  llvm/docs/CodingStandards.rst
  llvm/docs/ReleaseNotes.rst

Index: llvm/docs/ReleaseNotes.rst
===
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -47,6 +47,18 @@
 Update on required toolchains to build LLVM
 ---
 
+LLVM is now built with C++17 by default. This means C++17 can be used in
+the code base.
+
+The previous "soft" toolchain requirements have now been changed to "hard".
+This means that the the following versions are now required to build LLVM
+and there is no way to suppress this error.
+
+* GCC >= 7.1
+* Clang >= 5.0
+* Apple Clang >= 9.3
+* Visual Studio 2019 >= 16.7
+
 Changes to the LLVM IR
 --
 
Index: llvm/docs/CodingStandards.rst
===
--- llvm/docs/CodingStandards.rst
+++ llvm/docs/CodingStandards.rst
@@ -53,7 +53,7 @@
 C++ Standard Versions
 -
 
-Unless otherwise documented, LLVM subprojects are written using standard C++14
+Unless otherwise documented, LLVM subprojects are written using standard C++17
 code and avoid unnecessary vendor-specific extensions.
 
 Nevertheless, we restrict ourselves to features which are available in the
@@ -63,7 +63,13 @@
 Each toolchain provides a good reference for what it accepts:
 
 * Clang: https://clang.llvm.org/cxx_status.html
-* GCC: https://gcc.gnu.org/projects/cxx-status.html#cxx14
+
+  * libc++: https://libcxx.llvm.org/Status/Cxx17.html
+
+* GCC: https://gcc.gnu.org/projects/cxx-status.html#cxx17
+
+  * libstdc++: https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2017
+
 * MSVC: https://msdn.microsoft.com/en-us/library/hh567368.aspx
 
 
Index: llvm/cmake/modules/CheckCompilerVersion.cmake
===
--- llvm/cmake/modules/CheckCompilerVersion.cmake
+++ llvm/cmake/modules/CheckCompilerVersion.cmake
@@ -4,21 +4,19 @@
 
 include(CheckCXXSourceCompiles)
 
-set(GCC_MIN 5.1)
+set(GCC_MIN 7.1)
 set(GCC_SOFT_ERROR 7.1)
-set(CLANG_MIN 3.5)
+set(CLANG_MIN 5.0)
 set(CLANG_SOFT_ERROR 5.0)
-set(APPLECLANG_MIN 6.0)
+set(APPLECLANG_MIN 9.3)
 set(APPLECLANG_SOFT_ERROR 9.3)
 
 # https://en.wikipedia.org/wiki/Microsoft_Visual_C#Internal_version_numbering
-# _MSC_VER == 1920 MSVC++ 14.20 Visual Studio 2019 Version 16.0
 # _MSC_VER == 1927 MSVC++ 14.27 Visual Studio 2019 Version 16.7
-set(MSVC_MIN 19.20)
+set(MSVC_MIN 19.27)
 set(MSVC_SOFT_ERROR 19.27)
 
-# Map the above GCC versions to dates: https://gcc.gnu.org/develop.html#timeline
-set(GCC_MIN_DATE 20150422)
+set(LIBSTDCXX_MIN 7)
 set(LIBSTDCXX_SOFT_ERROR 7)
 
 
@@ -76,22 +74,14 @@
 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
 set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x")
-# Test for libstdc++ version of at least 4.8 by checking for _ZNKSt17bad_function_call4whatEv.
-# Note: We should check _GLIBCXX_RELEASE when possible (i.e., for GCC 7.1 and up).
 check_cxx_source_compiles("
 #include 
 #if defined(__GLIBCXX__)
-#if __GLIBCXX__ < ${GCC_MIN_DATE}
+#if !defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE < ${LIBSTDCXX_MIN}
 #error Unsupported libstdc++ version
 #endif
 #endif
-#if defined(__GLIBCXX__)
-extern const char _ZNKSt17bad_function_call4whatEv[];
-const char *chk = _ZNKSt17bad_function_call4whatEv;
-#else
-const char *chk = \"\";
-#endif
-int main() { ++chk; return 0; }
+int main() { return 0; }
 "
   LLVM_LIBSTDCXX_MIN)
 if(NOT LLVM_LIBSTDCXX_MIN)
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -58,7 +58,7 @@
 # Must go after project(..)
 include(GNUInstallDirs)
 
-set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
 set(CMAKE_CXX_STANDARD_REQUIRED YES)
 if (CYGWIN)
   # Cygwin is a bit stricter and lack things like 'strdup', 'stricmp', etc in
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -20,7 +20,7 @@
 if(LLDB_BUILT_STANDALONE)
   include(LLDBStandalone)
 
-  set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to c

[Lldb-commits] [PATCH] D131305: [lldb] Tidy some regex in crashlog.py (NFC)

2022-08-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Nice


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131305

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


[Lldb-commits] [PATCH] D131328: [lldb] Support fetching symbols with dsymForUUID in the background

2022-08-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: jasonmolenda, jingham, mib, clayborg.
Herald added a project: All.
JDevlieghere requested review of this revision.

On macOS, LLDB uses the DebugSymbols.framework to locate symbol rich dSYM 
bundles. [1] The framework uses a variety of methods, one of them calling into 
a binary or shell script to locate (and download) dSYMs. Internally at Apple, 
that tool is called `dsymForUUID` and for simplicity I'm just going to refer to 
it that way here too, even though it can be be an arbitrary executable.

The most common use case for dsymForUUID is to fetch symbols from the network. 
This can take a long time, and because the calls to the DebugSymbols.framework  
are blocking, lldb does not launch the process immediately. This is the 
expected behavior and many people therefore often don't use this functionality, 
but instead use `add-dsym` when they want symbols for a given frame, backtrace 
or module. This is a little faster because you're only fetching symbols for the 
module you care about, but it's still a slow, blocking operation.

This patch introduces a hybrid approach between the two. When 
`symbols.enable-background-lookup` is enabled, lldb will do the equivalent of 
`add-dsym` for every module it doesn't have symbols for in the background. From 
the user's perspective there is no slowdown, because the process launches 
immediately, with whatever symbols are available and more symbol information is 
added over time as the background fetching completes.

[1] https://lldb.llvm.org/use/symbols.html


https://reviews.llvm.org/D131328

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Core/ModuleList.h
  lldb/include/lldb/Symbol/LocateSymbolFile.h
  lldb/include/lldb/Target/TargetList.h
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Symbol/LocateSymbolFile.cpp
  lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
  lldb/source/Target/TargetList.cpp

Index: lldb/source/Target/TargetList.cpp
===
--- lldb/source/Target/TargetList.cpp
+++ lldb/source/Target/TargetList.cpp
@@ -540,3 +540,11 @@
 m_selected_target_idx = 0;
   return GetTargetAtIndex(m_selected_target_idx);
 }
+
+std::vector TargetList::GetCurrentTargets() {
+  std::vector targets;
+  std::lock_guard guard(m_target_list_mutex);
+  for (TargetSP target_sp : m_target_list)
+targets.push_back(target_sp);
+  return targets;
+}
Index: lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
===
--- lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
+++ lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
@@ -492,7 +492,8 @@
 }
 
 bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
-  Status &error, bool force_lookup) {
+  Status &error, bool force_lookup,
+  bool copy_executable) {
   bool success = false;
   const UUID *uuid_ptr = module_spec.GetUUIDPtr();
   const FileSpec *file_spec_ptr = module_spec.GetFileSpecPtr();
@@ -592,12 +593,16 @@
 file_spec_ptr->GetPath(file_path, sizeof(file_path));
 
   StreamString command;
+  const char *copy_executable_str =
+  copy_executable ? " --copyExecutable" : "";
   if (!uuid_str.empty())
-command.Printf("%s --ignoreNegativeCache --copyExecutable %s",
-   g_dsym_for_uuid_exe_path, uuid_str.c_str());
+command.Printf("%s --ignoreNegativeCache %s%s",
+   g_dsym_for_uuid_exe_path, copy_executable_str,
+   uuid_str.c_str());
   else if (file_path[0] != '\0')
-command.Printf("%s --ignoreNegativeCache --copyExecutable %s",
-   g_dsym_for_uuid_exe_path, file_path);
+command.Printf("%s --ignoreNegativeCache %s%s",
+   g_dsym_for_uuid_exe_path, copy_executable_str,
+   file_path);
 
   if (!command.GetString().empty()) {
 Log *log = GetLog(LLDBLog::Host);
Index: lldb/source/Symbol/LocateSymbolFile.cpp
===
--- lldb/source/Symbol/LocateSymbolFile.cpp
+++ lldb/source/Symbol/LocateSymbolFile.cpp
@@ -8,6 +8,8 @@
 
 #include "lldb/Symbol/LocateSymbolFile.h"
 
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/Progress.h"
@@ -24,6 +26,7 @@
 #include "lldb/Utility/UUID.h"
 
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/ThreadPool.h"
 
 // From MacOSX system header "mach/machine.h"
 typedef int cpu_type_t;
@@ -223,7 +226,8 @@
   // an appropriate parent directory
   if (!LocateDSYMInVincinityOfExecutable(module_spec, symbol_fspec)) {
 // We failed to easily find the dSYM

[Lldb-commits] [PATCH] D131332: [lldb][unittests] Add more test cases to CPlusPlusNameParser unit-tests

2022-08-06 Thread Michael Buch via Phabricator via lldb-commits
Michael137 created this revision.
Michael137 added a reviewer: aprantl.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Add test cases for the possible function qualifiers that the
`CPlusPlusNameParser` supports.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131332

Files:
  lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp


Index: lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
===
--- lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
+++ lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
@@ -108,7 +108,10 @@
"llvm", "isUInt<10u>", "(unsigned long)", "", "llvm::isUInt<10u>"},
   {"f, sizeof(B)()", "",
"f, sizeof(B)", "()", "",
-   "f, sizeof(B)"}};
+   "f, sizeof(B)"},
+  {"llvm::Optional::operator*() const volatile &&",
+   "llvm::Optional", "operator*", "()", "const volatile 
&&",
+   "llvm::Optional::operator*"}};
 
   for (const auto &test : test_cases) {
 CPlusPlusLanguage::MethodName method(ConstString(test.input));


Index: lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
===
--- lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
+++ lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
@@ -108,7 +108,10 @@
"llvm", "isUInt<10u>", "(unsigned long)", "", "llvm::isUInt<10u>"},
   {"f, sizeof(B)()", "",
"f, sizeof(B)", "()", "",
-   "f, sizeof(B)"}};
+   "f, sizeof(B)"},
+  {"llvm::Optional::operator*() const volatile &&",
+   "llvm::Optional", "operator*", "()", "const volatile &&",
+   "llvm::Optional::operator*"}};
 
   for (const auto &test : test_cases) {
 CPlusPlusLanguage::MethodName method(ConstString(test.input));
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131312: [LLDB][NFC] Fix suspicious bitwise expression in PrintBTEntry()

2022-08-06 Thread Will Hawkins via Phabricator via lldb-commits
hawkinsw added inline comments.



Comment at: lldb/tools/intel-features/intel-mpx/cli-wrapper-mpxtable.cpp:66
 
-  if ((lbound == one_cmpl64 || one_cmpl32) && ubound == 0) {
 result.Printf("Null bounds on map: pointer value = 0x%" PRIu64 "\n", 
value);

According to https://en.cppreference.com/w/cpp/language/operator_precedence, I 
would read the left operand of the `&&` as 

1. The `==` has higher precedence than `||` so, `b = (lbound == one_compl64)`
2. `b || one_cmpl32`

which does not seem like what the original author intended. I absolutely think 
that the fix is correct, but I just wanted to get everyone's feedback on 
whether this seems like more than just a "suspicious bitwise expression" (and 
more like a "mistaken bitwise expression").

All that said, I could be completely, 100% wrong. And, if I am, feel free to 
ignore me!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131312

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-08-06 Thread Douglas Yung via Phabricator via lldb-commits
dyung added a comment.

Your change is causing a build failure on the PS4 linux build bot using GCC 
9.3. Can you take a look?
https://lab.llvm.org/buildbot/#/builders/139/builds/26186

  FAILED: 
tools/clang/tools/extra/clang-tidy/bugprone/CMakeFiles/obj.clangTidyBugproneModule.dir/SignalHandlerCheck.cpp.o
 
  CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/g++ 
-DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/tools/extra/clang-tidy/bugprone
 
-I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang-tools-extra/clang-tidy/bugprone
 
-I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/tools/extra/clang-tidy
 
-I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include
 
-I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/include
 -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/include 
-I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include
 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden 
-Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings 
-Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long 
-Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess 
-Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment 
-Wmisleading-indentation -fdiagnostics-color -ffunction-sections 
-fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 
-DNDEBUG  -fno-exceptions -fno-rtti -UNDEBUG -std=c++17 -MD -MT 
tools/clang/tools/extra/clang-tidy/bugprone/CMakeFiles/obj.clangTidyBugproneModule.dir/SignalHandlerCheck.cpp.o
 -MF 
tools/clang/tools/extra/clang-tidy/bugprone/CMakeFiles/obj.clangTidyBugproneModule.dir/SignalHandlerCheck.cpp.o.d
 -o 
tools/clang/tools/extra/clang-tidy/bugprone/CMakeFiles/obj.clangTidyBugproneModule.dir/SignalHandlerCheck.cpp.o
 -c 
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp
  
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp:17:45:
 error: modification of ‘’ is not a constant expression
 17 | "signal", "abort", "_Exit", "quick_exit"};
| ^
  
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp:217:12:
 error: modification of ‘’ is not a constant expression
217 | "write"};
|^


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-08-06 Thread Trass3r via Phabricator via lldb-commits
Trass3r added a comment.

Also fails on gcc 11.2: https://github.com/Trass3r/llvm-project/runs/7703302032


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-08-06 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added a comment.

In D130689#3704581 , @dyung wrote:

> Your change is causing a build failure on the PS4 linux build bot using GCC 
> 9.3. Can you take a look?
> https://lab.llvm.org/buildbot/#/builders/139/builds/26186
>
>   FAILED: 
> tools/clang/tools/extra/clang-tidy/bugprone/CMakeFiles/obj.clangTidyBugproneModule.dir/SignalHandlerCheck.cpp.o
>  
>   CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/g++ 
> -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS 
> -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
> -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/tools/extra/clang-tidy/bugprone
>  
> -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang-tools-extra/clang-tidy/bugprone
>  
> -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/tools/extra/clang-tidy
>  
> -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include
>  
> -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/include
>  
> -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/include
>  
> -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include
>  -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden 
> -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings 
> -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long 
> -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess 
> -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type 
> -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment 
> -Wmisleading-indentation -fdiagnostics-color -ffunction-sections 
> -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 
> -DNDEBUG  -fno-exceptions -fno-rtti -UNDEBUG -std=c++17 -MD -MT 
> tools/clang/tools/extra/clang-tidy/bugprone/CMakeFiles/obj.clangTidyBugproneModule.dir/SignalHandlerCheck.cpp.o
>  -MF 
> tools/clang/tools/extra/clang-tidy/bugprone/CMakeFiles/obj.clangTidyBugproneModule.dir/SignalHandlerCheck.cpp.o.d
>  -o 
> tools/clang/tools/extra/clang-tidy/bugprone/CMakeFiles/obj.clangTidyBugproneModule.dir/SignalHandlerCheck.cpp.o
>  -c 
> /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp
>   
> /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp:17:45:
>  error: modification of ‘’ is not a constant expression
>  17 | "signal", "abort", "_Exit", "quick_exit"};
> | ^
>   
> /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp:217:12:
>  error: modification of ‘’ is not a constant expression
> 217 | "write"};
> |^

Fixed by c7ec86b13c461f6a8ce11f8443c1b6242013d26f 
 .
May be related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102921


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D131294: [LLDB][NFC] Reliability fixes to TCPSocket code

2022-08-06 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131294

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


[Lldb-commits] [lldb] aa4977f - [LLDB][NFC] Reliability fixes to TCPSocket code

2022-08-06 Thread Slava Gurevich via lldb-commits

Author: Slava Gurevich
Date: 2022-08-06T23:06:55-07:00
New Revision: aa4977f2e1354bb5e1937235dd12199839ab0801

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

LOG: [LLDB][NFC] Reliability fixes to TCPSocket code

Patch the following issues found by static code inspection:
- Unchecked return values from lib calls
- Passing potentially negative arg into a function that requires non-negative 
input
- Possible socket double-close

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

Added: 


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

Removed: 




diff  --git a/lldb/source/Host/common/TCPSocket.cpp 
b/lldb/source/Host/common/TCPSocket.cpp
index eabc9fef8a661..f424b42db7b64 100644
--- a/lldb/source/Host/common/TCPSocket.cpp
+++ b/lldb/source/Host/common/TCPSocket.cpp
@@ -174,7 +174,10 @@ Status TCPSocket::Connect(llvm::StringRef name) {
   continue;
 }
 
-SetOptionNoDelay();
+if (-1 == SetOptionNoDelay()) {
+  Close();
+  continue;
+}
 
 error.Clear();
 return error;
@@ -200,15 +203,18 @@ Status TCPSocket::Listen(llvm::StringRef name, int 
backlog) {
   for (SocketAddress &address : addresses) {
 int fd = Socket::CreateSocket(address.GetFamily(), kType, IPPROTO_TCP,
   m_child_processes_inherit, error);
-if (error.Fail())
+if (error.Fail() || fd < 0)
   continue;
 
 // enable local address reuse
 int option_value = 1;
 set_socket_option_arg_type option_value_p =
 reinterpret_cast(&option_value);
-::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, option_value_p,
- sizeof(option_value));
+if (-1 == ::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, option_value_p,
+   sizeof(option_value))) {
+  CLOSE_SOCKET(fd);
+  continue;
+}
 
 SocketAddress listen_address = address;
 if(!listen_address.IsLocalhost())
@@ -255,8 +261,8 @@ Status TCPSocket::Accept(Socket *&conn_socket) {
 return error;
   }
 
-  int sock = -1;
-  int listen_sock = -1;
+  int sock = kInvalidSocketValue;
+  int listen_sock = kInvalidSocketValue;
   lldb_private::SocketAddress AcceptAddr;
   MainLoop accept_loop;
   std::vector handles;
@@ -288,7 +294,10 @@ Status TCPSocket::Accept(Socket *&conn_socket) {
 
 lldb_private::SocketAddress &AddrIn = m_listen_sockets[listen_sock];
 if (!AddrIn.IsAnyAddr() && AcceptAddr != AddrIn) {
-  CLOSE_SOCKET(sock);
+  if (kInvalidSocketValue != sock) {
+CLOSE_SOCKET(sock);
+sock = kInvalidSocketValue;
+  }
   llvm::errs() << llvm::formatv(
   "error: rejecting incoming connection from {0} (expecting {1})",
   AcceptAddr.GetIPAddress(), AddrIn.GetIPAddress());



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


[Lldb-commits] [PATCH] D131294: [LLDB][NFC] Reliability fixes to TCPSocket code

2022-08-06 Thread Slava Gurevich via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaa4977f2e135: [LLDB][NFC] Reliability fixes to TCPSocket 
code (authored by fixathon).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131294

Files:
  lldb/source/Host/common/TCPSocket.cpp


Index: lldb/source/Host/common/TCPSocket.cpp
===
--- lldb/source/Host/common/TCPSocket.cpp
+++ lldb/source/Host/common/TCPSocket.cpp
@@ -174,7 +174,10 @@
   continue;
 }
 
-SetOptionNoDelay();
+if (-1 == SetOptionNoDelay()) {
+  Close();
+  continue;
+}
 
 error.Clear();
 return error;
@@ -200,15 +203,18 @@
   for (SocketAddress &address : addresses) {
 int fd = Socket::CreateSocket(address.GetFamily(), kType, IPPROTO_TCP,
   m_child_processes_inherit, error);
-if (error.Fail())
+if (error.Fail() || fd < 0)
   continue;
 
 // enable local address reuse
 int option_value = 1;
 set_socket_option_arg_type option_value_p =
 reinterpret_cast(&option_value);
-::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, option_value_p,
- sizeof(option_value));
+if (-1 == ::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, option_value_p,
+   sizeof(option_value))) {
+  CLOSE_SOCKET(fd);
+  continue;
+}
 
 SocketAddress listen_address = address;
 if(!listen_address.IsLocalhost())
@@ -255,8 +261,8 @@
 return error;
   }
 
-  int sock = -1;
-  int listen_sock = -1;
+  int sock = kInvalidSocketValue;
+  int listen_sock = kInvalidSocketValue;
   lldb_private::SocketAddress AcceptAddr;
   MainLoop accept_loop;
   std::vector handles;
@@ -288,7 +294,10 @@
 
 lldb_private::SocketAddress &AddrIn = m_listen_sockets[listen_sock];
 if (!AddrIn.IsAnyAddr() && AcceptAddr != AddrIn) {
-  CLOSE_SOCKET(sock);
+  if (kInvalidSocketValue != sock) {
+CLOSE_SOCKET(sock);
+sock = kInvalidSocketValue;
+  }
   llvm::errs() << llvm::formatv(
   "error: rejecting incoming connection from {0} (expecting {1})",
   AcceptAddr.GetIPAddress(), AddrIn.GetIPAddress());


Index: lldb/source/Host/common/TCPSocket.cpp
===
--- lldb/source/Host/common/TCPSocket.cpp
+++ lldb/source/Host/common/TCPSocket.cpp
@@ -174,7 +174,10 @@
   continue;
 }
 
-SetOptionNoDelay();
+if (-1 == SetOptionNoDelay()) {
+  Close();
+  continue;
+}
 
 error.Clear();
 return error;
@@ -200,15 +203,18 @@
   for (SocketAddress &address : addresses) {
 int fd = Socket::CreateSocket(address.GetFamily(), kType, IPPROTO_TCP,
   m_child_processes_inherit, error);
-if (error.Fail())
+if (error.Fail() || fd < 0)
   continue;
 
 // enable local address reuse
 int option_value = 1;
 set_socket_option_arg_type option_value_p =
 reinterpret_cast(&option_value);
-::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, option_value_p,
- sizeof(option_value));
+if (-1 == ::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, option_value_p,
+   sizeof(option_value))) {
+  CLOSE_SOCKET(fd);
+  continue;
+}
 
 SocketAddress listen_address = address;
 if(!listen_address.IsLocalhost())
@@ -255,8 +261,8 @@
 return error;
   }
 
-  int sock = -1;
-  int listen_sock = -1;
+  int sock = kInvalidSocketValue;
+  int listen_sock = kInvalidSocketValue;
   lldb_private::SocketAddress AcceptAddr;
   MainLoop accept_loop;
   std::vector handles;
@@ -288,7 +294,10 @@
 
 lldb_private::SocketAddress &AddrIn = m_listen_sockets[listen_sock];
 if (!AddrIn.IsAnyAddr() && AcceptAddr != AddrIn) {
-  CLOSE_SOCKET(sock);
+  if (kInvalidSocketValue != sock) {
+CLOSE_SOCKET(sock);
+sock = kInvalidSocketValue;
+  }
   llvm::errs() << llvm::formatv(
   "error: rejecting incoming connection from {0} (expecting {1})",
   AcceptAddr.GetIPAddress(), AddrIn.GetIPAddress());
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131303: [lldb] Refactor Symbols::DownloadObjectAndSymbolFile

2022-08-06 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

LGTM, I was looking at this method last week and had the same idea -- I started 
on a patch similar to this, but hadn't finished yet.




Comment at: lldb/source/Symbol/LocateSymbolFileMacOSX.cpp:566
   // external program to find the symbols, don't run it for them.
-  if (!force_lookup && g_dbgshell_command == NULL) {
+  if (!force_lookup && dbgshell_command.empty())
+return false;

I had this conditional also test if `LLDB_APPLE_DSYMFORUUID_EXECUTABLE` was 
currently set in the environment, which is equivalent to if the DBGShellCommand 
was set in the com.apple.DebugSymbol preferences.  But as I think through it, I 
think it's fine -- code is calling Symbol::DownloadObjectAndSymbolFile() when 
it is wiling to do a potentially expensive search for the debug information 
almost always - `force==true` is the default, and all of the important ones 
we're testing in the testsuite.  


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

https://reviews.llvm.org/D131303

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


[Lldb-commits] [PATCH] D131328: [lldb] Support fetching symbols with dsymForUUID in the background

2022-08-06 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

Interesting idea, it seems worth trying out and seeing how it works in practice.

My read of the llvm::ThreadPool is that this won't create an unbounded number 
of threads doing background fetches, right.  Some of the big UI apps in macOS 
these days can have a thousand dylib/frameworks loaded in them.


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

https://reviews.llvm.org/D131328

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