[Lldb-commits] [lldb] r352175 - Refactor HAVE_LIBCOMPRESSION and related code in GDBRemoteCommunication
Author: teemperor Date: Fri Jan 25 00:21:47 2019 New Revision: 352175 URL: http://llvm.org/viewvc/llvm-project?rev=352175&view=rev Log: Refactor HAVE_LIBCOMPRESSION and related code in GDBRemoteCommunication Summary: The field `m_decompression_scratch_type` is only used when `HAVE_LIBCOMPRESSION` is defined, which caused a warning which I fixed in rLLDB350675 by just marking the variable as always used. This patch fixes this in a better way by only defining the variable (and the related `m_decompression_scratch` variable) when `HAVE_LIBCOMPRESSION` is defined. This also required changing the way we handle `HAVE_LIBCOMPRESSION` works, as this was previously always defined on macOS within the source file but not in the header. Now it's always defined from within our config header when CMake defines it or when we are on macOS. The field initialization was moved to the header to prevent that we have `#ifdef` within our initializer list. Reviewers: #lldb, jasonmolenda, sgraenitz, labath Reviewed By: labath Subscribers: labath, beanz, mgorny, lldb-commits, dblaikie Differential Revision: https://reviews.llvm.org/D57011 Modified: lldb/trunk/include/lldb/Host/Config.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Modified: lldb/trunk/include/lldb/Host/Config.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Config.h?rev=352175&r1=352174&r2=352175&view=diff == --- lldb/trunk/include/lldb/Host/Config.h (original) +++ lldb/trunk/include/lldb/Host/Config.h Fri Jan 25 00:21:47 2019 @@ -25,6 +25,8 @@ #define HAVE_SIGACTION 1 +#define HAVE_LIBCOMPRESSION 1 + #else #error This file is only used by the Xcode build. Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=352175&r1=352174&r2=352175&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri Jan 25 00:21:47 2019 @@ -41,8 +41,7 @@ #define DEBUGSERVER_BASENAME "lldb-server" #endif -#if defined(__APPLE__) -#define HAVE_LIBCOMPRESSION +#if defined(HAVE_LIBCOMPRESSION) #include #endif @@ -67,10 +66,7 @@ GDBRemoteCommunication::GDBRemoteCommuni #endif m_echo_number(0), m_supports_qEcho(eLazyBoolCalculate), m_history(512), m_send_acks(true), m_compression_type(CompressionType::None), - m_listen_url(), m_decompression_scratch_type(CompressionType::None), - m_decompression_scratch(nullptr) { - // Unused unless HAVE_LIBCOMPRESSION is defined. - (void)m_decompression_scratch_type; + m_listen_url() { } //-- @@ -81,8 +77,10 @@ GDBRemoteCommunication::~GDBRemoteCommun Disconnect(); } +#if defined(HAVE_LIBCOMPRESSION) if (m_decompression_scratch) free (m_decompression_scratch); +#endif // Stop the communications read thread which is used to parse all incoming // packets. This function will block until the read thread returns. Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=352175&r1=352174&r2=352175&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Fri Jan 25 00:21:47 2019 @@ -18,6 +18,7 @@ #include #include "lldb/Core/Communication.h" +#include "lldb/Host/Config.h" #include "lldb/Host/HostThread.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/Listener.h" @@ -217,8 +218,10 @@ private: HostThread m_listen_thread; std::string m_listen_url; - CompressionType m_decompression_scratch_type; - void *m_decompression_scratch; +#if defined(HAVE_LIBCOMPRESSION) + CompressionType m_decompression_scratch_type = CompressionType::None; + void *m_decompression_scratch = nullptr; +#endif DISALLOW_COPY_AND_ASSIGN(GDBRemoteCommunication); }; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D57011: Refactor HAVE_LIBCOMPRESSION and related code in GDBRemoteCommunication
This revision was automatically updated to reflect the committed changes. Closed by commit rL352175: Refactor HAVE_LIBCOMPRESSION and related code in GDBRemoteCommunication (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D57011?vs=183265&id=183488#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57011/new/ https://reviews.llvm.org/D57011 Files: lldb/trunk/include/lldb/Host/Config.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -41,8 +41,7 @@ #define DEBUGSERVER_BASENAME "lldb-server" #endif -#if defined(__APPLE__) -#define HAVE_LIBCOMPRESSION +#if defined(HAVE_LIBCOMPRESSION) #include #endif @@ -67,10 +66,7 @@ #endif m_echo_number(0), m_supports_qEcho(eLazyBoolCalculate), m_history(512), m_send_acks(true), m_compression_type(CompressionType::None), - m_listen_url(), m_decompression_scratch_type(CompressionType::None), - m_decompression_scratch(nullptr) { - // Unused unless HAVE_LIBCOMPRESSION is defined. - (void)m_decompression_scratch_type; + m_listen_url() { } //-- @@ -81,8 +77,10 @@ Disconnect(); } +#if defined(HAVE_LIBCOMPRESSION) if (m_decompression_scratch) free (m_decompression_scratch); +#endif // Stop the communications read thread which is used to parse all incoming // packets. This function will block until the read thread returns. Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -18,6 +18,7 @@ #include #include "lldb/Core/Communication.h" +#include "lldb/Host/Config.h" #include "lldb/Host/HostThread.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/Listener.h" @@ -217,8 +218,10 @@ HostThread m_listen_thread; std::string m_listen_url; - CompressionType m_decompression_scratch_type; - void *m_decompression_scratch; +#if defined(HAVE_LIBCOMPRESSION) + CompressionType m_decompression_scratch_type = CompressionType::None; + void *m_decompression_scratch = nullptr; +#endif DISALLOW_COPY_AND_ASSIGN(GDBRemoteCommunication); }; Index: lldb/trunk/include/lldb/Host/Config.h === --- lldb/trunk/include/lldb/Host/Config.h +++ lldb/trunk/include/lldb/Host/Config.h @@ -25,6 +25,8 @@ #define HAVE_SIGACTION 1 +#define HAVE_LIBCOMPRESSION 1 + #else #error This file is only used by the Xcode build. Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -41,8 +41,7 @@ #define DEBUGSERVER_BASENAME "lldb-server" #endif -#if defined(__APPLE__) -#define HAVE_LIBCOMPRESSION +#if defined(HAVE_LIBCOMPRESSION) #include #endif @@ -67,10 +66,7 @@ #endif m_echo_number(0), m_supports_qEcho(eLazyBoolCalculate), m_history(512), m_send_acks(true), m_compression_type(CompressionType::None), - m_listen_url(), m_decompression_scratch_type(CompressionType::None), - m_decompression_scratch(nullptr) { - // Unused unless HAVE_LIBCOMPRESSION is defined. - (void)m_decompression_scratch_type; + m_listen_url() { } //-- @@ -81,8 +77,10 @@ Disconnect(); } +#if defined(HAVE_LIBCOMPRESSION) if (m_decompression_scratch) free (m_decompression_scratch); +#endif // Stop the communications read thread which is used to parse all incoming // packets. This function will block until the read thread returns. Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h === --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -18,6 +18,7 @@ #include #include "lldb/Core/Communication.h" +#include "lldb/Host/Config.h" #include "lldb/Host/HostThread.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/Listener.h" @@ -217,8 +218,10 @@ HostThread m_listen_thread; std::string m_listen_ur
[Lldb-commits] [lldb] r352180 - Fix typo in ClangModulesDeclVendor [NFC]
Author: teemperor Date: Fri Jan 25 01:28:48 2019 New Revision: 352180 URL: http://llvm.org/viewvc/llvm-project?rev=352180&view=rev Log: Fix typo in ClangModulesDeclVendor [NFC] Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h?rev=352180&r1=352179&r2=352180&view=diff == --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h Fri Jan 25 01:28:48 2019 @@ -103,7 +103,7 @@ public: //-- /// Query whether Clang supports modules for a particular language. /// LLDB uses this to decide whether to try to find the modules loaded - /// by a gaiven compile unit. + /// by a given compile unit. /// /// @param[in] language /// The language to query for. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D57222: Simplify LangOpts initalization in ClangExpressionParser [NFC]
teemperor created this revision. Herald added a subscriber: lldb-commits. Repository: rLLDB LLDB https://reviews.llvm.org/D57222 Files: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp === --- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -362,6 +362,7 @@ // 5. Set language options. lldb::LanguageType language = expr.Language(); + LangOptions &lang_opts = m_compiler->getLangOpts(); switch (language) { case lldb::eLanguageTypeC: @@ -373,13 +374,13 @@ // For now, the expression parser must use C++ anytime the language is a C // family language, because the expression parser uses features of C++ to // capture values. -m_compiler->getLangOpts().CPlusPlus = true; +lang_opts.CPlusPlus = true; break; case lldb::eLanguageTypeObjC: -m_compiler->getLangOpts().ObjC = true; +lang_opts.ObjC = true; // FIXME: the following language option is a temporary workaround, // to "ask for ObjC, get ObjC++" (see comment above). -m_compiler->getLangOpts().CPlusPlus = true; +lang_opts.CPlusPlus = true; // Clang now sets as default C++14 as the default standard (with // GNU extensions), so we do the same here to avoid mismatches that @@ -387,71 +388,67 @@ // as it's a C++11 feature). Currently lldb evaluates C++14 as C++11 (see // two lines below) so we decide to be consistent with that, but this could // be re-evaluated in the future. -m_compiler->getLangOpts().CPlusPlus11 = true; +lang_opts.CPlusPlus11 = true; break; case lldb::eLanguageTypeC_plus_plus: case lldb::eLanguageTypeC_plus_plus_11: case lldb::eLanguageTypeC_plus_plus_14: -m_compiler->getLangOpts().CPlusPlus11 = true; +lang_opts.CPlusPlus11 = true; m_compiler->getHeaderSearchOpts().UseLibcxx = true; LLVM_FALLTHROUGH; case lldb::eLanguageTypeC_plus_plus_03: -m_compiler->getLangOpts().CPlusPlus = true; +lang_opts.CPlusPlus = true; if (process_sp) - m_compiler->getLangOpts().ObjC = + lang_opts.ObjC = process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC) != nullptr; break; case lldb::eLanguageTypeObjC_plus_plus: case lldb::eLanguageTypeUnknown: default: -m_compiler->getLangOpts().ObjC = true; -m_compiler->getLangOpts().CPlusPlus = true; -m_compiler->getLangOpts().CPlusPlus11 = true; +lang_opts.ObjC = true; +lang_opts.CPlusPlus = true; +lang_opts.CPlusPlus11 = true; m_compiler->getHeaderSearchOpts().UseLibcxx = true; break; } - m_compiler->getLangOpts().Bool = true; - m_compiler->getLangOpts().WChar = true; - m_compiler->getLangOpts().Blocks = true; - m_compiler->getLangOpts().DebuggerSupport = + lang_opts.Bool = true; + lang_opts.WChar = true; + lang_opts.Blocks = true; + lang_opts.DebuggerSupport = true; // Features specifically for debugger clients if (expr.DesiredResultType() == Expression::eResultTypeId) -m_compiler->getLangOpts().DebuggerCastResultToId = true; +lang_opts.DebuggerCastResultToId = true; - m_compiler->getLangOpts().CharIsSigned = - ArchSpec(m_compiler->getTargetOpts().Triple.c_str()) - .CharIsSignedByDefault(); + lang_opts.CharIsSigned = ArchSpec(m_compiler->getTargetOpts().Triple.c_str()) + .CharIsSignedByDefault(); // Spell checking is a nice feature, but it ends up completing a lot of types // that we didn't strictly speaking need to complete. As a result, we spend a // long time parsing and importing debug information. - m_compiler->getLangOpts().SpellChecking = false; + lang_opts.SpellChecking = false; - if (process_sp && m_compiler->getLangOpts().ObjC) { + if (process_sp && lang_opts.ObjC) { if (process_sp->GetObjCLanguageRuntime()) { if (process_sp->GetObjCLanguageRuntime()->GetRuntimeVersion() == ObjCLanguageRuntime::ObjCRuntimeVersions::eAppleObjC_V2) -m_compiler->getLangOpts().ObjCRuntime.set(ObjCRuntime::MacOSX, - VersionTuple(10, 7)); +lang_opts.ObjCRuntime.set(ObjCRuntime::MacOSX, VersionTuple(10, 7)); else -m_compiler->getLangOpts().ObjCRuntime.set(ObjCRuntime::FragileMacOSX, - VersionTuple(10, 7)); +lang_opts.ObjCRuntime.set(ObjCRuntime::FragileMacOSX, + VersionTuple(10, 7)); if (process_sp->GetObjCLanguageRuntime()->HasNewLiteralsAndIndexing()) -m_compiler->getLangOpts().DebuggerObjCLiteral = true; +lang_opts.DebuggerObjCLiteral = true; } } - m_compiler->getLangOpts().ThreadsafeStatics = false; - m_compiler->getLangOpts().AccessControl = - false; //
[Lldb-commits] [PATCH] D57233: [CMake] Quick-Fix targets don't exist when building against LLVM install-tree with LLDB_INCLUDE_TESTS=ON
sgraenitz created this revision. sgraenitz added a reviewer: mgorny. The issue came up during release testing for LLVM 8: https://bugs.llvm.org/show_bug.cgi?id=40443 https://reviews.llvm.org/D57233 Files: cmake/modules/AddLLDB.cmake lit/CMakeLists.txt Index: lit/CMakeLists.txt === --- lit/CMakeLists.txt +++ lit/CMakeLists.txt @@ -26,9 +26,6 @@ llvm-config llvm-mc llvm-objcopy - FileCheck - count - not ) if(TARGET lld) @@ -55,6 +52,14 @@ ${CMAKE_CURRENT_SOURCE_DIR}/Suite/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/Suite/lit.site.cfg) +if(NOT LLDB_BUILT_STANDALONE) + list(APPEND LLDB_TEST_DEPS +FileCheck +count +not +) +endif() + add_lit_testsuite(check-lldb-lit "Running lldb lit test suite" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${LLDB_TEST_DEPS} Index: cmake/modules/AddLLDB.cmake === --- cmake/modules/AddLLDB.cmake +++ cmake/modules/AddLLDB.cmake @@ -88,7 +88,9 @@ # Hack: only some LLDB libraries depend on the clang autogenerated headers, # but it is simple enough to make all of LLDB depend on some of those # headers without negatively impacting much of anything. - add_dependencies(${name} clang-tablegen-targets) + if(NOT LLDB_BUILT_STANDALONE) +add_dependencies(${name} clang-tablegen-targets) + endif() # Add in any extra C++ compilation flags for this library. target_compile_options(${name} PRIVATE ${PARAM_EXTRA_CXXFLAGS}) Index: lit/CMakeLists.txt === --- lit/CMakeLists.txt +++ lit/CMakeLists.txt @@ -26,9 +26,6 @@ llvm-config llvm-mc llvm-objcopy - FileCheck - count - not ) if(TARGET lld) @@ -55,6 +52,14 @@ ${CMAKE_CURRENT_SOURCE_DIR}/Suite/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/Suite/lit.site.cfg) +if(NOT LLDB_BUILT_STANDALONE) + list(APPEND LLDB_TEST_DEPS +FileCheck +count +not +) +endif() + add_lit_testsuite(check-lldb-lit "Running lldb lit test suite" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${LLDB_TEST_DEPS} Index: cmake/modules/AddLLDB.cmake === --- cmake/modules/AddLLDB.cmake +++ cmake/modules/AddLLDB.cmake @@ -88,7 +88,9 @@ # Hack: only some LLDB libraries depend on the clang autogenerated headers, # but it is simple enough to make all of LLDB depend on some of those # headers without negatively impacting much of anything. - add_dependencies(${name} clang-tablegen-targets) + if(NOT LLDB_BUILT_STANDALONE) +add_dependencies(${name} clang-tablegen-targets) + endif() # Add in any extra C++ compilation flags for this library. target_compile_options(${name} PRIVATE ${PARAM_EXTRA_CXXFLAGS}) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D57233: [CMake] Quick-Fix targets don't exist when building against LLVM install-tree with LLDB_INCLUDE_TESTS=ON
mgorny accepted this revision. mgorny added a comment. This revision is now accepted and ready to land. WFM. A number of tests fail but that's entirely normal at this point and we basically stopped caring. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57233/new/ https://reviews.llvm.org/D57233 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r352226 - ResolveBreakpointSite: fix outdated warning message
Author: tkrasnukha Date: Fri Jan 25 10:27:09 2019 New Revision: 352226 URL: http://llvm.org/viewvc/llvm-project?rev=352226&view=rev Log: ResolveBreakpointSite: fix outdated warning message Currently if a breakpoint site is already present, its ID will be returned, not the LLDB_INVALID_BREAK_ID. On the other hand, Process::CreateBreakpointSite may have another reasons to return LLDB_INVALID_BREAK_ID. Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=352226&r1=352225&r2=352226&view=diff == --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Fri Jan 25 10:27:09 2019 @@ -454,13 +454,11 @@ bool BreakpointLocation::ResolveBreakpoi if (new_id == LLDB_INVALID_BREAK_ID) { Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS); if (log) - log->Warning("Tried to add breakpoint site at 0x%" PRIx64 - " but it was already present.\n", + log->Warning("Failed to add breakpoint site at 0x%" PRIx64, m_address.GetOpcodeLoadAddress(&m_owner.GetTarget())); -return false; } - return true; + return IsResolved(); } bool BreakpointLocation::SetBreakpointSite(BreakpointSiteSP &bp_site_sp) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D57194: [CMake] Use llvm-tblgen from NATIVE LLVM build when cross-compiling
compnerd accepted this revision. compnerd added inline comments. This revision is now accepted and ready to land. Comment at: cmake/modules/LLDBStandalone.cmake:44 +else() + set(LLVM_TABLEGEN_EXE + "${LLVM_NATIVE_BUILD}/Release/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}") Please add a comment that this will always be built release and thus we can assume that directory structure. Repository: rLLDB LLDB CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57194/new/ https://reviews.llvm.org/D57194 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r352158 - Remove a warning in DynamicLoaderDarwin::UpdateImageLoadAddress
Nice! On Thu, Jan 24, 2019 at 7:01 PM Jason Molenda via lldb-commits wrote: > > Author: jmolenda > Date: Thu Jan 24 19:01:48 2019 > New Revision: 352158 > > URL: http://llvm.org/viewvc/llvm-project?rev=352158&view=rev > Log: > Remove a warning in DynamicLoaderDarwin::UpdateImageLoadAddress > when the binary loaded in memory has a section that we cannot find > in the on-disk version. I added this warning out of an overabundance > of caution originally, but I've never seen an instance of it being > hit in the past few years, and there are some changes for the shared > cache on darwin systems where a segment is added when the shared > cache is constructed so we're now hitting this warning. I've decided > to remove it altogether. > > > > > Modified: > > lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp > > Modified: > lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp?rev=352158&r1=352157&r2=352158&view=diff > == > --- > lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp > (original) > +++ > lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp > Thu Jan 24 19:01:48 2019 > @@ -255,15 +255,7 @@ bool DynamicLoaderDarwin::UpdateImageLoa > >changed = m_process->GetTarget().SetSectionLoadAddress( >section_sp, new_section_load_addr, warn_multiple); > -} else { > - Host::SystemLog( > - Host::eSystemLogWarning, > - "warning: unable to find and load segment named '%s' at " > - "0x%" PRIx64 " in '%s' in macosx dynamic loader > plug-in.\n", > - info.segments[i].name.AsCString(""), > - (uint64_t)new_section_load_addr, > - image_object_file->GetFileSpec().GetPath().c_str()); > -} > +} >} > } > > > > ___ > lldb-commits mailing list > lldb-commits@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D57222: Simplify LangOpts initalization in ClangExpressionParser [NFC]
davide accepted this revision. davide added a comment. This revision is now accepted and ready to land. LGTM. Repository: rLLDB LLDB CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57222/new/ https://reviews.llvm.org/D57222 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D56822: [Reproducers] Tool to insert SBReproducer macros
JDevlieghere updated this revision to Diff 183584. JDevlieghere retitled this revision from "[WIP] Tool to insert SBReproducer macros" to "[Reproducers] Tool to insert SBReproducer macros". JDevlieghere added a comment. Fixed printing of booleans; the tool would show `_Bool` instead of `bool`. I ran this on a few files and it appears to work with the prototype. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56822/new/ https://reviews.llvm.org/D56822 Files: tools/CMakeLists.txt tools/sbrepro/CMakeLists.txt tools/sbrepro/SBRepro.cpp Index: tools/sbrepro/SBRepro.cpp === --- /dev/null +++ tools/sbrepro/SBRepro.cpp @@ -0,0 +1,249 @@ +#include "clang/AST/AST.h" +#include "clang/AST/ASTConsumer.h" +#include "clang/AST/RecursiveASTVisitor.h" +#include "clang/Frontend/ASTConsumers.h" +#include "clang/Frontend/CompilerInstance.h" +#include "clang/Frontend/FrontendActions.h" +#include "clang/Rewrite/Core/Rewriter.h" +#include "clang/Tooling/CommonOptionsParser.h" +#include "clang/Tooling/Tooling.h" + +#include "llvm/Support/raw_ostream.h" + +#include +#include + +using namespace clang; +using namespace clang::driver; +using namespace clang::tooling; + +static llvm::cl::OptionCategory ReproCategory("SB Reproducer"); + +static std::string Join(const std::vector &V) { + std::string Str; + llvm::raw_string_ostream OS(Str); + for (std::size_t I = 0, E = V.size(); I < E; ++I) { +OS << V[I]; +if (I != E - 1) + OS << ", "; + } + return OS.str(); +} + +static std::string GetRecordMethodMacroName(bool Static, bool Const, +bool NoArgs) { + std::string Macro; + llvm::raw_string_ostream OS(Macro); + + OS << "SB_RECORD"; + if (Static) +OS << "_STATIC"; + OS << "_METHOD"; + if (Const) +OS << "_CONST"; + if (NoArgs) +OS << "_NO_ARGS"; + + return OS.str(); +} + +static std::string GetRegisterMethodMacroName(bool Static, bool Const) { + std::string Macro; + llvm::raw_string_ostream OS(Macro); + + OS << "SB_REGISTER"; + if (Static) +OS << "_STATIC"; + OS << "_METHOD"; + if (Const) +OS << "_CONST"; + + return OS.str(); +} + +static std::string GetRecordMethodMacro(StringRef Result, StringRef Class, +StringRef Method, StringRef Signature, +StringRef Values, bool Static, +bool Const) { + std::string Macro; + llvm::raw_string_ostream OS(Macro); + + OS << GetRecordMethodMacroName(Static, Const, Values.empty()); + + OS << "(" << Result << ", " << Class << ", " << Method; + + if (!Values.empty()) { +OS << ", (" << Signature << "), " << Values << ");\n"; + } else { +OS << ");\n"; + } + + return OS.str(); +} + +static std::string GetRecordConstructorMacro(StringRef Class, + StringRef Signature, + StringRef Values) { + std::string Macro; + llvm::raw_string_ostream OS(Macro); + if (!Values.empty()) { +OS << "SB_RECORD_CONSTRUCTOR(" << Class << ", (" << Signature << "), " + << Values << ");\n"; + } else { +OS << "SB_RECORD_CONSTRUCTOR_NO_ARGS(" << Class << ");\n"; + } + return OS.str(); +} + +static std::string GetRegisterConstructorMacroMacro(StringRef Class, +StringRef Signature) { + std::string Macro; + llvm::raw_string_ostream OS(Macro); + OS << "SB_REGISTER_CONSTRUCTOR(" << Class << ", (" << Signature << "));\n"; + return OS.str(); +} + +static std::string GetRegisterMethodMacro(StringRef Result, StringRef Class, + StringRef Method, StringRef Signature, + bool Static, bool Const) { + std::string Macro; + llvm::raw_string_ostream OS(Macro); + OS << GetRegisterMethodMacroName(Static, Const); + OS << "(" << Result << ", " << Class << ", " << Method << ", (" << Signature + << "));\n"; + return OS.str(); +} + +class SBVisitor : public RecursiveASTVisitor { +public: + SBVisitor(Rewriter &R, ASTContext &Context) + : MyRewriter(R), Context(Context) {} + + bool VisitCXXMethodDecl(CXXMethodDecl *Decl) { +SourceManager &SM = MyRewriter.getSourceMgr(); + +// We don't want to modify anything outside the main file. +if (!SM.isInMainFile(Decl->getBeginLoc())) + return false; + +Stmt *Body = Decl->getBody(); +if (!Body) + return false; + +bool IsConstructor = dyn_cast(Decl) != nullptr; +bool IsDestructor = dyn_cast(Decl) != nullptr; + +// Do nothing for private decls. +AccessSpecifier AS = Decl->getAccess(); +if (AS != AccessSpecifier::AS_public) + return false; + +// Do nothing for destructor. +if (IsDestructor) + return false; + +// Print 'bool' instead of '_Bool'. +PrintingPolicy Policy(Context.getLangOpts());
[Lldb-commits] [PATCH] D57194: [CMake] Use llvm-tblgen from NATIVE LLVM build when cross-compiling
xiaobai updated this revision to Diff 183585. xiaobai added a comment. Added a comment CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57194/new/ https://reviews.llvm.org/D57194 Files: cmake/modules/LLDBStandalone.cmake Index: cmake/modules/LLDBStandalone.cmake === --- cmake/modules/LLDBStandalone.cmake +++ cmake/modules/LLDBStandalone.cmake @@ -25,8 +25,31 @@ set(LLVM_BINARY_DIR ${LLVM_BUILD_BINARY_DIR} CACHE PATH "Path to LLVM build tree") set(LLVM_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE PATH "Path to llvm-lit") - find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} -NO_DEFAULT_PATH) + if(CMAKE_CROSSCOMPILING) +set(LLVM_NATIVE_BUILD "${LLDB_PATH_TO_LLVM_BUILD}/NATIVE") +if (NOT EXISTS "${LLVM_NATIVE_BUILD}") + message(FATAL_ERROR +"Attempting to cross-compile LLDB standalone but no native LLVM build +found. Please cross-compile LLVM as well.") +endif() + +if (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(HOST_EXECUTABLE_SUFFIX ".exe") +endif() + +if (NOT CMAKE_CONFIGURATION_TYPES) + set(LLVM_TABLEGEN_EXE +"${LLVM_NATIVE_BUILD}/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}") +else() + # NOTE: LLVM NATIVE build is always built Release, as is specified in + # CrossCompile.cmake + set(LLVM_TABLEGEN_EXE + "${LLVM_NATIVE_BUILD}/Release/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}") +endif() + else() +find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} + NO_DEFAULT_PATH) + endif() # They are used as destination of target generators. set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) Index: cmake/modules/LLDBStandalone.cmake === --- cmake/modules/LLDBStandalone.cmake +++ cmake/modules/LLDBStandalone.cmake @@ -25,8 +25,31 @@ set(LLVM_BINARY_DIR ${LLVM_BUILD_BINARY_DIR} CACHE PATH "Path to LLVM build tree") set(LLVM_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE PATH "Path to llvm-lit") - find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} -NO_DEFAULT_PATH) + if(CMAKE_CROSSCOMPILING) +set(LLVM_NATIVE_BUILD "${LLDB_PATH_TO_LLVM_BUILD}/NATIVE") +if (NOT EXISTS "${LLVM_NATIVE_BUILD}") + message(FATAL_ERROR +"Attempting to cross-compile LLDB standalone but no native LLVM build +found. Please cross-compile LLVM as well.") +endif() + +if (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(HOST_EXECUTABLE_SUFFIX ".exe") +endif() + +if (NOT CMAKE_CONFIGURATION_TYPES) + set(LLVM_TABLEGEN_EXE +"${LLVM_NATIVE_BUILD}/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}") +else() + # NOTE: LLVM NATIVE build is always built Release, as is specified in + # CrossCompile.cmake + set(LLVM_TABLEGEN_EXE +"${LLVM_NATIVE_BUILD}/Release/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}") +endif() + else() +find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} + NO_DEFAULT_PATH) + endif() # They are used as destination of target generators. set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r352235 - [CMake] Use llvm-tblgen from NATIVE LLVM build when cross-compiling
Author: xiaobai Date: Fri Jan 25 11:38:21 2019 New Revision: 352235 URL: http://llvm.org/viewvc/llvm-project?rev=352235&view=rev Log: [CMake] Use llvm-tblgen from NATIVE LLVM build when cross-compiling Summary: When cross-compiling LLDB, we want to use llvm-tblgen built for the host, not the target. Reviewers: compnerd, sgraenitz Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D57194 Modified: lldb/trunk/cmake/modules/LLDBStandalone.cmake Modified: lldb/trunk/cmake/modules/LLDBStandalone.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBStandalone.cmake?rev=352235&r1=352234&r2=352235&view=diff == --- lldb/trunk/cmake/modules/LLDBStandalone.cmake (original) +++ lldb/trunk/cmake/modules/LLDBStandalone.cmake Fri Jan 25 11:38:21 2019 @@ -25,8 +25,31 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR set(LLVM_BINARY_DIR ${LLVM_BUILD_BINARY_DIR} CACHE PATH "Path to LLVM build tree") set(LLVM_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE PATH "Path to llvm-lit") - find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} -NO_DEFAULT_PATH) + if(CMAKE_CROSSCOMPILING) +set(LLVM_NATIVE_BUILD "${LLDB_PATH_TO_LLVM_BUILD}/NATIVE") +if (NOT EXISTS "${LLVM_NATIVE_BUILD}") + message(FATAL_ERROR +"Attempting to cross-compile LLDB standalone but no native LLVM build +found. Please cross-compile LLVM as well.") +endif() + +if (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(HOST_EXECUTABLE_SUFFIX ".exe") +endif() + +if (NOT CMAKE_CONFIGURATION_TYPES) + set(LLVM_TABLEGEN_EXE +"${LLVM_NATIVE_BUILD}/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}") +else() + # NOTE: LLVM NATIVE build is always built Release, as is specified in + # CrossCompile.cmake + set(LLVM_TABLEGEN_EXE + "${LLVM_NATIVE_BUILD}/Release/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}") +endif() + else() +find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} + NO_DEFAULT_PATH) + endif() # They are used as destination of target generators. set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D57194: [CMake] Use llvm-tblgen from NATIVE LLVM build when cross-compiling
This revision was automatically updated to reflect the committed changes. Closed by commit rL352235: [CMake] Use llvm-tblgen from NATIVE LLVM build when cross-compiling (authored by xiaobai, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57194/new/ https://reviews.llvm.org/D57194 Files: lldb/trunk/cmake/modules/LLDBStandalone.cmake Index: lldb/trunk/cmake/modules/LLDBStandalone.cmake === --- lldb/trunk/cmake/modules/LLDBStandalone.cmake +++ lldb/trunk/cmake/modules/LLDBStandalone.cmake @@ -25,8 +25,31 @@ set(LLVM_BINARY_DIR ${LLVM_BUILD_BINARY_DIR} CACHE PATH "Path to LLVM build tree") set(LLVM_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE PATH "Path to llvm-lit") - find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} -NO_DEFAULT_PATH) + if(CMAKE_CROSSCOMPILING) +set(LLVM_NATIVE_BUILD "${LLDB_PATH_TO_LLVM_BUILD}/NATIVE") +if (NOT EXISTS "${LLVM_NATIVE_BUILD}") + message(FATAL_ERROR +"Attempting to cross-compile LLDB standalone but no native LLVM build +found. Please cross-compile LLVM as well.") +endif() + +if (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(HOST_EXECUTABLE_SUFFIX ".exe") +endif() + +if (NOT CMAKE_CONFIGURATION_TYPES) + set(LLVM_TABLEGEN_EXE +"${LLVM_NATIVE_BUILD}/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}") +else() + # NOTE: LLVM NATIVE build is always built Release, as is specified in + # CrossCompile.cmake + set(LLVM_TABLEGEN_EXE + "${LLVM_NATIVE_BUILD}/Release/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}") +endif() + else() +find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} + NO_DEFAULT_PATH) + endif() # They are used as destination of target generators. set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) Index: lldb/trunk/cmake/modules/LLDBStandalone.cmake === --- lldb/trunk/cmake/modules/LLDBStandalone.cmake +++ lldb/trunk/cmake/modules/LLDBStandalone.cmake @@ -25,8 +25,31 @@ set(LLVM_BINARY_DIR ${LLVM_BUILD_BINARY_DIR} CACHE PATH "Path to LLVM build tree") set(LLVM_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE PATH "Path to llvm-lit") - find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} -NO_DEFAULT_PATH) + if(CMAKE_CROSSCOMPILING) +set(LLVM_NATIVE_BUILD "${LLDB_PATH_TO_LLVM_BUILD}/NATIVE") +if (NOT EXISTS "${LLVM_NATIVE_BUILD}") + message(FATAL_ERROR +"Attempting to cross-compile LLDB standalone but no native LLVM build +found. Please cross-compile LLVM as well.") +endif() + +if (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(HOST_EXECUTABLE_SUFFIX ".exe") +endif() + +if (NOT CMAKE_CONFIGURATION_TYPES) + set(LLVM_TABLEGEN_EXE +"${LLVM_NATIVE_BUILD}/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}") +else() + # NOTE: LLVM NATIVE build is always built Release, as is specified in + # CrossCompile.cmake + set(LLVM_TABLEGEN_EXE +"${LLVM_NATIVE_BUILD}/Release/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}") +endif() + else() +find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} + NO_DEFAULT_PATH) + endif() # They are used as destination of target generators. set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D57213: [Scalar] Add support for 512-bits values.
aprantl added inline comments. Comment at: lldb/source/Utility/RegisterValue.cpp:159 case 32: +case 64: if (buffer.length % sizeof(uint64_t) == 0) { I'm curious, everything else in this patch refers to 512, how does this fit in? Comment at: lldb/source/Utility/Scalar.cpp:168 + swapped_words[6] = apint_words[1]; + swapped_words[7] = apint_words[0]; + apint_words = swapped_words; std::reverse perhaps? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57213/new/ https://reviews.llvm.org/D57213 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D57213: [Scalar] Add support for 512-bits values.
davide marked 2 inline comments as done. davide added inline comments. Comment at: lldb/source/Utility/RegisterValue.cpp:159 case 32: +case 64: if (buffer.length % sizeof(uint64_t) == 0) { aprantl wrote: > I'm curious, everything else in this patch refers to 512, how does this fit > in? 512 bits / 8 (bits per byte) = 64 bytes. I can change the number to be in bits, if you want. Comment at: lldb/source/Utility/Scalar.cpp:168 + swapped_words[6] = apint_words[1]; + swapped_words[7] = apint_words[0]; + apint_words = swapped_words; aprantl wrote: > std::reverse perhaps? We might want to change this everywhere. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57213/new/ https://reviews.llvm.org/D57213 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D57222: Simplify LangOpts initalization in ClangExpressionParser [NFC]
shafik added a comment. Nice improvement in readability! Repository: rLLDB LLDB CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57222/new/ https://reviews.llvm.org/D57222 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r352249 - Simplify LangOpts initalization in ClangExpressionParser [NFC]
Author: teemperor Date: Fri Jan 25 14:41:31 2019 New Revision: 352249 URL: http://llvm.org/viewvc/llvm-project?rev=352249&view=rev Log: Simplify LangOpts initalization in ClangExpressionParser [NFC] Reviewers: davide Reviewed By: davide Subscribers: shafik, davide, lldb-commits Differential Revision: https://reviews.llvm.org/D57222 Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=352249&r1=352248&r2=352249&view=diff == --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Fri Jan 25 14:41:31 2019 @@ -362,6 +362,7 @@ ClangExpressionParser::ClangExpressionPa // 5. Set language options. lldb::LanguageType language = expr.Language(); + LangOptions &lang_opts = m_compiler->getLangOpts(); switch (language) { case lldb::eLanguageTypeC: @@ -373,13 +374,13 @@ ClangExpressionParser::ClangExpressionPa // For now, the expression parser must use C++ anytime the language is a C // family language, because the expression parser uses features of C++ to // capture values. -m_compiler->getLangOpts().CPlusPlus = true; +lang_opts.CPlusPlus = true; break; case lldb::eLanguageTypeObjC: -m_compiler->getLangOpts().ObjC = true; +lang_opts.ObjC = true; // FIXME: the following language option is a temporary workaround, // to "ask for ObjC, get ObjC++" (see comment above). -m_compiler->getLangOpts().CPlusPlus = true; +lang_opts.CPlusPlus = true; // Clang now sets as default C++14 as the default standard (with // GNU extensions), so we do the same here to avoid mismatches that @@ -387,71 +388,67 @@ ClangExpressionParser::ClangExpressionPa // as it's a C++11 feature). Currently lldb evaluates C++14 as C++11 (see // two lines below) so we decide to be consistent with that, but this could // be re-evaluated in the future. -m_compiler->getLangOpts().CPlusPlus11 = true; +lang_opts.CPlusPlus11 = true; break; case lldb::eLanguageTypeC_plus_plus: case lldb::eLanguageTypeC_plus_plus_11: case lldb::eLanguageTypeC_plus_plus_14: -m_compiler->getLangOpts().CPlusPlus11 = true; +lang_opts.CPlusPlus11 = true; m_compiler->getHeaderSearchOpts().UseLibcxx = true; LLVM_FALLTHROUGH; case lldb::eLanguageTypeC_plus_plus_03: -m_compiler->getLangOpts().CPlusPlus = true; +lang_opts.CPlusPlus = true; if (process_sp) - m_compiler->getLangOpts().ObjC = + lang_opts.ObjC = process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC) != nullptr; break; case lldb::eLanguageTypeObjC_plus_plus: case lldb::eLanguageTypeUnknown: default: -m_compiler->getLangOpts().ObjC = true; -m_compiler->getLangOpts().CPlusPlus = true; -m_compiler->getLangOpts().CPlusPlus11 = true; +lang_opts.ObjC = true; +lang_opts.CPlusPlus = true; +lang_opts.CPlusPlus11 = true; m_compiler->getHeaderSearchOpts().UseLibcxx = true; break; } - m_compiler->getLangOpts().Bool = true; - m_compiler->getLangOpts().WChar = true; - m_compiler->getLangOpts().Blocks = true; - m_compiler->getLangOpts().DebuggerSupport = + lang_opts.Bool = true; + lang_opts.WChar = true; + lang_opts.Blocks = true; + lang_opts.DebuggerSupport = true; // Features specifically for debugger clients if (expr.DesiredResultType() == Expression::eResultTypeId) -m_compiler->getLangOpts().DebuggerCastResultToId = true; +lang_opts.DebuggerCastResultToId = true; - m_compiler->getLangOpts().CharIsSigned = - ArchSpec(m_compiler->getTargetOpts().Triple.c_str()) - .CharIsSignedByDefault(); + lang_opts.CharIsSigned = ArchSpec(m_compiler->getTargetOpts().Triple.c_str()) + .CharIsSignedByDefault(); // Spell checking is a nice feature, but it ends up completing a lot of types // that we didn't strictly speaking need to complete. As a result, we spend a // long time parsing and importing debug information. - m_compiler->getLangOpts().SpellChecking = false; + lang_opts.SpellChecking = false; - if (process_sp && m_compiler->getLangOpts().ObjC) { + if (process_sp && lang_opts.ObjC) { if (process_sp->GetObjCLanguageRuntime()) { if (process_sp->GetObjCLanguageRuntime()->GetRuntimeVersion() == ObjCLanguageRuntime::ObjCRuntimeVersions::eAppleObjC_V2) -m_compiler->getLangOpts().ObjCRuntime.set(ObjCRuntime::MacOSX, - VersionTuple(10, 7)); +lang_opts.ObjCRuntime.set(ObjCRuntime::MacOSX, VersionTuple(10, 7)); else -
[Lldb-commits] [PATCH] D57222: Simplify LangOpts initalization in ClangExpressionParser [NFC]
This revision was automatically updated to reflect the committed changes. Closed by commit rLLDB352249: Simplify LangOpts initalization in ClangExpressionParser [NFC] (authored by teemperor, committed by ). Repository: rLLDB LLDB CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57222/new/ https://reviews.llvm.org/D57222 Files: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp === --- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -362,6 +362,7 @@ // 5. Set language options. lldb::LanguageType language = expr.Language(); + LangOptions &lang_opts = m_compiler->getLangOpts(); switch (language) { case lldb::eLanguageTypeC: @@ -373,13 +374,13 @@ // For now, the expression parser must use C++ anytime the language is a C // family language, because the expression parser uses features of C++ to // capture values. -m_compiler->getLangOpts().CPlusPlus = true; +lang_opts.CPlusPlus = true; break; case lldb::eLanguageTypeObjC: -m_compiler->getLangOpts().ObjC = true; +lang_opts.ObjC = true; // FIXME: the following language option is a temporary workaround, // to "ask for ObjC, get ObjC++" (see comment above). -m_compiler->getLangOpts().CPlusPlus = true; +lang_opts.CPlusPlus = true; // Clang now sets as default C++14 as the default standard (with // GNU extensions), so we do the same here to avoid mismatches that @@ -387,71 +388,67 @@ // as it's a C++11 feature). Currently lldb evaluates C++14 as C++11 (see // two lines below) so we decide to be consistent with that, but this could // be re-evaluated in the future. -m_compiler->getLangOpts().CPlusPlus11 = true; +lang_opts.CPlusPlus11 = true; break; case lldb::eLanguageTypeC_plus_plus: case lldb::eLanguageTypeC_plus_plus_11: case lldb::eLanguageTypeC_plus_plus_14: -m_compiler->getLangOpts().CPlusPlus11 = true; +lang_opts.CPlusPlus11 = true; m_compiler->getHeaderSearchOpts().UseLibcxx = true; LLVM_FALLTHROUGH; case lldb::eLanguageTypeC_plus_plus_03: -m_compiler->getLangOpts().CPlusPlus = true; +lang_opts.CPlusPlus = true; if (process_sp) - m_compiler->getLangOpts().ObjC = + lang_opts.ObjC = process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC) != nullptr; break; case lldb::eLanguageTypeObjC_plus_plus: case lldb::eLanguageTypeUnknown: default: -m_compiler->getLangOpts().ObjC = true; -m_compiler->getLangOpts().CPlusPlus = true; -m_compiler->getLangOpts().CPlusPlus11 = true; +lang_opts.ObjC = true; +lang_opts.CPlusPlus = true; +lang_opts.CPlusPlus11 = true; m_compiler->getHeaderSearchOpts().UseLibcxx = true; break; } - m_compiler->getLangOpts().Bool = true; - m_compiler->getLangOpts().WChar = true; - m_compiler->getLangOpts().Blocks = true; - m_compiler->getLangOpts().DebuggerSupport = + lang_opts.Bool = true; + lang_opts.WChar = true; + lang_opts.Blocks = true; + lang_opts.DebuggerSupport = true; // Features specifically for debugger clients if (expr.DesiredResultType() == Expression::eResultTypeId) -m_compiler->getLangOpts().DebuggerCastResultToId = true; +lang_opts.DebuggerCastResultToId = true; - m_compiler->getLangOpts().CharIsSigned = - ArchSpec(m_compiler->getTargetOpts().Triple.c_str()) - .CharIsSignedByDefault(); + lang_opts.CharIsSigned = ArchSpec(m_compiler->getTargetOpts().Triple.c_str()) + .CharIsSignedByDefault(); // Spell checking is a nice feature, but it ends up completing a lot of types // that we didn't strictly speaking need to complete. As a result, we spend a // long time parsing and importing debug information. - m_compiler->getLangOpts().SpellChecking = false; + lang_opts.SpellChecking = false; - if (process_sp && m_compiler->getLangOpts().ObjC) { + if (process_sp && lang_opts.ObjC) { if (process_sp->GetObjCLanguageRuntime()) { if (process_sp->GetObjCLanguageRuntime()->GetRuntimeVersion() == ObjCLanguageRuntime::ObjCRuntimeVersions::eAppleObjC_V2) -m_compiler->getLangOpts().ObjCRuntime.set(ObjCRuntime::MacOSX, - VersionTuple(10, 7)); +lang_opts.ObjCRuntime.set(ObjCRuntime::MacOSX, VersionTuple(10, 7)); else -m_compiler->getLangOpts().ObjCRuntime.set(ObjCRuntime::FragileMacOSX, - VersionTuple(10, 7)); +lang_opts.ObjCRuntime.set(ObjCRuntime::FragileMacOSX, + VersionTuple(10, 7)); if (process_sp->GetObjCLanguageRuntime()->HasNewLiteralsAndIndexing()) -m_compiler->getLangOpts().Debugge
[Lldb-commits] [PATCH] D54617: [Reproducers] Add file provider
JDevlieghere updated this revision to Diff 183631. JDevlieghere added a comment. - Fix issue in lit test. - Add unit test for the file collector. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54617/new/ https://reviews.llvm.org/D54617 Files: include/lldb/Host/FileSystem.h include/lldb/Utility/FileCollector.h include/lldb/Utility/Reproducer.h lit/Reproducer/Inputs/FileCapture.in lit/Reproducer/Inputs/FileReplay.in lit/Reproducer/TestFileRepro.test lit/Reproducer/TestGDBRemoteRepro.test source/Host/common/FileSystem.cpp source/Host/macosx/objcxx/Host.mm source/Initialization/SystemInitializerCommon.cpp source/Utility/CMakeLists.txt source/Utility/FileCollector.cpp source/Utility/Reproducer.cpp unittests/Utility/CMakeLists.txt unittests/Utility/FileCollectorTest.cpp Index: unittests/Utility/FileCollectorTest.cpp === --- /dev/null +++ unittests/Utility/FileCollectorTest.cpp @@ -0,0 +1,109 @@ +//===-- FileCollectorTest.cpp ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include "lldb/Utility/FileCollector.h" +#include "lldb/Utility/FileSpec.h" + +#include "llvm/Support/FileSystem.h" + +using namespace llvm; +using namespace lldb_private; + +class TestingFileCollector : public FileCollector { +public: + using FileCollector::FileCollector; + using FileCollector::m_root; + using FileCollector::m_seen; + using FileCollector::m_symlink_map; + using FileCollector::m_vfs_writer; + + bool HasSeen(llvm::StringRef p) { return m_seen.find(p) != m_seen.end(); } +}; + +TEST(FileCollectorTest, AddFile) { + FileSpec root("/root", FileSpec::Style::posix); + TestingFileCollector file_collector(root); + + file_collector.AddFile("/path/to/a"); + file_collector.AddFile("/path/to/b"); + file_collector.AddFile(FileSpec("/path/to/c", FileSpec::Style::posix)); + + // Make sure the root is correct. + EXPECT_EQ(file_collector.m_root, FileSpec("/root")); + + // Make sure we've seen all the added files. + EXPECT_TRUE(file_collector.HasSeen("/path/to/a")); + EXPECT_TRUE(file_collector.HasSeen("/path/to/b")); + EXPECT_TRUE(file_collector.HasSeen("/path/to/c")); + + // Make sure we've only seen the added files. + EXPECT_FALSE(file_collector.HasSeen("/path/to/d")); + + // All added files share a common parent path (/path/to) so the symlink map + // should contain exactly one entry. + EXPECT_EQ((size_t)1, file_collector.m_symlink_map.size()); + + // As the path is bogus it should point to an empty string. + auto it = file_collector.m_symlink_map.find("/path/to"); + EXPECT_NE(it, file_collector.m_symlink_map.end()); + EXPECT_EQ(it->second, std::string()); + + // Verify the mapping. + auto mapping = file_collector.m_vfs_writer.getMappings(); + EXPECT_EQ((size_t)3, mapping.size()); + for (auto &entry : mapping) { +EXPECT_EQ((size_t)0, entry.VPath.find("/path/to/")); +EXPECT_EQ((size_t)0, entry.RPath.find("/root/")); +EXPECT_EQ(entry.VPath.back(), entry.RPath.back()); + } +} + +TEST(FileCollectorTest, CopyFiles) { + std::error_code ec; + // Create a unique directory. We cannot depend on lldb's filesystem for this + // because it depends on Utility. + SmallString<128> collector_root; + ec = sys::fs::createUniqueDirectory("root", collector_root); + EXPECT_FALSE(ec); + + // Create some temporary files. + SmallString<128> file_a; + ec = sys::fs::createTemporaryFile("file", "a", file_a); + EXPECT_FALSE(ec); + + SmallString<128> file_b; + ec = sys::fs::createTemporaryFile("file", "b", file_b); + EXPECT_FALSE(ec); + + SmallString<128> file_c; + ec = sys::fs::createTemporaryFile("file", "c", file_c); + EXPECT_FALSE(ec); + + // Create file collector and add files. + FileSpec root(collector_root); + TestingFileCollector file_collector(root); + file_collector.AddFile(file_a); + file_collector.AddFile(file_b); + file_collector.AddFile(file_c); + + // Make sure we can copy the files. + ec = file_collector.CopyFiles(true); + EXPECT_FALSE(ec); + + // Now add a bogus file and make sure we error out. + file_collector.AddFile("/some/bogus/file"); + ec = file_collector.CopyFiles(true); + EXPECT_TRUE(ec); + + // However, if stop_on_error is true the copy should still succeed. + ec = file_collector.CopyFiles(false); + EXPECT_FALSE(ec); +} Index: unittests/Utility/CMakeLists.txt === --- unittests/Utility/CMakeLists.txt +++ unittests/Utility/CMakeLists.txt @@ -10,6 +10,7 @@ DataExtractorTest.cpp EnvironmentTest.cpp EventTest.cpp + FileCollectorTest.cpp FileSpecTest.c
[Lldb-commits] [PATCH] D54617: [Reproducers] Add file provider
davide added a comment. Some comments. Thanks! Comment at: include/lldb/Utility/FileCollector.h:5-7 +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// You might want to update the license. Comment at: include/lldb/Utility/FileCollector.h:50-54 + std::mutex m_mutex; + FileSpec m_root; + llvm::StringSet<> m_seen; + llvm::vfs::YAMLVFSWriter m_vfs_writer; + llvm::StringMap m_symlink_map; Can we add comments to these member variables? Some are not entirely obvious to me, e.g. what's `m_root`? What's `m_mutex` is supposed to protect . I think we should document these invariants. Comment at: source/Utility/FileCollector.cpp:27-33 + // Change path to all upper case and ask for its real path, if the latter + // exists and is equal to path, it's not case sensitive. Default to case + // sensitive in the absence of real_path, since this is the YAMLVFSWriter + // default. + upper_dest = path.upper(); + if (sys::fs::real_path(upper_dest, real_dest) && path.equals(real_dest)) +return false; should this be a function in FS to check the case-sensitiveness? Comment at: source/Utility/FileCollector.cpp:84-87 + // Canonicalize the source path by removing "..", "." components. + SmallString<256> virtual_path = absolute_src; + sys::path::remove_dots(virtual_path, /*remove_dot_dot=*/true); + Ditto (I thought there was one to canonicalize the source path?) CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54617/new/ https://reviews.llvm.org/D54617 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54617: [Reproducers] Add file provider
JDevlieghere updated this revision to Diff 183641. JDevlieghere marked 9 inline comments as done. JDevlieghere added a comment. Code review feedback Davide. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54617/new/ https://reviews.llvm.org/D54617 Files: include/lldb/Host/FileSystem.h include/lldb/Utility/FileCollector.h include/lldb/Utility/Reproducer.h lit/Reproducer/Inputs/FileCapture.in lit/Reproducer/Inputs/FileReplay.in lit/Reproducer/TestFileRepro.test lit/Reproducer/TestGDBRemoteRepro.test source/Host/common/FileSystem.cpp source/Host/macosx/objcxx/Host.mm source/Initialization/SystemInitializerCommon.cpp source/Utility/CMakeLists.txt source/Utility/FileCollector.cpp source/Utility/Reproducer.cpp unittests/Utility/CMakeLists.txt unittests/Utility/FileCollectorTest.cpp Index: unittests/Utility/FileCollectorTest.cpp === --- /dev/null +++ unittests/Utility/FileCollectorTest.cpp @@ -0,0 +1,109 @@ +//===-- FileCollectorTest.cpp ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include "lldb/Utility/FileCollector.h" +#include "lldb/Utility/FileSpec.h" + +#include "llvm/Support/FileSystem.h" + +using namespace llvm; +using namespace lldb_private; + +class TestingFileCollector : public FileCollector { +public: + using FileCollector::FileCollector; + using FileCollector::m_root; + using FileCollector::m_seen; + using FileCollector::m_symlink_map; + using FileCollector::m_vfs_writer; + + bool HasSeen(llvm::StringRef p) { return m_seen.find(p) != m_seen.end(); } +}; + +TEST(FileCollectorTest, AddFile) { + FileSpec root("/root", FileSpec::Style::posix); + TestingFileCollector file_collector(root); + + file_collector.AddFile("/path/to/a"); + file_collector.AddFile("/path/to/b"); + file_collector.AddFile(FileSpec("/path/to/c", FileSpec::Style::posix)); + + // Make sure the root is correct. + EXPECT_EQ(file_collector.m_root, FileSpec("/root")); + + // Make sure we've seen all the added files. + EXPECT_TRUE(file_collector.HasSeen("/path/to/a")); + EXPECT_TRUE(file_collector.HasSeen("/path/to/b")); + EXPECT_TRUE(file_collector.HasSeen("/path/to/c")); + + // Make sure we've only seen the added files. + EXPECT_FALSE(file_collector.HasSeen("/path/to/d")); + + // All added files share a common parent path (/path/to) so the symlink map + // should contain exactly one entry. + EXPECT_EQ((size_t)1, file_collector.m_symlink_map.size()); + + // As the path is bogus it should point to an empty string. + auto it = file_collector.m_symlink_map.find("/path/to"); + EXPECT_NE(it, file_collector.m_symlink_map.end()); + EXPECT_EQ(it->second, std::string()); + + // Verify the mapping. + auto mapping = file_collector.m_vfs_writer.getMappings(); + EXPECT_EQ((size_t)3, mapping.size()); + for (auto &entry : mapping) { +EXPECT_EQ((size_t)0, entry.VPath.find("/path/to/")); +EXPECT_EQ((size_t)0, entry.RPath.find("/root/")); +EXPECT_EQ(entry.VPath.back(), entry.RPath.back()); + } +} + +TEST(FileCollectorTest, CopyFiles) { + std::error_code ec; + // Create a unique directory. We cannot depend on lldb's filesystem for this + // because it depends on Utility. + SmallString<128> collector_root; + ec = sys::fs::createUniqueDirectory("root", collector_root); + EXPECT_FALSE(ec); + + // Create some temporary files. + SmallString<128> file_a; + ec = sys::fs::createTemporaryFile("file", "a", file_a); + EXPECT_FALSE(ec); + + SmallString<128> file_b; + ec = sys::fs::createTemporaryFile("file", "b", file_b); + EXPECT_FALSE(ec); + + SmallString<128> file_c; + ec = sys::fs::createTemporaryFile("file", "c", file_c); + EXPECT_FALSE(ec); + + // Create file collector and add files. + FileSpec root(collector_root); + TestingFileCollector file_collector(root); + file_collector.AddFile(file_a); + file_collector.AddFile(file_b); + file_collector.AddFile(file_c); + + // Make sure we can copy the files. + ec = file_collector.CopyFiles(true); + EXPECT_FALSE(ec); + + // Now add a bogus file and make sure we error out. + file_collector.AddFile("/some/bogus/file"); + ec = file_collector.CopyFiles(true); + EXPECT_TRUE(ec); + + // However, if stop_on_error is true the copy should still succeed. + ec = file_collector.CopyFiles(false); + EXPECT_FALSE(ec); +} Index: unittests/Utility/CMakeLists.txt === --- unittests/Utility/CMakeLists.txt +++ unittests/Utility/CMakeLists.txt @@ -10,6 +10,7 @@ DataExtractorTest.cpp EnvironmentTest.cpp EventTest.cpp + FileCollectorTest.cpp Fil
[Lldb-commits] [PATCH] D54617: [Reproducers] Add file provider
JDevlieghere added inline comments. Comment at: source/Utility/FileCollector.cpp:27-33 + // Change path to all upper case and ask for its real path, if the latter + // exists and is equal to path, it's not case sensitive. Default to case + // sensitive in the absence of real_path, since this is the YAMLVFSWriter + // default. + upper_dest = path.upper(); + if (sys::fs::real_path(upper_dest, real_dest) && path.equals(real_dest)) +return false; davide wrote: > should this be a function in FS to check the case-sensitiveness? As Host depends on Utility, we cannot depend on the filesystem class here. Comment at: source/Utility/FileCollector.cpp:84-87 + // Canonicalize the source path by removing "..", "." components. + SmallString<256> virtual_path = absolute_src; + sys::path::remove_dots(virtual_path, /*remove_dot_dot=*/true); + davide wrote: > Ditto (I thought there was one to canonicalize the source path?) See previous answer. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54617/new/ https://reviews.llvm.org/D54617 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54617: [Reproducers] Add file provider
davide accepted this revision. davide added a comment. This revision is now accepted and ready to land. I don't have other comments, this is good to go for me. Pavel? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54617/new/ https://reviews.llvm.org/D54617 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r352259 - [lldb] Update shebang python2 -> python
Author: jdevlieghere Date: Fri Jan 25 17:05:02 2019 New Revision: 352259 URL: http://llvm.org/viewvc/llvm-project?rev=352259&view=rev Log: [lldb] Update shebang python2 -> python Modified: lldb/trunk/lit/Quit/expect_exit_code.py Modified: lldb/trunk/lit/Quit/expect_exit_code.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Quit/expect_exit_code.py?rev=352259&r1=352258&r2=352259&view=diff == --- lldb/trunk/lit/Quit/expect_exit_code.py (original) +++ lldb/trunk/lit/Quit/expect_exit_code.py Fri Jan 25 17:05:02 2019 @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python import subprocess import sys ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D57272: Remove unimplemented function
aprantl created this revision. aprantl added reviewers: jasonmolenda, jingham. Looks like this was an unintended sideeffect of r124250. https://reviews.llvm.org/D57272 Files: source/Symbol/Type.cpp Index: source/Symbol/Type.cpp === --- source/Symbol/Type.cpp +++ source/Symbol/Type.cpp @@ -138,12 +138,6 @@ m_byte_size(rhs.m_byte_size), m_decl(rhs.m_decl), m_compiler_type(rhs.m_compiler_type), m_flags(rhs.m_flags) {} -const Type &Type::operator=(const Type &rhs) { - if (this != &rhs) { - } - return *this; -} - void Type::GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name) { *s << "id = " << (const UserID &)*this; Index: source/Symbol/Type.cpp === --- source/Symbol/Type.cpp +++ source/Symbol/Type.cpp @@ -138,12 +138,6 @@ m_byte_size(rhs.m_byte_size), m_decl(rhs.m_decl), m_compiler_type(rhs.m_compiler_type), m_flags(rhs.m_flags) {} -const Type &Type::operator=(const Type &rhs) { - if (this != &rhs) { - } - return *this; -} - void Type::GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name) { *s << "id = " << (const UserID &)*this; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D57273: Make Type::GetByteSize optional
aprantl created this revision. aprantl added reviewers: jingham, labath. This is a continuation of my quest to make the size 0 a supported value. https://reviews.llvm.org/D57273 Files: include/lldb/Symbol/Type.h source/Core/ValueObjectMemory.cpp source/Expression/Materializer.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Symbol/Type.cpp Index: source/Symbol/Type.cpp === --- source/Symbol/Type.cpp +++ source/Symbol/Type.cpp @@ -107,7 +107,7 @@ } Type::Type(lldb::user_id_t uid, SymbolFile *symbol_file, - const ConstString &name, uint64_t byte_size, + const ConstString &name, llvm::Optional byte_size, SymbolContextScope *context, user_id_t encoding_uid, EncodingDataType encoding_uid_type, const Declaration &decl, const CompilerType &compiler_type, @@ -115,7 +115,14 @@ : std::enable_shared_from_this(), UserID(uid), m_name(name), m_symbol_file(symbol_file), m_context(context), m_encoding_type(nullptr), m_encoding_uid(encoding_uid), m_encoding_uid_type(encoding_uid_type), - m_byte_size(byte_size), m_decl(decl), m_compiler_type(compiler_type) { + m_decl(decl), m_compiler_type(compiler_type) { + if (byte_size) { +m_byte_size = *byte_size; +m_byte_size_has_value = true; + } else { +m_byte_size = 0; +m_byte_size_has_value = false; + } m_flags.compiler_type_resolve_state = (compiler_type ? compiler_type_resolve_state : eResolveStateUnresolved); m_flags.is_complete_objc_class = false; @@ -125,7 +132,8 @@ : std::enable_shared_from_this(), UserID(0), m_name(""), m_symbol_file(nullptr), m_context(nullptr), m_encoding_type(nullptr), m_encoding_uid(LLDB_INVALID_UID), m_encoding_uid_type(eEncodingInvalid), - m_byte_size(0), m_decl(), m_compiler_type() { + m_byte_size(0), m_byte_size_has_value(false), m_decl(), + m_compiler_type() { m_flags.compiler_type_resolve_state = eResolveStateUnresolved; m_flags.is_complete_objc_class = false; } @@ -135,7 +143,8 @@ m_symbol_file(rhs.m_symbol_file), m_context(rhs.m_context), m_encoding_type(rhs.m_encoding_type), m_encoding_uid(rhs.m_encoding_uid), m_encoding_uid_type(rhs.m_encoding_uid_type), - m_byte_size(rhs.m_byte_size), m_decl(rhs.m_decl), + m_byte_size(rhs.m_byte_size), + m_byte_size_has_value(rhs.m_byte_size_has_value), m_decl(rhs.m_decl), m_compiler_type(rhs.m_compiler_type), m_flags(rhs.m_flags) {} const Type &Type::operator=(const Type &rhs) { @@ -213,7 +222,7 @@ if (m_name) *s << ", name = \"" << m_name << "\""; - if (m_byte_size != 0) + if (m_byte_size_has_value) s->Printf(", size = %" PRIu64, m_byte_size); if (show_context && m_context != nullptr) { @@ -292,7 +301,7 @@ GetForwardCompilerType().DumpValue( exe_ctx, s, format == lldb::eFormatDefault ? GetFormat() : format, data, -data_byte_offset, GetByteSize(), +data_byte_offset, GetByteSize().getValueOr(0), 0, // Bitfield bit size 0, // Bitfield bit offset show_types, show_summary, verbose, 0); @@ -305,36 +314,45 @@ return m_encoding_type; } -uint64_t Type::GetByteSize() { - if (m_byte_size == 0) { -switch (m_encoding_uid_type) { -case eEncodingInvalid: -case eEncodingIsSyntheticUID: - break; -case eEncodingIsUID: -case eEncodingIsConstUID: -case eEncodingIsRestrictUID: -case eEncodingIsVolatileUID: -case eEncodingIsTypedefUID: { - Type *encoding_type = GetEncodingType(); - if (encoding_type) -m_byte_size = encoding_type->GetByteSize(); - if (m_byte_size == 0) -if (llvm::Optional size = -GetLayoutCompilerType().GetByteSize(nullptr)) - m_byte_size = *size; +llvm::Optional Type::GetByteSize() { + if (m_byte_size_has_value) +return m_byte_size; + + switch (m_encoding_uid_type) { + case eEncodingInvalid: + case eEncodingIsSyntheticUID: +break; + case eEncodingIsUID: + case eEncodingIsConstUID: + case eEncodingIsRestrictUID: + case eEncodingIsVolatileUID: + case eEncodingIsTypedefUID: { +Type *encoding_type = GetEncodingType(); +if (encoding_type) + if (llvm::Optional size = encoding_type->GetByteSize()) { +m_byte_size = *size; +m_byte_size_has_value = true; + } + +if (!m_byte_size_has_value) + if (llvm::Optional size = + GetLayoutCompilerType().GetByteSize(nullptr)) { +m_byte_size = *size; +m_byte_size_has_value = true; + } } break; // If we are a pointer or reference, then this is just a pointer size; case eEncodingIsPointerUID: case eEncodingIsLValueReferenceUID: case eEncodingIsRValueReferenceUID: { - if (ArchSpec arch = m_symbol_file->GetObjectFile()->GetArchitecture()
[Lldb-commits] [PATCH] D57275: [testsuite] Remove seven dependency
JDevlieghere created this revision. JDevlieghere added reviewers: davide, zturner, stella.stamenova, labath. JDevlieghere added a project: LLDB. Herald added a reviewer: serge-sans-paille. When running the test suite on macOS with Python 3 we noticed a difference in behavior between Python 2 and Python 3 for `seven.get_command_output`. The output contained a newline with Python 3, but not for Python 2. This resulted in an invalid SDK path passed to the compiler. There were only two actual usages left of this module so I propose to remove it and have a simple, local implementation for `get_command_output`. Repository: rLLDB LLDB https://reviews.llvm.org/D57275 Files: packages/Python/lldbsuite/support/seven.py packages/Python/lldbsuite/test/dosep.py packages/Python/lldbsuite/test/dotest.py packages/Python/lldbsuite/test/functionalities/exec/TestExec.py packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py Index: packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py === --- packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py +++ packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py @@ -10,21 +10,11 @@ import re import lldb -from lldbsuite.support import seven from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil -def execute_command(command): -# print('%% %s' % (command)) -(exit_status, output) = seven.get_command_status_output(command) -# if output: -# print(output) -# print('status = %u' % (exit_status)) -return exit_status - - class ObjCiVarIMPTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) Index: packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py === --- packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py +++ packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py @@ -7,7 +7,6 @@ import lldb import os import time -import lldbsuite.support.seven as seven from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil Index: packages/Python/lldbsuite/test/functionalities/exec/TestExec.py === --- packages/Python/lldbsuite/test/functionalities/exec/TestExec.py +++ packages/Python/lldbsuite/test/functionalities/exec/TestExec.py @@ -7,21 +7,11 @@ import lldb import os import time -from lldbsuite.support import seven from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil -def execute_command(command): -#print('%% %s' % (command)) -(exit_status, output) = seven.get_command_status_output(command) -# if output: -#print(output) -#print('status = %u' % (exit_status)) -return exit_status - - class ExecTestCase(TestBase): NO_DEBUG_INFO_TESTCASE = True Index: packages/Python/lldbsuite/test/dotest.py === --- packages/Python/lldbsuite/test/dotest.py +++ packages/Python/lldbsuite/test/dotest.py @@ -46,9 +46,15 @@ from lldbsuite.test_event import formatter from . import test_result from lldbsuite.test_event.event_builder import EventBuilder -from ..support import seven +def get_command_output(cmd): + try: +return subprocess.check_output(cmd, shell=True).rstrip() + except: +pass + return '' + def is_exe(fpath): """Returns true if fpath is an executable.""" if fpath == None: @@ -290,7 +296,7 @@ # Use a compiler appropriate appropriate for the Apple SDK if one was # specified if platform_system == 'Darwin' and args.apple_sdk: -configuration.compiler = seven.get_command_output( +configuration.compiler = get_command_output( 'xcrun -sdk "%s" -find clang 2> /dev/null' % (args.apple_sdk)) else: @@ -304,7 +310,7 @@ if args.dsymutil: os.environ['DSYMUTIL'] = args.dsymutil elif platform_system == 'Darwin': - os.environ['DSYMUTIL'] = seven.get_command_output( + os.environ['DSYMUTIL'] = get_command_output( 'xcrun -find -toolchain default dsymutil') if args.filecheck: @@ -336,7 +342,7 @@ # Set SDKROOT if we are using an Apple SDK if platform_system == 'Darwin' and args.apple_sdk: -os.environ['SDKROOT'] = seven.get_command_output( +os.environ['SDKROOT'] = get_command_output( 'xcrun --sdk "%s" --show-sdk-path 2> /dev/null' % (args.apple_sdk)) @@ -344,10 +350,10 @@ configuration.arch = args.arch if configuration.arch.startswith(
Re: [Lldb-commits] [PATCH] D57275: [testsuite] Remove seven dependency
The idea behind seven is that it’s a place to put stuff that we need for py2/py3 interoperability that doesn’t already exist in six. Yes, maybe there’s only one thing there now, but there could be more over time. At least that was the thinking when I created it. It seems like there’s two separate issues here: 1) you need to fix a bug, and 2) you want to propose removing seven. Is it worth doing those two things separately? On Fri, Jan 25, 2019 at 6:00 PM Jonas Devlieghere via Phabricator < revi...@reviews.llvm.org> wrote: > JDevlieghere created this revision. > JDevlieghere added reviewers: davide, zturner, stella.stamenova, labath. > JDevlieghere added a project: LLDB. > Herald added a reviewer: serge-sans-paille. > > When running the test suite on macOS with Python 3 we noticed a difference > in behavior between Python 2 and Python 3 for `seven.get_command_output`. > The output contained a newline with Python 3, but not for Python 2. This > resulted in an invalid SDK path passed to the compiler. > > There were only two actual usages left of this module so I propose to > remove it and have a simple, local implementation for `get_command_output`. > > > Repository: > rLLDB LLDB > > https://reviews.llvm.org/D57275 > > Files: > packages/Python/lldbsuite/support/seven.py > packages/Python/lldbsuite/test/dosep.py > packages/Python/lldbsuite/test/dotest.py > packages/Python/lldbsuite/test/functionalities/exec/TestExec.py > > packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py > packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits