[llvm-branch-commits] [lldb] bab121a - [lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference
Author: Raphael Isemann Date: 2021-01-15T13:26:42+01:00 New Revision: bab121a1b66e85390cad019ec921febcba35519d URL: https://github.com/llvm/llvm-project/commit/bab121a1b66e85390cad019ec921febcba35519d DIFF: https://github.com/llvm/llvm-project/commit/bab121a1b66e85390cad019ec921febcba35519d.diff LOG: [lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference Currently LLDB uses epydoc to generate the Python API reference for the website. epydoc however is unmaintained since more than a decade and no longer works with Python 3. Also whatever setup we had once for generating the documentation on the website server no longer seems to work, so the current website documentation has been stale since more than a year. This patch replaces epydoc with sphinx and its automodapi plugin that can generate Python API references. LLVM already uses sphinx for the rest of the documentation, so this way we are more consistent with the rest of LLVM. The only new dependency is the automodapi plugin for sphinx. This patch effectively does the following things: * Remove the epydoc code. * Make a new dummy Python API page in our website that just calls the Sphinx command for generated the API documentation. * Add a mock _lldb module that is only used when generating the Python API. This way we don't have to build all of LLDB to generate the API reference. Some notes: * The long list of skips is necessary due to boilerplate functions that SWIG is generating. Sadly automodapi is not really scriptable from what I can see, so we have to blacklist this stuff manually. * The .gitignore change because automodapi wants a subfolder of our documentation directory to place generated documentation files there. The path is also what is used on the website, so we can't really workaround this (without copying the whole `docs` dir somewhere else when we build). * We have to use environment variables to pass our build path to our sphinx configuration. Sphinx doesn't support passing variables onto that script. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D94489 Added: lldb/docs/_lldb/__init__.py lldb/docs/python_api.rst Modified: .gitignore lldb/docs/CMakeLists.txt lldb/docs/conf.py lldb/docs/index.rst llvm/cmake/modules/AddSphinxTarget.cmake Removed: diff --git a/.gitignore b/.gitignore index 5e937552c5f8..c58c673c198a 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,5 @@ pythonenv* /clang/utils/analyzer/projects/*/PatchedSource /clang/utils/analyzer/projects/*/ScanBuildResults /clang/utils/analyzer/projects/*/RefScanBuildResults +# automodapi puts generated documentation files here. +/lldb/docs/python_api/ diff --git a/lldb/docs/CMakeLists.txt b/lldb/docs/CMakeLists.txt index b633a4abf054..af18eb22e954 100644 --- a/lldb/docs/CMakeLists.txt +++ b/lldb/docs/CMakeLists.txt @@ -15,60 +15,39 @@ if(DOXYGEN_FOUND) ) endif() -if (LLDB_ENABLE_PYTHON) - find_program(EPYDOC_EXECUTABLE NAMES epydoc epydoc.py) - if(EPYDOC_EXECUTABLE) -message(STATUS "Found epydoc - ${EPYDOC_EXECUTABLE}") - -find_program(DOT_EXECUTABLE dot) -if(DOT_EXECUTABLE) - set(EPYDOC_OPTIONS ${EPYDOC_OPTIONS} --graph all --dotpath ${DOT_EXECUTABLE}) - message(STATUS "Found dot - ${DOT_EXECUTABLE}") -endif() +if (LLVM_ENABLE_SPHINX) + include(AddSphinxTarget) +endif() -# Pretend to make a python package so that we can generate the reference. -# Because we don't build liblldb, epydoc will complain that the import of -# _lldb.so failed, but that doesn't prevent it from generating the docs. +if (LLDB_ENABLE_PYTHON AND SPHINX_FOUND) + if (${SPHINX_OUTPUT_HTML}) +# Pretend that the SWIG generated API is a Python package. file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lldb) get_target_property(lldb_bindings_dir swig_wrapper_python BINARY_DIR) add_custom_target(lldb-python-doc-package COMMAND "${CMAKE_COMMAND}" -E copy "${lldb_bindings_dir}/lldb.py" "${CMAKE_CURRENT_BINARY_DIR}/lldb/__init__.py" - COMMENT "Copying lldb.py to pretend package.") + COMMENT "Copying lldb.py to pretend its a Python package.") add_dependencies(lldb-python-doc-package swig_wrapper_python) -set(DOC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc") -file(MAKE_DIRECTORY "${DOC_DIR}") -add_custom_target(lldb-python-doc - ${EPYDOC_EXECUTABLE} - --html - lldb - -o ${CMAKE_CURRENT_BINARY_DIR}/python_reference - --name "LLDB python API" - --url "http://lldb.llvm.org"; - ${EPYDOC_OPTIONS} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating LLDB Python API reference with epydoc" VERBATIM -) -add_dependencies(lldb-python-doc swig_wrapper_python lldb-python-doc-package) - else() -message(STATUS "Could NOT find epydoc") +# FIXME: Don't treat Sphinx wa
[llvm-branch-commits] [lldb] 4017c6f - [lldb][docs] Translate ASCII art to restructured text formatting
Author: Raphael Isemann Date: 2021-01-15T14:43:27+01:00 New Revision: 4017c6fe7f11db5f266306bcd504690be586620a URL: https://github.com/llvm/llvm-project/commit/4017c6fe7f11db5f266306bcd504690be586620a DIFF: https://github.com/llvm/llvm-project/commit/4017c6fe7f11db5f266306bcd504690be586620a.diff LOG: [lldb][docs] Translate ASCII art to restructured text formatting This translates most of the old ASCII art in our documentation to the equivalent in restructured text (which the new version of the LLDB docs is using). Added: Modified: lldb/bindings/interface/SBAddress.i lldb/bindings/interface/SBBreakpoint.i lldb/bindings/interface/SBBreakpointLocation.i lldb/bindings/interface/SBBreakpointName.i lldb/bindings/interface/SBCommandInterpreter.i lldb/bindings/interface/SBCommandInterpreterRunOptions.i lldb/bindings/interface/SBCommandReturnObject.i lldb/bindings/interface/SBCompileUnit.i lldb/bindings/interface/SBEnvironment.i lldb/bindings/interface/SBError.i lldb/bindings/interface/SBEvent.i lldb/bindings/interface/SBFileSpec.i lldb/bindings/interface/SBFrame.i lldb/bindings/interface/SBFunction.i lldb/bindings/interface/SBInstructionList.i lldb/bindings/interface/SBLineEntry.i lldb/bindings/interface/SBListener.i lldb/bindings/interface/SBModule.i lldb/bindings/interface/SBPlatform.i lldb/bindings/interface/SBProcess.i lldb/bindings/interface/SBSection.i lldb/bindings/interface/SBSourceManager.i lldb/bindings/interface/SBStream.i lldb/bindings/interface/SBSymbol.i lldb/bindings/interface/SBSymbolContext.i lldb/bindings/interface/SBSymbolContextList.i lldb/bindings/interface/SBTarget.i lldb/bindings/interface/SBThread.i lldb/bindings/interface/SBType.i lldb/bindings/interface/SBTypeEnumMember.i lldb/bindings/interface/SBValue.i lldb/bindings/interface/SBValueList.i lldb/bindings/interface/SBWatchpoint.i lldb/bindings/python/python-extensions.swig lldb/bindings/python/python.swig Removed: diff --git a/lldb/bindings/interface/SBAddress.i b/lldb/bindings/interface/SBAddress.i index 6fd06c83d293..694a7723e225 100644 --- a/lldb/bindings/interface/SBAddress.i +++ b/lldb/bindings/interface/SBAddress.i @@ -17,8 +17,9 @@ libraries, bundles, frameworks) being loaded at diff erent addresses than the addresses found in the object file that represents them on disk. There are currently two types of addresses for a section: -o file addresses -o load addresses + +* file addresses +* load addresses File addresses represents the virtual addresses that are in the 'on disk' object files. These virtual addresses are converted to be diff --git a/lldb/bindings/interface/SBBreakpoint.i b/lldb/bindings/interface/SBBreakpoint.i index 696795241b11..983e9facfe20 100644 --- a/lldb/bindings/interface/SBBreakpoint.i +++ b/lldb/bindings/interface/SBBreakpoint.i @@ -11,7 +11,7 @@ namespace lldb { "Represents a logical breakpoint and its associated settings. For example (from test/functionalities/breakpoint/breakpoint_ignore_count/ -TestBreakpointIgnoreCount.py), +TestBreakpointIgnoreCount.py),:: def breakpoint_ignore_count_python(self): '''Use Python APIs to set breakpoint ignore count.''' @@ -62,13 +62,13 @@ TestBreakpointIgnoreCount.py), process.Continue() -SBBreakpoint supports breakpoint location iteration, for example, +SBBreakpoint supports breakpoint location iteration, for example,:: for bl in breakpoint: print('breakpoint location load addr: %s' % hex(bl.GetLoadAddress())) print('breakpoint location condition: %s' % hex(bl.GetCondition())) -and rich comparison methods which allow the API program to use, +and rich comparison methods which allow the API program to use,:: if aBreakpoint == bBreakpoint: ... @@ -102,7 +102,7 @@ public: lldb::SBTarget GetTarget() const; - + lldb::SBBreakpointLocation FindLocationByAddress (lldb::addr_t vm_addr); diff --git a/lldb/bindings/interface/SBBreakpointLocation.i b/lldb/bindings/interface/SBBreakpointLocation.i index dc39c83c2d67..fc37475ba745 100644 --- a/lldb/bindings/interface/SBBreakpointLocation.i +++ b/lldb/bindings/interface/SBBreakpointLocation.i @@ -15,7 +15,7 @@ A breakpoint location is defined by the breakpoint that produces it, and the address that resulted in this particular instantiation. Each breakpoint location has its settable options. -SBBreakpoint contains SBBreakpointLocation(s). See docstring of SBBreakpoint +:py:class:`SBBreakpoint` contains SBBreakpointLocation(s). See docstring of SBBreakpoint for retrieval of an SBBreakpointLocation from an SBBreakpoint." ) SBBreakpointLocation; class SBBreakpointLocation diff --git a/lldb/bindings/interface/SBBreakpointName.i b/lldb/bindings/interface/SBBreakpointN
[llvm-branch-commits] [lldb] e7bc6c5 - Reland [lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference
Author: Raphael Isemann Date: 2021-01-17T12:13:01+01:00 New Revision: e7bc6c594b75602c23cb901f53b3a30d48e2ee78 URL: https://github.com/llvm/llvm-project/commit/e7bc6c594b75602c23cb901f53b3a30d48e2ee78 DIFF: https://github.com/llvm/llvm-project/commit/e7bc6c594b75602c23cb901f53b3a30d48e2ee78.diff LOG: Reland [lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference The build server should now have the missing dependencies. Original summary: Currently LLDB uses epydoc to generate the Python API reference for the website. epydoc however is unmaintained since more than a decade and no longer works with Python 3. Also whatever setup we had once for generating the documentation on the website server no longer seems to work, so the current website documentation has been stale since more than a year. This patch replaces epydoc with sphinx and its automodapi plugin that can generate Python API references. LLVM already uses sphinx for the rest of the documentation, so this way we are more consistent with the rest of LLVM. The only new dependency is the automodapi plugin for sphinx. This patch effectively does the following things: * Remove the epydoc code. * Make a new dummy Python API page in our website that just calls the Sphinx command for generated the API documentation. * Add a mock _lldb module that is only used when generating the Python API. This way we don't have to build all of LLDB to generate the API reference. Some notes: * The long list of skips is necessary due to boilerplate functions that SWIG is generating. Sadly automodapi is not really scriptable from what I can see, so we have to blacklist this stuff manually. * The .gitignore change because automodapi wants a subfolder of our documentation directory to place generated documentation files there. The path is also what is used on the website, so we can't really workaround this (without copying the whole `docs` dir somewhere else when we build). * We have to use environment variables to pass our build path to our sphinx configuration. Sphinx doesn't support passing variables onto that script. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D94489 Added: lldb/docs/_lldb/__init__.py lldb/docs/python_api.rst Modified: .gitignore lldb/docs/CMakeLists.txt lldb/docs/conf.py lldb/docs/index.rst llvm/cmake/modules/AddSphinxTarget.cmake Removed: diff --git a/.gitignore b/.gitignore index 5e937552c5f8..c58c673c198a 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,5 @@ pythonenv* /clang/utils/analyzer/projects/*/PatchedSource /clang/utils/analyzer/projects/*/ScanBuildResults /clang/utils/analyzer/projects/*/RefScanBuildResults +# automodapi puts generated documentation files here. +/lldb/docs/python_api/ diff --git a/lldb/docs/CMakeLists.txt b/lldb/docs/CMakeLists.txt index b633a4abf054..af18eb22e954 100644 --- a/lldb/docs/CMakeLists.txt +++ b/lldb/docs/CMakeLists.txt @@ -15,60 +15,39 @@ if(DOXYGEN_FOUND) ) endif() -if (LLDB_ENABLE_PYTHON) - find_program(EPYDOC_EXECUTABLE NAMES epydoc epydoc.py) - if(EPYDOC_EXECUTABLE) -message(STATUS "Found epydoc - ${EPYDOC_EXECUTABLE}") - -find_program(DOT_EXECUTABLE dot) -if(DOT_EXECUTABLE) - set(EPYDOC_OPTIONS ${EPYDOC_OPTIONS} --graph all --dotpath ${DOT_EXECUTABLE}) - message(STATUS "Found dot - ${DOT_EXECUTABLE}") -endif() +if (LLVM_ENABLE_SPHINX) + include(AddSphinxTarget) +endif() -# Pretend to make a python package so that we can generate the reference. -# Because we don't build liblldb, epydoc will complain that the import of -# _lldb.so failed, but that doesn't prevent it from generating the docs. +if (LLDB_ENABLE_PYTHON AND SPHINX_FOUND) + if (${SPHINX_OUTPUT_HTML}) +# Pretend that the SWIG generated API is a Python package. file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lldb) get_target_property(lldb_bindings_dir swig_wrapper_python BINARY_DIR) add_custom_target(lldb-python-doc-package COMMAND "${CMAKE_COMMAND}" -E copy "${lldb_bindings_dir}/lldb.py" "${CMAKE_CURRENT_BINARY_DIR}/lldb/__init__.py" - COMMENT "Copying lldb.py to pretend package.") + COMMENT "Copying lldb.py to pretend its a Python package.") add_dependencies(lldb-python-doc-package swig_wrapper_python) -set(DOC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc") -file(MAKE_DIRECTORY "${DOC_DIR}") -add_custom_target(lldb-python-doc - ${EPYDOC_EXECUTABLE} - --html - lldb - -o ${CMAKE_CURRENT_BINARY_DIR}/python_reference - --name "LLDB python API" - --url "http://lldb.llvm.org"; - ${EPYDOC_OPTIONS} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating LLDB Python API reference with epydoc" VERBATIM -) -add_dependencies(lldb-python-doc swig_wrapper_python lldb-python-doc-package) - e
[llvm-branch-commits] [lldb] acdc745 - [lldb][docs] Cleanup the Python doc strings for SB API classes
Author: Raphael Isemann Date: 2021-01-17T16:51:07+01:00 New Revision: acdc74568927d47f94816e73b6e105c9460cc3e4 URL: https://github.com/llvm/llvm-project/commit/acdc74568927d47f94816e73b6e105c9460cc3e4 DIFF: https://github.com/llvm/llvm-project/commit/acdc74568927d47f94816e73b6e105c9460cc3e4.diff LOG: [lldb][docs] Cleanup the Python doc strings for SB API classes The first line of the doc string ends up on the SB API class summary at the root page of the Python API web page of LLDB. Currently many of the descriptions are missing or are several lines which makes the table really hard to read. This just adds the missing docstrings where possible and fixes the formatting where necessary. Added: Modified: lldb/bindings/interface/SBAttachInfo.i lldb/bindings/interface/SBBreakpoint.i lldb/bindings/interface/SBCommunication.i lldb/bindings/interface/SBData.i lldb/bindings/interface/SBExecutionContext.i lldb/bindings/interface/SBFileSpecList.i lldb/bindings/interface/SBFrame.i lldb/bindings/interface/SBHostOS.i lldb/bindings/interface/SBInstruction.i lldb/bindings/interface/SBLanguageRuntime.i lldb/bindings/interface/SBLaunchInfo.i lldb/bindings/interface/SBLineEntry.i lldb/bindings/interface/SBMemoryRegionInfoList.i lldb/bindings/interface/SBModuleSpec.i lldb/bindings/interface/SBPlatform.i lldb/bindings/interface/SBQueue.i lldb/bindings/interface/SBQueueItem.i lldb/bindings/interface/SBReproducer.i lldb/bindings/interface/SBStringList.i lldb/bindings/interface/SBThreadPlan.i lldb/bindings/interface/SBTrace.i lldb/bindings/interface/SBTraceOptions.i lldb/bindings/interface/SBType.i lldb/bindings/interface/SBTypeEnumMember.i lldb/bindings/interface/SBVariablesOptions.i lldb/bindings/python/python-extensions.swig Removed: diff --git a/lldb/bindings/interface/SBAttachInfo.i b/lldb/bindings/interface/SBAttachInfo.i index 3f4634e14619..9ac96e6dd7be 100644 --- a/lldb/bindings/interface/SBAttachInfo.i +++ b/lldb/bindings/interface/SBAttachInfo.i @@ -7,7 +7,9 @@ //===--===// namespace lldb { - +%feature("docstring", +"Describes how to attach when calling :py:class:`SBTarget.Attach`." +) SBAttachInfo; class SBAttachInfo { public: diff --git a/lldb/bindings/interface/SBBreakpoint.i b/lldb/bindings/interface/SBBreakpoint.i index 983e9facfe20..37fcc7fbab48 100644 --- a/lldb/bindings/interface/SBBreakpoint.i +++ b/lldb/bindings/interface/SBBreakpoint.i @@ -313,6 +313,10 @@ public: class SBBreakpointListImpl; + +%feature("docstring", +"Represents a list of :py:class:`SBBreakpoint`." +) SBBreakpointList; class LLDB_API SBBreakpointList { public: diff --git a/lldb/bindings/interface/SBCommunication.i b/lldb/bindings/interface/SBCommunication.i index 87d3d0c9c5e4..8611e83e92ad 100644 --- a/lldb/bindings/interface/SBCommunication.i +++ b/lldb/bindings/interface/SBCommunication.i @@ -8,6 +8,9 @@ namespace lldb { +%feature("docstring", +"Allows sending/receiving data." +) SBCommunication; class SBCommunication { public: diff --git a/lldb/bindings/interface/SBData.i b/lldb/bindings/interface/SBData.i index 3e74240329e0..a1fb4472cd23 100644 --- a/lldb/bindings/interface/SBData.i +++ b/lldb/bindings/interface/SBData.i @@ -9,6 +9,9 @@ namespace lldb { +%feature("docstring", +"Represents a data buffer." +) SBData; class SBData { public: diff --git a/lldb/bindings/interface/SBExecutionContext.i b/lldb/bindings/interface/SBExecutionContext.i index 46968d04ae32..5fc5c0571182 100644 --- a/lldb/bindings/interface/SBExecutionContext.i +++ b/lldb/bindings/interface/SBExecutionContext.i @@ -8,6 +8,9 @@ namespace lldb { +%feature("docstring", +"Describes the program context in which a command should be executed." +) SBExecutionContext; class SBExecutionContext { public: diff --git a/lldb/bindings/interface/SBFileSpecList.i b/lldb/bindings/interface/SBFileSpecList.i index 96641613f459..384dd4c4ae08 100644 --- a/lldb/bindings/interface/SBFileSpecList.i +++ b/lldb/bindings/interface/SBFileSpecList.i @@ -8,6 +8,9 @@ namespace lldb { +%feature("docstring", +"Represents a list of :py:class:`SBFileSpec`." +) SBFileSpecList; class SBFileSpecList { public: diff --git a/lldb/bindings/interface/SBFrame.i b/lldb/bindings/interface/SBFrame.i index b4e9b1c5f542..8ceb03bb7a18 100644 --- a/lldb/bindings/interface/SBFrame.i +++ b/lldb/bindings/interface/SBFrame.i @@ -10,6 +10,7 @@ namespace lldb { %feature("docstring", "Represents one of the stack frames associated with a thread. + SBThread contains SBFrame(s). For example (from test/lldbutil.py), :: def print_stacktrace(thread, string_buffer = False): diff --git a/lldb/bindings/interface/SBHostOS.i b/lldb/bindings/interface/SBHostOS.i index 14f4186cb9f3..791fa5a
[llvm-branch-commits] [lldb] 7e9e6ac - [lldb][docs] Fix some RST formatting errors related to code examples.
Author: Raphael Isemann Date: 2021-01-17T17:41:05+01:00 New Revision: 7e9e6ac526ebd90fe8ec0b8d2bb6edd3516ab908 URL: https://github.com/llvm/llvm-project/commit/7e9e6ac526ebd90fe8ec0b8d2bb6edd3516ab908 DIFF: https://github.com/llvm/llvm-project/commit/7e9e6ac526ebd90fe8ec0b8d2bb6edd3516ab908.diff LOG: [lldb][docs] Fix some RST formatting errors related to code examples. Mostly just making sure the indentation is right (SBDebugger had 0 spaces as it was still plain text, the others had too much indentation or other minor issues). Added: Modified: lldb/bindings/interface/SBBroadcaster.i lldb/bindings/interface/SBCommandInterpreterRunOptions.i lldb/bindings/interface/SBDebugger.i lldb/bindings/interface/SBProcess.i lldb/bindings/interface/SBStructuredData.i lldb/bindings/interface/SBType.i Removed: diff --git a/lldb/bindings/interface/SBBroadcaster.i b/lldb/bindings/interface/SBBroadcaster.i index 79100e171b49..dd6de1feff42 100644 --- a/lldb/bindings/interface/SBBroadcaster.i +++ b/lldb/bindings/interface/SBBroadcaster.i @@ -11,7 +11,7 @@ namespace lldb { %feature("docstring", "Represents an entity which can broadcast events. A default broadcaster is associated with an SBCommandInterpreter, SBProcess, and SBTarget. For -example, use +example, use :: broadcaster = process.GetBroadcaster() diff --git a/lldb/bindings/interface/SBCommandInterpreterRunOptions.i b/lldb/bindings/interface/SBCommandInterpreterRunOptions.i index bad099205724..1a618a228bbe 100644 --- a/lldb/bindings/interface/SBCommandInterpreterRunOptions.i +++ b/lldb/bindings/interface/SBCommandInterpreterRunOptions.i @@ -12,6 +12,7 @@ namespace lldb { "SBCommandInterpreterRunOptions controls how the RunCommandInterpreter runs the code it is fed. A default SBCommandInterpreterRunOptions object has: + * StopOnContinue: false * StopOnError:false * StopOnCrash:false diff --git a/lldb/bindings/interface/SBDebugger.i b/lldb/bindings/interface/SBDebugger.i index f2e23a7ed780..78d737b48c23 100644 --- a/lldb/bindings/interface/SBDebugger.i +++ b/lldb/bindings/interface/SBDebugger.i @@ -12,108 +12,108 @@ namespace lldb { "SBDebugger is the primordial object that creates SBTargets and provides access to them. It also manages the overall debugging experiences. -For example (from example/disasm.py), - -import lldb -import os -import sys - -def disassemble_instructions (insts): -for i in insts: -print i - -... - -# Create a new debugger instance -debugger = lldb.SBDebugger.Create() - -# When we step or continue, don't return from the function until the process -# stops. We do this by setting the async mode to false. -debugger.SetAsync (False) - -# Create a target from a file and arch -print('Creating a target for \'%s\'' % exe) - -target = debugger.CreateTargetWithFileAndArch (exe, lldb.LLDB_ARCH_DEFAULT) - -if target: -# If the target is valid set a breakpoint at main -main_bp = target.BreakpointCreateByName (fname, target.GetExecutable().GetFilename()); - -print main_bp - -# Launch the process. Since we specified synchronous mode, we won't return -# from this function until we hit the breakpoint at main -process = target.LaunchSimple (None, None, os.getcwd()) - -# Make sure the launch went ok -if process: -# Print some simple process info -state = process.GetState () -print process -if state == lldb.eStateStopped: -# Get the first thread -thread = process.GetThreadAtIndex (0) -if thread: -# Print some simple thread info -print thread -# Get the first frame -frame = thread.GetFrameAtIndex (0) -if frame: -# Print some simple frame info -print frame -function = frame.GetFunction() -# See if we have debug info (a function) -if function: -# We do have a function, print some info for the function -print function -# Now get all instructions for this function and print them -insts = function.GetInstructions(target) -disassemble_instructions (insts) -else: -# See if we have a symbol in the symbol table for where we stopped -symbol = frame.GetSymbol(); -if symbol: -# We do have a symbol, print some info for the symbol -print symbol -# Now get all instructions for this symbol and print them -insts = symbol.GetInstructions(target) +For example (from example/disasm.py),:: + +import lldb +i
[llvm-branch-commits] [lldb] f446fc5 - [lldb][docs] Resolve the remaining sphinx formatter warnings in the SB API docs
Author: Raphael Isemann Date: 2021-01-18T10:47:19+01:00 New Revision: f446fc5acf88fda676b5df1c04838f7244201d20 URL: https://github.com/llvm/llvm-project/commit/f446fc5acf88fda676b5df1c04838f7244201d20 DIFF: https://github.com/llvm/llvm-project/commit/f446fc5acf88fda676b5df1c04838f7244201d20.diff LOG: [lldb][docs] Resolve the remaining sphinx formatter warnings in the SB API docs With this patch there should no longer be any warnings when generating the SB API sphinx docs. Added: Modified: lldb/bindings/interface/SBAddress.i lldb/bindings/interface/SBBroadcaster.i lldb/bindings/interface/SBDebugger.i lldb/bindings/interface/SBFrame.i lldb/bindings/interface/SBModule.i lldb/bindings/interface/SBProcess.i lldb/bindings/interface/SBTarget.i lldb/bindings/interface/SBValue.i Removed: diff --git a/lldb/bindings/interface/SBAddress.i b/lldb/bindings/interface/SBAddress.i index 694a7723e225..8e95d36e580d 100644 --- a/lldb/bindings/interface/SBAddress.i +++ b/lldb/bindings/interface/SBAddress.i @@ -109,18 +109,17 @@ public: An address might refer to code or data from an existing module, or it might refer to something on the stack or heap. The following functions will only return valid values if the address has been resolved to a code -or data address using 'void SBAddress::SetLoadAddress(...)' or -'lldb::SBAddress SBTarget::ResolveLoadAddress (...)'.") GetSymbolContext; +or data address using :py:class:`SBAddress.SetLoadAddress' or +:py:class:`SBTarget.ResolveLoadAddress`.") GetSymbolContext; lldb::SBSymbolContext GetSymbolContext (uint32_t resolve_scope); %feature("docstring", " GetModule() and the following grab individual objects for a given address and are less efficient if you want more than one symbol related objects. -Use one of the following when you want multiple debug symbol related -objects for an address: - lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t resolve_scope); - lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const SBAddress &addr, uint32_t resolve_scope); +Use :py:class:`SBAddress.GetSymbolContext` or +:py:class:`SBTarget.ResolveSymbolContextForAddress` when you want multiple +debug symbol related objects for an address. One or more bits from the SymbolContextItem enumerations can be logically OR'ed together to more efficiently retrieve multiple symbol objects.") GetModule; lldb::SBModule diff --git a/lldb/bindings/interface/SBBroadcaster.i b/lldb/bindings/interface/SBBroadcaster.i index dd6de1feff42..e97d8f964bde 100644 --- a/lldb/bindings/interface/SBBroadcaster.i +++ b/lldb/bindings/interface/SBBroadcaster.i @@ -9,7 +9,9 @@ namespace lldb { %feature("docstring", -"Represents an entity which can broadcast events. A default broadcaster is +"Represents an entity which can broadcast events. + +A default broadcaster is associated with an SBCommandInterpreter, SBProcess, and SBTarget. For example, use :: diff --git a/lldb/bindings/interface/SBDebugger.i b/lldb/bindings/interface/SBDebugger.i index 78d737b48c23..cf4411980cc3 100644 --- a/lldb/bindings/interface/SBDebugger.i +++ b/lldb/bindings/interface/SBDebugger.i @@ -498,12 +498,12 @@ A tuple with the number of errors encountered by the interpreter, a boolean indicating whether quitting the interpreter was requested and another boolean set to True in case of a crash. -Example: +Example: :: -# Start an interactive lldb session from a script (with a valid debugger object -# created beforehand): -n_errors, quit_requested, has_crashed = debugger.RunCommandInterpreter(True, -False, lldb.SBCommandInterpreterRunOptions(), 0, False, False)") RunCommandInterpreter; +# Start an interactive lldb session from a script (with a valid debugger object +# created beforehand): +n_errors, quit_requested, has_crashed = debugger.RunCommandInterpreter(True, +False, lldb.SBCommandInterpreterRunOptions(), 0, False, False)") RunCommandInterpreter; %apply int& INOUT { int& num_errors }; %apply bool& INOUT { bool& quit_requested }; %apply bool& INOUT { bool& stopped_for_crash }; diff --git a/lldb/bindings/interface/SBFrame.i b/lldb/bindings/interface/SBFrame.i index 8ceb03bb7a18..047b090e8a61 100644 --- a/lldb/bindings/interface/SBFrame.i +++ b/lldb/bindings/interface/SBFrame.i @@ -13,30 +13,30 @@ namespace lldb { SBThread contains SBFrame(s). For example (from test/lldbutil.py), :: -def print_stacktrace(thread, string_buffer = False): -'''Prints a simple stack trace of this thread.''' - -... - -for i in range(depth): -frame = thread.GetFrameAtIndex(i) -function = frame.GetFunction() - -load_addr = addrs[i].GetLoadAddress(target) -if not function: -file_addr = addrs[i].Ge
[llvm-branch-commits] [lldb] 6e75ee6 - [lldb][docs] Use inline literals for code/paths instead of rendering it with the default role
Author: Raphael Isemann Date: 2021-01-18T11:10:19+01:00 New Revision: 6e75ee6b65c1c9924c0c9c10b1cbd57f10fe127b URL: https://github.com/llvm/llvm-project/commit/6e75ee6b65c1c9924c0c9c10b1cbd57f10fe127b DIFF: https://github.com/llvm/llvm-project/commit/6e75ee6b65c1c9924c0c9c10b1cbd57f10fe127b.diff LOG: [lldb][docs] Use inline literals for code/paths instead of rendering it with the default role Right now we're using the 'content' role as default which will just render these things as cursive (which isn't really useful for code examples). It also prevents us from assigning a more useful default role in the future. Added: Modified: lldb/bindings/interface/SBFile.i lldb/bindings/interface/SBFrame.i lldb/bindings/interface/SBValue.i lldb/docs/design/reproducers.rst lldb/docs/design/sbapi.rst lldb/docs/man/lldb.rst lldb/docs/resources/build.rst lldb/docs/resources/contributing.rst Removed: diff --git a/lldb/bindings/interface/SBFile.i b/lldb/bindings/interface/SBFile.i index c86c5f26f147..4a2f58e0e78f 100644 --- a/lldb/bindings/interface/SBFile.i +++ b/lldb/bindings/interface/SBFile.i @@ -93,7 +93,7 @@ public: If there is no underlying python file to unwrap, GetFile will use the file descriptor, if available to create a new python -file object using `open(fd, mode=..., closefd=False)` +file object using ``open(fd, mode=..., closefd=False)`` "); FileSP GetFile(); }; diff --git a/lldb/bindings/interface/SBFrame.i b/lldb/bindings/interface/SBFrame.i index 047b090e8a61..7bbf63c713f3 100644 --- a/lldb/bindings/interface/SBFrame.i +++ b/lldb/bindings/interface/SBFrame.i @@ -282,7 +282,7 @@ public: Find variables, register sets, registers, or persistent variables using the frame as the scope. -The version that doesn't supply a `use_dynamic` value will use the +The version that doesn't supply a ``use_dynamic`` value will use the target's default.") FindValue; lldb::SBValue FindValue (const char *name, ValueType value_type); diff --git a/lldb/bindings/interface/SBValue.i b/lldb/bindings/interface/SBValue.i index 928b6cffe464..dd012e667a20 100644 --- a/lldb/bindings/interface/SBValue.i +++ b/lldb/bindings/interface/SBValue.i @@ -379,13 +379,13 @@ public: Get an SBData wrapping what this SBValue points to. This method will dereference the current SBValue, if its -data type is a `T\*` or `T[]`, and extract `item_count` elements -of type `T` from it, copying their contents in an :py:class:`SBData`. +data type is a ``T\*`` or ``T[]``, and extract ``item_count`` elements +of type ``T`` from it, copying their contents in an :py:class:`SBData`. :param item_idx: The index of the first item to retrieve. For an array this is equivalent to array[item_idx], for a pointer -to `\*(pointer + item_idx)`. In either case, the measurement -unit for item_idx is the `sizeof(T)` rather than the byte +to ``\*(pointer + item_idx)``. In either case, the measurement +unit for item_idx is the ``sizeof(T)`` rather than the byte :param item_count: How many items should be copied into the output. By default only one item is copied, but more can be asked for. :return: The contents of the copied items on success. An empty :py:class:`SBData` otherwise. diff --git a/lldb/docs/design/reproducers.rst b/lldb/docs/design/reproducers.rst index 1b109c06d907..d8ad3dd7866d 100644 --- a/lldb/docs/design/reproducers.rst +++ b/lldb/docs/design/reproducers.rst @@ -105,7 +105,7 @@ Active Replay ^ No matter how a reproducer was captured, they can always be replayed with the -command line driver. When a reproducer is passed with the `--replay` flag, the +command line driver. When a reproducer is passed with the ``--replay`` flag, the driver short-circuits and passes off control to the reproducer infrastructure, effectively bypassing its normal operation. This works because the driver is implemented using the SB API and is therefore nothing more than a sequence of diff --git a/lldb/docs/design/sbapi.rst b/lldb/docs/design/sbapi.rst index 674fd680b907..676509bbd99e 100644 --- a/lldb/docs/design/sbapi.rst +++ b/lldb/docs/design/sbapi.rst @@ -76,7 +76,7 @@ will need to run ``clang-format`` over the processed file, as the tool (intentionally) makes no attempt to get that right. The ``LLDB_REGISTER`` macros are printed to standard out between curly braces. -You'll have to copy-paste those into the corresponding `RegsiterMethods` +You'll have to copy-paste those into the corresponding ``RegisterMethods`` function in the implementation file. This function is fully specialized in the corresponding type. diff --git a/lldb/docs/man/lldb.rst b/lldb/docs/man/lldb.rst index 65ac462fed94..6dca15fa35dc 100644 --- a/lldb/docs/man/lldb.rst +++ b/lldb
[llvm-branch-commits] [lldb] a58acef - [lldb][docs] Use 'any' as the default role in LLDB's sphinx project
Author: Raphael Isemann Date: 2021-01-18T19:08:19+01:00 New Revision: a58aceffad61ebffb1a860763299b3307041efa6 URL: https://github.com/llvm/llvm-project/commit/a58aceffad61ebffb1a860763299b3307041efa6 DIFF: https://github.com/llvm/llvm-project/commit/a58aceffad61ebffb1a860763299b3307041efa6.diff LOG: [lldb][docs] Use 'any' as the default role in LLDB's sphinx project sphinx processes text in backticks depending on what 'role' it has (e.g., `:code:\`blub\`` -> role is `code`). If no role is provided, the default role is taken which is right now using the default value of `content`. `content` only really makes the text cursive which isn't really useful for anything right now. Sphinx recommends using the `any` role by default [1] as that turns text in backticks without an explicit roles into some kind of smart reference. If we did this in LLDB, then we could just reference SB API classes by doing `\`SBValue\`` instead of typing out the rather verbose `:py:class:`/`:py:func:`/... role before each reference. This would be especially nice when writing the SB API docs itself as we constantly have to reference other classes. [1] https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-any Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D94899 Added: Modified: lldb/docs/conf.py lldb/docs/use/python.rst lldb/docs/use/variable.rst Removed: diff --git a/lldb/docs/conf.py b/lldb/docs/conf.py index b5b594538239..2c7cd5d94c1f 100644 --- a/lldb/docs/conf.py +++ b/lldb/docs/conf.py @@ -98,8 +98,9 @@ # directories to ignore when looking for source files. exclude_patterns = ['_build', 'analyzer'] -# The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# Use the recommended 'any' rule so that referencing SB API classes is possible +# by just writing `SBData`. +default_role = 'any' # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True diff --git a/lldb/docs/use/python.rst b/lldb/docs/use/python.rst index 6b2125705086..efbe0d732c12 100644 --- a/lldb/docs/use/python.rst +++ b/lldb/docs/use/python.rst @@ -110,10 +110,10 @@ kind of Python variable will it be? The answers are to use the LLDB API functions, provided as part of the LLDB Python module. Running Python from inside LLDB, LLDB will automatically give us our current frame object as a Python variable, "lldb.frame". This variable has the type -"SBFrame" (see the LLDB API for more information about SBFrame +`SBFrame` (see the LLDB API for more information about `SBFrame` objects). One of the things we can do with a frame object, is to ask it to find and return its local variable. We will call the API function -"FindVariable" on the lldb.frame object to give us our dictionary +`SBFrame.FindVariable` on the lldb.frame object to give us our dictionary variable as a Python variable: :: @@ -125,11 +125,11 @@ current frame to find the variable named "dictionary" and return it. We then store the returned value in the Python variable named "root". This answers the question of HOW to get the variable, but it still doesn't explain WHAT actually gets put into "root". If you examine the LLDB API, you will find that the -SBFrame method "FindVariable" returns an object of type SBValue. SBValue +`SBFrame` method "FindVariable" returns an object of type `SBValue`. `SBValue` objects are used, among other things, to wrap up program variables and values. -There are many useful methods defined in the SBValue class to allow you to get +There are many useful methods defined in the `SBValue` class to allow you to get information or children values out of SBValues. For complete information, see -the header file SBValue.h. The SBValue methods that we use in our DFS function +the header file SBValue.h. The `SBValue` methods that we use in our DFS function are ``GetChildMemberWithName()``, ``GetSummary()``, and ``GetValue()``. diff --git a/lldb/docs/use/variable.rst b/lldb/docs/use/variable.rst index ae6dbf2f4e5e..b9bcdf57cdde 100644 --- a/lldb/docs/use/variable.rst +++ b/lldb/docs/use/variable.rst @@ -677,7 +677,7 @@ passed two parameters: ``valobj`` and ``internal_dict``. not touch it. ``valobj`` is the object encapsulating the actual variable being displayed, and -its type is SBValue. Out of the many possible operations on an SBValue, the +its type is `SBValue`. Out of the many possible operations on an `SBValue`, the basic one is retrieve the children objects it contains (essentially, the fields of the object wrapped by it), by calling ``GetChildMemberWithName()``, passing it the child's name as a string. @@ -685,15 +685,15 @@ it the child's name as a string. If the variable has a value, you can ask for it, and return it as a string using ``GetValue()``, or as a signed/unsigned number using `
[llvm-branch-commits] [lldb] 626681b - [lldb] Fix two documentation typos
Author: Raphael Isemann Date: 2021-01-19T15:25:15+01:00 New Revision: 626681b09a3e87cfeda54a3cd00f7b0ed9df3bcc URL: https://github.com/llvm/llvm-project/commit/626681b09a3e87cfeda54a3cd00f7b0ed9df3bcc DIFF: https://github.com/llvm/llvm-project/commit/626681b09a3e87cfeda54a3cd00f7b0ed9df3bcc.diff LOG: [lldb] Fix two documentation typos Added: Modified: lldb/bindings/interface/SBListener.i lldb/include/lldb/lldb-enumerations.h Removed: diff --git a/lldb/bindings/interface/SBListener.i b/lldb/bindings/interface/SBListener.i index 63474b3335fb..9062e7534423 100644 --- a/lldb/bindings/interface/SBListener.i +++ b/lldb/bindings/interface/SBListener.i @@ -11,7 +11,7 @@ namespace lldb { %feature("docstring", "API clients can register its own listener to debugger events. -See aslo :py:class:`SBEvent` for example usage of creating and adding a listener." +See also :py:class:`SBEvent` for example usage of creating and adding a listener." ) SBListener; class SBListener { diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index ff4e15e7e070..cb78ff29e557 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -971,7 +971,7 @@ enum GdbSignal { eGdbSignalBreakpoint = 0x96 }; -/// Used with SBHost::GetPath (lldb::PathType) to find files that are +/// Used with SBHostOS::GetLLDBPath (lldb::PathType) to find files that are /// related to LLDB on the current host machine. Most files are /// relative to LLDB or are in known locations. enum PathType { ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 3cae8b3 - [lldb][docs] Add a doc page for enums and constants
Author: Raphael Isemann Date: 2021-01-19T18:54:05+01:00 New Revision: 3cae8b33297b14449514a87dcaa8996ba40db412 URL: https://github.com/llvm/llvm-project/commit/3cae8b33297b14449514a87dcaa8996ba40db412 DIFF: https://github.com/llvm/llvm-project/commit/3cae8b33297b14449514a87dcaa8996ba40db412.diff LOG: [lldb][docs] Add a doc page for enums and constants Enums and constants are currently missing in the new LLDB Python API docs. In theory we could just let them be autogenerated like the SB API classes, but sadly the generated documentation suffers from a bunch of problems. Most of these problems come from the way SWIG is representing enums, which is done by translating every single enum case into its own constant. This has a bunch of nasty effects: * Because SWIG throws away the enum types, we can't actually reference the enum type itself in the API. Also because automodapi is impossible to script, this can't be fixed in post (at least without running like sed over the output files). * The lack of enum types also causes that every enum *case* has its own full doc page. Having a full doc page that just shows a single enum case is pointless and it really slows down sphinx. * There is no SWIG code for the enums, so there is also no place to write documentation strings for them. Also there is no support for copying the doxygen strings (which would be in the wrong format, but better than nothing) for enums (let alone our defines), so we can't really document all this code. * Because the enum cases are just forwards to the native lldb module (which we mock), automodapi actually takes the `Mock` docstrings and adds it to every single enum case. I don't see any way to solve this via automodapi or SWIG. The most reasonable way to solve this is IMHO to write a simple Clang tool that just parses our enum/constant headers and emits an *.rst file that we check in. This way we can do all the LLDB-specific enum case and constant grouping that we need to make a readable documentation page. As we're without any real documentation until I get around to write that tool, I wrote a doc page for the enums/constants as a stop gap measure. Most of this is done by just grepping our enum header and then manually cleaning up all the artifacts and copying the few doc strings we have. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D94959 Added: lldb/docs/python_api_enums.rst Modified: lldb/bindings/interface/SBLanguageRuntime.i lldb/bindings/python/python.swig Removed: diff --git a/lldb/bindings/interface/SBLanguageRuntime.i b/lldb/bindings/interface/SBLanguageRuntime.i index 244c57048e64d..d8698ee36c0dd 100644 --- a/lldb/bindings/interface/SBLanguageRuntime.i +++ b/lldb/bindings/interface/SBLanguageRuntime.i @@ -9,7 +9,7 @@ namespace lldb { %feature("docstring", -"Utility functions for :py:class:`LanguageType`" +"Utility functions for :ref:`LanguageType`" ) SBLanguageRuntime; class SBLanguageRuntime { diff --git a/lldb/bindings/python/python.swig b/lldb/bindings/python/python.swig index 599699e33c45d..9dc4ab87a4bd9 100644 --- a/lldb/bindings/python/python.swig +++ b/lldb/bindings/python/python.swig @@ -28,7 +28,11 @@ Some of the important classes are described here: * :py:class:`SBFunction`: Represents a generic function, which can be inlined or not. * :py:class:`SBBlock`: Represents a lexical block. :py:class:`SBFunction` contains SBBlocks. * :py:class:`SBLineEntry`: Specifies an association with a contiguous range of instructions - and a source file location. :py:class:`SBCompileUnit` contains SBLineEntry." + and a source file location. :py:class:`SBCompileUnit` contains SBLineEntry. + +The diff erent enums in the `lldb` module are described in :doc:`python_api_enums`. + +" %enddef /* diff --git a/lldb/docs/python_api_enums.rst b/lldb/docs/python_api_enums.rst new file mode 100644 index 0..b00ac47bd1fa1 --- /dev/null +++ b/lldb/docs/python_api_enums.rst @@ -0,0 +1,1257 @@ +.. + This is a sub page of the Python API docs and linked from the main API page. + The page isn't in any toctree, so silence the sphinx warnings by marking it as orphan. + +:orphan: + +Python API enumerators and constants + + +.. py:currentmodule:: lldb + +Constants +* + +Generic register numbers + + +.. py:data:: LLDB_REGNUM_GENERIC_PC + + Program counter. + +.. py:data:: LLDB_REGNUM_GENERIC_SP + + Stack pointer. +.. py:data:: LLDB_REGNUM_GENERIC_FP + + Frame pointer. + +.. py:data:: LLDB_REGNUM_GENERIC_RA + + Return address. + +.. py:data:: LLDB_REGNUM_GENERIC_FLAGS + + Processor flags register. + +.. py:data:: LLDB_REGNUM_GENERIC_ARG1 + + The register that would contain pointer size or less argument 1 (if any). + +.. py:data:: LLDB_REGNUM_GENERIC_ARG2 + + The register that would con
[llvm-branch-commits] [lldb] 2f80995 - [lldb][docs] Update .htaccess to redirect from old SB API documentation to new one
Author: Raphael Isemann Date: 2021-01-19T18:58:43+01:00 New Revision: 2f8099509030d3352ac211b1fbae4c6c32b0bfa7 URL: https://github.com/llvm/llvm-project/commit/2f8099509030d3352ac211b1fbae4c6c32b0bfa7 DIFF: https://github.com/llvm/llvm-project/commit/2f8099509030d3352ac211b1fbae4c6c32b0bfa7.diff LOG: [lldb][docs] Update .htaccess to redirect from old SB API documentation to new one This is mostly SEO so that the new API can take over the old API when people search for the different SB* classes. Sadly epydoc decided to throw in a -class prefix behind all the class file names, so we can't just overwrite the old files with the newly generated ones. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D94900 Added: Modified: lldb/docs/.htaccess Removed: diff --git a/lldb/docs/.htaccess b/lldb/docs/.htaccess index 31b80359fb5fe..7f84a78df0a68 100644 --- a/lldb/docs/.htaccess +++ b/lldb/docs/.htaccess @@ -18,3 +18,89 @@ Redirect 301 /use/architecture.html https://lldb.llvm.org/resources/architecture Redirect 301 /resources/architecture.html https://lldb.llvm.org/design/overview.html Redirect 301 /resources/reproducers.html https://lldb.llvm.org/design/reproducers.html Redirect 301 /resources/sbapi.html https://lldb.llvm.org/design/sbapi.html + +# Redirect old Python API to new Python API. +Redirect 301 /python_reference/lldb-module.html https://lldb.llvm.org/python_api.html + +Redirect 301 /python_reference/lldb.SBAddress-class.html https://lldb.llvm.org/python_api/lldb.SBAddress.html +Redirect 301 /python_reference/lldb.SBAttachInfo-class.html https://lldb.llvm.org/python_api/lldb.SBAttachInfo.html +Redirect 301 /python_reference/lldb.SBBlock-class.html https://lldb.llvm.org/python_api/lldb.SBBlock.html +Redirect 301 /python_reference/lldb.SBBreakpoint-class.html https://lldb.llvm.org/python_api/lldb.SBBreakpoint.html +Redirect 301 /python_reference/lldb.SBBreakpointList-class.html https://lldb.llvm.org/python_api/lldb.SBBreakpointList.html +Redirect 301 /python_reference/lldb.SBBreakpointLocation-class.html https://lldb.llvm.org/python_api/lldb.SBBreakpointLocation.html +Redirect 301 /python_reference/lldb.SBBreakpointName-class.html https://lldb.llvm.org/python_api/lldb.SBBreakpointName.html +Redirect 301 /python_reference/lldb.SBBroadcaster-class.html https://lldb.llvm.org/python_api/lldb.SBBroadcaster.html +Redirect 301 /python_reference/lldb.SBCommandInterpreter-class.html https://lldb.llvm.org/python_api/lldb.SBCommandInterpreter.html +Redirect 301 /python_reference/lldb.SBCommandInterpreterRunOptions-class.html https://lldb.llvm.org/python_api/lldb.SBCommandInterpreterRunOptions.html +Redirect 301 /python_reference/lldb.SBCommandReturnObject-class.html https://lldb.llvm.org/python_api/lldb.SBCommandReturnObject.html +Redirect 301 /python_reference/lldb.SBCommunication-class.html https://lldb.llvm.org/python_api/lldb.SBCommunication.html +Redirect 301 /python_reference/lldb.SBCompileUnit-class.html https://lldb.llvm.org/python_api/lldb.SBCompileUnit.html +Redirect 301 /python_reference/lldb.SBData-class.html https://lldb.llvm.org/python_api/lldb.SBData.html +Redirect 301 /python_reference/lldb.SBDebugger-class.html https://lldb.llvm.org/python_api/lldb.SBDebugger.html +Redirect 301 /python_reference/lldb.SBDeclaration-class.html https://lldb.llvm.org/python_api/lldb.SBDeclaration.html +Redirect 301 /python_reference/lldb.SBEnvironment-class.html https://lldb.llvm.org/python_api/lldb.SBEnvironment.html +Redirect 301 /python_reference/lldb.SBError-class.html https://lldb.llvm.org/python_api/lldb.SBError.html +Redirect 301 /python_reference/lldb.SBEvent-class.html https://lldb.llvm.org/python_api/lldb.SBEvent.html +Redirect 301 /python_reference/lldb.SBExecutionContext-class.html https://lldb.llvm.org/python_api/lldb.SBExecutionContext.html +Redirect 301 /python_reference/lldb.SBExpressionOptions-class.html https://lldb.llvm.org/python_api/lldb.SBExpressionOptions.html +Redirect 301 /python_reference/lldb.SBFile-class.html https://lldb.llvm.org/python_api/lldb.SBFile.html +Redirect 301 /python_reference/lldb.SBFileSpec-class.html https://lldb.llvm.org/python_api/lldb.SBFileSpec.html +Redirect 301 /python_reference/lldb.SBFileSpecList-class.html https://lldb.llvm.org/python_api/lldb.SBFileSpecList.html +Redirect 301 /python_reference/lldb.SBFrame-class.html https://lldb.llvm.org/python_api/lldb.SBFrame.html +Redirect 301 /python_reference/lldb.SBFunction-class.html https://lldb.llvm.org/python_api/lldb.SBFunction.html +Redirect 301 /python_reference/lldb.SBHostOS-class.html https://lldb.llvm.org/python_api/lldb.SBHostOS.html +Redirect 301 /python_reference/lldb.SBInstruction-class.html https://lldb.llvm.org/python_api/lldb.SBInstruction.html +Redirect 301 /python_reference/lldb.SBInstructionList-class.html https://lldb.llvm.org/python_api/lld
[llvm-branch-commits] [lldb] 7fce3b2 - [lldb][docs] Remove -webkit-hyphens in table cells so that table widths are correct on Safari
Author: Raphael Isemann Date: 2021-01-20T09:05:28+01:00 New Revision: 7fce3b240b6b313b1becf19ddf3f2a904c34ced2 URL: https://github.com/llvm/llvm-project/commit/7fce3b240b6b313b1becf19ddf3f2a904c34ced2 DIFF: https://github.com/llvm/llvm-project/commit/7fce3b240b6b313b1becf19ddf3f2a904c34ced2.diff LOG: [lldb][docs] Remove -webkit-hyphens in table cells so that table widths are correct on Safari The tables in the new LLDB documentation currently are less wide than their contents. The reason for that seems to be the `-webkit-hyphens: auto` property that sphinx is setting for all `p` tags. The `p` tags in the generated Python documentation seem to trigger some Safari layout issue, so Safari is calculating the cell width to be smaller than it should be (which ends up looking like this {F15104344} ). This patch just sets that property back to the browser default `manual`. Not sure if that's the proper workaround, but I clicked around on the website with the changed CSS and nothing looked funny (which is I believe how webdev unit testing works). Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D94991 Added: Modified: lldb/docs/_static/lldb.css Removed: diff --git a/lldb/docs/_static/lldb.css b/lldb/docs/_static/lldb.css index 53b725940831..6df20b7dd6e4 100644 --- a/lldb/docs/_static/lldb.css +++ b/lldb/docs/_static/lldb.css @@ -44,6 +44,13 @@ table.mapping td.content { padding-bottom: 15px; } +/* Workaround for a Safari bug that would otherwise make table cells less wide +than the containing text. This just sets it back to the default browser +property.*/ +td p { + -webkit-hyphens: manual !important; +} + div.sphinxsidebar .caption { font-family: Helvetica, Verdana, sans-serif; font-size: 10pt; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 3c69ff4 - [lldb][docs] Filter out 'thisown' attribute and inheritance boilerplate
Author: Raphael Isemann Date: 2021-01-20T09:07:36+01:00 New Revision: 3c69ff4b03abaa3b7b80f4f3f2a1c1806e2d4495 URL: https://github.com/llvm/llvm-project/commit/3c69ff4b03abaa3b7b80f4f3f2a1c1806e2d4495 DIFF: https://github.com/llvm/llvm-project/commit/3c69ff4b03abaa3b7b80f4f3f2a1c1806e2d4495.diff LOG: [lldb][docs] Filter out 'thisown' attribute and inheritance boilerplate This patch implements a filter that post-processes some of the generated RST sources of the Python API docs. I mainly want to avoid two things: 1. Filter out all the inheritance boilerplate that just keeps mentioning for every class that it inherits from the builtin 'object'. There is no inheritance in the SB API. 2. More importantly, removes the SWIG generated `thisown` attribute from the public documentation. I don't think we want users to mess with that attribute and this is probably causing more confusion than it would help anyone. It also makes the documentation for some smaller classes more verbose than necessary. This patch just uses the sphinx event for reading source and removes the parts that we don't want in documentation. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D94967 Added: Modified: lldb/docs/conf.py Removed: diff --git a/lldb/docs/conf.py b/lldb/docs/conf.py index 2c7cd5d94c1f..b9b94672cbde 100644 --- a/lldb/docs/conf.py +++ b/lldb/docs/conf.py @@ -298,3 +298,36 @@ def process_md(name): # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' + +empty_attr_summary = re.compile(r'\.\. rubric:: Attributes Summary\s*\.\. autosummary::\s*\.\. rubric::') +empty_attr_documentation = re.compile(r'\.\. rubric:: Attributes Documentation\s*\.\. rubric::') + +def cleanup_source(app, docname, source): +""" Cleans up source files generated by automodapi. """ +# Don't cleanup anything beside automodapi-generated sources. +if not automodapi_toctreedirnm in docname: + return +processed = source[0] + +# Don't show the list of inheritance info as there is no inheritance in the +# SBI API. This avoids all the repeated text on all doc pages that a +# class inherits from 'object'. + +processed = processed.replace(":show-inheritance:", "") +# Remove the SWIG generated 'thisown' attribute. It just bloats the generated +# documentation and users shouldn't fiddle with the value anyway. +processed = re.sub(r'~SB[a-zA-Z]+\.thisown', "", processed) +processed = processed.replace(" .. autoattribute:: thisown", "") + +# After removing 'thisown', many objects don't have any attributes left. +# Remove all now empty attribute summary/documentation sections with +# some rather ugly regex. +processed = empty_attr_summary.sub('.. rubric::', processed) +processed = empty_attr_documentation.sub('.. rubric::', processed) + +# Replace the original source with the processed one (source is a single +# element list). +source[0] = processed + +def setup(app): +app.connect('source-read', cleanup_source) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] b3c260d - [lldb][docs] Expand CSS fix for LLDB doc tables
Author: Raphael Isemann Date: 2021-01-20T10:30:00+01:00 New Revision: b3c260d8fa07ed1202afdda9ca4c437a2a847080 URL: https://github.com/llvm/llvm-project/commit/b3c260d8fa07ed1202afdda9ca4c437a2a847080 DIFF: https://github.com/llvm/llvm-project/commit/b3c260d8fa07ed1202afdda9ca4c437a2a847080.diff LOG: [lldb][docs] Expand CSS fix for LLDB doc tables Apparently the sphinx version on the server doesn't place tags in the table cells, so the previous fix from commit 7fce3b240b6b313b1becf19ddf3f2a90 didn't fix the bug for that sphinx version. Just expand the CSS workaround to all tags. Added: Modified: lldb/docs/_static/lldb.css Removed: diff --git a/lldb/docs/_static/lldb.css b/lldb/docs/_static/lldb.css index 6df20b7dd6e4..e1e49f84c903 100644 --- a/lldb/docs/_static/lldb.css +++ b/lldb/docs/_static/lldb.css @@ -47,7 +47,7 @@ table.mapping td.content { /* Workaround for a Safari bug that would otherwise make table cells less wide than the containing text. This just sets it back to the default browser property.*/ -td p { +td { -webkit-hyphens: manual !important; } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 99b7b41 - [lldb][import-std-module] Do some basic file checks before trying to import a module
Author: Raphael Isemann Date: 2021-01-21T12:32:51+01:00 New Revision: 99b7b41edf4fbc2d6e52bc4524c956e8f69042d9 URL: https://github.com/llvm/llvm-project/commit/99b7b41edf4fbc2d6e52bc4524c956e8f69042d9 DIFF: https://github.com/llvm/llvm-project/commit/99b7b41edf4fbc2d6e52bc4524c956e8f69042d9.diff LOG: [lldb][import-std-module] Do some basic file checks before trying to import a module Currently when LLDB has enough data in the debug information to import the `std` module, it will just try to import it. However when debugging libraries where the sources aren't available anymore, importing the module will generate a confusing diagnostic that the module couldn't be built. For the fallback mode (where we retry failed expressions with the loaded module), this will cause the second expression to fail with a module built error instead of the actual parsing issue in the user expression. This patch adds checks that ensures that we at least have any source files in the found include paths before we try to import the module. This prevents the module from being loaded in the situation described above which means we don't emit the bogus 'can't import module' diagnostic and also don't waste any time retrying the expression in the fallback mode. For the unit tests I did some refactoring as they now require a VFS with the files in it and not just the paths. The Python test just builds a binary with a fake C++ module, then deletes the module before debugging. Fixes rdar://73264458 Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D95096 Added: lldb/test/API/commands/expression/import-std-module/empty-module/root/usr/include/c++/v1/vector lldb/test/API/commands/expression/import-std-module/empty-module/root/usr/include/stdio.h lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/root/usr/include/stdio.h lldb/test/API/commands/expression/import-std-module/missing-module-sources/Makefile lldb/test/API/commands/expression/import-std-module/missing-module-sources/TestStdModuleSourcesMissing.py lldb/test/API/commands/expression/import-std-module/missing-module-sources/main.cpp lldb/test/API/commands/expression/import-std-module/missing-module-sources/root/usr/include/c++/v1/module.modulemap lldb/test/API/commands/expression/import-std-module/missing-module-sources/root/usr/include/c++/v1/vector lldb/test/API/commands/expression/import-std-module/missing-module-sources/root/usr/include/stdio.h lldb/test/API/commands/expression/import-std-module/sysroot/root/usr/include/c++/v1/vector lldb/test/API/commands/expression/import-std-module/sysroot/root/usr/include/stdio.h Modified: lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h lldb/test/API/commands/expression/import-std-module/empty-module/root/usr/include/c++/v1/algorithm lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/root/usr/include/c++/v1/vector lldb/test/API/commands/expression/import-std-module/sysroot/root/usr/include/c++/v1/algorithm lldb/unittests/Expression/CppModuleConfigurationTest.cpp Removed: lldb/test/API/commands/expression/import-std-module/empty-module/root/usr/include/libc_header.h lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/root/usr/include/libc_header.h lldb/test/API/commands/expression/import-std-module/sysroot/root/usr/include/libc_header.h diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp index d2162cf4c574..ffab16b1682b 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp @@ -57,9 +57,38 @@ bool CppModuleConfiguration::analyzeFile(const FileSpec &f) { return true; } +/// Utility function for just appending two paths. +static std::string MakePath(llvm::StringRef lhs, llvm::StringRef rhs) { + llvm::SmallString<256> result(lhs); + llvm::sys::path::append(result, rhs); + return std::string(result); +} + bool CppModuleConfiguration::hasValidConfig() { - // We all these include directories to have a valid usable configuration. - return m_c_inc.Valid() && m_std_inc.Valid(); + // We need to have a C and C++ include dir for a valid configuration. + if (!m_c_inc.Valid() || !m_std_inc.Valid()) +return false; + + // Do some basic sanity checks on the directories that we don't activate + // the module when it's clear that it's not usable. + const std::vector files_to_check = { + // * Check that the C library contains at least one random C standard + // library header. + MakePath(m_c_inc.Get(), "stdio.h"), + // * With
[llvm-branch-commits] [lldb] 060b51e - [lldb] Make TestBSDArchives a no-debug-info-test
Author: Raphael Isemann Date: 2021-01-21T13:06:48+01:00 New Revision: 060b51e0524aed6b6cc452baa8eb6d663a580eee URL: https://github.com/llvm/llvm-project/commit/060b51e0524aed6b6cc452baa8eb6d663a580eee DIFF: https://github.com/llvm/llvm-project/commit/060b51e0524aed6b6cc452baa8eb6d663a580eee.diff LOG: [lldb] Make TestBSDArchives a no-debug-info-test The DSYM variant of this test is failing since D94890. But as we explicitly try to disable the DSYM generation in the makefile and build the archive on our own, I don't see why we even need to run the DSYM version of the test. This patch disables the generated derived versions of this test for the different debug information containers (which includes the failing DSYM one). Added: Modified: lldb/test/API/functionalities/archives/TestBSDArchives.py Removed: diff --git a/lldb/test/API/functionalities/archives/TestBSDArchives.py b/lldb/test/API/functionalities/archives/TestBSDArchives.py index 4464edd96bea..500c1763b690 100644 --- a/lldb/test/API/functionalities/archives/TestBSDArchives.py +++ b/lldb/test/API/functionalities/archives/TestBSDArchives.py @@ -19,6 +19,8 @@ def setUp(self): self.line = line_number( 'a.c', '// Set file and line breakpoint inside a().') +# Doesn't depend on any specific debug information. +@no_debug_info_test @expectedFailureAll( oslist=["windows"], bugnumber="llvm.org/pr24527. Makefile.rules doesn't know how to build static libs on Windows") ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] ed2853d - Reland [lldb] Fix TestThreadStepOut.py after "Flush local value map on every instruction"
Author: Raphael Isemann Date: 2021-01-21T13:35:13+01:00 New Revision: ed2853d2c82d7286ba510c8f65049d6f649017f0 URL: https://github.com/llvm/llvm-project/commit/ed2853d2c82d7286ba510c8f65049d6f649017f0 DIFF: https://github.com/llvm/llvm-project/commit/ed2853d2c82d7286ba510c8f65049d6f649017f0.diff LOG: Reland [lldb] Fix TestThreadStepOut.py after "Flush local value map on every instruction" The original patch got reverted as a dependency of cf1c774d6ace59c5adc9ab71b31e . That patch got relanded so it's also necessary to reland this patch. Original summary: After cf1c774d6ace59c5adc9ab71b31e762c1be695b1, Clang seems to generate code that is more similar to icc/Clang, so we can use the same line numbers for all compilers in this test. Added: Modified: lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py lldb/test/API/functionalities/thread/step_out/main.cpp Removed: diff --git a/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py b/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py index e273cc4be31b..2ab36b57eaee 100644 --- a/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py +++ b/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py @@ -70,12 +70,8 @@ def setUp(self): self.bkpt_string = '// Set breakpoint here' self.breakpoint = line_number('main.cpp', self.bkpt_string) -if "gcc" in self.getCompiler() or self.isIntelCompiler(): -self.step_out_destination = line_number( -'main.cpp', '// Expect to stop here after step-out (icc and gcc)') -else: -self.step_out_destination = line_number( -'main.cpp', '// Expect to stop here after step-out (clang)') +self.step_out_destination = line_number( + 'main.cpp', '// Expect to stop here after step-out.') def step_out_single_thread_with_cmd(self): self.step_out_with_cmd("this-thread") diff --git a/lldb/test/API/functionalities/thread/step_out/main.cpp b/lldb/test/API/functionalities/thread/step_out/main.cpp index 14d84010de8a..e7dd230d239c 100644 --- a/lldb/test/API/functionalities/thread/step_out/main.cpp +++ b/lldb/test/API/functionalities/thread/step_out/main.cpp @@ -19,10 +19,10 @@ thread_func () pseudo_barrier_wait(g_barrier); // Do something -step_out_of_here(); // Expect to stop here after step-out (clang) +step_out_of_here(); // Return -return NULL; // Expect to stop here after step-out (icc and gcc) +return NULL; // Expect to stop here after step-out. } int main () ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 37510f6 - [lldb][NFC] Fix build with GCC<6
Author: Raphael Isemann Date: 2021-01-21T15:04:41+01:00 New Revision: 37510f69b4cb8d76064f108d57bebe95984a23ae URL: https://github.com/llvm/llvm-project/commit/37510f69b4cb8d76064f108d57bebe95984a23ae DIFF: https://github.com/llvm/llvm-project/commit/37510f69b4cb8d76064f108d57bebe95984a23ae.diff LOG: [lldb][NFC] Fix build with GCC<6 GCC/libstdc++ before 6.1 can't handle scoped enums as unordered_map keys. LLVM (and some build) bots officially support some GCC 5.x versions, so this patch just makes the enum unscoped until we can require GCC 6.x. Added: Modified: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h Removed: diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index d24c5958204f..24c6d90694b7 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -1125,7 +1125,7 @@ class ScratchTypeSystemClang : public TypeSystemClang { /// These ASTs are isolated from the main scratch AST and are each /// dedicated to a special language option/feature that makes the contained /// AST nodes incompatible with other AST nodes. - enum class IsolatedASTKind { + enum IsolatedASTKind { /// The isolated AST for declarations/types from expressions that imported /// type information from a C++ module. The templates from a C++ module /// often conflict with the templates we generate from debug information, ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] b0dc54e - [lldb][NFC] Refactor setup code for Clang diagnostics
Author: Raphael Isemann Date: 2021-01-08T14:26:04+01:00 New Revision: b0dc54e08a9b5bee8ba1e874e9c12f4c4859f4a3 URL: https://github.com/llvm/llvm-project/commit/b0dc54e08a9b5bee8ba1e874e9c12f4c4859f4a3 DIFF: https://github.com/llvm/llvm-project/commit/b0dc54e08a9b5bee8ba1e874e9c12f4c4859f4a3.diff LOG: [lldb][NFC] Refactor setup code for Clang diagnostics Added: Modified: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Removed: diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp index 9b6e6e0f01f0..c61c0105661f 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -337,6 +337,20 @@ static void RemoveAllCppKeywords(IdentifierTable &idents) { #include "clang/Basic/TokenKinds.def" } +/// Configures Clang diagnostics for the expression parser. +static void SetupDefaultClangDiagnostics(CompilerInstance &compiler) { + // List of Clang warning groups that are not useful when parsing expressions. + const std::vector groupsToIgnore = { + "unused-value", + "odr", + }; + for (const char *group : groupsToIgnore) { +compiler.getDiagnostics().setSeverityForGroup( +clang::diag::Flavor::WarningOrError, group, +clang::diag::Severity::Ignored, SourceLocation()); + } +} + //===--===// // Implementation of ClangExpressionParser //===--===// @@ -637,12 +651,7 @@ ClangExpressionParser::ClangExpressionParser( m_compiler->getCodeGenOpts().setDebugInfo(codegenoptions::NoDebugInfo); // Disable some warnings. - m_compiler->getDiagnostics().setSeverityForGroup( - clang::diag::Flavor::WarningOrError, "unused-value", - clang::diag::Severity::Ignored, SourceLocation()); - m_compiler->getDiagnostics().setSeverityForGroup( - clang::diag::Flavor::WarningOrError, "odr", - clang::diag::Severity::Ignored, SourceLocation()); + SetupDefaultClangDiagnostics(*m_compiler); // Inform the target of the language options // ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 2b09ded - [lldb] Fix import-std-module tests after libc++ got a new __memory subdirectory
Author: Raphael Isemann Date: 2020-12-15T16:16:00+01:00 New Revision: 2b09dedac4c824c51bc0a8934b33c0f50ce0e126 URL: https://github.com/llvm/llvm-project/commit/2b09dedac4c824c51bc0a8934b33c0f50ce0e126 DIFF: https://github.com/llvm/llvm-project/commit/2b09dedac4c824c51bc0a8934b33c0f50ce0e126.diff LOG: [lldb] Fix import-std-module tests after libc++ got a new __memory subdirectory 7ad49aec125b3c1205b164331d0aa954d773f890 added a __memory subdirectory to libc++ but the code we use to find libc++ from the debug info support files wasn't prepared to encounter unknown subdirectories within libc++. The import-std-module tests automatically fell back to not importing the std module which caused them to fail. This patch removes our hardcoded exception for the 'experimental' subdirectory and instead just ignores all subdirectories of c++/vX/ when searching the support files. Added: Modified: lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp Removed: diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp index f1272c67d20f..d2162cf4c574 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp @@ -38,9 +38,11 @@ bool CppModuleConfiguration::analyzeFile(const FileSpec &f) { // Check for /c++/vX/ that is used by libc++. static llvm::Regex libcpp_regex(R"regex(/c[+][+]/v[0-9]/)regex"); - if (libcpp_regex.match(f.GetPath())) { -// Strip away libc++'s /experimental directory if there is one. -posix_dir.consume_back("/experimental"); + // If the path is in the libc++ include directory use it as the found libc++ + // path. Ignore subdirectories such as /c++/v1/experimental as those don't + // need to be specified in the header search. + if (libcpp_regex.match(f.GetPath()) && + parent_path(posix_dir, Style::posix).endswith("c++")) { return m_std_inc.TrySet(posix_dir); } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 722247c - [lldb] Unify the two CreateTypedef implementations in TypeSystemClang
Author: Raphael Isemann Date: 2020-12-17T10:49:26+01:00 New Revision: 722247c8124a6b840686757ae128b16cea248130 URL: https://github.com/llvm/llvm-project/commit/722247c8124a6b840686757ae128b16cea248130 DIFF: https://github.com/llvm/llvm-project/commit/722247c8124a6b840686757ae128b16cea248130.diff LOG: [lldb] Unify the two CreateTypedef implementations in TypeSystemClang To get LLDB one step closer to fulfil the software redundancy requirements of modern aircrafts, we apparently decided to have two separately maintained implementations of `CreateTypedef` in TypeSystemClang. Let's pass on the idea of an LLDB-powered jetliner and deleted one implementation. On a more serious note: This function got duplicated a long time ago when the idea of CompilerType with a backing TypeSystemClang subclass happened (56939cb31061d24ae3d1fc62da38b57e78bb2556). One implementation was supposed to be called from CompilerType::CreateTypedef and the other has just always been around to create typedefs. By accident one of the implementations is only used by the PDB parser while the CompilerType::CreateTypedef backend is used by the rest of LLDB. We also had some patches over the year that only fixed one of the two functions (D18099 for example only fixed up the CompilerType::CreateTypedef implementation). D51162 and D86140 both fixed the same missing `addDecl` call for one of the two implementations. This patch: * deletes the `CreateTypedefType` function as its only used by the PDB parser and the `CreateTypedef` implementation is anyway needed as it's the backend implementation of CompilerType. * replaces the calls in the PDB parser by just calling the CompilerType wrapper. * moves the documentation to the remaining function. * moves the check for empty typedef names that was only in the deleted implementation to the other (I don't think this fixes anything as I believe all callers are already doing the same check). I'll fix up the usual stuff (not using StringRef, not doing early exit) in a NFC follow-up. This patch is not NFC as the PDB parser now calls the function that has the fix from D18099. Reviewed By: labath, JDevlieghere Differential Revision: https://reviews.llvm.org/D93382 Added: Modified: lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h lldb/unittests/Symbol/TestTypeSystemClang.cpp Removed: diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp index 21f8b13bf07f..5b4ab78ac219 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp @@ -881,8 +881,8 @@ PdbAstBuilder::GetOrCreateTypedefDecl(PdbGlobalSymId id) { std::string uname = std::string(DropNameScope(udt.Name)); - CompilerType ct = m_clang.CreateTypedefType(ToCompilerType(qt), uname.c_str(), - ToCompilerDeclContext(*scope), 0); + CompilerType ct = ToCompilerType(qt).CreateTypedef( + uname.c_str(), ToCompilerDeclContext(*scope), 0); clang::TypedefNameDecl *tnd = m_clang.GetAsTypedefDecl(ct); DeclStatus status; status.resolved = true; diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp index 7649e8a90f9a..f9c12e634140 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -550,8 +550,8 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) { if (!ast_typedef.IsValid()) { CompilerType target_ast_type = target_type->GetFullCompilerType(); - ast_typedef = m_ast.CreateTypedefType( - target_ast_type, name.c_str(), m_ast.CreateDeclContext(decl_ctx), 0); + ast_typedef = target_ast_type.CreateTypedef( + name.c_str(), m_ast.CreateDeclContext(decl_ctx), 0); if (!ast_typedef) return nullptr; diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index f46b145da66c..643ea7e02206 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -4402,39 +4402,6 @@ TypeSystemClang::GetNonReferenceType(lldb::opaque_compiler_type_t type) { return CompilerType(); } -CompilerType TypeSystemClang::CreateTypedefType( -const CompilerType &type, const char *typedef_name, -const CompilerDeclContext &compiler_decl_ctx, uint32_t payload) { - if (type && typedef_name && typedef_name[0]) { -TypeSystemClang *ast = -llvm::dyn_cast(type.GetTypeSystem()); -if (!ast
[llvm-branch-commits] [lldb] b833898 - [lldb] Add std::array to the supported template list of the CxxModuleHandler
Author: Raphael Isemann Date: 2020-12-17T11:47:58+01:00 New Revision: b8338983e6f6ec6ebd48a7fc640b5d859e653b27 URL: https://github.com/llvm/llvm-project/commit/b8338983e6f6ec6ebd48a7fc640b5d859e653b27 DIFF: https://github.com/llvm/llvm-project/commit/b8338983e6f6ec6ebd48a7fc640b5d859e653b27.diff LOG: [lldb] Add std::array to the supported template list of the CxxModuleHandler Identical to the other patches that add STL containers to the supported templated list. Added: lldb/test/API/commands/expression/import-std-module/array/Makefile lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py lldb/test/API/commands/expression/import-std-module/array/main.cpp Modified: lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp Removed: diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp index 8a8450245990..f953e860969c 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp @@ -22,6 +22,7 @@ CxxModuleHandler::CxxModuleHandler(ASTImporter &importer, ASTContext *target) std::initializer_list supported_names = { // containers + "array", "deque", "forward_list", "list", diff --git a/lldb/test/API/commands/expression/import-std-module/array/Makefile b/lldb/test/API/commands/expression/import-std-module/array/Makefile new file mode 100644 index ..f938f7428468 --- /dev/null +++ b/lldb/test/API/commands/expression/import-std-module/array/Makefile @@ -0,0 +1,3 @@ +USE_LIBCPP := 1 +CXX_SOURCES := main.cpp +include Makefile.rules diff --git a/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py new file mode 100644 index ..ba9a7853b2f6 --- /dev/null +++ b/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py @@ -0,0 +1,86 @@ +""" +Test basic std::array functionality. +""" + +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@add_test_categories(["libc++"]) +@skipIf(compiler=no_match("clang")) +def test(self): +self.build() + +lldbutil.run_to_source_breakpoint(self, + "// Set break point at this line.", + lldb.SBFileSpec("main.cpp")) + +self.runCmd("settings set target.import-std-module true") + + +# Test inspecting an array of integers. +array_type = "std::array" +size_type = "std::array::size_type" +value_type = array_type + "::value_type" + +iterator = array_type + "::iterator" +riterator = array_type + "::reverse_iterator" + +self.expect_expr("a", + result_type=array_type, + result_children=[ + ValueCheck(name="__elems_", children=[ + ValueCheck(value="3"), + ValueCheck(value="1"), + ValueCheck(value="2"), + ]) + ]) +self.expect_expr("a.size()", result_type=size_type, result_value="3") +self.expect_expr("a.front()", result_type=value_type, result_value="3") +self.expect_expr("a[1]", result_type=value_type, result_value="1") +self.expect_expr("a.back()", result_type=value_type, result_value="2") + +# Both are just pointers to the underlying elements. +self.expect_expr("a.begin()", result_type=iterator) +self.expect_expr("a.rbegin()", result_type=riterator) + +self.expect_expr("*a.begin()", result_type=value_type, result_value="3") +self.expect_expr("*a.rbegin()", result_type="int", result_value="2") + +self.expect_expr("a.at(0)", result_type=value_type, result_value="3") + + +# Same again with an array that has an element type from debug info. +array_type = "std::array" +size_type = "std::array::size_type" +value_type = array_type + "::value_type" + +iterator = array_type + "::iterator" +riterator = array_type + "::reverse_iterator" +dbg_info_elem_children = [ValueCheck(value="4")] +dbg_info_elem = [ValueCheck(children=dbg_info_elem_children)] + +self.expect_expr("b", + result_type=array_type, + result_children=[ + ValueCheck(name="__elems_", children=dbg_info_elem) + ]) +self.expec
[llvm-branch-commits] [lldb] 53a14a4 - [lldb] Fix TestThreadStepOut.py after "Flush local value map on every instruction"
Author: Raphael Isemann Date: 2020-11-26T09:43:47+01:00 New Revision: 53a14a47ee89dadb8798ca8ed19848f33f4551d5 URL: https://github.com/llvm/llvm-project/commit/53a14a47ee89dadb8798ca8ed19848f33f4551d5 DIFF: https://github.com/llvm/llvm-project/commit/53a14a47ee89dadb8798ca8ed19848f33f4551d5.diff LOG: [lldb] Fix TestThreadStepOut.py after "Flush local value map on every instruction" After cf1c774d6ace59c5adc9ab71b31e762c1be695b1, Clang seems to generate code that is more similar to icc/Clang, so we can use the same line numbers for all compilers in this test. Added: Modified: lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py lldb/test/API/functionalities/thread/step_out/main.cpp Removed: diff --git a/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py b/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py index eb2d264ec2e3..ae46530f4ab5 100644 --- a/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py +++ b/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py @@ -70,12 +70,8 @@ def setUp(self): self.bkpt_string = '// Set breakpoint here' self.breakpoint = line_number('main.cpp', self.bkpt_string) -if "gcc" in self.getCompiler() or self.isIntelCompiler(): -self.step_out_destination = line_number( -'main.cpp', '// Expect to stop here after step-out (icc and gcc)') -else: -self.step_out_destination = line_number( -'main.cpp', '// Expect to stop here after step-out (clang)') +self.step_out_destination = line_number( + 'main.cpp', '// Expect to stop here after step-out.') def step_out_single_thread_with_cmd(self): self.step_out_with_cmd("this-thread") diff --git a/lldb/test/API/functionalities/thread/step_out/main.cpp b/lldb/test/API/functionalities/thread/step_out/main.cpp index 14d84010de8a..e7dd230d239c 100644 --- a/lldb/test/API/functionalities/thread/step_out/main.cpp +++ b/lldb/test/API/functionalities/thread/step_out/main.cpp @@ -19,10 +19,10 @@ thread_func () pseudo_barrier_wait(g_barrier); // Do something -step_out_of_here(); // Expect to stop here after step-out (clang) +step_out_of_here(); // Return -return NULL; // Expect to stop here after step-out (icc and gcc) +return NULL; // Expect to stop here after step-out. } int main () ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 39a5dd1 - [ASTImporter] Import the default argument of TemplateTemplateParmDecl
Author: Raphael Isemann Date: 2020-11-26T15:12:45+01:00 New Revision: 39a5dd164ca8648e24525869c934c9137c4887ef URL: https://github.com/llvm/llvm-project/commit/39a5dd164ca8648e24525869c934c9137c4887ef DIFF: https://github.com/llvm/llvm-project/commit/39a5dd164ca8648e24525869c934c9137c4887ef.diff LOG: [ASTImporter] Import the default argument of TemplateTemplateParmDecl Same idea as in D92103 and D92106, but I realised after creating those reviews that there are also TemplateTemplateParmDecls that can have default arguments, so here's hopefully the last patch for default template arguments. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D92119 Added: Modified: clang/lib/AST/ASTImporter.cpp clang/unittests/AST/ASTImporterTest.cpp Removed: diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 0886980fe905..835551528e0d 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -5250,15 +5250,22 @@ ASTNodeImporter::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) { if (!TemplateParamsOrErr) return TemplateParamsOrErr.takeError(); - // FIXME: Import default argument. - TemplateTemplateParmDecl *ToD = nullptr; - (void)GetImportedOrCreateDecl( - ToD, D, Importer.getToContext(), - Importer.getToContext().getTranslationUnitDecl(), *LocationOrErr, - D->getDepth(), D->getPosition(), D->isParameterPack(), - (*NameOrErr).getAsIdentifierInfo(), - *TemplateParamsOrErr); + if (GetImportedOrCreateDecl( + ToD, D, Importer.getToContext(), + Importer.getToContext().getTranslationUnitDecl(), *LocationOrErr, + D->getDepth(), D->getPosition(), D->isParameterPack(), + (*NameOrErr).getAsIdentifierInfo(), *TemplateParamsOrErr)) +return ToD; + + if (D->hasDefaultArgument()) { +Expected ToDefaultArgOrErr = +import(D->getDefaultArgument()); +if (!ToDefaultArgOrErr) + return ToDefaultArgOrErr.takeError(); +ToD->setDefaultArgument(Importer.getToContext(), *ToDefaultArgOrErr); + } + return ToD; } diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp index 97a18a76622b..33e4b7226fba 100644 --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/unittests/AST/ASTImporterTest.cpp @@ -901,6 +901,39 @@ TEST_P(ASTImporterOptionSpecificTestBase, ImportBeginLocOfDeclRefExpr) { .isValid()); } +TEST_P(ASTImporterOptionSpecificTestBase, + TemplateTemplateParmDeclNoDefaultArg) { + Decl *FromTU = getTuDecl(R"( + template typename TT> struct Y {}; + )", + Lang_CXX17); + auto From = FirstDeclMatcher().match( + FromTU, templateTemplateParmDecl(hasName("TT"))); + TemplateTemplateParmDecl *To = Import(From, Lang_CXX17); + ASSERT_FALSE(To->hasDefaultArgument()); +} + +TEST_P(ASTImporterOptionSpecificTestBase, TemplateTemplateParmDeclDefaultArg) { + Decl *FromTU = getTuDecl(R"( + template struct X {}; + template typename TT = X> struct Y {}; + )", + Lang_CXX17); + auto From = FirstDeclMatcher().match( + FromTU, templateTemplateParmDecl(hasName("TT"))); + TemplateTemplateParmDecl *To = Import(From, Lang_CXX17); + ASSERT_TRUE(To->hasDefaultArgument()); + const TemplateArgument &ToDefaultArg = To->getDefaultArgument().getArgument(); + ASSERT_TRUE(To->isTemplateDecl()); + TemplateDecl *ToTemplate = ToDefaultArg.getAsTemplate().getAsTemplateDecl(); + + // Find the default argument template 'X' in the AST and compare it against + // the default argument we got. + auto ToExpectedDecl = FirstDeclMatcher().match( + To->getTranslationUnitDecl(), classTemplateDecl(hasName("X"))); + ASSERT_EQ(ToTemplate, ToExpectedDecl); +} + TEST_P(ASTImporterOptionSpecificTestBase, ImportOfTemplatedDeclOfClassTemplateDecl) { Decl *FromTU = getTuDecl("template struct S{};", Lang_CXX03); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] 3f6c856 - [ASTImporter] Import the default argument of TemplateTypeParmDecl
Author: Raphael Isemann Date: 2020-11-26T18:01:30+01:00 New Revision: 3f6c856bb5ae4426a586426bca9f1ef2848a2b12 URL: https://github.com/llvm/llvm-project/commit/3f6c856bb5ae4426a586426bca9f1ef2848a2b12 DIFF: https://github.com/llvm/llvm-project/commit/3f6c856bb5ae4426a586426bca9f1ef2848a2b12.diff LOG: [ASTImporter] Import the default argument of TemplateTypeParmDecl The test case isn't using the AST matchers for all checks as there doesn't seem to be support for matching TemplateTypeParmDecl default arguments. Otherwise this is simply importing the default arguments. Also updates several LLDB tests that now as intended omit the default template arguments of several std templates. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D92103 Added: Modified: clang/lib/AST/ASTImporter.cpp clang/unittests/AST/ASTImporterTest.cpp lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py lldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py lldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py lldb/test/API/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py lldb/test/API/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py lldb/test/API/commands/expression/import-std-module/list/TestListFromStdModule.py lldb/test/API/commands/expression/import-std-module/queue/TestQueueFromStdModule.py lldb/test/API/commands/expression/import-std-module/stack/TestStackFromStdModule.py lldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/TestUniquePtrDbgInfoContent.py lldb/test/API/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py lldb/test/API/commands/expression/import-std-module/vector-bool/TestVectorBoolFromStdModule.py lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py Removed: diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 835551528e0d..5159682da85f 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -5158,8 +5158,6 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { // context. This context will be fixed when the actual template declaration // is created. - // FIXME: Import default argument and constraint expression. - ExpectedSLoc BeginLocOrErr = import(D->getBeginLoc()); if (!BeginLocOrErr) return BeginLocOrErr.takeError(); @@ -5206,6 +5204,14 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { ToIDC); } + if (D->hasDefaultArgument()) { +Expected ToDefaultArgOrErr = +import(D->getDefaultArgumentInfo()); +if (!ToDefaultArgOrErr) + return ToDefaultArgOrErr.takeError(); +ToD->setDefaultArgument(*ToDefaultArgOrErr); + } + return ToD; } diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp index 33e4b7226fba..5a93a7348e7a 100644 --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/unittests/AST/ASTImporterTest.cpp @@ -880,6 +880,25 @@ TEST_P(ImportExpr, DependentSizedArrayType) { has(fieldDecl(hasType(dependentSizedArrayType(; } +TEST_P(ASTImporterOptionSpecificTestBase, TemplateTypeParmDeclNoDefaultArg) { + Decl *FromTU = getTuDecl("template struct X {};", Lang_CXX03); + auto From = FirstDeclMatcher().match( + FromTU, templateTypeParmDecl(hasName("T"))); + TemplateTypeParmDecl *To = Import(From, Lang_CXX03); + ASSERT_FALSE(To->hasDefaultArgument()); +} + +TEST_P(ASTImporterOptionSpecificTestBase, TemplateTypeParmDeclDefaultArg) { + Decl *FromTU = + getTuDecl("template struct X {};", Lang_CXX03); + auto From = FirstDeclMatcher().match( + FromTU, templateTypeParmDecl(hasName("T"))); + TemplateTypeParmDecl *To = Import(From, Lang_CXX03); + ASSERT_TRUE(To->hasDefaultArgument()); + QualType ToArg = To->getDefaultArgument(); + ASSERT_EQ(ToArg, QualType(To->getASTContext().IntTy)); +} + TEST_P(ASTImporterOptionSpecificTestBase, ImportBeginLocOfDeclRefExpr) { Decl *FromTU = getTuDecl("class A { public: static int X; }; void f() { (void)A::X; }", diff --git a/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py index 18bd8ae37ff9..0eaa50a12727 100644 --- a/lldb/test/API
[llvm-branch-commits] [clang] 89c1a7a - [ASTImporter] Import the default argument of NonTypeTemplateParmDecl
Author: Raphael Isemann Date: 2020-11-27T11:40:07+01:00 New Revision: 89c1a7a67d6947f56dc2db189d3872626f5a8609 URL: https://github.com/llvm/llvm-project/commit/89c1a7a67d6947f56dc2db189d3872626f5a8609 DIFF: https://github.com/llvm/llvm-project/commit/89c1a7a67d6947f56dc2db189d3872626f5a8609.diff LOG: [ASTImporter] Import the default argument of NonTypeTemplateParmDecl The test case isn't using the AST matchers for all checks as there doesn't seem to be support for matching NonTypeTemplateParmDecl default arguments. Otherwise this is simply importing the default arguments. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D92106 Added: Modified: clang/lib/AST/ASTImporter.cpp clang/unittests/AST/ASTImporterTest.cpp Removed: diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 5159682da85f..01ee8d275af1 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -5227,15 +5227,22 @@ ASTNodeImporter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) { if (Err) return std::move(Err); - // FIXME: Import default argument. - NonTypeTemplateParmDecl *ToD = nullptr; - (void)GetImportedOrCreateDecl( - ToD, D, Importer.getToContext(), - Importer.getToContext().getTranslationUnitDecl(), - ToInnerLocStart, ToLocation, D->getDepth(), - D->getPosition(), ToDeclName.getAsIdentifierInfo(), ToType, - D->isParameterPack(), ToTypeSourceInfo); + if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), + Importer.getToContext().getTranslationUnitDecl(), + ToInnerLocStart, ToLocation, D->getDepth(), + D->getPosition(), + ToDeclName.getAsIdentifierInfo(), ToType, + D->isParameterPack(), ToTypeSourceInfo)) +return ToD; + + if (D->hasDefaultArgument()) { +ExpectedExpr ToDefaultArgOrErr = import(D->getDefaultArgument()); +if (!ToDefaultArgOrErr) + return ToDefaultArgOrErr.takeError(); +ToD->setDefaultArgument(*ToDefaultArgOrErr); + } + return ToD; } diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp index 5a93a7348e7a..81a92a10f48d 100644 --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/unittests/AST/ASTImporterTest.cpp @@ -953,6 +953,27 @@ TEST_P(ASTImporterOptionSpecificTestBase, TemplateTemplateParmDeclDefaultArg) { ASSERT_EQ(ToTemplate, ToExpectedDecl); } +TEST_P(ASTImporterOptionSpecificTestBase, NonTypeTemplateParmDeclNoDefaultArg) { + Decl *FromTU = getTuDecl("template struct X {};", Lang_CXX03); + auto From = FirstDeclMatcher().match( + FromTU, nonTypeTemplateParmDecl(hasName("N"))); + NonTypeTemplateParmDecl *To = Import(From, Lang_CXX03); + ASSERT_FALSE(To->hasDefaultArgument()); +} + +TEST_P(ASTImporterOptionSpecificTestBase, NonTypeTemplateParmDeclDefaultArg) { + Decl *FromTU = getTuDecl("template struct X {};", Lang_CXX03); + auto From = FirstDeclMatcher().match( + FromTU, nonTypeTemplateParmDecl(hasName("S"))); + NonTypeTemplateParmDecl *To = Import(From, Lang_CXX03); + ASSERT_TRUE(To->hasDefaultArgument()); + Stmt *ToArg = To->getDefaultArgument(); + ASSERT_TRUE(isa(ToArg)); + ToArg = *ToArg->child_begin(); + ASSERT_TRUE(isa(ToArg)); + ASSERT_EQ(cast(ToArg)->getValue().getLimitedValue(), 1U); +} + TEST_P(ASTImporterOptionSpecificTestBase, ImportOfTemplatedDeclOfClassTemplateDecl) { Decl *FromTU = getTuDecl("template struct S{};", Lang_CXX03); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] e0e7bbe - [lldb] Always include template arguments that have their default value in the internal type name
Author: Raphael Isemann Date: 2020-11-30T16:40:50+01:00 New Revision: e0e7bbeb545516c50a0354efc34d329453558c9c URL: https://github.com/llvm/llvm-project/commit/e0e7bbeb545516c50a0354efc34d329453558c9c DIFF: https://github.com/llvm/llvm-project/commit/e0e7bbeb545516c50a0354efc34d329453558c9c.diff LOG: [lldb] Always include template arguments that have their default value in the internal type name Our type formatters/summaries match on the internal type name we generate in LLDB for Clang types. These names were generated using Clang's default printing policy. However Clang's default printing policy got tweaked over the last month to make the generated type names more readable (by for example excluding inline/anonymous namespaces and removing template arguments that have their default value). This broke the formatter system where LLDB's matching logic now no longer can format certain types as the new type names generated by Clang's default printing policy no longer match the type names that LLDB/the user specified. I already introduced LLDB's own type printing policy and fixed the inline/anonymous namespaces in da121fff1184267a405f81a87f7314df2d474e1c (just to get the test suite passing again). This patch is restoring the old type printing behaviour where always include the template arguments in the internal type name (even if they match the default args). This should get template type formatters/summaries working again in the rare situation where we do know template default arguments within LLDB. This can only happen when either having a template that was parsed in the expression parser or when we get type information from a C++ module. The Clang change that removed defaulted template arguments from Clang's printing policy was e7f3e2103cdb567dda4fd52f81bf4bc07179f5a8 Reviewed By: labath Differential Revision: https://reviews.llvm.org/D92311 Added: lldb/test/API/lang/cpp/default-template-args/Makefile lldb/test/API/lang/cpp/default-template-args/TestDefaultTemplateArgs.py lldb/test/API/lang/cpp/default-template-args/main.cpp 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 77470486dd45..bab50a3b068c 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -1998,6 +1998,18 @@ PrintingPolicy TypeSystemClang::GetTypePrintingPolicy() { // and libstdc++ are diff erentiated by their inline namespaces). printing_policy.SuppressInlineNamespace = false; printing_policy.SuppressUnwrittenScope = false; + // Default arguments are also always important for type formatters. Otherwise + // we would need to always specify two type names for the setups where we do + // know the default arguments and where we don't know default arguments. + // + // For example, without this we would need to have formatters for both: + // std::basic_string + // and + // std::basic_string, std::allocator > + // to support setups where LLDB was able to reconstruct default arguments + // (and we then would have suppressed them from the type name) and also setups + // where LLDB wasn't able to reconstruct the default arguments. + printing_policy.SuppressDefaultTemplateArgs = false; return printing_policy; } diff --git a/lldb/test/API/lang/cpp/default-template-args/Makefile b/lldb/test/API/lang/cpp/default-template-args/Makefile new file mode 100644 index ..8b20bcb0 --- /dev/null +++ b/lldb/test/API/lang/cpp/default-template-args/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/lang/cpp/default-template-args/TestDefaultTemplateArgs.py b/lldb/test/API/lang/cpp/default-template-args/TestDefaultTemplateArgs.py new file mode 100644 index ..970c3522a175 --- /dev/null +++ b/lldb/test/API/lang/cpp/default-template-args/TestDefaultTemplateArgs.py @@ -0,0 +1,41 @@ +""" +Test default template arguments. +""" + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +class TestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@no_debug_info_test +def test(self): +self.build() +lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp")) + +# Declare a template with a template argument that has a default argument. +self.expect("expr --top-level -- template struct $X { int v; };") + +# The type we display to the user should omit the argument with the default +# value. +result = self.expect_expr("$X<> x; x", result_type="$X<>") +# The internal name should also always show all argume
[llvm-branch-commits] [lldb] 64f0462 - [lldb][NFC] Modernize and cleanup TestClassTemplateParameterPack
Author: Raphael Isemann Date: 2020-12-01T15:53:40+01:00 New Revision: 64f04629aa7a4cf9d2deb725683959faa4a857fe URL: https://github.com/llvm/llvm-project/commit/64f04629aa7a4cf9d2deb725683959faa4a857fe DIFF: https://github.com/llvm/llvm-project/commit/64f04629aa7a4cf9d2deb725683959faa4a857fe.diff LOG: [lldb][NFC] Modernize and cleanup TestClassTemplateParameterPack * Un-inline the test. * Use expect_expr everywhere and also check all involved types. * Clang-format the test sources. * Explain what we're actually testing with the 'C' and 'D' templates. * Split out the non-template-parameter-pack part of the test into its own small test. Added: lldb/test/API/lang/cpp/class-template-parameter-pack/Makefile lldb/test/API/lang/cpp/non-type-template-param/Makefile lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClass.py lldb/test/API/lang/cpp/non-type-template-param/main.cpp Modified: lldb/test/API/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py lldb/test/API/lang/cpp/class-template-parameter-pack/main.cpp Removed: diff --git a/lldb/test/API/lang/cpp/class-template-parameter-pack/Makefile b/lldb/test/API/lang/cpp/class-template-parameter-pack/Makefile new file mode 100644 index ..8b20bcb0 --- /dev/null +++ b/lldb/test/API/lang/cpp/class-template-parameter-pack/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py b/lldb/test/API/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py index 7e67f73b7092..e0497b62f55c 100644 --- a/lldb/test/API/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py +++ b/lldb/test/API/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py @@ -1,7 +1,38 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil -lldbinline.MakeInlineTest( -__file__, globals(), [ -decorators.expectedFailureAll( -compiler="gcc")]) +class TestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@expectedFailureAll(compiler="gcc") +def test(self): +self.build() +lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp")) + +# Test non-type template parameter packs. +self.expect_expr("myC", result_type="C", result_children=[ +ValueCheck(name="C", children=[ +ValueCheck(name="member", value="64") +]) +]) +self.expect_expr("myLesserC.argsAre_16_32()", result_value="false") +self.expect_expr("myC.argsAre_16_32()", result_value="true") + +# Test type template parameter packs. +self.expect_expr("myD", result_type="D", result_children=[ +ValueCheck(name="D", children=[ +ValueCheck(name="member", value="64") +]) +]) +self.expect_expr("myLesserD.argsAre_Int_bool()", result_value="false") +self.expect_expr("myD.argsAre_Int_bool()", result_value="true") + +# Disabling until we do template lookup correctly: http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html +# FIXME: Rewrite this with expect_expr +# self.expect("expression -- C().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"]) +# self.expect("expression -- C().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"]) +# self.expect("expression -- D().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"]) +# self.expect("expression -- D().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"]) diff --git a/lldb/test/API/lang/cpp/class-template-parameter-pack/main.cpp b/lldb/test/API/lang/cpp/class-template-parameter-pack/main.cpp index 82f09a1f268c..8bb0a42b58a3 100644 --- a/lldb/test/API/lang/cpp/class-template-parameter-pack/main.cpp +++ b/lldb/test/API/lang/cpp/class-template-parameter-pack/main.cpp @@ -1,64 +1,43 @@ template struct C { T member; - bool isSixteenThirtyTwo() { return false; } + bool argsAre_16_32() { return false; } }; template <> struct C { int member; - bool isSixteenThirtyTwo() { return false; } + bool argsAre_16_32() { return false; } }; template <> struct C : C { - bool isSixteenThirtyTwo() { return true; } + bool argsAre_16_32() { return true; } }; template struct D { T member; - bool isIntBool() { return false; } + bool argsAre_Int_bool() { return false; } }; template <> struct D { int member; - bool isIntBool() { return false; } + bool argsAre_Int_bool() { return false; } }; template <> struct D
[llvm-branch-commits] [lldb] 9126ba2 - [lldb][NFC] Fix test file name in lang/cpp/non-type-template-param
Author: Raphael Isemann Date: 2020-12-02T08:41:53+01:00 New Revision: 9126ba25a3eeffa438e20d3a18abf70eb547789d URL: https://github.com/llvm/llvm-project/commit/9126ba25a3eeffa438e20d3a18abf70eb547789d DIFF: https://github.com/llvm/llvm-project/commit/9126ba25a3eeffa438e20d3a18abf70eb547789d.diff LOG: [lldb][NFC] Fix test file name in lang/cpp/non-type-template-param The 'AlignAsBaseClass' part was a leftover form the align_as test that served as the template for this test. Added: lldb/test/API/lang/cpp/non-type-template-param/TestCppNonTypeTemplateParam.py Modified: Removed: lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClassNonTemplateParam.py diff --git a/lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClassNonTemplateParam.py b/lldb/test/API/lang/cpp/non-type-template-param/TestCppNonTypeTemplateParam.py similarity index 100% rename from lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClassNonTemplateParam.py rename to lldb/test/API/lang/cpp/non-type-template-param/TestCppNonTypeTemplateParam.py ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] c526426 - [lldb] Don't reject empty or unnamed template parameter packs
Author: Raphael Isemann Date: 2020-12-02T10:50:41+01:00 New Revision: c526426f5cba5308782ea4f86822047ee2ee3818 URL: https://github.com/llvm/llvm-project/commit/c526426f5cba5308782ea4f86822047ee2ee3818 DIFF: https://github.com/llvm/llvm-project/commit/c526426f5cba5308782ea4f86822047ee2ee3818.diff LOG: [lldb] Don't reject empty or unnamed template parameter packs We currently reject all templates that have either zero args or that have a parameter pack without a name. Both cases are actually allowed in C++, so rejecting them leads to LLDB instead falling back to a dummy 'void' type. This leads to all kind of errors later on (most notable, variables that have such template types appear to be missing as we can't have 'void' variables and inheriting from such a template type will cause Clang to hit some asserts when finding that the base class is 'void'). This just removes the too strict tests and adds a few tests for this stuff (+ some combinations of these tests with preceding template parameters). Things that I left for follow-up patches: * All the possible interactions with template-template arguments which seem like a whole new source of possible bugs. * Function templates which completely lack sanity checks. * Variable templates are not implemented. * Alias templates are not implemented too. * The rather strange checks that just make sure that the separate list of template arg names and values always have the same length. I believe those ought to be asserts, but my current plan is to move both those things into a single list that can't end up in this inconsistent state. Reviewed By: JDevlieghere, shafik Differential Revision: https://reviews.llvm.org/D92425 Added: lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/Makefile lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/main.cpp lldb/test/API/lang/cpp/class-template-type-parameter-pack/Makefile lldb/test/API/lang/cpp/class-template-type-parameter-pack/TestClassTemplateTypeParameterPack.py lldb/test/API/lang/cpp/class-template-type-parameter-pack/main.cpp Modified: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h lldb/unittests/Symbol/TestTypeSystemClang.cpp Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 6633acd70a50..2c045d6dc9c0 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -1944,8 +1944,6 @@ bool DWARFASTParserClang::ParseTemplateParameterInfos( break; } } - if (template_param_infos.args.empty()) -return false; return template_param_infos.args.size() == template_param_infos.names.size(); } diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 5eb492f0dbc2..6879d2566183 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -332,10 +332,11 @@ class TypeSystemClang : public TypeSystem { class TemplateParameterInfos { public: bool IsValid() const { - if (args.empty()) + // Having a pack name but no packed args doesn't make sense, so mark + // these template parameters as invalid. + if (pack_name && !packed_args) return false; return args.size() == names.size() && -((bool)pack_name == (bool)packed_args) && (!packed_args || !packed_args->packed_args); } diff --git a/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/Makefile b/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/Makefile new file mode 100644 index ..8b20bcb0 --- /dev/null +++ b/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py b/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py new file mode 100644 index ..d366d9d69222 --- /dev/null +++ b/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py @@ -0,0 +1,76 @@ +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +class TestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@no_debug_info_test +def test(self): +self.build() +self.dbg.CreateTarget(self.getBuildArtifact("a.out")) + +
[llvm-branch-commits] [lldb] 291cc1b - [lldb][NFC] Give class template pack test files unique class names
Author: Raphael Isemann Date: 2020-12-02T19:19:35+01:00 New Revision: 291cc1bbea1f4a6cab829509e95b3efe40af908f URL: https://github.com/llvm/llvm-project/commit/291cc1bbea1f4a6cab829509e95b3efe40af908f DIFF: https://github.com/llvm/llvm-project/commit/291cc1bbea1f4a6cab829509e95b3efe40af908f.diff LOG: [lldb][NFC] Give class template pack test files unique class names Added: Modified: lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py lldb/test/API/lang/cpp/class-template-type-parameter-pack/TestClassTemplateTypeParameterPack.py Removed: diff --git a/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py b/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py index d366d9d69222..6b4b96049cdb 100644 --- a/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py +++ b/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py @@ -3,7 +3,7 @@ from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil -class TestCase(TestBase): +class TestCaseClassTemplateNonTypeParameterPack(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -73,4 +73,4 @@ def test(self): self.expect_expr("emptyNonTypePackAfterNonTypeParam", result_type="NonTypePackAfterNonTypeParam<1>", result_children=[ValueCheck(name="j", type="int")]) self.expect_expr("oneElemNonTypePackAfterNonTypeParam", result_type="NonTypePackAfterNonTypeParam<1, 2>", -result_children=[ValueCheck(name="j", type="int")]) \ No newline at end of file +result_children=[ValueCheck(name="j", type="int")]) diff --git a/lldb/test/API/lang/cpp/class-template-type-parameter-pack/TestClassTemplateTypeParameterPack.py b/lldb/test/API/lang/cpp/class-template-type-parameter-pack/TestClassTemplateTypeParameterPack.py index 48ea59d6e5eb..223ba5224274 100644 --- a/lldb/test/API/lang/cpp/class-template-type-parameter-pack/TestClassTemplateTypeParameterPack.py +++ b/lldb/test/API/lang/cpp/class-template-type-parameter-pack/TestClassTemplateTypeParameterPack.py @@ -3,7 +3,7 @@ from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil -class TestCase(TestBase): +class TestCaseClassTemplateTypeParameterPack(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -73,4 +73,4 @@ def test(self): self.expect_expr("emptyTypePackAfterNonTypeParam", result_type="TypePackAfterNonTypeParam<1>", result_children=[ValueCheck(name="j", type="int")]) self.expect_expr("oneElemTypePackAfterNonTypeParam", result_type="TypePackAfterNonTypeParam<1, int>", -result_children=[ValueCheck(name="j", type="int")]) \ No newline at end of file +result_children=[ValueCheck(name="j", type="int")]) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] c49e718 - [lldb][NFC] Make DeclOrigin::Valid() const
Author: Raphael Isemann Date: 2020-12-03T00:08:19+01:00 New Revision: c49e71805142ac3a27a5567ce516890e9243b34e URL: https://github.com/llvm/llvm-project/commit/c49e71805142ac3a27a5567ce516890e9243b34e DIFF: https://github.com/llvm/llvm-project/commit/c49e71805142ac3a27a5567ce516890e9243b34e.diff LOG: [lldb][NFC] Make DeclOrigin::Valid() const Added: Modified: lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h Removed: diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h index b8c751479d4b..bf4ad174cf9c 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h @@ -160,7 +160,7 @@ class ClangASTImporter { decl = rhs.decl; } -bool Valid() { return (ctx != nullptr || decl != nullptr); } +bool Valid() const { return (ctx != nullptr || decl != nullptr); } clang::ASTContext *ctx; clang::Decl *decl; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 640567d - [lldb] X-FAIL class template parameter pack tests on Windows
Author: Raphael Isemann Date: 2020-12-03T00:38:05+01:00 New Revision: 640567d4646292f77e87e77b8710ebf1bde1f390 URL: https://github.com/llvm/llvm-project/commit/640567d4646292f77e87e77b8710ebf1bde1f390 DIFF: https://github.com/llvm/llvm-project/commit/640567d4646292f77e87e77b8710ebf1bde1f390.diff LOG: [lldb] X-FAIL class template parameter pack tests on Windows Both seem to fail to read values from the non-running target. Added: Modified: lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py lldb/test/API/lang/cpp/class-template-type-parameter-pack/TestClassTemplateTypeParameterPack.py Removed: diff --git a/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py b/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py index 6b4b96049cdb1..3a51e08d75e08 100644 --- a/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py +++ b/lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py @@ -7,6 +7,7 @@ class TestCaseClassTemplateNonTypeParameterPack(TestBase): mydir = TestBase.compute_mydir(__file__) +@expectedFailureAll(oslist=["windows"]) # Fails to read memory from target. @no_debug_info_test def test(self): self.build() diff --git a/lldb/test/API/lang/cpp/class-template-type-parameter-pack/TestClassTemplateTypeParameterPack.py b/lldb/test/API/lang/cpp/class-template-type-parameter-pack/TestClassTemplateTypeParameterPack.py index 223ba52242742..88beac18e891a 100644 --- a/lldb/test/API/lang/cpp/class-template-type-parameter-pack/TestClassTemplateTypeParameterPack.py +++ b/lldb/test/API/lang/cpp/class-template-type-parameter-pack/TestClassTemplateTypeParameterPack.py @@ -7,6 +7,7 @@ class TestCaseClassTemplateTypeParameterPack(TestBase): mydir = TestBase.compute_mydir(__file__) +@expectedFailureAll(oslist=["windows"]) # Fails to read memory from target. @no_debug_info_test def test(self): self.build() ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 973f390 - [lldb][NFC] Rename TypeSystemClangForExpressions to ScratchTypeSystemClang
Author: Raphael Isemann Date: 2020-12-04T09:41:42+01:00 New Revision: 973f3907a471eee85c35f7d283fe2de91ce953e2 URL: https://github.com/llvm/llvm-project/commit/973f3907a471eee85c35f7d283fe2de91ce953e2 DIFF: https://github.com/llvm/llvm-project/commit/973f3907a471eee85c35f7d283fe2de91ce953e2.diff LOG: [lldb][NFC] Rename TypeSystemClangForExpressions to ScratchTypeSystemClang We keep referring to the single object created by this class as 'scratch AST/Context/TypeSystem' so at this point we might as well rename the class. It's also not involved at all in expression evaluation, so the 'ForExpressions' prefix is a bit misleading. Added: Modified: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h Removed: diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index ca109ef9c2fc..0445e4b0a056 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -613,7 +613,7 @@ lldb::TypeSystemSP TypeSystemClang::CreateInstance(lldb::LanguageType language, "ASTContext for '" + module->GetFileSpec().GetPath() + "'"; return std::make_shared(ast_name, triple); } else if (target && target->IsValid()) -return std::make_shared(*target, triple); +return std::make_shared(*target, triple); return lldb::TypeSystemSP(); } @@ -9567,8 +9567,8 @@ TypeSystemClang::DeclContextGetTypeSystemClang(const CompilerDeclContext &dc) { return nullptr; } -TypeSystemClangForExpressions::TypeSystemClangForExpressions( -Target &target, llvm::Triple triple) +ScratchTypeSystemClang::ScratchTypeSystemClang(Target &target, + llvm::Triple triple) : TypeSystemClang("scratch ASTContext", triple), m_target_wp(target.shared_from_this()), m_persistent_variables(new ClangPersistentVariables) { @@ -9580,16 +9580,15 @@ TypeSystemClangForExpressions::TypeSystemClangForExpressions( SetExternalSource(proxy_ast_source); } -void TypeSystemClangForExpressions::Finalize() { +void ScratchTypeSystemClang::Finalize() { TypeSystemClang::Finalize(); m_scratch_ast_source_up.reset(); } -UserExpression *TypeSystemClangForExpressions::GetUserExpression( +UserExpression *ScratchTypeSystemClang::GetUserExpression( llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, Expression::ResultType desired_type, -const EvaluateExpressionOptions &options, -ValueObject *ctx_obj) { +const EvaluateExpressionOptions &options, ValueObject *ctx_obj) { TargetSP target_sp = m_target_wp.lock(); if (!target_sp) return nullptr; @@ -9598,7 +9597,7 @@ UserExpression *TypeSystemClangForExpressions::GetUserExpression( desired_type, options, ctx_obj); } -FunctionCaller *TypeSystemClangForExpressions::GetFunctionCaller( +FunctionCaller *ScratchTypeSystemClang::GetFunctionCaller( const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name) { TargetSP target_sp = m_target_wp.lock(); @@ -9614,8 +9613,8 @@ FunctionCaller *TypeSystemClangForExpressions::GetFunctionCaller( } std::unique_ptr -TypeSystemClangForExpressions::CreateUtilityFunction(std::string text, - std::string name) { +ScratchTypeSystemClang::CreateUtilityFunction(std::string text, + std::string name) { TargetSP target_sp = m_target_wp.lock(); if (!target_sp) return {}; @@ -9625,6 +9624,6 @@ TypeSystemClangForExpressions::CreateUtilityFunction(std::string text, } PersistentExpressionState * -TypeSystemClangForExpressions::GetPersistentExpressionState() { +ScratchTypeSystemClang::GetPersistentExpressionState() { return m_persistent_variables.get(); } diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 6879d2566183..15c52b32ba12 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -1122,11 +1122,11 @@ class TypeSystemClang : public TypeSystem { /// The TypeSystemClang instance used for the scratch ASTContext in a /// lldb::Target. -class TypeSystemClangForExpressions : public TypeSystemClang { +class ScratchTypeSystemClang : public TypeSystemClang { public: - TypeSystemClangForExpressions(Target &target, llvm::Triple triple); + ScratchTypeSystemClang(Target &target, llvm::Triple triple); - ~TypeSystemClangForExpressions() override = default; + ~ScratchTypeSystemClang() override = default; void Finalize() override; @@ -1148,9 +1148,11 @@ class TypeSystemCl
[llvm-branch-commits] [lldb] 594308c - [lldb][NFC] Rename TypeSystemClang::GetScratch to ScratchTypeSystemClang::GetForTarget
Author: Raphael Isemann Date: 2020-12-04T11:29:08+01:00 New Revision: 594308c7ad07b4cea20f41d915aa81794e909654 URL: https://github.com/llvm/llvm-project/commit/594308c7ad07b4cea20f41d915aa81794e909654 DIFF: https://github.com/llvm/llvm-project/commit/594308c7ad07b4cea20f41d915aa81794e909654.diff LOG: [lldb][NFC] Rename TypeSystemClang::GetScratch to ScratchTypeSystemClang::GetForTarget Also add some documentation while I'm at it. Added: Modified: lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp lldb/source/Plugins/Language/ObjC/NSArray.cpp lldb/source/Plugins/Language/ObjC/NSDictionary.cpp lldb/source/Plugins/Language/ObjC/NSError.cpp lldb/source/Plugins/Language/ObjC/NSException.cpp lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp lldb/source/Plugins/Language/ObjC/NSString.cpp lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h Removed: diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index 569d84d39c807..e35e6063a0f1c 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -1113,7 +1113,7 @@ DynamicLoaderDarwin::GetThreadLocalData(const lldb::ModuleSP module_sp, StackFrameSP frame_sp = thread_sp->GetStackFrameAtIndex(0); if (frame_sp) { TypeSystemClang *clang_ast_context = - TypeSystemClang::GetScratch(target); + ScratchTypeSystemClang::GetForTarget(target); if (!clang_ast_context) return LLDB_INVALID_ADDRESS; diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp index 7bc14061ffe05..9fc5e5daeafb5 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -224,7 +224,7 @@ bool DynamicLoaderMacOS::NotifyBreakpointHit(void *baton, // get the values from the ABI: TypeSystemClang *clang_ast_context = -TypeSystemClang::GetScratch(process->GetTarget()); +ScratchTypeSystemClang::GetForTarget(process->GetTarget()); if (!clang_ast_context) return false; diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index d425b3587237c..76b4c48110941 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -343,7 +343,7 @@ bool DynamicLoaderMacOSXDYLD::NotifyBreakpointHit( // get the values from the ABI: TypeSystemClang *clang_ast_context = -TypeSystemClang::GetScratch(process->GetTarget()); +ScratchTypeSystemClang::GetForTarget(process->GetTarget()); if (!clang_ast_context) return false; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp index 39ba5f4e9e4fd..66a87ba924dba 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -443,7 +443,7 @@ void ASTResultSynthesizer::CommitPersistentDecls() { return; auto *persistent_vars = llvm::cast(state); - TypeSystemClang *scratch_ctx = TypeSystemClang::GetScratch(m_target); +
[llvm-branch-commits] [lldb] e97b991 - [lldb] Remove LLDB session dir and just store test traces in the respective test build directory
Author: Raphael Isemann Date: 2020-12-04T11:43:10+01:00 New Revision: e97b991eef63663d1f635813fe375354edb7b51a URL: https://github.com/llvm/llvm-project/commit/e97b991eef63663d1f635813fe375354edb7b51a DIFF: https://github.com/llvm/llvm-project/commit/e97b991eef63663d1f635813fe375354edb7b51a.diff LOG: [lldb] Remove LLDB session dir and just store test traces in the respective test build directory Test runs log some of their output to files inside the LLDB session dir. This session dir is shared between all tests, so all the tests have to make sure they choose a unique file name inside that directory. We currently choose by default `-` as the log file name. However, that means that if not every test class in the test suite has a unique class name, then we end up with a race condition as two tests will try to write to the same log file. I already tried in D83767 changing the format to use the test file basename instead (which we already require to be unique for some other functionality), but it seems the code for getting the basename didn't work on Windows. This patch instead just changes that dotest stores the log files in the build directory for the current test. We know that directory is unique for this test, so no need to generate some unique file name now. Also removes all the environment vars and parameters related to the now unused session dir. The new log paths now look like this for a failure in 'TestCppOperators`: ``` ./lldb-test-build.noindex/lang/cpp/operators/TestCppOperators.test_dwarf/Failure.log ./lldb-test-build.noindex/lang/cpp/operators/TestCppOperators.test_dsym/Failure.log ./lldb-test-build.noindex/lang/cpp/operators/TestCppOperators.test_gmodules/Failure.log ``` Reviewed By: labath Differential Revision: https://reviews.llvm.org/D92498 Added: Modified: lldb/examples/test/.lldb-loggings lldb/examples/test/usage-lldb-loggings lldb/packages/Python/lldbsuite/test/configuration.py lldb/packages/Python/lldbsuite/test/dotest.py lldb/packages/Python/lldbsuite/test/dotest_args.py lldb/packages/Python/lldbsuite/test/lldbtest.py lldb/test/API/CMakeLists.txt lldb/test/API/lit.cfg.py lldb/test/API/lit.site.cfg.py.in lldb/utils/lldb-dotest/CMakeLists.txt lldb/utils/lldb-dotest/lldb-dotest.in Removed: diff --git a/lldb/examples/test/.lldb-loggings b/lldb/examples/test/.lldb-loggings index 9c92bd958479..873bb88c844d 100644 --- a/lldb/examples/test/.lldb-loggings +++ b/lldb/examples/test/.lldb-loggings @@ -3,8 +3,7 @@ def pre_flight(self): import lldb import lldbtest -dname = os.path.join(os.environ["LLDB_TEST"], - os.environ["LLDB_SESSION_DIRNAME"]) +dname = os.path.join(os.environ["LLDB_TEST"]) if not os.path.isdir(dname): os.mkdir(dname) dest = os.path.join(dname, "lldb_log-%s-%s-%s.txt" % (self.getArchitecture(), self.getCompiler(), self.id())) diff --git a/lldb/examples/test/usage-lldb-loggings b/lldb/examples/test/usage-lldb-loggings index b7d7e2e58fc1..4ce9689f3d37 100644 --- a/lldb/examples/test/usage-lldb-loggings +++ b/lldb/examples/test/usage-lldb-loggings @@ -88,8 +88,7 @@ lldb.pre_flight: def pre_flight(self): import lldb import lldbtest -dname = os.path.join(os.environ["LLDB_TEST"], - os.environ["LLDB_SESSION_DIRNAME"]) +dname = os.path.join(os.environ["LLDB_TEST"]) if not os.path.isdir(dname): os.mkdir(dname) dest = os.path.join(dname, "lldb_log-%s-%s-%s.txt" % (self.getArchitecture(), self.getCompiler(), self.id())) diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py index 7939a27badf0..db4262f65345 100644 --- a/lldb/packages/Python/lldbsuite/test/configuration.py +++ b/lldb/packages/Python/lldbsuite/test/configuration.py @@ -76,20 +76,6 @@ skip_tests = None xfail_tests = None -# By default, recorded session info for errored/failed test are dumped into its -# own file under a session directory named after the timestamp of the test suite -# run. Use '-s session-dir-name' to specify a specific dir name. -sdir_name = None - -# Valid options: -# f - test file name (without extension) -# n - test class name -# m - test method name -# a - architecture -# c - compiler path -# The default is to write all fields. -session_file_format = 'fnmac' - # Set this flag if there is any session info dumped during the test run. sdir_has_content = False # svn_info stores the output from 'svn info lldb.base.dir'. diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index 7c0a9ec56fce..64a197872f9e 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -388,14 +388,6 @@ def parseOptionsAndInitTestdirs(): usage(parser)
[llvm-branch-commits] [lldb] 6face91 - [lldb][import-std-module] Add a test for typedef'd std types
Author: Raphael Isemann Date: 2020-12-08T13:36:13+01:00 New Revision: 6face9119c811e06cfb284755953ba6cdbdaa22b URL: https://github.com/llvm/llvm-project/commit/6face9119c811e06cfb284755953ba6cdbdaa22b DIFF: https://github.com/llvm/llvm-project/commit/6face9119c811e06cfb284755953ba6cdbdaa22b.diff LOG: [lldb][import-std-module] Add a test for typedef'd std types Added: Modified: lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py lldb/test/API/commands/expression/import-std-module/vector/main.cpp Removed: diff --git a/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py index 9a186e7a2243..a03c347a728f 100644 --- a/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py @@ -87,3 +87,13 @@ def test(self): ValueCheck(value="4"), ValueCheck(value="5") ]) + +# Test that the typedef'd vector type can be substituted. +self.expect("expr b.emplace_back(6)") +self.expect_expr("b", result_type="vector_long", + result_children=[ + ValueCheck(value="3"), + ValueCheck(value="1"), + ValueCheck(value="2"), + ValueCheck(value="6"), + ]) diff --git a/lldb/test/API/commands/expression/import-std-module/vector/main.cpp b/lldb/test/API/commands/expression/import-std-module/vector/main.cpp index edf130d47488..668b59181d42 100644 --- a/lldb/test/API/commands/expression/import-std-module/vector/main.cpp +++ b/lldb/test/API/commands/expression/import-std-module/vector/main.cpp @@ -1,6 +1,8 @@ #include +typedef std::vector vector_long; int main(int argc, char **argv) { std::vector a = {3, 1, 2}; + vector_long b = {3, 1, 2}; return 0; // Set break point at this line. } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] a2c157e - [cmake] Make ExecutionEngine/Orc/Shared depend on intrinsics_gen to fix modules build
Author: Raphael Isemann Date: 2020-12-08T20:41:35+01:00 New Revision: a2c157eb3ebc5ed7e8037f7942991bd344a882cc URL: https://github.com/llvm/llvm-project/commit/a2c157eb3ebc5ed7e8037f7942991bd344a882cc DIFF: https://github.com/llvm/llvm-project/commit/a2c157eb3ebc5ed7e8037f7942991bd344a882cc.diff LOG: [cmake] Make ExecutionEngine/Orc/Shared depend on intrinsics_gen to fix modules build The LLVM_ENABLE_MODULES builds currently randomly fail due depending on the headers generated by the intrinsics_gen target, but the current dependency only model the non-modules dependencies: ``` While building module 'LLVM_ExecutionEngine' imported from llvm-project/llvm/lib/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.cpp:13: While building module 'LLVM_intrinsic_gen' imported from llvm-project/llvm/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h:17: In file included from :1: In file included from llvm-project/llvm/include/llvm/IR/Argument.h:18: llvm/include/llvm/IR/Attributes.h:75:14: fatal error: 'llvm/IR/Attributes.inc' file not found #include "llvm/IR/Attributes.inc" ^~~~ ``` Depending on whether intrinsics_gen runs before compiling Orc/Shared files we either fail or include an outdated Attributes.inc in module builds. The Clang modules require these additional dependencies as including/importing one module requires all includes headers by that module to be parsable. Differential Revision: https://reviews.llvm.org/D92873 Added: Modified: llvm/lib/ExecutionEngine/Orc/Shared/CMakeLists.txt Removed: diff --git a/llvm/lib/ExecutionEngine/Orc/Shared/CMakeLists.txt b/llvm/lib/ExecutionEngine/Orc/Shared/CMakeLists.txt index 808408c0e5df..62da0c71fb3f 100644 --- a/llvm/lib/ExecutionEngine/Orc/Shared/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/Orc/Shared/CMakeLists.txt @@ -5,6 +5,9 @@ add_llvm_component_library(LLVMOrcShared ADDITIONAL_HEADER_DIRS ${LLVM_MAIN_INCLUDE_DIR}/llvm/ExecutionEngine/Orc + DEPENDS + intrinsics_gen + LINK_COMPONENTS Support ) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 199ec40 - [lldb][NFC] Refactor _get_bool_config_skip_if_decorator
Author: Raphael Isemann Date: 2020-12-09T20:02:06+01:00 New Revision: 199ec40e7bcc8548282d803b1a43b1ae1d3b57ce URL: https://github.com/llvm/llvm-project/commit/199ec40e7bcc8548282d803b1a43b1ae1d3b57ce DIFF: https://github.com/llvm/llvm-project/commit/199ec40e7bcc8548282d803b1a43b1ae1d3b57ce.diff LOG: [lldb][NFC] Refactor _get_bool_config_skip_if_decorator NFC preparation for another patch. Also add some documentation for why the error value is true (and not false). Added: Modified: lldb/packages/Python/lldbsuite/test/decorators.py Removed: diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index 2013c5241007..bcf665f6cc4c 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -830,11 +830,20 @@ def skipIfAsan(func): """Skip this test if the environment is set up to run LLDB *itself* under ASAN.""" return skipTestIfFn(is_running_under_asan)(func) -def _get_bool_config_skip_if_decorator(key): +def _get_bool_config(key, fail_value = True): +""" +Returns the current LLDB's build config value. +:param key The key to lookup in LLDB's build configuration. +:param fail_value The error value to return when the key can't be found. + Defaults to true so that if an unknown key is lookup up we rather + enable more tests (that then fail) than silently skipping them. +""" config = lldb.SBDebugger.GetBuildConfiguration() value_node = config.GetValueForKey(key) -fail_value = True # More likely to notice if something goes wrong -have = value_node.GetValueForKey("value").GetBooleanValue(fail_value) +return value_node.GetValueForKey("value").GetBooleanValue(fail_value) + +def _get_bool_config_skip_if_decorator(key): +have = _get_bool_config(key) return unittest2.skipIf(not have, "requires " + key) def skipIfCursesSupportMissing(func): ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 4df4edb - [lldb][NFC] Fix a typo in TestCppMultipleInheritance
Author: Raphael Isemann Date: 2020-12-10T10:56:46+01:00 New Revision: 4df4edb6ad14c7748acda8670944cde19d537621 URL: https://github.com/llvm/llvm-project/commit/4df4edb6ad14c7748acda8670944cde19d537621 DIFF: https://github.com/llvm/llvm-project/commit/4df4edb6ad14c7748acda8670944cde19d537621.diff LOG: [lldb][NFC] Fix a typo in TestCppMultipleInheritance Added: Modified: lldb/test/API/lang/cpp/multiple-inheritance/TestCppMultipleInheritance.py Removed: diff --git a/lldb/test/API/lang/cpp/multiple-inheritance/TestCppMultipleInheritance.py b/lldb/test/API/lang/cpp/multiple-inheritance/TestCppMultipleInheritance.py index defd4bd5df5f..bc2b7a5f95b0 100644 --- a/lldb/test/API/lang/cpp/multiple-inheritance/TestCppMultipleInheritance.py +++ b/lldb/test/API/lang/cpp/multiple-inheritance/TestCppMultipleInheritance.py @@ -9,7 +9,7 @@ class TestCase(TestBase): def test(self): self.build() -lldbutil.run_to_source_breakpoint(self,"// break here", lldb.SBFileSpec("main.cpp")) +lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp")) # Member access self.expect_expr("C.Base1::m_base", result_type="int", result_value="11") ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 9586082 - [lldb] Allow LLDB to automatically retry a failed expression with an imported std C++ module
Author: Raphael Isemann Date: 2020-12-10T12:29:17+01:00 New Revision: 958608285eb4d04c6e3dc7071fa429b43597585b URL: https://github.com/llvm/llvm-project/commit/958608285eb4d04c6e3dc7071fa429b43597585b DIFF: https://github.com/llvm/llvm-project/commit/958608285eb4d04c6e3dc7071fa429b43597585b.diff LOG: [lldb] Allow LLDB to automatically retry a failed expression with an imported std C++ module By now LLDB can import the 'std' C++ module to improve expression evaluation, but there are still a few problems to solve before we can do this by default. One is that importing the C++ module is slightly slower than normal expression evaluation (mostly because the disk access and loading the initial lookup data is quite slow in comparison to the barebone Clang setup the rest of the LLDB expression evaluator is usually doing). Another problem is that some complicated types in the standard library aren't fully supported yet by the ASTImporter, so we end up types that fail to import (which usually appears to the user as if the type is empty or there is just no result variable). To still allow people to adopt this mode in their daily debugging, this patch adds a setting that allows LLDB to automatically retry failed expression with a loaded C++ module. All success expressions will behave exactly as they would do before this patch. Failed expressions get a another parse attempt if we find a usable C++ module in the current execution context. This way we shouldn't have any performance/parsing regressions in normal debugging workflows, while the debugging workflows involving STL containers benefit from the C++ module type info. This setting is off by default for now with the intention to enable it by default on macOS soon-ish. The implementation is mostly just extracting the existing parse logic into its own function and then calling the parse function again if the first evaluation failed and we have a C++ module to retry the parsing with. Reviewed By: shafik, JDevlieghere, aprantl Differential Revision: https://reviews.llvm.org/D92784 Added: lldb/test/API/commands/expression/import-std-module/retry-with-std-module/Makefile lldb/test/API/commands/expression/import-std-module/retry-with-std-module/TestRetryWithStdModule.py lldb/test/API/commands/expression/import-std-module/retry-with-std-module/main.cpp Modified: lldb/include/lldb/Target/Target.h lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h lldb/source/Target/Target.cpp lldb/source/Target/TargetProperties.td Removed: diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index 47568c9e4429..69baefb964b0 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -65,6 +65,12 @@ enum LoadDependentFiles { eLoadDependentsNo, }; +enum ImportStdModule { + eImportStdModuleFalse, + eImportStdModuleFallback, + eImportStdModuleTrue, +}; + class TargetExperimentalProperties : public Properties { public: TargetExperimentalProperties(); @@ -135,7 +141,7 @@ class TargetProperties : public Properties { bool GetEnableAutoImportClangModules() const; - bool GetEnableImportStdModule() const; + ImportStdModule GetImportStdModule() const; bool GetEnableAutoApplyFixIts() const; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp index a28b4a7fb42c..9be294750fa0 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -417,7 +417,6 @@ void ClangUserExpression::CreateSourceCode( DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, std::vector modules_to_import, bool for_completion) { - m_filename = m_clang_state->GetNextExprFileName(); std::string prefix = m_expr_prefix; if (m_options.GetExecutionPolicy() == eExecutionPolicyTopLevel) { @@ -477,9 +476,6 @@ CppModuleConfiguration GetModuleConfig(lldb::LanguageType language, if (!target) return LogConfigError("No target"); - if (!target->GetEnableImportStdModule()) -return LogConfigError("Importing std module not enabled in settings"); - StackFrame *frame = exe_ctx.GetFramePtr(); if (!frame) return LogConfigError("No frame"); @@ -529,8 +525,6 @@ CppModuleConfiguration GetModuleConfig(lldb::LanguageType language, bool ClangUserExpression::PrepareForParsing( DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, bool for_completion) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - InstallContext(exe_ctx); if (!SetupPersistentState(diagnostic_manager, exe_ctx)) @@ -551,50 +545,20 @@ bool ClangUserExpression::PrepareForPars
[llvm-branch-commits] [lldb] 208e3f5 - [lldb] Fix that symbols.clang-modules-cache-path is never initialized
Author: Raphael Isemann Date: 2020-12-10T13:37:40+01:00 New Revision: 208e3f5d9b6c172f65dbb9cdbc9354c81c6d8911 URL: https://github.com/llvm/llvm-project/commit/208e3f5d9b6c172f65dbb9cdbc9354c81c6d8911 DIFF: https://github.com/llvm/llvm-project/commit/208e3f5d9b6c172f65dbb9cdbc9354c81c6d8911.diff LOG: [lldb] Fix that symbols.clang-modules-cache-path is never initialized LLDB is supposed to ask the Clang Driver what the default module cache path is and then use that value as the default for the `symbols.clang-modules-cache-path` setting. However, we use the property type `String` to change `symbols.clang-modules-cache-path` even though the type of that setting is `FileSpec`, so the setter will simply do nothing and return `false`. We also don't check the return value of the setter, so this whole code ends up not doing anything at all. This changes the setter to use the correct property type and adds an assert that we actually successfully set the default path. Also adds a test that checks that the default value for this setting is never unset/empty path as this would effectively disable the import-std-module feature from working by default. Reviewed By: JDevlieghere, shafik Differential Revision: https://reviews.llvm.org/D92772 Added: lldb/test/Shell/Settings/TestDefaultModuleCachePath.test Modified: lldb/include/lldb/Core/ModuleList.h lldb/source/Core/ModuleList.cpp lldb/test/Shell/helper/toolchain.py Removed: diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index d90b27e474ac..1609f0f77c56 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -56,7 +56,7 @@ class ModuleListProperties : public Properties { ModuleListProperties(); FileSpec GetClangModulesCachePath() const; - bool SetClangModulesCachePath(llvm::StringRef path); + bool SetClangModulesCachePath(const FileSpec &path); bool GetEnableExternalLookup() const; bool SetEnableExternalLookup(bool new_value); diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index cf276ba65931..b6e1ceb40889 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -82,8 +82,9 @@ ModuleListProperties::ModuleListProperties() { [this] { UpdateSymlinkMappings(); }); llvm::SmallString<128> path; - clang::driver::Driver::getDefaultModuleCachePath(path); - SetClangModulesCachePath(path); + if (clang::driver::Driver::getDefaultModuleCachePath(path)) { +lldbassert(SetClangModulesCachePath(FileSpec(path))); + } } bool ModuleListProperties::GetEnableExternalLookup() const { @@ -104,8 +105,8 @@ FileSpec ModuleListProperties::GetClangModulesCachePath() const { ->GetCurrentValue(); } -bool ModuleListProperties::SetClangModulesCachePath(llvm::StringRef path) { - return m_collection_sp->SetPropertyAtIndexAsString( +bool ModuleListProperties::SetClangModulesCachePath(const FileSpec &path) { + return m_collection_sp->SetPropertyAtIndexAsFileSpec( nullptr, ePropertyClangModulesCachePath, path); } diff --git a/lldb/test/Shell/Settings/TestDefaultModuleCachePath.test b/lldb/test/Shell/Settings/TestDefaultModuleCachePath.test new file mode 100644 index ..80dc0f25ce58 --- /dev/null +++ b/lldb/test/Shell/Settings/TestDefaultModuleCachePath.test @@ -0,0 +1,9 @@ +# RUN: %lldb-noinit -x -s %s | FileCheck %s +settings show symbols.clang-modules-cache-path +q +# This test checks that we get *any* clang modules cache path by default. The +# actual path depends on the operating system. +# CHECK: symbols.clang-modules-cache-path (file) = " +# Clang treats an empty path in the same way as 'no path', so explicitly check +# that we never have an empty path by default. +# CHECK-NOT: symbols.clang-modules-cache-path (file) = "" diff --git a/lldb/test/Shell/helper/toolchain.py b/lldb/test/Shell/helper/toolchain.py index ebf9e03d81a0..59b078411c1c 100644 --- a/lldb/test/Shell/helper/toolchain.py +++ b/lldb/test/Shell/helper/toolchain.py @@ -54,6 +54,10 @@ def use_lldb_substitutions(config): command=FindTool('lldb'), extra_args=['-S', lldb_init], unresolved='fatal'), +ToolSubst('%lldb-noinit', + command=FindTool('lldb'), + extra_args=['--no-lldbinit'], + unresolved='fatal'), ToolSubst('%lldb-server', command=FindTool("lldb-server"), extra_args=[], ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lldb] 839e845 - [lldb] Remove assumption from Clang-based data formatters that their types are in the scratch AST
Author: Raphael Isemann Date: 2020-12-10T17:35:03+01:00 New Revision: 839e845277894ad37fbca8063cbf1955331fbeff URL: https://github.com/llvm/llvm-project/commit/839e845277894ad37fbca8063cbf1955331fbeff DIFF: https://github.com/llvm/llvm-project/commit/839e845277894ad37fbca8063cbf1955331fbeff.diff LOG: [lldb] Remove assumption from Clang-based data formatters that their types are in the scratch AST Several data formatters assume their types are in the Target's scratch AST and build new types from that scratch AST instance. However, types from different ASTs shouldn't be mixed, so this (unchecked) assumption may lead to problems if we ever have more than one scratch AST or someone somehow invokes data formatters on a type that are not in the scratch AST. Instead we can use in all the formatters just the TypeSystem of the type we're formatting. That's much simpler and avoids all the headache of finding the right TypeSystem that matches the one of the formatted type. Right now LLDB only has one scratch TypeSystemClang instance and we format only types that are in the scratch AST, so this doesn't change anything in the current way LLDB works. The intention here is to allow follow up refactorings that introduce multiple scratch ASTs with the same Target. Differential Revision: https://reviews.llvm.org/D92757 Added: Modified: lldb/source/DataFormatters/VectorType.cpp lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp lldb/source/Plugins/Language/ObjC/CoreMedia.cpp Removed: diff --git a/lldb/source/DataFormatters/VectorType.cpp b/lldb/source/DataFormatters/VectorType.cpp index fd1c0bc96cd4..cc24bb1de428 100644 --- a/lldb/source/DataFormatters/VectorType.cpp +++ b/lldb/source/DataFormatters/VectorType.cpp @@ -220,20 +220,8 @@ class VectorTypeSyntheticFrontEnd : public SyntheticChildrenFrontEnd { CompilerType parent_type(m_backend.GetCompilerType()); CompilerType element_type; parent_type.IsVectorType(&element_type, nullptr); -TypeSystem *type_system = nullptr; -if (auto target_sp = m_backend.GetTargetSP()) { - auto type_system_or_err = - target_sp->GetScratchTypeSystemForLanguage(lldb::eLanguageTypeC); - if (auto err = type_system_or_err.takeError()) { -LLDB_LOG_ERROR( -lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS), -std::move(err), "Unable to update from scratch TypeSystem"); - } else { -type_system = &type_system_or_err.get(); - } -} -m_child_type = -::GetCompilerTypeForFormat(m_parent_format, element_type, type_system); +m_child_type = ::GetCompilerTypeForFormat(m_parent_format, element_type, + parent_type.GetTypeSystem()); m_num_children = ::CalculateNumChildren(parent_type, m_child_type); m_item_format = GetItemFormatForFormat(m_parent_format, m_child_type); return false; diff --git a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp index 42f6bd9ffb7b..35788a6445c2 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp @@ -50,11 +50,7 @@ class BlockPointerSyntheticFrontEnd : public SyntheticChildrenFrontEnd { } TypeSystemClang *clang_ast_context = -llvm::dyn_cast(&type_system_or_err.get()); - -if (!clang_ast_context) { - return; -} +llvm::cast(block_pointer_type.GetTypeSystem()); std::shared_ptr clang_ast_importer; auto *state = target_sp->GetPersistentExpressionStateForLanguage( diff --git a/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp b/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp index ac2f45b8354f..efc80cc75557 100644 --- a/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp +++ b/lldb/source/Plugins/Language/ObjC/CoreMedia.cpp @@ -25,21 +25,12 @@ bool lldb_private::formatters::CMTimeSummaryProvider( if (!type.IsValid()) return false; - auto type_system_or_err = - valobj.GetExecutionContextRef() - .GetTargetSP() - ->GetScratchTypeSystemForLanguage(lldb::eLanguageTypeC); - if (auto err = type_system_or_err.takeError()) { -LLDB_LOG_ERROR( -lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS), -std::move(err), "Failed to get scratch type system"); -return false; - } + TypeSystem *type_system = type.GetTypeSystem(); // fetch children by offset to compensate for potential lack of debug info - auto int64_ty = type_system_or_err->GetBuiltinTypeForEncodingAndBitSize( - eEncodingSint, 64); - auto int32_ty = type_system_or_err->GetBuiltinTypeForEncodingAndBitSize( - eEncodingSint, 32); + auto int64_ty = + type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 64); + auto int32_ty = + type_syst
[llvm-branch-commits] [lldb] 47e7ecd - [lldb] Introduce separate scratch ASTs for debug info types and types imported from C++ modules.
Author: Raphael Isemann Date: 2020-12-10T19:28:01+01:00 New Revision: 47e7ecdd7d36ca0924aa89c0fb2d956a6345a8f5 URL: https://github.com/llvm/llvm-project/commit/47e7ecdd7d36ca0924aa89c0fb2d956a6345a8f5 DIFF: https://github.com/llvm/llvm-project/commit/47e7ecdd7d36ca0924aa89c0fb2d956a6345a8f5.diff LOG: [lldb] Introduce separate scratch ASTs for debug info types and types imported from C++ modules. Right now we have one large AST for all types in LLDB. All ODR violations in types we reconstruct are resolved by just letting the ASTImporter handle the conflicts (either by merging types or somehow trying to introduce a duplicated declaration in the AST). This works ok for the normal types we build from debug information as most of them are just simple CXXRecordDecls or empty template declarations. However, with a loaded `std` C++ module we have alternative versions of pretty much all declarations in the `std` namespace that are much more fleshed out than the debug information declarations. They have all the information that is lost when converting to DWARF, such as default arguments, template default arguments, the actual uninstantiated template declarations and so on. When we merge these C++ module types into the big scratch AST (that might already contain debug information types) we give the ASTImporter the tricky task of somehow creating a consistent AST out of all these declarations. Usually this ends in a messy AST that contains a mostly broken mix of both module and debug info declarations. The ASTImporter in LLDB is also importing types with the MinimalImport setting, which usually means the only information we have when merging two types is often just the name of the declaration and the information that it contains some child declarations. This makes it pretty much impossible to even implement a better merging logic (as the names of C++ module declarations and debug info declarations are identical). This patch works around this whole merging problem by separating C++ module types from debug information types. This is done by splitting up the single scratch AST into two: One default AST for debug information and a dedicated AST for C++ module types. The C++ module AST is implemented as a 'specialised AST' that lives within the default ScratchTypeSystemClang. When we select the scratch AST we can explicitly request that we want such a isolated sub-AST of the scratch AST. I kept the infrastructure more general as we probably can use the same mechanism for other features that introduce conflicting types (such as programs that are compiled with a custom -wchar-size= option). There are just two places where we explicitly have request the C++ module AST: When we export persistent declarations (`$mytype`) and when we create our persistent result variable (`$0`, `$1`, ...). There are a few formatters that were previously assuming that there is only one scratch AST which I cleaned up in a preparation revision here (D92757). Reviewed By: aprantl Differential Revision: https://reviews.llvm.org/D92759 Added: lldb/test/API/commands/expression/import-std-module/non-module-type-separation/Makefile lldb/test/API/commands/expression/import-std-module/non-module-type-separation/TestNonModuleTypeSeparation.py lldb/test/API/commands/expression/import-std-module/non-module-type-separation/main.cpp Modified: lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h lldb/unittests/Symbol/TestTypeSystemClang.cpp Removed: diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp index 66a87ba924db..3edbc4ab98c0 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -443,7 +443,9 @@ void ASTResultSynthesizer::CommitPersistentDecls() { return; auto *persistent_vars = llvm::cast(state); - TypeSystemClang *scratch_ctx = ScratchTypeSystemClang::GetForTarget(m_target); + + TypeSystemClang *scratch_ctx = ScratchTypeSystemClang::GetForTarget( + m_target, m_ast_context->getLangOpts()); for (clang::NamedDecl *decl : m_decls) { StringRef name = decl->getName(); diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp index cf34d9359f11..79ee565a3fdd 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang
[llvm-branch-commits] [clang] 22ccdb7 - Revert "Consider reference, pointer, and pointer-to-member TemplateArguments to be different if they have different types."
Author: Raphael Isemann Date: 2020-12-14T14:03:38+01:00 New Revision: 22ccdb787024e954318e35fcf904fd4fa36f5679 URL: https://github.com/llvm/llvm-project/commit/22ccdb787024e954318e35fcf904fd4fa36f5679 DIFF: https://github.com/llvm/llvm-project/commit/22ccdb787024e954318e35fcf904fd4fa36f5679.diff LOG: Revert "Consider reference, pointer, and pointer-to-member TemplateArguments to be different if they have different types." This reverts commit 05cdf4acf42acce9ddcff646a5d6ac666710fe6d. It breaks stage-2 compilation of LLVM, see https://reviews.llvm.org/D91488#2451534 Added: Modified: clang/include/clang/Basic/LangOptions.h clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/StmtProfile.cpp clang/lib/AST/TemplateBase.cpp clang/test/CodeGenCXX/clang-abi-compat.cpp clang/test/CodeGenCXX/mangle-class-nttp.cpp clang/test/CodeGenCXX/mangle-template.cpp clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp Removed: diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h index 251c9a9ecb5d..203c45fdd9a7 100644 --- a/clang/include/clang/Basic/LangOptions.h +++ b/clang/include/clang/Basic/LangOptions.h @@ -155,10 +155,8 @@ class LangOptions : public LangOptionsBase { /// Attempt to be ABI-compatible with code generated by Clang 11.0.x /// (git 2e10b7a39b93). This causes clang to pass unions with a 256-bit -/// vector member on the stack instead of using registers, to not properly -/// mangle substitutions for template names in some cases, and to mangle -/// declaration template arguments without a cast to the parameter type -/// even when that can lead to mangling collisions. +/// vector member on the stack instead of using registers, and to not +/// properly mangle substitutions for template names in some cases. Ver11, /// Conform to the underlying platform's C and C++ ABIs as closely diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index fe4968052e17..f5a4f6708c83 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -551,15 +551,13 @@ class CXXNameMangler { void mangleCXXCtorType(CXXCtorType T, const CXXRecordDecl *InheritedFrom); void mangleCXXDtorType(CXXDtorType T); - void mangleTemplateArgs(TemplateName TN, - const TemplateArgumentLoc *TemplateArgs, + void mangleTemplateArgs(const TemplateArgumentLoc *TemplateArgs, unsigned NumTemplateArgs); - void mangleTemplateArgs(TemplateName TN, const TemplateArgument *TemplateArgs, + void mangleTemplateArgs(const TemplateArgument *TemplateArgs, unsigned NumTemplateArgs); - void mangleTemplateArgs(TemplateName TN, const TemplateArgumentList &AL); - void mangleTemplateArg(TemplateArgument A, bool NeedExactType); - void mangleValueInTemplateArg(QualType T, const APValue &V, bool TopLevel, -bool NeedExactType = false); + void mangleTemplateArgs(const TemplateArgumentList &AL); + void mangleTemplateArg(TemplateArgument A); + void mangleValueInTemplateArg(QualType T, const APValue &V); void mangleTemplateParameter(unsigned Depth, unsigned Index); @@ -825,11 +823,6 @@ isTemplate(GlobalDecl GD, const TemplateArgumentList *&TemplateArgs) { return GlobalDecl(); } -static TemplateName asTemplateName(GlobalDecl GD) { - const TemplateDecl *TD = dyn_cast_or_null(GD.getDecl()); - return TemplateName(const_cast(TD)); -} - void CXXNameMangler::mangleName(GlobalDecl GD) { const NamedDecl *ND = cast(GD.getDecl()); if (const VarDecl *VD = dyn_cast(ND)) { @@ -906,7 +899,7 @@ void CXXNameMangler::mangleNameWithAbiTags(GlobalDecl GD, const TemplateArgumentList *TemplateArgs = nullptr; if (GlobalDecl TD = isTemplate(GD, TemplateArgs)) { mangleUnscopedTemplateName(TD, AdditionalAbiTags); - mangleTemplateArgs(asTemplateName(TD), *TemplateArgs); + mangleTemplateArgs(*TemplateArgs); return; } @@ -959,7 +952,7 @@ void CXXNameMangler::mangleTemplateName(const TemplateDecl *TD, if (DC->isTranslationUnit() || isStdNamespace(DC)) { mangleUnscopedTemplateName(TD, nullptr); -mangleTemplateArgs(asTemplateName(TD), TemplateArgs, NumTemplateArgs); +mangleTemplateArgs(TemplateArgs, NumTemplateArgs); } else { mangleNestedName(TD, TemplateArgs, NumTemplateArgs); } @@ -1109,8 +1102,7 @@ void CXXNameMangler::manglePrefix(QualType type) { // FIXME: GCC does not appear to mangle the template arguments when // the template in question is a dependent template name. Should we // emulate that badness? - mangleTemplateArgs(TST->getTemplateName(), TST->getArgs(), - TST->getNumArgs()); + mangleTemplateArgs(TST->getArgs(), TST->getNumArgs()); addSubstitution(QualType
[llvm-branch-commits] [llvm] 3a91c12 - [docs] Add some LLDB release notes
Author: Raphael Isemann Date: 2020-02-21T12:02:35+01:00 New Revision: 3a91c12e7aa4c84026f2952f7f03857eb9510a52 URL: https://github.com/llvm/llvm-project/commit/3a91c12e7aa4c84026f2952f7f03857eb9510a52 DIFF: https://github.com/llvm/llvm-project/commit/3a91c12e7aa4c84026f2952f7f03857eb9510a52.diff LOG: [docs] Add some LLDB release notes Added: Modified: llvm/docs/ReleaseNotes.rst Removed: diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst index 20e49b20f95d..9c4bb3c33f03 100644 --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -254,6 +254,15 @@ Changes to LLDB * Initial support for debugging Windows ARM and ARM64 binaries +* Improved error messages in the expression evaluator. + +* Tab completions for command options now also provide a description for each option. + +* Fixed that printing structs/classes with the `expression` command sometimes did not + print the members/contents of the class. + +* Improved support for using classes with bit-field members in the expression evaluator. + External Open Source Projects Using LLVM 10 === ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits