[Lldb-commits] [PATCH] D27759: Fix build for mingw.

2016-12-15 Thread Hafiz Abid Qadeer via Phabricator via lldb-commits
abidh added a comment.

In https://reviews.llvm.org/D27759#622332, @labath wrote:

> Yeah, I meant using it everywhere as a generic "am I on windows, regardless 
> of the compiler" check. (Assuming Zach is fine with that)


OK. If Zachary is fine with that then I can do that in a separate commit.

@zturner
Do you have any other comment on this patch ?


https://reviews.llvm.org/D27759



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


[Lldb-commits] [PATCH] D27780: Make OptionDefinition structure store a StringRef

2016-12-15 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Looks reasonable. I look forward to using StringRef in more places.


https://reviews.llvm.org/D27780



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


[Lldb-commits] [lldb] r289801 - Remove linux/personality.h wrapper

2016-12-15 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Dec 15 04:47:40 2016
New Revision: 289801

URL: http://llvm.org/viewvc/llvm-project?rev=289801&view=rev
Log:
Remove linux/personality.h wrapper

This code is currently unused.

Removing it should make porting of the linux plugin to NetBSD easier, and we can
always add it later if needed.

Removed:
lldb/trunk/include/lldb/Host/linux/Personality.h
Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp

Removed: lldb/trunk/include/lldb/Host/linux/Personality.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/Personality.h?rev=289800&view=auto
==
--- lldb/trunk/include/lldb/Host/linux/Personality.h (original)
+++ lldb/trunk/include/lldb/Host/linux/Personality.h (removed)
@@ -1,25 +0,0 @@
-//===-- Personality.h ---*- C++ 
-*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-// This file defines personality functions & structures
-
-#ifndef liblldb_Host_linux_Personality_h_
-#define liblldb_Host_linux_Personality_h_
-
-#ifdef __ANDROID__
-#include 
-#endif
-
-#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
-#include 
-#else
-#include 
-#endif
-
-#endif // liblldb_Host_linux_Personality_h_

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=289801&r1=289800&r2=289801&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Thu Dec 15 
04:47:40 2016
@@ -58,7 +58,6 @@
 #include 
 #include 
 
-#include "lldb/Host/linux/Personality.h"
 #include "lldb/Host/linux/Ptrace.h"
 #include "lldb/Host/linux/Uio.h"
 


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


Re: [Lldb-commits] [PATCH] D27759: Fix build for mingw.

2016-12-15 Thread Zachary Turner via lldb-commits
Looks good
On Thu, Dec 15, 2016 at 2:16 AM Hafiz Abid Qadeer via Phabricator <
revi...@reviews.llvm.org> wrote:

> abidh added a comment.
>
> In https://reviews.llvm.org/D27759#622332, @labath wrote:
>
> > Yeah, I meant using it everywhere as a generic "am I on windows,
> regardless of the compiler" check. (Assuming Zach is fine with that)
>
>
> OK. If Zachary is fine with that then I can do that in a separate commit.
>
> @zturner
> Do you have any other comment on this patch ?
>
>
> https://reviews.llvm.org/D27759
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D27759: Fix build for mingw.

2016-12-15 Thread Hafiz Abid Qadeer via Phabricator via lldb-commits
abidh updated this revision to Diff 81576.
abidh added a comment.

Replaced /D with -D as per comments.


https://reviews.llvm.org/D27759

Files:
  cmake/LLDBDependencies.cmake
  cmake/modules/AddLLDB.cmake
  cmake/modules/LLDBConfig.cmake
  include/lldb/Host/windows/windows.h
  source/API/SystemInitializerFull.cpp
  source/Core/Mangled.cpp
  source/Host/common/File.cpp
  source/Host/windows/Host.cpp
  source/Host/windows/HostProcessWindows.cpp
  source/Host/windows/ProcessRunLock.cpp
  source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
  source/Plugins/Process/Windows/Common/ExceptionRecord.h
  source/Target/ProcessLaunchInfo.cpp
  tools/driver/Driver.cpp
  tools/lldb-mi/MICmnStreamStdin.cpp
  tools/lldb-mi/MIUtilDebug.cpp

Index: tools/lldb-mi/MIUtilDebug.cpp
===
--- tools/lldb-mi/MIUtilDebug.cpp
+++ tools/lldb-mi/MIUtilDebug.cpp
@@ -9,7 +9,7 @@
 
 // Third party headers:
 #ifdef _WIN32
-#include 
+#include 
 #endif
 
 // In-house headers:
Index: tools/lldb-mi/MICmnStreamStdin.cpp
===
--- tools/lldb-mi/MICmnStreamStdin.cpp
+++ tools/lldb-mi/MICmnStreamStdin.cpp
@@ -9,7 +9,7 @@
 
 // Third Party Headers
 #ifdef _MSC_VER
-#include 
+#include 
 #endif
 #include  // For std::strerror()
 
Index: tools/driver/Driver.cpp
===
--- tools/driver/Driver.cpp
+++ tools/driver/Driver.cpp
@@ -1208,13 +1208,13 @@
 }
 
 int
-#ifdef WIN32
+#ifdef _MSC_VER
 wmain(int argc, wchar_t const *wargv[])
 #else
 main(int argc, char const *argv[])
 #endif
 {
-#ifdef _WIN32
+#ifdef _MSC_VER
   // Convert wide arguments to UTF-8
   std::vector argvStrings(argc);
   std::vector argvPointers(argc);
Index: source/Target/ProcessLaunchInfo.cpp
===
--- source/Target/ProcessLaunchInfo.cpp
+++ source/Target/ProcessLaunchInfo.cpp
@@ -294,7 +294,7 @@
   __FUNCTION__);
 
 int open_flags = O_RDWR | O_NOCTTY;
-#if !defined(_MSC_VER)
+#if !defined(_WIN32)
 // We really shouldn't be specifying platform specific flags
 // that are intended for a system call in generic code.  But
 // this will have to do for now.
Index: source/Plugins/Process/Windows/Common/ExceptionRecord.h
===
--- source/Plugins/Process/Windows/Common/ExceptionRecord.h
+++ source/Plugins/Process/Windows/Common/ExceptionRecord.h
@@ -12,7 +12,7 @@
 
 #include "lldb/Host/windows/windows.h"
 #include "lldb/lldb-forward.h"
-#include 
+#include 
 
 #include 
 #include 
Index: source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
===
--- source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
+++ source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
@@ -16,7 +16,7 @@
 
 #ifdef _WIN32
 #include "lldb/Host/windows/windows.h"
-#include  // for MiniDumpWriteDump
+#include  // for MiniDumpWriteDump
 #endif
 
 namespace lldb_private {
Index: source/Host/windows/ProcessRunLock.cpp
===
--- source/Host/windows/ProcessRunLock.cpp
+++ source/Host/windows/ProcessRunLock.cpp
@@ -10,16 +10,6 @@
 #include "lldb/Host/ProcessRunLock.h"
 #include "lldb/Host/windows/windows.h"
 
-namespace {
-#if defined(__MINGW32__)
-// Taken from WinNT.h
-typedef struct _RTL_SRWLOCK { PVOID Ptr; } RTL_SRWLOCK, *PRTL_SRWLOCK;
-
-// Taken from WinBase.h
-typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK;
-#endif
-}
-
 static PSRWLOCK GetLock(lldb::rwlock_t lock) {
   return static_cast(lock);
 }
Index: source/Host/windows/HostProcessWindows.cpp
===
--- source/Host/windows/HostProcessWindows.cpp
+++ source/Host/windows/HostProcessWindows.cpp
@@ -16,7 +16,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/ConvertUTF.h"
 
-#include 
+#include 
 
 using namespace lldb_private;
 
Index: source/Host/windows/Host.cpp
===
--- source/Host/windows/Host.cpp
+++ source/Host/windows/Host.cpp
@@ -29,7 +29,7 @@
 #include "llvm/Support/ConvertUTF.h"
 
 // Windows includes
-#include 
+#include 
 
 using namespace lldb;
 using namespace lldb_private;
Index: source/Host/common/File.cpp
===
--- source/Host/common/File.cpp
+++ source/Host/common/File.cpp
@@ -222,7 +222,7 @@
   }
 
   do {
-#ifdef _WIN32
+#ifdef _MSC_VER
 std::wstring wpath;
 if (!llvm::ConvertUTF8toWide(path, wpath)) {
   m_descriptor = -1;
Index: source/Core/Mangled.cpp
===
--- source/Core/Mangled.cpp
+++ source/Core/Mangled.cpp
@@ -9,9 +9,9 @@
 
 // FreeBSD9-STABLE requires this to know about size_t in cxxabi.h
 #include 
-#if

[Lldb-commits] [PATCH] D27759: Fix build for mingw.

2016-12-15 Thread Hafiz Abid Qadeer via Phabricator via lldb-commits
abidh accepted this revision.
abidh added a reviewer: abidh.
abidh marked an inline comment as done.
abidh added a comment.
This revision is now accepted and ready to land.

Accepted in email.


https://reviews.llvm.org/D27759



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


[Lldb-commits] [lldb] r289821 - Fix build for mingw.

2016-12-15 Thread Hafiz Abid Qadeer via lldb-commits
Author: abidh
Date: Thu Dec 15 09:00:41 2016
New Revision: 289821

URL: http://llvm.org/viewvc/llvm-project?rev=289821&view=rev
Log:
Fix build for mingw.

Summary: I was building lldb using cross mingw-w64 toolchain on Linux and 
observed some issues. This is first patch in the series to fix that build. It 
mostly corrects the case of include files and adjusts some #ifdefs from 
_MSC_VER to _WIN32 and vice versa. I built lldb on windows with VS after 
applying this patch to make sure it does not break the build there.

Reviewers: zturner, labath, abidh

Subscribers: ki.stfu, mgorny, lldb-commits

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

Modified:
lldb/trunk/cmake/LLDBDependencies.cmake
lldb/trunk/cmake/modules/AddLLDB.cmake
lldb/trunk/cmake/modules/LLDBConfig.cmake
lldb/trunk/include/lldb/Host/windows/windows.h
lldb/trunk/source/API/SystemInitializerFull.cpp
lldb/trunk/source/Core/Mangled.cpp
lldb/trunk/source/Host/common/File.cpp
lldb/trunk/source/Host/windows/Host.cpp
lldb/trunk/source/Host/windows/HostProcessWindows.cpp
lldb/trunk/source/Host/windows/ProcessRunLock.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/ExceptionRecord.h
lldb/trunk/source/Target/ProcessLaunchInfo.cpp
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/tools/lldb-mi/MICmnStreamStdin.cpp
lldb/trunk/tools/lldb-mi/MIUtilDebug.cpp

Modified: lldb/trunk/cmake/LLDBDependencies.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/LLDBDependencies.cmake?rev=289821&r1=289820&r2=289821&view=diff
==
--- lldb/trunk/cmake/LLDBDependencies.cmake (original)
+++ lldb/trunk/cmake/LLDBDependencies.cmake Thu Dec 15 09:00:41 2016
@@ -91,8 +91,8 @@ set( LLDB_USED_LIBS
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
   list(APPEND LLDB_USED_LIBS
 lldbPluginProcessWindowsCommon
-Ws2_32
-Rpcrt4
+ws2_32
+rpcrt4
 )
 endif ()
 

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=289821&r1=289820&r2=289821&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Thu Dec 15 09:00:41 2016
@@ -49,7 +49,7 @@ macro(add_lldb_library name)
   endif()
 
   #PIC not needed on Win
-  if (NOT MSVC)
+  if (NOT WIN32)
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
   endif()
 

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=289821&r1=289820&r2=289821&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Thu Dec 15 09:00:41 2016
@@ -243,7 +243,7 @@ endif()
 
 # Use the Unicode (UTF-16) APIs by default on Win32
 if (CMAKE_SYSTEM_NAME MATCHES "Windows")
-   add_definitions( /D _UNICODE /D UNICODE )
+add_definitions( -D_UNICODE -DUNICODE )
 endif()
 
 set(LLDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})

Modified: lldb/trunk/include/lldb/Host/windows/windows.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/windows.h?rev=289821&r1=289820&r2=289821&view=diff
==
--- lldb/trunk/include/lldb/Host/windows/windows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/windows.h Thu Dec 15 09:00:41 2016
@@ -11,9 +11,11 @@
 #define LLDB_lldb_windows_h_
 
 #define NTDDI_VERSION NTDDI_VISTA
+#undef _WIN32_WINNT // undef a previous definition to avoid warning
 #define _WIN32_WINNT _WIN32_WINNT_VISTA
 #define WIN32_LEAN_AND_MEAN
 #define NOGDI
+#undef NOMINMAX // undef a previous definition to avoid warning
 #define NOMINMAX
 #include 
 #undef GetUserName

Modified: lldb/trunk/source/API/SystemInitializerFull.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=289821&r1=289820&r2=289821&view=diff
==
--- lldb/trunk/source/API/SystemInitializerFull.cpp (original)
+++ lldb/trunk/source/API/SystemInitializerFull.cpp Thu Dec 15 09:00:41 2016
@@ -107,7 +107,7 @@
 #include "Plugins/Process/FreeBSD/ProcessFreeBSD.h"
 #endif
 
-#if defined(_MSC_VER)
+#if defined(_WIN32)
 #include "Plugins/Process/Windows/Common/ProcessWindows.h"
 #include "lldb/Host/windows/windows.h"
 #endif
@@ -332,7 +332,7 @@ void SystemInitializerFull::Initialize()
   ObjCPlusPlusLanguage::Initialize();
   OCamlLanguage::Initialize();
 
-#if defined(_MSC_VER)
+#if defined(_WIN32)
   ProcessWindows::Initialize();
 #endif
 #if defined(__FreeBSD__)

Modified: lldb/trunk/source/Core/Mangled.cpp
URL: 
http://llvm.o

[Lldb-commits] [PATCH] D26757: Fix broken escaping of commands in the build

2016-12-15 Thread Luke Drummond via Phabricator via lldb-commits
ldrumm marked 2 inline comments as done.
ldrumm added a comment.

ping


https://reviews.llvm.org/D26757



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


Re: [Lldb-commits] [PATCH] D26757: Fix broken escaping of commands in the build

2016-12-15 Thread Zachary Turner via lldb-commits
I think this was lgtm'ed wasn't it?

On Thu, Dec 15, 2016 at 9:46 AM Luke Drummond via Phabricator <
revi...@reviews.llvm.org> wrote:

> ldrumm marked 2 inline comments as done.
> ldrumm added a comment.
>
> ping
>
>
> https://reviews.llvm.org/D26757
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D26757: Fix broken escaping of commands in the build

2016-12-15 Thread Luke Drummond via lldb-commits

Hi Zachary

On 15/12/16 17:52, Zachary Turner wrote:

I think this was lgtm'ed wasn't it?


Chris checked the cmake changes, so if you're happy with the python 
fixes I'll go ahead and commit this.


Thanks

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


[Lldb-commits] [lldb] r289841 - [CMake] Only support LLDB_BUILD_FRAMEWORK on CMake 3.7 and later

2016-12-15 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Thu Dec 15 12:18:47 2016
New Revision: 289841

URL: http://llvm.org/viewvc/llvm-project?rev=289841&view=rev
Log:
[CMake] Only support LLDB_BUILD_FRAMEWORK on CMake 3.7 and later

CMake's framework target generation was unable to generate POST_BUILD steps 
(see: https://gitlab.kitware.com/cmake/cmake/issues/16363).

It turns out working around this is really not reasonable. The more reasonable 
solution to me is just to not support LLDB.framework unless you are on CMake 
3.7 or newer.

Since CMake 3.7.1 is released that's how I'm going to handle this.

Modified:
lldb/trunk/source/API/CMakeLists.txt
lldb/trunk/test/CMakeLists.txt

Modified: lldb/trunk/source/API/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/CMakeLists.txt?rev=289841&r1=289840&r2=289841&view=diff
==
--- lldb/trunk/source/API/CMakeLists.txt (original)
+++ lldb/trunk/source/API/CMakeLists.txt Thu Dec 15 12:18:47 2016
@@ -8,6 +8,10 @@ include(${LLDB_PROJECT_ROOT}/cmake/LLDBD
 
 option(LLDB_BUILD_FRAMEWORK "Build the Darwin LLDB.framework" Off)
 
+if(LLDB_BUILD_FRAMEWORK AND CMAKE_VERSION VERSION_LESS 3.7)
+  message(FATAL_ERROR "LLDB_BUILD_FRAMEWORK is not supported on CMake < 3.7")
+endif()
+
 if (LLDB_BUILD_FRAMEWORK AND NOT APPLE)
   message(FATAL_ERROR "LLDB.framework cannot be generated unless targeting 
Apple platforms.")
 endif()
@@ -140,24 +144,11 @@ if(LLDB_BUILD_FRAMEWORK)
 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}
 PUBLIC_HEADER "${public_headers}")
 
-  set(symlink_commands
-COMMAND ${CMAKE_COMMAND} -E make_directory $
-COMMAND ${CMAKE_COMMAND} -E create_symlink 
${LLDB_SOURCE_DIR}/include/lldb/API $/Headers
+  add_custom_command(TARGET liblldb POST_BUILD
+COMMAND ${CMAKE_COMMAND} -E make_directory 
$/Versions/${LLDB_FRAMEWORK_VERSION}
+COMMAND ${CMAKE_COMMAND} -E copy_directory 
${LLDB_SOURCE_DIR}/include/lldb/API $/Headers
 COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers 
${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers 
-COMMAND ${CMAKE_COMMAND} -E create_symlink 
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} 
$/Resources/Clang
+COMMAND ${CMAKE_COMMAND} -E copy_directory 
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} 
$/Resources/Clang
 )
-
-  # This works around a CMake bug where POST_BUILD steps are not applied to 
-  # framework targets. This fix is merged into the CMake release branch and
-  # should be available with CMake 3.7 rc2:
-  # https://gitlab.kitware.com/cmake/cmake/issues/16363
-  if(CMAKE_VERSION VERSION_GREATER 3.6.99)
-add_custom_command(TARGET liblldb POST_BUILD ${symlink_commands})
-  else()
-add_custom_command(OUTPUT 
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Headers
-  ${symlink_commands})
-add_custom_target(lldb_header_symlink
-  DEPENDS 
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Headers)
-  endif()
 endif()
 

Modified: lldb/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=289841&r1=289840&r2=289841&view=diff
==
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Thu Dec 15 12:18:47 2016
@@ -27,11 +27,6 @@ if(TARGET lldb-mi)
   list(APPEND LLDB_TEST_DEPS lldb-mi)
 endif()
 
-# This target will only exist if the user is using a CMake older than 3.7
-if(TARGET lldb_header_symlink)
-  list(APPEND LLDB_TEST_DEPS lldb_header_symlink)
-endif()
-
 if ("${LLDB_TEST_COMPILER}" STREQUAL "")
 string(REGEX REPLACE ".*ccache\ +" "" LLDB_TEST_COMPILER 
${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1})
 endif()


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


[Lldb-commits] [lldb] r289842 - [CMake] Ensure Python files are inside the LLDB framework bundle

2016-12-15 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Thu Dec 15 12:19:10 2016
New Revision: 289842

URL: http://llvm.org/viewvc/llvm-project?rev=289842&view=rev
Log:
[CMake] Ensure Python files are inside the LLDB framework bundle

When building the LLDB Framework we need to ensure that the Python files get 
put into the Framework before the Framework's install target can be invoked.

All files inside the Framework's Resources bundle will get copied over during 
the install action.

Modified:
lldb/trunk/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=289842&r1=289841&r2=289842&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Thu Dec 15 12:19:10 2016
@@ -63,6 +63,12 @@ if (NOT LLDB_DISABLE_PYTHON)
 # Ensure we do the python post-build step when building lldb.
 add_dependencies(lldb finish_swig)
 
+if(LLDB_BUILD_FRAMEWORK)
+  # The target to install libLLDB needs to depend on finish swig so that 
the
+  # framework build properly copies over the Python files.
+  add_dependencies(install-liblldb finish_swig)
+endif()
+
 # Add a Post-Build Event to copy the custom Python DLL to the lldb 
binaries dir so that Windows can find it when launching
 # lldb.exe or any other executables that were linked with liblldb.
 if (WIN32 AND NOT "${PYTHON_DLL}" STREQUAL "")


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


[Lldb-commits] [PATCH] D27780: Make OptionDefinition structure store a StringRef

2016-12-15 Thread Zachary Turner via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL289853: [StringRef] Add enable-if to StringLiteral. 
(authored by zturner).

Changed prior to commit:
  https://reviews.llvm.org/D27780?vs=81487&id=81624#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27780

Files:
  llvm/trunk/include/llvm/ADT/StringRef.h


Index: llvm/trunk/include/llvm/ADT/StringRef.h
===
--- llvm/trunk/include/llvm/ADT/StringRef.h
+++ llvm/trunk/include/llvm/ADT/StringRef.h
@@ -838,22 +838,21 @@
 
   /// A wrapper around a string literal that serves as a proxy for constructing
   /// global tables of StringRefs with the length computed at compile time.
-  /// Using this class with a non-literal char array is considered undefined
-  /// behavior.  To prevent this, it is recommended that StringLiteral *only*
-  /// be used in a constexpr context, as such:
+  /// In order to avoid the invocation of a global constructor, StringLiteral
+  /// should *only* be used in a constexpr context, as such:
   ///
   /// constexpr StringLiteral S("test");
   ///
-  /// Note: There is a subtle behavioral difference in the constructor of
-  /// StringRef and StringLiteral, as illustrated below:
-  ///
-  /// constexpr StringLiteral S("a\0b");  // S.size() == 3
-  /// StringRef S("a\0b");  // S.size() == 1
-  ///
   class StringLiteral : public StringRef {
   public:
 template 
-constexpr StringLiteral(const char (&Str)[N]) : StringRef(Str, N - 1) {}
+constexpr StringLiteral(const char (&Str)[N])
+#if __has_attribute(enable_if)
+__attribute((enable_if(__builtin_strlen(Str) == N - 1,
+   "invalid string literal")))
+#endif
+: StringRef(Str, N - 1) {
+}
   };
 
   /// @name StringRef Comparison Operators
@@ -865,9 +864,7 @@
   }
 
   LLVM_ATTRIBUTE_ALWAYS_INLINE
-  inline bool operator!=(StringRef LHS, StringRef RHS) {
-return !(LHS == RHS);
-  }
+  inline bool operator!=(StringRef LHS, StringRef RHS) { return !(LHS == RHS); 
}
 
   inline bool operator<(StringRef LHS, StringRef RHS) {
 return LHS.compare(RHS) == -1;


Index: llvm/trunk/include/llvm/ADT/StringRef.h
===
--- llvm/trunk/include/llvm/ADT/StringRef.h
+++ llvm/trunk/include/llvm/ADT/StringRef.h
@@ -838,22 +838,21 @@
 
   /// A wrapper around a string literal that serves as a proxy for constructing
   /// global tables of StringRefs with the length computed at compile time.
-  /// Using this class with a non-literal char array is considered undefined
-  /// behavior.  To prevent this, it is recommended that StringLiteral *only*
-  /// be used in a constexpr context, as such:
+  /// In order to avoid the invocation of a global constructor, StringLiteral
+  /// should *only* be used in a constexpr context, as such:
   ///
   /// constexpr StringLiteral S("test");
   ///
-  /// Note: There is a subtle behavioral difference in the constructor of
-  /// StringRef and StringLiteral, as illustrated below:
-  ///
-  /// constexpr StringLiteral S("a\0b");  // S.size() == 3
-  /// StringRef S("a\0b");  // S.size() == 1
-  ///
   class StringLiteral : public StringRef {
   public:
 template 
-constexpr StringLiteral(const char (&Str)[N]) : StringRef(Str, N - 1) {}
+constexpr StringLiteral(const char (&Str)[N])
+#if __has_attribute(enable_if)
+__attribute((enable_if(__builtin_strlen(Str) == N - 1,
+   "invalid string literal")))
+#endif
+: StringRef(Str, N - 1) {
+}
   };
 
   /// @name StringRef Comparison Operators
@@ -865,9 +864,7 @@
   }
 
   LLVM_ATTRIBUTE_ALWAYS_INLINE
-  inline bool operator!=(StringRef LHS, StringRef RHS) {
-return !(LHS == RHS);
-  }
+  inline bool operator!=(StringRef LHS, StringRef RHS) { return !(LHS == RHS); }
 
   inline bool operator<(StringRef LHS, StringRef RHS) {
 return LHS.compare(RHS) == -1;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D27780: Make OptionDefinition structure store a StringRef

2016-12-15 Thread Zachary Turner via Phabricator via lldb-commits
zturner reopened this revision.
zturner added a comment.

My bad, this revision was not actually closed, I attached the wrong diff to an 
unrelated commit.  I will need to re-upload this one.


Repository:
  rL LLVM

https://reviews.llvm.org/D27780



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


[Lldb-commits] [PATCH] D27780: Make OptionDefinition structure store a StringRef

2016-12-15 Thread Zachary Turner via Phabricator via lldb-commits
zturner removed rL LLVM as the repository for this revision.
zturner updated this revision to Diff 81625.
zturner added a comment.

Re-upload the correct diff.


https://reviews.llvm.org/D27780

Files:
  lldb/include/lldb/Interpreter/Options.h
  lldb/include/lldb/lldb-private-types.h
  lldb/source/Commands/CommandObjectSettings.cpp
  lldb/source/Host/common/OptionParser.cpp
  lldb/source/Interpreter/Args.cpp
  lldb/source/Interpreter/OptionGroupOutputFile.cpp
  lldb/source/Interpreter/Options.cpp

Index: lldb/source/Interpreter/Options.cpp
===
--- lldb/source/Interpreter/Options.cpp
+++ lldb/source/Interpreter/Options.cpp
@@ -333,27 +333,14 @@
   }
 }
 
-bool Options::SupportsLongOption(const char *long_option) {
-  if (!long_option || !long_option[0])
+bool Options::SupportsLongOption(llvm::StringRef long_option) {
+  long_option.consume_front("--");
+  if (long_option.empty())
 return false;
 
-  auto opt_defs = GetDefinitions();
-  if (opt_defs.empty())
-return false;
-
-  const char *long_option_name = long_option;
-  if (long_option[0] == '-' && long_option[1] == '-')
-long_option_name += 2;
-
-  for (auto &def : opt_defs) {
-if (!def.long_option)
-  continue;
-
-if (strcmp(def.long_option, long_option_name) == 0)
-  return true;
-  }
-
-  return false;
+  return llvm::any_of(GetDefinitions(), [=](const OptionDefinition &D) {
+return D.long_option == long_option;
+  });
 }
 
 enum OptionDisplayType {
@@ -603,9 +590,10 @@
 
   strm.IndentMore(5);
 
-  if (opt_defs[i].usage_text)
+  if (!opt_defs[i].usage_text.empty())
 OutputFormattedUsageText(strm, opt_defs[i], screen_width);
-  if (opt_defs[i].enum_values != nullptr) {
+
+  if (opt_defs[i].enum_values == nullptr) {
 strm.Indent();
 strm.Printf("Values: ");
 for (int k = 0; opt_defs[i].enum_values[k].string_value != nullptr;
@@ -670,10 +658,6 @@
 
   auto opt_defs = GetDefinitions();
 
-  std::string cur_opt_std_str(input.GetArgumentAtIndex(cursor_index));
-  cur_opt_std_str.erase(char_pos);
-  const char *cur_opt_str = cur_opt_std_str.c_str();
-
   for (size_t i = 0; i < opt_element_vector.size(); i++) {
 int opt_pos = opt_element_vector[i].opt_pos;
 int opt_arg_pos = opt_element_vector[i].opt_arg_pos;
@@ -708,18 +692,17 @@
 }
 return true;
   } else if (opt_defs_index != OptionArgElement::eUnrecognizedArg) {
+auto cur_opt_str = input[cursor_index].ref.take_front(char_pos);
+
 // We recognized it, if it an incomplete long option, complete it anyway
-// (getopt_long_only is
-// happy with shortest unique string, but it's still a nice thing to
-// do.)  Otherwise return
-// The string so the upper level code will know this is a full match and
-// add the " ".
-if (cur_opt_str && strlen(cur_opt_str) > 2 && cur_opt_str[0] == '-' &&
-cur_opt_str[1] == '-' &&
-strcmp(opt_defs[opt_defs_index].long_option, cur_opt_str) != 0) {
+// (getopt_long_only is happy with shortest unique string, but it's
+// still a nice thing to do.)  Otherwise return the string so the upper
+// level code will know this is a full match and add the " ".
+if (cur_opt_str.startswith("--") &&
+cur_opt_str.drop_front(2) != opt_defs[opt_defs_index].long_option) {
   std::string full_name("--");
   full_name.append(opt_defs[opt_defs_index].long_option);
-  matches.AppendString(full_name.c_str());
+  matches.AppendString(full_name);
   return true;
 } else {
   matches.AppendString(input.GetArgumentAtIndex(cursor_index));
@@ -729,33 +712,32 @@
 // FIXME - not handling wrong options yet:
 // Check to see if they are writing a long option & complete it.
 // I think we will only get in here if the long option table has two
-// elements
-// that are not unique up to this point.  getopt_long_only does shortest
-// unique match
-// for long options already.
-
-if (cur_opt_str && strlen(cur_opt_str) > 2 && cur_opt_str[0] == '-' &&
-cur_opt_str[1] == '-') {
-  for (auto &def : opt_defs) {
-if (!def.long_option)
-  continue;
+// elements that are not unique up to this point.  getopt_long_only
+// does shortest unique match for long options already.
+auto cur_opt_str = input[cursor_index].ref.take_front(char_pos);
 
-if (strstr(def.long_option, cur_opt_str + 2) == def.long_option) {
-  std::string full_name("--");
-  full_name.append(def.long_option);
-  // The options definitions table has duplicates because of the
-  // way the grouping information is stored, so only add once.
-  bool duplicate = false;
-  for (size_t k = 0; k < 

[Lldb-commits] [lldb] r289879 - [CMake] Refactor LLDB libraries and tools to be components

2016-12-15 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Thu Dec 15 16:01:17 2016
New Revision: 289879

URL: http://llvm.org/viewvc/llvm-project?rev=289879&view=rev
Log:
[CMake] Refactor LLDB libraries and tools to be components

In LLVM's CMake we have a convention that components have both a build and an 
install target. Making LLDB follow this convention will allow LLDB to take 
advantage of the LLVM_DISTRIBUTION_COMPONENTS build option from LLVM.

Modified:
lldb/trunk/cmake/modules/AddLLDB.cmake
lldb/trunk/cmake/modules/LLDBConfig.cmake
lldb/trunk/tools/argdumper/CMakeLists.txt
lldb/trunk/tools/darwin-debug/CMakeLists.txt
lldb/trunk/tools/debugserver/source/MacOSX/CMakeLists.txt
lldb/trunk/tools/driver/CMakeLists.txt
lldb/trunk/tools/lldb-mi/CMakeLists.txt
lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=289879&r1=289878&r2=289879&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Thu Dec 15 16:01:17 2016
@@ -17,7 +17,7 @@ function(lldb_link_common_libs name targ
   endif()
 endfunction(lldb_link_common_libs)
 
-macro(add_lldb_library name)
+function(add_lldb_library name)
   # only supported parameters to this macro are the optional
   # MODULE;SHARED;STATIC library type and source files
   cmake_parse_arguments(PARAM
@@ -80,14 +80,23 @@ macro(add_lldb_library name)
   set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR})
 endif()
 install(TARGETS ${name}
+  COMPONENT ${name}
   RUNTIME DESTINATION bin
   LIBRARY DESTINATION ${out_dir}
   ARCHIVE DESTINATION ${out_dir})
   else()
 install(TARGETS ${name}
+  COMPONENT ${name}
   LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
   ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
   endif()
+  if (NOT CMAKE_CONFIGURATION_TYPES)
+add_custom_target(install-${name}
+  DEPENDS ${name}
+  COMMAND "${CMAKE_COMMAND}"
+  -DCMAKE_INSTALL_COMPONENT=${name}
+  -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+  endif()
 endif()
   endif()
 
@@ -100,14 +109,15 @@ macro(add_lldb_library name)
   endif()
 
   set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
-endmacro(add_lldb_library)
+endfunction(add_lldb_library)
 
-macro(add_lldb_executable name)
-  cmake_parse_arguments(ARG "INCLUDE_IN_FRAMEWORK" "" "" ${ARGN})
+function(add_lldb_executable name)
+  cmake_parse_arguments(ARG "INCLUDE_IN_FRAMEWORK;GENERATE_INSTALL" "" "" 
${ARGN})
   add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
   set_target_properties(${name} PROPERTIES
 FOLDER "lldb executables")
 
+  set(install_dir bin)
   if(LLDB_BUILD_FRAMEWORK)
 if(ARG_INCLUDE_IN_FRAMEWORK)
   string(REGEX REPLACE "[^/]+" ".." _dots ${LLDB_FRAMEWORK_INSTALL_DIR})
@@ -115,16 +125,34 @@ macro(add_lldb_executable name)
 RUNTIME_OUTPUT_DIRECTORY $/Resources
 BUILD_WITH_INSTALL_RPATH On
 INSTALL_RPATH 
"@loader_path/../../../../${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}")
-
-  add_llvm_tool_symlink(${name} ${name} ARG_ALWAYS_GENERATE
-OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
 else()
   set_target_properties(${name} PROPERTIES
 BUILD_WITH_INSTALL_RPATH On
 INSTALL_RPATH "@loader_path/../${LLDB_FRAMEWORK_INSTALL_DIR}")
+  if(ARG_GENERATE_INSTALL)
+install(TARGETS ${name}
+  COMPONENT ${name}
+  RUNTIME DESTINATION ${install_dir})
+if (NOT CMAKE_CONFIGURATION_TYPES)
+  add_custom_target(install-${name}
+DEPENDS ${name}
+COMMAND "${CMAKE_COMMAND}"
+-DCMAKE_INSTALL_COMPONENT=${name}
+-P 
"${CMAKE_BINARY_DIR}/cmake_install.cmake")
+endif()
+  endif()
 endif()
   endif()
-endmacro(add_lldb_executable)
+
+  if(ARG_INCLUDE_IN_FRAMEWORK AND LLDB_BUILD_FRAMEWORK)
+add_llvm_tool_symlink(${name} ${name} ALWAYS_GENERATE SKIP_INSTALL
+OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
+  endif()
+endfunction(add_lldb_executable)
+
+function(add_lldb_tool name)
+  add_lldb_executable(${name} GENERATE_INSTALL ${ARGN})
+endfunction()
 
 # Support appending linker flags to an existing target.
 # This will preserve the existing linker flags on the

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=289879&r1=289878&r2=289879&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.

[Lldb-commits] [PATCH] D26510: Xcode build: specify NDEBUG for all binaries built using the BuildAndIntegration configuration

2016-12-15 Thread Todd Fiala via Phabricator via lldb-commits
tfiala abandoned this revision.
tfiala added a comment.

This one needs more analysis.

I'm bowing out of it.  Greg, you might want to pick this one up?


https://reviews.llvm.org/D26510



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


[Lldb-commits] [PATCH] D23977: Support of lldb on Kfreebsd

2016-12-15 Thread Todd Fiala via Phabricator via lldb-commits
tfiala added a comment.

Looks reasonable to me.

@beanz, any comments on this?


https://reviews.llvm.org/D23977



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


[Lldb-commits] [PATCH] D25922: Test infra: expose CFLAGS_NO_ARCH for use by test custom build rules

2016-12-15 Thread Todd Fiala via Phabricator via lldb-commits
tfiala abandoned this revision.
tfiala added a comment.

@jingham, there may be some reconciliation needed between here and swift-lldb.

I'm bowing out of this one.


https://reviews.llvm.org/D25922



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


[Lldb-commits] [lldb] r289913 - Fix a bug when using a StructuredData darwin-log plugin

2016-12-15 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Thu Dec 15 20:48:39 2016
New Revision: 289913

URL: http://llvm.org/viewvc/llvm-project?rev=289913&view=rev
Log:
Fix a bug when using a StructuredData darwin-log plugin
where we would insert a breakpoint into a system library
but never remove it, so the second time we ran the binary
there would be two breakpoints and the debugger would
stop there.

 

Modified:

lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h
lldb/trunk/source/Target/Process.cpp

Modified: 
lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp?rev=289913&r1=289912&r2=289913&view=diff
==
--- 
lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp 
Thu Dec 15 20:48:39 2016
@@ -1405,6 +1405,20 @@ void StructuredDataDarwinLog::ModulesDid
   EnableNow();
 }
 
+// 
-
+// public destructor
+// 
-
+
+StructuredDataDarwinLog::~StructuredDataDarwinLog() {
+  if (m_breakpoint_id != LLDB_INVALID_BREAK_ID) {
+ProcessSP process_sp(GetProcess());
+if (process_sp) {
+  process_sp->GetTarget().RemoveBreakpointByID(m_breakpoint_id);
+  m_breakpoint_id = LLDB_INVALID_BREAK_ID;
+}
+  }
+}
+
 #pragma mark -
 #pragma mark Private instance methods
 
@@ -1415,7 +1429,8 @@ void StructuredDataDarwinLog::ModulesDid
 StructuredDataDarwinLog::StructuredDataDarwinLog(const ProcessWP &process_wp)
 : StructuredDataPlugin(process_wp), m_recorded_first_timestamp(false),
   m_first_timestamp_seen(0), m_is_enabled(false),
-  m_added_breakpoint_mutex(), m_added_breakpoint() {}
+  m_added_breakpoint_mutex(), m_added_breakpoint(),
+  m_breakpoint_id(LLDB_INVALID_BREAK_ID) {}
 
 // 
-
 // Private static methods
@@ -1734,6 +1749,7 @@ void StructuredDataDarwinLog::AddInitCom
 
   // Set our callback.
   breakpoint_sp->SetCallback(InitCompletionHookCallback, nullptr);
+  m_breakpoint_id = breakpoint_sp->GetID();
   if (log)
 log->Printf("StructuredDataDarwinLog::%s() breakpoint set in module %s,"
 "function %s (process uid %u)",

Modified: 
lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h?rev=289913&r1=289912&r2=289913&view=diff
==
--- 
lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h 
(original)
+++ 
lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h 
Thu Dec 15 20:48:39 2016
@@ -74,6 +74,8 @@ public:
 
   void ModulesDidLoad(Process &process, ModuleList &module_list) override;
 
+  ~StructuredDataDarwinLog();
+
 private:
   // -
   // Private constructors
@@ -129,6 +131,7 @@ private:
   bool m_is_enabled;
   std::mutex m_added_breakpoint_mutex;
   bool m_added_breakpoint;
+  lldb::user_id_t m_breakpoint_id;
 };
 }
 

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=289913&r1=289912&r2=289913&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Dec 15 20:48:39 2016
@@ -889,6 +889,7 @@ void Process::Finalize() {
   m_public_run_lock.SetStopped();
   m_private_run_lock.TrySetRunning(); // This will do nothing if already locked
   m_private_run_lock.SetStopped();
+  m_structured_data_plugin_map.clear();
   m_finalize_called = true;
 }
 


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


[Lldb-commits] [PATCH] D27780: Make OptionDefinition structure store a StringRef

2016-12-15 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

Greg, did the comments about implicit construction of a `StringRef` from a char 
literal being zero overhead make sense?  If so, are there any other concerns?


https://reviews.llvm.org/D27780



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


[Lldb-commits] [lldb] r289922 - Add methods to enable using formatv syntax in LLDB.

2016-12-15 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Dec 15 22:27:00 2016
New Revision: 289922

URL: http://llvm.org/viewvc/llvm-project?rev=289922&view=rev
Log:
Add methods to enable using formatv syntax in LLDB.

This adds formatv-backed formatting functions in various
places in LLDB such as StreamString, logging, constructing
error messages, etc.  A couple of callsites are changed
from Printf style syntax to formatv style syntax to
illustrate its usage.  Additionally, a FileSpec formatter
is introduced so that FileSpecs can be formatted natively.

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

Modified:
lldb/trunk/include/lldb/Core/Error.h
lldb/trunk/include/lldb/Core/Log.h
lldb/trunk/include/lldb/Core/ModuleSpec.h
lldb/trunk/include/lldb/Core/Stream.h
lldb/trunk/include/lldb/Host/FileSpec.h
lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h
lldb/trunk/source/Breakpoint/BreakpointOptions.cpp
lldb/trunk/source/Commands/CommandObjectApropos.cpp
lldb/trunk/source/Core/Log.cpp
lldb/trunk/source/Host/common/FileSpec.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/unittests/Host/FileSpecTest.cpp

Modified: lldb/trunk/include/lldb/Core/Error.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Error.h?rev=289922&r1=289921&r2=289922&view=diff
==
--- lldb/trunk/include/lldb/Core/Error.h (original)
+++ lldb/trunk/include/lldb/Core/Error.h Thu Dec 15 22:27:00 2016
@@ -19,6 +19,8 @@
 
 #include "lldb/lldb-private.h"
 
+#include "llvm/Support/FormatVariadic.h"
+
 namespace lldb_private {
 
 class Log;
@@ -258,6 +260,11 @@ public:
 
   int SetErrorStringWithVarArg(const char *format, va_list args);
 
+  template 
+  void SetErrorStringWithFormatv(const char *format, Args &&... args) {
+SetErrorString(llvm::formatv(format, std::forward(args)...).str());
+  }
+
   //--
   /// Test for success condition.
   ///

Modified: lldb/trunk/include/lldb/Core/Log.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=289922&r1=289921&r2=289922&view=diff
==
--- lldb/trunk/include/lldb/Core/Log.h (original)
+++ lldb/trunk/include/lldb/Core/Log.h Thu Dec 15 22:27:00 2016
@@ -25,6 +25,8 @@
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/lldb-private.h"
 
+#include "llvm/Support/FormatVariadic.h"
+
 //--
 // Logging Options
 //--
@@ -43,7 +45,7 @@
 //--
 namespace lldb_private {
 
-class Log {
+class Log final {
 public:
   //--
   // Callback definitions for abstracted plug-in log access.
@@ -102,42 +104,32 @@ public:
 
   Log(const lldb::StreamSP &stream_sp);
 
-  virtual ~Log();
+  ~Log();
+
+  void PutCString(const char *cstr);
+  void PutString(llvm::StringRef str);
 
-  virtual void PutCString(const char *cstr);
-  virtual void PutString(llvm::StringRef str);
+  template  void Format(const char *fmt, Args &&... args) {
+PutString(llvm::formatv(fmt, std::forward(args)...).str());
+  }
 
   // CLEANUP: Add llvm::raw_ostream &Stream() function.
-  virtual void Printf(const char *format, ...)
-  __attribute__((format(printf, 2, 3)));
+  void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
 
-  virtual void VAPrintf(const char *format, va_list args);
+  void VAPrintf(const char *format, va_list args);
 
-  virtual void LogIf(uint32_t mask, const char *fmt, ...)
+  void LogIf(uint32_t mask, const char *fmt, ...)
   __attribute__((format(printf, 3, 4)));
 
-  virtual void Debug(const char *fmt, ...)
-  __attribute__((format(printf, 2, 3)));
-
-  virtual void DebugVerbose(const char *fmt, ...)
-  __attribute__((format(printf, 2, 3)));
+  void Debug(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
 
-  virtual void Error(const char *fmt, ...)
-  __attribute__((format(printf, 2, 3)));
-
-  virtual void VAError(const char *format, va_list args);
-
-  virtual void FatalError(int err, const char *fmt, ...)
-  __attribute__((format(printf, 3, 4)));
+  void Error(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
 
-  virtual void Verbose(const char *fmt, ...)
-  __attribute__((format(printf, 2, 3)));
+  void VAError(const char *format, va_list args);
 
-  virtual void Warning(const char *fmt, ...)
-  __attribute__((format(printf, 2, 3)));
+  void Verbose(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
 
-  virtual void WarningVerbose(const char *fmt, ...)
-  __attribute__((format(printf, 2, 3)));
+  void Warning(const char *

[Lldb-commits] [PATCH] D27632: Add Formatv() versions of all our printf style formatting functions

2016-12-15 Thread Zachary Turner via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL289922: Add methods to enable using formatv syntax in LLDB. 
(authored by zturner).

Changed prior to commit:
  https://reviews.llvm.org/D27632?vs=80992&id=81713#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27632

Files:
  lldb/trunk/include/lldb/Core/Error.h
  lldb/trunk/include/lldb/Core/Log.h
  lldb/trunk/include/lldb/Core/ModuleSpec.h
  lldb/trunk/include/lldb/Core/Stream.h
  lldb/trunk/include/lldb/Host/FileSpec.h
  lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h
  lldb/trunk/source/Breakpoint/BreakpointOptions.cpp
  lldb/trunk/source/Commands/CommandObjectApropos.cpp
  lldb/trunk/source/Core/Log.cpp
  lldb/trunk/source/Host/common/FileSpec.cpp
  lldb/trunk/source/Symbol/ClangASTContext.cpp
  lldb/trunk/source/Target/Target.cpp
  lldb/trunk/unittests/Host/FileSpecTest.cpp

Index: lldb/trunk/unittests/Host/FileSpecTest.cpp
===
--- lldb/trunk/unittests/Host/FileSpecTest.cpp
+++ lldb/trunk/unittests/Host/FileSpecTest.cpp
@@ -260,3 +260,27 @@
 << "Original path: " << test.first;
   }
 }
+
+TEST(FileSpecTest, FormatFileSpec) {
+  auto win = FileSpec::ePathSyntaxWindows;
+
+  FileSpec F;
+  EXPECT_EQ("(empty)", llvm::formatv("{0}", F).str());
+  EXPECT_EQ("(empty)", llvm::formatv("{0:D}", F).str());
+  EXPECT_EQ("(empty)", llvm::formatv("{0:F}", F).str());
+
+  F = FileSpec("C:\\foo\\bar.txt", false, win);
+  EXPECT_EQ("C:\\foo\\bar.txt", llvm::formatv("{0}", F).str());
+  EXPECT_EQ("C:\\foo\\", llvm::formatv("{0:D}", F).str());
+  EXPECT_EQ("bar.txt", llvm::formatv("{0:F}", F).str());
+
+  F = FileSpec("foo\\bar.txt", false, win);
+  EXPECT_EQ("foo\\bar.txt", llvm::formatv("{0}", F).str());
+  EXPECT_EQ("foo\\", llvm::formatv("{0:D}", F).str());
+  EXPECT_EQ("bar.txt", llvm::formatv("{0:F}", F).str());
+
+  F = FileSpec("foo", false, win);
+  EXPECT_EQ("foo", llvm::formatv("{0}", F).str());
+  EXPECT_EQ("foo", llvm::formatv("{0:F}", F).str());
+  EXPECT_EQ("(empty)", llvm::formatv("{0:D}", F).str());
+}
\ No newline at end of file
Index: lldb/trunk/source/Target/Target.cpp
===
--- lldb/trunk/source/Target/Target.cpp
+++ lldb/trunk/source/Target/Target.cpp
@@ -1554,11 +1554,9 @@
 if (load_addr == LLDB_INVALID_ADDRESS) {
   ModuleSP addr_module_sp(resolved_addr.GetModule());
   if (addr_module_sp && addr_module_sp->GetFileSpec())
-error.SetErrorStringWithFormat(
-"%s[0x%" PRIx64 "] can't be resolved, %s in not currently loaded",
-addr_module_sp->GetFileSpec().GetFilename().AsCString(""),
-resolved_addr.GetFileAddress(),
-addr_module_sp->GetFileSpec().GetFilename().AsCString(""));
+error.SetErrorStringWithFormatv(
+"{0:F}[{1:x+}] can't be resolved, {0:F} is not currently loaded",
+addr_module_sp->GetFileSpec(), resolved_addr.GetFileAddress());
   else
 error.SetErrorStringWithFormat("0x%" PRIx64 " can't be resolved",
resolved_addr.GetFileAddress());
Index: lldb/trunk/source/Symbol/ClangASTContext.cpp
===
--- lldb/trunk/source/Symbol/ClangASTContext.cpp
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp
@@ -9,6 +9,9 @@
 
 #include "lldb/Symbol/ClangASTContext.h"
 
+#include "llvm/Support/FormatAdapters.h"
+#include "llvm/Support/FormatVariadic.h"
+
 // C Includes
 // C++ Includes
 #include  // std::once
@@ -6739,10 +6742,7 @@
   if (array) {
 CompilerType element_type(getASTContext(), array->getElementType());
 if (element_type.GetCompleteType()) {
-  char element_name[64];
-  ::snprintf(element_name, sizeof(element_name), "[%" PRIu64 "]",
- static_cast(idx));
-  child_name.assign(element_name);
+  child_name = llvm::formatv("[{0}]", idx);
   child_byte_size = element_type.GetByteSize(
   exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL);
   child_byte_offset = (int32_t)idx * (int32_t)child_byte_size;
@@ -8883,8 +8883,8 @@
   std::string base_class_type_name(base_class_qual_type.getAsString());
 
   // Indent and print the base class type name
-  s->Printf("\n%*s%s ", depth + DEPTH_INCREMENT, "",
-base_class_type_name.c_str());
+  s->Format("\n{0}{1}", llvm::fmt_repeat(" ", depth + DEPTH_INCREMENT),
+base_class_type_name);
 
   clang::TypeInfo base_class_type_info =
   getASTContext()->getTypeInfo(base_class_qual_type);
Index: lldb/trunk/source/Commands/CommandObjectApropos.cpp
===
--- lldb/trunk/source/Commands/CommandObjectApropos.cpp
+++ lldb/trunk/source/Commands/CommandObjectApropos.cpp
@@ -90

Re: [Lldb-commits] [PATCH] D27780: Make OptionDefinition structure store a StringRef

2016-12-15 Thread Zachary Turner via lldb-commits
So I ran into a nasty problem doing the rest of the conversions and at the
moment I'm not sure if there's even a workaround.  So this is on hold while
I think about it.

On Thu, Dec 15, 2016 at 8:06 PM Zachary Turner via Phabricator <
revi...@reviews.llvm.org> wrote:

> zturner added a comment.
>
> Greg, did the comments about implicit construction of a `StringRef` from a
> char literal being zero overhead make sense?  If so, are there any other
> concerns?
>
>
> https://reviews.llvm.org/D27780
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits