[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang] Reland: Instantiate alias templates with sugar (PR #101858)
gribozavr wrote: > So from my undertstanding, IWYU only needs the SubstTemplateTypeParmType for > resugaring purposes, in order to recover the type as written by the user. > > But with this patch we are doing the substitution already with sugar, so > there is no need to resugar, so IWYU shouldn't need the > SubstTemplateTypeParmType here anymore. I agree that we don't need `SubstTemplateTypeParmType` nodes if all resuraging that we ever do is related to types that the Clang frontend itself knows. However that is not universally true. For example, we (Google) have a tool for inferring and checking nullability contracts (https://github.com/google/crubit/tree/main/nullability). It relies on `SubstTemplateTypeParmType` nodes to propagate nullability annotations through template signatures. We can't rely on the Clang frontend doing this propagation because this logic is in an external tool. So for all practical purposes, the removal of `SubstTemplateTypeParmType` is losing relevant information, and it means that no other tool can do the things that Clang frontend can. https://github.com/llvm/llvm-project/pull/101858 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang] Reland: Instantiate alias templates with sugar (PR #101858)
gribozavr wrote: ## On resugaring bodies of function template instantiations > I just don't think that can be something we can always enable, as that would > make some examples of source code take exponentially more time and memory to > compile. We keep track of propagated and inferred nullability annotations in a [side data structure](https://github.com/google/crubit/blob/main/nullability/type_nullability.h#L185). Our approach allows us to save on memory by not actually re-instantiating everything with new sugar. But I do have a question - how is the built-in resugarer going to do this without maintaining a side data structure like we do? Clang currently does not have a concept of non-canonical instantiations. `std::vector`, `std::vector>`, `std::vector>` are the same canonical type, so they must share one instantiation. Are you also proposing to change that? > Right now the priority is to implement the stuff that won't take a big hit on > perf. But that is just priority. But wouldn't it be better if out-of-tree users like us were not blocked on the priorities of your work? With the `Subst*` nodes in the AST the information is available for out-of-tree users to use in any way they like. Are you sure you can predict all use cases? Do you really want to be in the business of satisfying them? --- ## On (in)completeness of the out-of-tree resugarer > I don't think, from looking at the resugarer implemented in > type_nullability.cc, it's anywhere close to being able to resugar through a > complex type like an STL vector, as shown in the example. Actually, resugaring in nullability analysis already works for `std::vector::push_back()`: ```c++ #include #include "absl/base/nullability.h" void Test() { int *p = nullptr; std::vector> xs; xs.push_back(p); } ``` ``` $ clang-tidy example.cc example.cc:7:16: warning: expected parameter '__x' of 'std::vector::push_back' to be nonnull, but a nullable argument was used [google-runtime-pointer-nullability] 7 | xs.push_back(p); |^ ``` > as for example both libc++ and libstdc++ vector implementations derive the > element type not through the first template argument, but through the > allocator instead. As far as I see, libc++ does not actually use the allocator to define `const_reference`, `value_type` and so on: ```c++ template */> class _LIBCPP_TEMPLATE_VIS vector { typedef _Tp value_type; typedef value_type& reference; typedef const value_type& const_reference; /* ... */ void push_back(const_reference __x); ``` (see https://github.com/llvm/llvm-project/blob/main/libcxx/include/vector) > I see the implementation of the resugarer in `type_nullability.cc`, and it's > much more incomplete that the one I am proposing to upstream. So I think if > you get it to work through upstream transforms, you will get there faster. I'm not sure what you mean by "get there faster" - our implementation already works, is already deployed internally, and covers a lot of cases that are relevant in practice. We are still tweaking things of course, and we are working on inference tooling (that infers nullability contracts based on the implementation and suggests edits to the source code accordingly). That is, the difficult part and the focus at the moment is not resugaring in the analysis. I do admit that our implementation of resugaring is probably not as comprehensive as the one that you're working on, but it works for the vast majority of real-world code that people write in our monorepo - we tweaked it based on the cases that we actually observed. --- ## On upstreaming the work > As far as I can see, you don't need to keep the Subst* nodes after resugaring > if you implement: We are in the process of adding Clang's `_Nullable` and `_Nonnull` attributes to the implementation of `absl::Nullable` and `absl::Nonnull`. This work is taking time because we need to adjust our internal codebase to conform to Clang's existing expectations, behaviors, and warnings that get triggered by these attributes. These attributes will get picked up by the in-tree resugaring implementation because the source of the annotation is physically spelled in the code. Good. However, a part of the nullability language extension is the [pragma that changes the default meaning of pointers](https://github.com/google/crubit/blob/main/nullability/test/pragma_nonnull.h#L6) from "unknown" to "nonnull". That is, we interpret the following two files in an identical way: ```c++ #include "absl/base/nullability.h" #pragma nullability file_default nonnull void TakePointer(int *p); ``` ```c++ #include "absl/base/nullability.h" void TakePointer(absl::Nonnull p); ``` Unfortunately we expect this pragma to be a controversial upstream because Clang already has a pragma for this exact purpose (`#pragma clang assume_nonnull begin/end`), but it was introduced by Apple in context of Objective-C and some of its behavior is
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang] Reland: Instantiate alias templates with sugar (PR #101858)
gribozavr wrote: @mizvekov I will provide a more detailed response to the points you made in your last message separately, but for now I would like to ask you to revert the commit to unbreak us. We looked into the problem internally and it does not look we have a simple hack we can apply to recover this information. The solutions you offered so far to unblock us are going to take years to implement (like waiting for you to complete work that you consider low priority, or upstreaming our code - which means upstreaming 20 KLoC of nullability verification code which involves resolving differences around pragma semantics etc.) https://github.com/llvm/llvm-project/pull/101858 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang] Reland: Instantiate alias templates with sugar (PR #101858)
gribozavr wrote: > @gribozavr see #102510 for alternative. Thank you! We are looking at this now. > That's not really true. You only need to upstream the AST affecting parts. > The attributes itself and AST node which represent it. The attributes are already upstream (we are reusing nullability attributes added by Apple), as I explained above. The C++-compatible pragma is missing - and I expect it to be a lot of work to reconcile. And even then, we still need to propagate the annotations - which currently happens within the ClangTidy check. For example, we need to understand that the template parameter 0 of `std::vector` variable below is nullable: ```c++ std::vector> MakeVectorOfNullable(); void Test() { std::vector xs = MakeVectorOfNullable(); *xs[0]; // warning } ``` This propagation could happen within core Clang so that it can be integrated into the resugarer that constructs the AST, but doing so (injecting nullable annotations here) would have its own cost for the AST, and would require rearchitecting the check, to essentially run part of the logic during AST construction instead of inside of ClangTidy. https://github.com/llvm/llvm-project/pull/101858 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 6528157 - [lldb][swig] Use the correct variable in the return statement
Author: Dmitri Gribenko Date: 2024-08-21T15:29:03+02:00 New Revision: 65281570afd7e35e01533b07c6c2937de410fc52 URL: https://github.com/llvm/llvm-project/commit/65281570afd7e35e01533b07c6c2937de410fc52 DIFF: https://github.com/llvm/llvm-project/commit/65281570afd7e35e01533b07c6c2937de410fc52.diff LOG: [lldb][swig] Use the correct variable in the return statement The issue was introduced in https://github.com/llvm/llvm-project/pull/104523. The code introduces the `ret_val` variable but does not use it. Instead it returns a pointer, which gets implicitly converted to bool. Added: Modified: lldb/bindings/python/python-wrapper.swig Removed: diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index 2ce42e3e017d5b..360c392235a866 100644 --- a/lldb/bindings/python/python-wrapper.swig +++ b/lldb/bindings/python/python-wrapper.swig @@ -837,7 +837,7 @@ bool lldb_private::python::SWIGBridge::LLDBSwigPython_ShouldHide( bool ret_val = result ? PyObject_IsTrue(result) : false; Py_XDECREF(result); - return result; + return ret_val; } void *lldb_private::python::SWIGBridge::LLDBSWIGPython_GetDynamicSetting( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Extend frame recognizers to hide frames from backtraces (PR #104523)
gribozavr wrote: @adrian-prantl I'm going to revert this PR because it fails msan due to uninitialized variables. Specifically, `StackFrame::m_frame_recognizer_generation` and `StackFrameRecognizerManager::m_generation` are never initialized. Sample msan failure on `lldb/test/Shell/Unwind/eh-frame-small-fde`: ``` ==4576==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x557c5364 in lldb_private::StackFrame::GetRecognizedFrame() third_party/llvm/llvm-project/lldb/source/Target/StackFrame.cpp:1986:7 #1 0x557d24e7 in lldb_private::StackFrameList::SelectMostRelevantFrame() third_party/llvm/llvm-project/lldb/source/Target/StackFrameList.cpp:817:58 #2 0x557d2ba2 in lldb_private::StackFrameList::GetSelectedFrameIndex(SelectMostRelevant) third_party/llvm/llvm-project/lldb/source/Target/StackFrameList.cpp:838:5 #3 0x55799920ee11 in lldb_private::Thread::GetSelectedFrameIndex(SelectMostRelevant) third_party/llvm/llvm-project/lldb/include/lldb/Target/Thread.h:445:33 #4 0x55771af0 in lldb_private::Process::HandleProcessStateChangedEvent(std::__msan::shared_ptr const&, lldb_private::Stream*, SelectMostRelevant, bool&) third_party/llvm/llvm-project/lldb/source/Target/Process.cpp:939:26 #5 0x5577025d in lldb_private::Process::WaitForProcessToStop(lldb_private::Timeout> const&, std::__msan::shared_ptr*, bool, std::__msan::shared_ptr, lldb_private::Stream*, bool, SelectMostRelevant) third_party/llvm/llvm-project/lldb/source/Target/Process.cpp:722:5 #6 0x5577676f in lldb_private::Process::ResumeSynchronous(lldb_private::Stream*) third_party/llvm/llvm-project/lldb/source/Target/Process.cpp:1415:9 #7 0x557999a198e1 in lldb_private::Target::Launch(lldb_private::ProcessLaunchInfo&, lldb_private::Stream*) third_party/llvm/llvm-project/lldb/source/Target/Target.cpp:3339:21 #8 0x557999274a55 in CommandObjectProcessLaunch::DoExecute(lldb_private::Args&, lldb_private::CommandReturnObject&) third_party/llvm/llvm-project/lldb/source/Commands/CommandObjectProcess.cpp:236:28 #9 0x55799933f44c in lldb_private::CommandObjectParsed::Execute(char const*, lldb_private::CommandReturnObject&) third_party/llvm/llvm-project/lldb/source/Interpreter/CommandObject.cpp:835:9 #10 0x55799916d868 in lldb_private::CommandInterpreter::HandleCommand(char const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&, bool) third_party/llvm/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2071:14 #11 0x557999176120 in lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::__msan::basic_string, std::__msan::allocator>&) third_party/llvm/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:3167:3 #12 0x55799917656c in non-virtual thunk to lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::__msan::basic_string, std::__msan::allocat or>&) third_party/llvm/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp #13 0x55799902338c in lldb_private::IOHandlerEditline::Run() third_party/llvm/llvm-project/lldb/source/Core/IOHandler.cpp:600:22 #14 0x557998fdbbff in lldb_private::Debugger::RunIOHandlerSync(std::__msan::shared_ptr const&) third_party/llvm/llvm-project/lldb/source/Core/Debugger.cpp:1131:20 #15 0x5579991715f9 in lldb_private::CommandInterpreter::HandleCommandsFromFile(lldb_private::FileSpec&, lldb_private::CommandInterpreterRunOptions const&, lldb_private::CommandReturnObject&) third_party/llvm/ll vm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2853:12 #16 0x5579991ab51e in CommandObjectCommandsSource::DoExecute(lldb_private::Args&, lldb_private::CommandReturnObject&) third_party/llvm/llvm-project/lldb/source/Commands/CommandObjectCommands.cpp:169:19 #17 0x55799933f44c in lldb_private::CommandObjectParsed::Execute(char const*, lldb_private::CommandReturnObject&) third_party/llvm/llvm-project/lldb/source/Interpreter/CommandObject.cpp:835:9 #18 0x55799916d868 in lldb_private::CommandInterpreter::HandleCommand(char const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&, bool) third_party/llvm/llvm-project/lldb/source/Interpreter/Command Interpreter.cpp:2071:14 #19 0x557999176120 in lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::__msan::basic_string, std::__msan::allocator>&) third_par ty/llvm/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:3167:3 #20 0x55799917656c in non-virtual thunk to lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::__msan::basic_string, std::__msan::allocat or>&) third_party/llvm/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp #21 0x55799902338c in lldb_private::IOHandlerEditline::Run() third_party/llvm/llvm-project/lldb/source/Core/IOHandler.cpp:600:22 #22 0x557998fdb7d6 in lldb_private::Debugger::RunIOHandlers() third_party/llvm/llv
[Lldb-commits] [lldb] 7323e7e - Revert "[lldb][swig] Use the correct variable in the return statement"
Author: Dmitri Gribenko Date: 2024-08-22T13:14:30+02:00 New Revision: 7323e7eee3a819e9a2d8ec29f00d362bcad87731 URL: https://github.com/llvm/llvm-project/commit/7323e7eee3a819e9a2d8ec29f00d362bcad87731 DIFF: https://github.com/llvm/llvm-project/commit/7323e7eee3a819e9a2d8ec29f00d362bcad87731.diff LOG: Revert "[lldb][swig] Use the correct variable in the return statement" This reverts commit 65281570afd7e35e01533b07c6c2937de410fc52. I'm reverting https://github.com/llvm/llvm-project/pull/104523 (https://github.com/llvm/llvm-project/commit/f01f80ce6ca7640bb0e267b84b1ed0e89b57e2d9) and this fixup belongs to the same series of changes. Added: Modified: lldb/bindings/python/python-wrapper.swig Removed: diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index 360c392235a866..2ce42e3e017d5b 100644 --- a/lldb/bindings/python/python-wrapper.swig +++ b/lldb/bindings/python/python-wrapper.swig @@ -837,7 +837,7 @@ bool lldb_private::python::SWIGBridge::LLDBSwigPython_ShouldHide( bool ret_val = result ? PyObject_IsTrue(result) : false; Py_XDECREF(result); - return ret_val; + return result; } void *lldb_private::python::SWIGBridge::LLDBSWIGPython_GetDynamicSetting( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 547917a - Revert "[lldb] Extend frame recognizers to hide frames from backtraces (#104523)"
Author: Dmitri Gribenko Date: 2024-08-22T13:24:57+02:00 New Revision: 547917aebd1e79a8929b53f0ddf3b5185ee4df74 URL: https://github.com/llvm/llvm-project/commit/547917aebd1e79a8929b53f0ddf3b5185ee4df74 DIFF: https://github.com/llvm/llvm-project/commit/547917aebd1e79a8929b53f0ddf3b5185ee4df74.diff LOG: Revert "[lldb] Extend frame recognizers to hide frames from backtraces (#104523)" This reverts commit f01f80ce6ca7640bb0e267b84b1ed0e89b57e2d9. This commit introduces an msan violation. See the discussion on https://github.com/llvm/llvm-project/pull/104523. Added: Modified: lldb/bindings/python/python-wrapper.swig lldb/include/lldb/API/SBFrame.h lldb/include/lldb/Interpreter/ScriptInterpreter.h lldb/include/lldb/Target/StackFrame.h lldb/include/lldb/Target/StackFrameList.h lldb/include/lldb/Target/StackFrameRecognizer.h lldb/include/lldb/Target/Thread.h lldb/source/API/SBFrame.cpp lldb/source/API/SBThread.cpp lldb/source/Commands/CommandCompletions.cpp lldb/source/Commands/CommandObjectFrame.cpp lldb/source/Commands/CommandObjectMemory.cpp lldb/source/Commands/CommandObjectThread.cpp lldb/source/Commands/Options.td lldb/source/Core/Debugger.cpp lldb/source/Interpreter/CommandInterpreter.cpp lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h lldb/source/Target/Process.cpp lldb/source/Target/StackFrame.cpp lldb/source/Target/StackFrameList.cpp lldb/source/Target/StackFrameRecognizer.cpp lldb/source/Target/Thread.cpp lldb/source/Target/ThreadPlanStepOut.cpp lldb/test/API/commands/frame/recognizer/TestFrameRecognizer.py lldb/test/API/commands/frame/recognizer/main.m lldb/test/API/commands/frame/recognizer/recognizer.py Removed: lldb/test/API/lang/cpp/std-function-recognizer/Makefile lldb/test/API/lang/cpp/std-function-recognizer/TestStdFunctionRecognizer.py lldb/test/API/lang/cpp/std-function-recognizer/main.cpp diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index 2ce42e3e017d5b..8f050643fa68b3 100644 --- a/lldb/bindings/python/python-wrapper.swig +++ b/lldb/bindings/python/python-wrapper.swig @@ -813,7 +813,7 @@ PythonObject lldb_private::python::SWIGBridge::LLDBSWIGPython_CreateFrameRecogni } PyObject *lldb_private::python::SWIGBridge::LLDBSwigPython_GetRecognizedArguments( -PyObject *implementor, const lldb::StackFrameSP &frame_sp) { +PyObject * implementor, const lldb::StackFrameSP &frame_sp) { static char callee_name[] = "get_recognized_arguments"; PythonObject arg = SWIGBridge::ToSWIGWrapper(frame_sp); @@ -824,22 +824,6 @@ PyObject *lldb_private::python::SWIGBridge::LLDBSwigPython_GetRecognizedArgument return result; } -bool lldb_private::python::SWIGBridge::LLDBSwigPython_ShouldHide( -PyObject *implementor, const lldb::StackFrameSP &frame_sp) { - static char callee_name[] = "should_hide"; - - PythonObject arg = SWIGBridge::ToSWIGWrapper(frame_sp); - - PythonString str(callee_name); - - PyObject *result = - PyObject_CallMethodObjArgs(implementor, str.get(), arg.get(), NULL); - bool ret_val = result ? PyObject_IsTrue(result) : false; - Py_XDECREF(result); - - return result; -} - void *lldb_private::python::SWIGBridge::LLDBSWIGPython_GetDynamicSetting( void *module, const char *setting, const lldb::TargetSP &target_sp) { if (!module || !setting) diff --git a/lldb/include/lldb/API/SBFrame.h b/lldb/include/lldb/API/SBFrame.h index e0d15c3ecc5b1c..821ff3cf7ce519 100644 --- a/lldb/include/lldb/API/SBFrame.h +++ b/lldb/include/lldb/API/SBFrame.h @@ -104,10 +104,6 @@ class LLDB_API SBFrame { bool IsArtificial() const; - /// Return whether a frame recognizer decided this frame should not - /// be displayes in backtraces etc. - bool IsHidden() const; - /// The version that doesn't supply a 'use_dynamic' value will use the /// target's default. lldb::SBValue EvaluateExpression(const char *expr); diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/lldb/include/lldb/Interpreter/ScriptInterpreter.h index 89a480a28880aa..05f0d7f0955f3e 100644 --- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h +++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h @@ -252,11 +252,6 @@ class ScriptInterpreter : public PluginInterface { return lldb::ValueObjectListSP(); } - virtual bool ShouldHide(const StructuredData::ObjectSP &implementor, - lldb::StackFrameSP frame_sp) { -return false; - } - virtual StructuredData::GenericSP CreateScriptedBreakpointResolver(const char *class_name,
[Lldb-commits] [lldb] aa70f83 - Revert "[lldb-dap] Mark hidden frames as "subtle" (#105457)"
Author: Dmitri Gribenko Date: 2024-08-22T13:24:57+02:00 New Revision: aa70f83e660453c006193aab7ba67c94db236948 URL: https://github.com/llvm/llvm-project/commit/aa70f83e660453c006193aab7ba67c94db236948 DIFF: https://github.com/llvm/llvm-project/commit/aa70f83e660453c006193aab7ba67c94db236948.diff LOG: Revert "[lldb-dap] Mark hidden frames as "subtle" (#105457)" This reverts commit 6f456024c37424d9c8cc1cea07126a28f246588d, which depends on https://github.com/llvm/llvm-project/pull/104523, which I'm reverting. Added: Modified: lldb/tools/lldb-dap/JSONUtils.cpp Removed: lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/Makefile lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/TestDAP_subtleFrames.py lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/main.cpp diff --git a/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/Makefile b/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/Makefile deleted file mode 100644 index 8b20bcb050..00 --- a/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -CXX_SOURCES := main.cpp - -include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/TestDAP_subtleFrames.py b/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/TestDAP_subtleFrames.py deleted file mode 100644 index 1e41e841e39bc8..00 --- a/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/TestDAP_subtleFrames.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -Test lldb-dap stack trace response -""" - - -import dap_server -from lldbsuite.test.decorators import * - -import lldbdap_testcase -from lldbsuite.test.lldbtest import * - - -class TestDAP_subtleFrames(lldbdap_testcase.DAPTestCaseBase): -@add_test_categories(["libc++"]) -def test_subtleFrames(self): -""" -Internal stack frames (such as the ones used by `std::function`) are marked as "subtle". -""" -program = self.getBuildArtifact("a.out") -self.build_and_launch(program) -source = "main.cpp" -self.set_source_breakpoints(source, [line_number(source, "BREAK HERE")]) -self.continue_to_next_stop() - -frames = self.get_stackFrames() -for f in frames: -if "__function" in f["name"]: -self.assertEqual(f["presentationHint"], "subtle") -self.assertTrue(any(f.get("presentationHint") == "subtle" for f in frames)) diff --git a/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/main.cpp b/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/main.cpp deleted file mode 100644 index 71944528441e38..00 --- a/lldb/test/API/tools/lldb-dap/stackTrace/subtleFrames/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include - -void greet() { - // BREAK HERE - std::cout << "Hello\n"; -} - -int main() { - std::function func{greet}; - func(); - return 0; -} diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index c080fd395b7288..a8b85f55939e17 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -763,9 +763,6 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame) { object.try_emplace("instructionPointerReference", formatted_addr); } - if (frame.IsArtificial() || frame.IsHidden()) -object.try_emplace("presentationHint", "subtle"); - return llvm::json::Value(std::move(object)); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Mark hidden frames as "subtle" (PR #105457)
gribozavr wrote: Sorry, but I had to revert this PR because it depends on https://github.com/llvm/llvm-project/pull/104523, which I'm reverting because it fails under msan. Revert commits: https://github.com/llvm/llvm-project/commit/7323e7eee3a819e9a2d8ec29f00d362bcad87731 https://github.com/llvm/llvm-project/commit/aa70f83e660453c006193aab7ba67c94db236948 https://github.com/llvm/llvm-project/commit/547917aebd1e79a8929b53f0ddf3b5185ee4df74 https://github.com/llvm/llvm-project/pull/105457 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Extend frame recognizers to hide frames from backtraces (PR #104523)
gribozavr wrote: Revert commits: https://github.com/llvm/llvm-project/commit/7323e7eee3a819e9a2d8ec29f00d362bcad87731 https://github.com/llvm/llvm-project/commit/aa70f83e660453c006193aab7ba67c94db236948 https://github.com/llvm/llvm-project/commit/547917aebd1e79a8929b53f0ddf3b5185ee4df74 https://github.com/llvm/llvm-project/pull/104523 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] cd9a5cf - Use the range-based overload of llvm::sort where possible
Author: Dmitri Gribenko Date: 2022-07-23T15:13:25+02:00 New Revision: cd9a5cfd2e4e4d583c9bf5ef1100acaf5e96f29e URL: https://github.com/llvm/llvm-project/commit/cd9a5cfd2e4e4d583c9bf5ef1100acaf5e96f29e DIFF: https://github.com/llvm/llvm-project/commit/cd9a5cfd2e4e4d583c9bf5ef1100acaf5e96f29e.diff LOG: Use the range-based overload of llvm::sort where possible Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D130403 Added: Modified: clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp clang-tools-extra/clangd/index/StdLib.cpp clang/include/clang/Basic/Attr.td clang/lib/Driver/Multilib.cpp clang/lib/Frontend/FrontendAction.cpp clang/lib/Sema/AnalysisBasedWarnings.cpp lldb/source/Interpreter/OptionValueArray.cpp lldb/source/Interpreter/OptionValueFileSpecList.cpp lldb/source/Interpreter/OptionValuePathMappings.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp lldb/source/Symbol/ArmUnwindInfo.cpp lldb/source/Symbol/CompileUnit.cpp lldb/source/Symbol/Symtab.cpp lldb/source/Target/DynamicRegisterInfo.cpp lldb/source/Target/Target.cpp lldb/source/Utility/ReproducerProvider.cpp lldb/source/Utility/Timer.cpp llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp llvm/unittests/ADT/SmallPtrSetTest.cpp llvm/unittests/TextAPI/TextStubV1Tests.cpp llvm/unittests/TextAPI/TextStubV2Tests.cpp llvm/unittests/TextAPI/TextStubV3Tests.cpp llvm/unittests/TextAPI/TextStubV4Tests.cpp Removed: diff --git a/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp b/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp index e25c8e2449dc8..cb5caf1ca92a1 100644 --- a/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp +++ b/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp @@ -193,8 +193,7 @@ groupReplacements(const TUReplacements &TUs, const TUDiagnostics &TUDs, // Sort replacements per file to keep consistent behavior when // clang-apply-replacements run on diff erents machine. for (auto &FileAndReplacements : GroupedReplacements) { -llvm::sort(FileAndReplacements.second.begin(), - FileAndReplacements.second.end()); +llvm::sort(FileAndReplacements.second); } return GroupedReplacements; diff --git a/clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp b/clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp index ebb4a70c1f8db..95b5ed0a8b1aa 100644 --- a/clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp +++ b/clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp @@ -59,7 +59,7 @@ static void rank(std::vector &Symbols, } // Sort by the gathered scores. Use file name as a tie breaker so we can // deduplicate. - llvm::sort(Symbols.begin(), Symbols.end(), + llvm::sort(Symbols, [&](const SymbolAndSignals &A, const SymbolAndSignals &B) { auto AS = Score[A.Symbol.getFilePath()]; auto BS = Score[B.Symbol.getFilePath()]; diff --git a/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp b/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp index 0209071af87f4..1d15ae19ead4d 100644 --- a/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp @@ -104,10 +104,8 @@ MagicNumbersCheck::MagicNumbersCheck(StringRef Name, ClangTidyContext *Context) consumeError(StatusOrErr.takeError()); IgnoredDoublePointValues.push_back(DoubleValue.convertToDouble()); } -llvm::sort(IgnoredFloatingPointValues.begin(), - IgnoredFloatingPointValues.end()); -llvm::sort(IgnoredDoublePointValues.begin(), - IgnoredDoublePointValues.end()); +llvm::sort(IgnoredFloatingPointValues); +llvm::sort(IgnoredDoublePointValues); } } diff --git a/clang-tools-extra/clangd/index/StdLib.cpp b/clang-tools-extra/clangd/index/StdLib.cpp index f00067229a860..f2edc514bae30 100644 --- a/clang-tools-extra/clangd/index/StdLib.cpp +++ b/clang-tools-extra/clangd/index/StdLib.cpp @@ -80,7 +80,7 @@ std::string buildUmbrella(llvm::StringLiteral Mandatory, "#endif\n", Mandatory); - llvm::sort(Headers.begin(), Headers.end()); + llvm::sort(Headers); auto Last = std::unique(Headers.begin(), Headers.end()); for (auto Header = Headers.begin(); Header != Last; ++Header) { OS << llvm::formatv("#if __has_include({0})\n" diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 78e0fce917a0f..d61f3583281d1 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/B
[Lldb-commits] [lldb] 82d4f39 - [lldb][AArch64] Fix an unused variable warning in release builds. NFC
Author: Dmitri Gribenko Date: 2022-07-25T16:58:03+02:00 New Revision: 82d4f39f342165a92eaa1fe74488158942cf27b4 URL: https://github.com/llvm/llvm-project/commit/82d4f39f342165a92eaa1fe74488158942cf27b4 DIFF: https://github.com/llvm/llvm-project/commit/82d4f39f342165a92eaa1fe74488158942cf27b4.diff LOG: [lldb][AArch64] Fix an unused variable warning in release builds. NFC Added: Modified: lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp Removed: diff --git a/lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp b/lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp index e0126d840971..dbd36fbcb212 100644 --- a/lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp +++ b/lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp @@ -290,6 +290,7 @@ MemoryTagManagerAArch64MTE::UnpackTagsFromCoreFileSegment( const size_t bytes_copied = reader(tag_segment_data_address + file_offset_in_bytes, tag_bytes_to_read, tag_data.data()); + (void)bytes_copied; assert(bytes_copied == tag_bytes_to_read); std::vector tags; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 41454c3 - Updated LLDB for the new Clang Language enumerator 'OpenCLCXX'
Author: Dmitri Gribenko Date: 2021-03-24T16:46:02+01:00 New Revision: 41454c30f6a38c3e107d857e63da0561610fd141 URL: https://github.com/llvm/llvm-project/commit/41454c30f6a38c3e107d857e63da0561610fd141 DIFF: https://github.com/llvm/llvm-project/commit/41454c30f6a38c3e107d857e63da0561610fd141.diff LOG: Updated LLDB for the new Clang Language enumerator 'OpenCLCXX' Added: Modified: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp Removed: diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index a61666adebaad..d1addb864 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -477,6 +477,9 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) { case clang::Language::OpenCL: LangStd = LangStandard::lang_opencl10; break; +case clang::Language::OpenCLCXX: + LangStd = LangStandard::lang_openclcpp; + break; case clang::Language::CUDA: LangStd = LangStandard::lang_cuda; break; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 0f1195a - Revert "[lldb/test] Relax NSDate mock test for non-Apple platforms"
Author: Dmitri Gribenko Date: 2020-05-20T12:44:19+02:00 New Revision: 0f1195a58648998d21bcfa1575a78a4706eaa52c URL: https://github.com/llvm/llvm-project/commit/0f1195a58648998d21bcfa1575a78a4706eaa52c DIFF: https://github.com/llvm/llvm-project/commit/0f1195a58648998d21bcfa1575a78a4706eaa52c.diff LOG: Revert "[lldb/test] Relax NSDate mock test for non-Apple platforms" This reverts commit fff3a8464d4d518c7086c928fba967908eb294d7. It is a follow-up to b783f70a42575a5d9147bea1ac97e872370fe55b, which I'm reverting -- see the explanation in that revert. Added: Modified: lldb/unittests/DataFormatter/MockTests.cpp Removed: diff --git a/lldb/unittests/DataFormatter/MockTests.cpp b/lldb/unittests/DataFormatter/MockTests.cpp index 752e3987dac9..0042888243f7 100644 --- a/lldb/unittests/DataFormatter/MockTests.cpp +++ b/lldb/unittests/DataFormatter/MockTests.cpp @@ -9,7 +9,6 @@ #include "lldb/DataFormatters/Mock.h" #include "lldb/Utility/StreamString.h" #include "llvm/ADT/Optional.h" -#include "llvm/ADT/StringRef.h" #include "gtest/gtest.h" #include @@ -37,6 +36,5 @@ TEST(DataFormatterMockTest, NSDate) { EXPECT_EQ(formatDateValue(std::numeric_limits::max()), llvm::None); EXPECT_EQ(formatDateValue(std::numeric_limits::min()), llvm::None); - EXPECT_TRUE( - llvm::StringRef(*formatDateValue(0)).startswith("2001-01-01 00:00:00")); + EXPECT_EQ(*formatDateValue(0), "2001-01-01 00:00:00 UTC"); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] f67f9e8 - Revert "[lldb/test] Disable NSDate format check under _WIN32"
Author: Dmitri Gribenko Date: 2020-05-20T12:44:19+02:00 New Revision: f67f9e86e86e68d4cbc05ef8d6ffd0cb33246d45 URL: https://github.com/llvm/llvm-project/commit/f67f9e86e86e68d4cbc05ef8d6ffd0cb33246d45 DIFF: https://github.com/llvm/llvm-project/commit/f67f9e86e86e68d4cbc05ef8d6ffd0cb33246d45.diff LOG: Revert "[lldb/test] Disable NSDate format check under _WIN32" This reverts commit e3aa4cd9dbcee6441f51102e3958c35321698c67. It is a follow-up to b783f70a42575a5d9147bea1ac97e872370fe55b, which I'm reverting -- see the explanation in that revert. Added: Modified: lldb/unittests/DataFormatter/MockTests.cpp Removed: diff --git a/lldb/unittests/DataFormatter/MockTests.cpp b/lldb/unittests/DataFormatter/MockTests.cpp index 1185d7bf2c9c..752e3987dac9 100644 --- a/lldb/unittests/DataFormatter/MockTests.cpp +++ b/lldb/unittests/DataFormatter/MockTests.cpp @@ -37,10 +37,6 @@ TEST(DataFormatterMockTest, NSDate) { EXPECT_EQ(formatDateValue(std::numeric_limits::max()), llvm::None); EXPECT_EQ(formatDateValue(std::numeric_limits::min()), llvm::None); - // FIXME: The formatting result is wrong on Windows because we adjust the - // epoch when _WIN32 is defined (see GetOSXEpoch). -#ifndef _WIN32 EXPECT_TRUE( llvm::StringRef(*formatDateValue(0)).startswith("2001-01-01 00:00:00")); -#endif } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 8214eff - Revert "[lldb/DataFormatter] Check for overflow when finding NSDate epoch"
Author: Dmitri Gribenko Date: 2020-05-20T12:44:19+02:00 New Revision: 8214eff467f583309e9fbb971862d3c1cdcc65e4 URL: https://github.com/llvm/llvm-project/commit/8214eff467f583309e9fbb971862d3c1cdcc65e4 DIFF: https://github.com/llvm/llvm-project/commit/8214eff467f583309e9fbb971862d3c1cdcc65e4.diff LOG: Revert "[lldb/DataFormatter] Check for overflow when finding NSDate epoch" This reverts commit b783f70a42575a5d9147bea1ac97e872370fe55b. This change had multiple issues which required post-commit fixups, and not all issues are fixed yet. In particular, the LLDB build bot for ARM is still broken. There is also an ongoing conversation in the original phabricator review about whether there is undefined behavior in the code. Added: Modified: lldb/source/Plugins/Language/ObjC/Cocoa.cpp lldb/unittests/DataFormatter/CMakeLists.txt Removed: lldb/include/lldb/DataFormatters/Mock.h lldb/unittests/DataFormatter/MockTests.cpp diff --git a/lldb/include/lldb/DataFormatters/Mock.h b/lldb/include/lldb/DataFormatters/Mock.h deleted file mode 100644 index b3fc10cd2e51.. --- a/lldb/include/lldb/DataFormatters/Mock.h +++ /dev/null @@ -1,26 +0,0 @@ -//===-- Mock.h --*- 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 -// -//===--===// - -#ifndef LLDB_DATAFORMATTERS_MOCK_H -#define LLDB_DATAFORMATTERS_MOCK_H - -namespace lldb_private { - -class Stream; - -namespace formatters { -namespace NSDate { - -/// Format the date_value field of a NSDate. -bool FormatDateValue(double date_value, Stream &stream); - -} // namespace NSDate -} // namespace formatters -} // namespace lldb_private - -#endif // LLDB_DATAFORMATTERS_MOCK_H diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp index 1ad443b8b74e..8a44811dd36b 100644 --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -13,7 +13,6 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" -#include "lldb/DataFormatters/Mock.h" #include "lldb/DataFormatters/StringPrinter.h" #include "lldb/DataFormatters/TypeSummary.h" #include "lldb/Host/Time.h" @@ -28,7 +27,6 @@ #include "llvm/ADT/APInt.h" #include "llvm/ADT/bit.h" -#include "llvm/Support/CheckedArithmetic.h" #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h" @@ -787,34 +785,6 @@ static double decodeTaggedTimeInterval(uint64_t encodedTimeInterval) { return llvm::bit_cast(decodedBits); } -bool lldb_private::formatters::NSDate::FormatDateValue(double date_value, - Stream &stream) { - if (date_value == -63114076800) { -stream.Printf("0001-12-30 00:00:00 +"); -return true; - } - - if (date_value > std::numeric_limits::max() || - date_value < std::numeric_limits::min()) -return false; - - time_t epoch = GetOSXEpoch(); - if (auto osx_epoch = llvm::checkedAdd(epoch, (time_t)date_value)) -epoch = *osx_epoch; - else -return false; - tm *tm_date = gmtime(&epoch); - if (!tm_date) -return false; - std::string buffer(1024, 0); - if (strftime(&buffer[0], 1023, "%Z", tm_date) == 0) -return false; - stream.Printf("%04d-%02d-%02d %02d:%02d:%02d %s", tm_date->tm_year + 1900, -tm_date->tm_mon + 1, tm_date->tm_mday, tm_date->tm_hour, -tm_date->tm_min, tm_date->tm_sec, buffer.c_str()); - return true; -} - bool lldb_private::formatters::NSDateSummaryProvider( ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) { ProcessSP process_sp = valobj.GetProcessSP(); @@ -858,16 +828,6 @@ bool lldb_private::formatters::NSDateSummaryProvider( if (descriptor->GetTaggedPointerInfo(&info_bits, &value_bits)) { date_value_bits = ((value_bits << 8) | (info_bits << 4)); memcpy(&date_value, &date_value_bits, sizeof(date_value_bits)); - - // Accomodate the __NSTaggedDate format introduced in Foundation 1600. - if (class_name == g___NSTaggedDate) { -auto *apple_runtime = llvm::dyn_cast_or_null( -ObjCLanguageRuntime::Get(*process_sp)); -if (!apple_runtime) - return false; -if (apple_runtime->GetFoundationVersion() >= 1600) - date_value = decodeTaggedTimeInterval(value_bits << 4); - } } else { llvm::Triple triple( process_sp->GetTarget().GetArchitecture().GetTriple()); @@ -890,7 +850,34 @@ bool lldb_private::formatters::NSDateSummaryProvider( } else return false; - ret
[Lldb-commits] [lldb] 23f29b2 - Revert "Silence warnings around int/float conversions."
Author: Dmitri Gribenko Date: 2020-05-20T12:44:19+02:00 New Revision: 23f29b2fcc5668c51f15809067a1c3503b422c64 URL: https://github.com/llvm/llvm-project/commit/23f29b2fcc5668c51f15809067a1c3503b422c64 DIFF: https://github.com/llvm/llvm-project/commit/23f29b2fcc5668c51f15809067a1c3503b422c64.diff LOG: Revert "Silence warnings around int/float conversions." This reverts commit 15ee8a3a58223b48afbe33cb60084f864ef20889. It is a follow-up to b783f70a42575a5d9147bea1ac97e872370fe55b, which I'm reverting -- see the explanation in that revert. Added: Modified: lldb/source/Plugins/Language/ObjC/Cocoa.cpp lldb/unittests/DataFormatter/MockTests.cpp Removed: diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp index 37b352263260..1ad443b8b74e 100644 --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -794,8 +794,8 @@ bool lldb_private::formatters::NSDate::FormatDateValue(double date_value, return true; } - if ((time_t)date_value > std::numeric_limits::max() || - (time_t)date_value < std::numeric_limits::min()) + if (date_value > std::numeric_limits::max() || + date_value < std::numeric_limits::min()) return false; time_t epoch = GetOSXEpoch(); diff --git a/lldb/unittests/DataFormatter/MockTests.cpp b/lldb/unittests/DataFormatter/MockTests.cpp index f7daaf22d140..1185d7bf2c9c 100644 --- a/lldb/unittests/DataFormatter/MockTests.cpp +++ b/lldb/unittests/DataFormatter/MockTests.cpp @@ -28,14 +28,14 @@ TEST(DataFormatterMockTest, NSDate) { EXPECT_EQ(*formatDateValue(-63114076800), "0001-12-30 00:00:00 +"); // Can't convert the date_value to a time_t. - EXPECT_EQ(formatDateValue((double)(std::numeric_limits::max()) + 1), + EXPECT_EQ(formatDateValue(std::numeric_limits::max() + 1), llvm::None); - EXPECT_EQ(formatDateValue((double)(std::numeric_limits::min()) - 1), + EXPECT_EQ(formatDateValue(std::numeric_limits::min() - 1), llvm::None); // Can't add the macOS epoch to the converted date_value (the add overflows). - EXPECT_EQ(formatDateValue((double)std::numeric_limits::max()), llvm::None); - EXPECT_EQ(formatDateValue((double)std::numeric_limits::min()), llvm::None); + EXPECT_EQ(formatDateValue(std::numeric_limits::max()), llvm::None); + EXPECT_EQ(formatDateValue(std::numeric_limits::min()), llvm::None); // FIXME: The formatting result is wrong on Windows because we adjust the // epoch when _WIN32 is defined (see GetOSXEpoch). ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 79fcd35 - Revert "[lldb/test] Move "DataFormatters/Mock.h" to "Plugins/Language/ObjC/Utilities.h""
Author: Dmitri Gribenko Date: 2020-05-20T12:44:18+02:00 New Revision: 79fcd35c688b94becadd162a6c37e9b95df5c084 URL: https://github.com/llvm/llvm-project/commit/79fcd35c688b94becadd162a6c37e9b95df5c084 DIFF: https://github.com/llvm/llvm-project/commit/79fcd35c688b94becadd162a6c37e9b95df5c084.diff LOG: Revert "[lldb/test] Move "DataFormatters/Mock.h" to "Plugins/Language/ObjC/Utilities.h"" This reverts commit 82dbf4aca84ec889d0dc390674ff44e30441bcfd. It is a follow-up to b783f70a42575a5d9147bea1ac97e872370fe55b, which I'm reverting -- see the explanation in that revert. Added: lldb/include/lldb/DataFormatters/Mock.h lldb/unittests/DataFormatter/MockTests.cpp Modified: lldb/source/Plugins/Language/ObjC/Cocoa.cpp lldb/unittests/DataFormatter/CMakeLists.txt lldb/unittests/Language/CMakeLists.txt Removed: lldb/source/Plugins/Language/ObjC/Utilities.h lldb/unittests/Language/ObjC/CMakeLists.txt lldb/unittests/Language/ObjC/UtilitiesTests.cpp diff --git a/lldb/source/Plugins/Language/ObjC/Utilities.h b/lldb/include/lldb/DataFormatters/Mock.h similarity index 73% rename from lldb/source/Plugins/Language/ObjC/Utilities.h rename to lldb/include/lldb/DataFormatters/Mock.h index 4cfeb2b28bfd..b3fc10cd2e51 100644 --- a/lldb/source/Plugins/Language/ObjC/Utilities.h +++ b/lldb/include/lldb/DataFormatters/Mock.h @@ -1,4 +1,4 @@ -//===-- Utilities.h -*- C++ -*-===// +//===-- Mock.h --*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===--===// -#ifndef LLDB_PLUGINS_LANGUAGE_OBJC_UTILITIES_H -#define LLDB_PLUGINS_LANGUAGE_OBJC_UTILITIES_H +#ifndef LLDB_DATAFORMATTERS_MOCK_H +#define LLDB_DATAFORMATTERS_MOCK_H namespace lldb_private { @@ -23,4 +23,4 @@ bool FormatDateValue(double date_value, Stream &stream); } // namespace formatters } // namespace lldb_private -#endif // LLDB_PLUGINS_LANGUAGE_OBJC_UTILITIES_H +#endif // LLDB_DATAFORMATTERS_MOCK_H diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp index 5128f2865879..37b352263260 100644 --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -8,12 +8,12 @@ #include "Cocoa.h" -#include "Plugins/Language/ObjC/Utilities.h" #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" #include "lldb/Core/Mangled.h" #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" +#include "lldb/DataFormatters/Mock.h" #include "lldb/DataFormatters/StringPrinter.h" #include "lldb/DataFormatters/TypeSummary.h" #include "lldb/Host/Time.h" diff --git a/lldb/unittests/DataFormatter/CMakeLists.txt b/lldb/unittests/DataFormatter/CMakeLists.txt index 45011c56b0b0..716c8e735287 100644 --- a/lldb/unittests/DataFormatter/CMakeLists.txt +++ b/lldb/unittests/DataFormatter/CMakeLists.txt @@ -1,5 +1,6 @@ add_lldb_unittest(LLDBFormatterTests FormatManagerTests.cpp + MockTests.cpp StringPrinterTests.cpp LINK_LIBS diff --git a/lldb/unittests/Language/ObjC/UtilitiesTests.cpp b/lldb/unittests/DataFormatter/MockTests.cpp similarity index 84% rename from lldb/unittests/Language/ObjC/UtilitiesTests.cpp rename to lldb/unittests/DataFormatter/MockTests.cpp index b28060973d86..f7daaf22d140 100644 --- a/lldb/unittests/Language/ObjC/UtilitiesTests.cpp +++ b/lldb/unittests/DataFormatter/MockTests.cpp @@ -1,4 +1,4 @@ -//===-- UtilitiesTests.cpp ===// +//===-- MockTests.cpp -===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===--===// -#include "Plugins/Language/ObjC/Utilities.h" +#include "lldb/DataFormatters/Mock.h" #include "lldb/Utility/StreamString.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/StringRef.h" @@ -25,8 +25,7 @@ static llvm::Optional formatDateValue(double date_value) { } TEST(DataFormatterMockTest, NSDate) { - EXPECT_EQ(formatDateValue(-63114076800), -std::string("0001-12-30 00:00:00 +")); + EXPECT_EQ(*formatDateValue(-63114076800), "0001-12-30 00:00:00 +"); // Can't convert the date_value to a time_t. EXPECT_EQ(formatDateValue((double)(std::numeric_limits::max()) + 1), @@ -35,10 +34,8 @@ TEST(DataFormatterMockTest, NSDate) { llvm::None); // Can't add the macOS epoch to the converted date_value (the add overflows)
[Lldb-commits] [lldb] [lldb] Fix compile error. (PR #130091)
https://github.com/gribozavr approved this pull request. https://github.com/llvm/llvm-project/pull/130091 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits