Commit Graph

96 Commits

Author SHA1 Message Date
Tony Allevato
5284cb6f99 Add dependencies where targets depend on inclusions from unspecified targets.
A follow-up PR adds a flag to control an inline namespace that allows
symbols in libDemangling to be distinguished between the runtime and
the compiler. These dependencies ensure that the flag is plumbed
through for inclusions of Demangling headers that aren't already
covered by existing `target_link_libraries`.
2020-03-31 09:19:41 -07:00
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00
Arnold Schwaighofer
43c24be5cd Merge remote-tracking branch 'upstream/master' into master-next 2020-01-08 06:41:34 -08:00
Kita, Maksim
b7cb3b67bf SR-11889: Using Located<T> instead of std::pair<SourceLoc, T> 2019-12-20 17:18:58 +03:00
swift-ci
ef8a0d15a5 Merge remote-tracking branch 'origin/master' into master-next 2019-08-16 08:50:45 -07:00
swift-ci
4aefbcf447 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-16 08:43:42 -07:00
Adrian Prantl
1020d8188a Add back the dummy DWARFImporter test to lldb-moduleimport-test. 2019-08-15 16:35:05 -07:00
Alex Langford
04c5ceb18c Adjust for svn r368826
LLVM svn r368826 changed the SectionRef::getName() interface to return an
Expected<StringRef> instead of filling out one that is passed to it.
Adjust accordingly.
2019-08-15 10:56:06 -07:00
swift-ci
032def3316 Merge remote-tracking branch 'origin/master' into master-next 2019-08-14 11:50:24 -07:00
swift-ci
7245d76875 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-14 11:44:30 -07:00
Adrian Prantl
c08a62764a Move DWARFImporterDelegate into ClangImporter and remove DWARFImporter.
This refactors DWARFImporter to become a part of ClangImporter, since
it needs access to many of its implementation details anyway. The
DWARFImporterDelegate is just another mechanism for deserializing
Clang ASTs and once we have a Clang AST, the processing is effectively
the same.
2019-08-14 10:28:50 -07:00
swift-ci
24d2d5fd7a Merge remote-tracking branch 'origin/master' into master-next 2019-06-14 13:09:28 -07:00
Saleem Abdulrasool
f33fa6b037 lldb-module-test: correct the output pipe
Use the error stream for error messages.
2019-05-22 07:56:12 -07:00
Gwen Mittertreiner
67cfef2d60 SectionRef::getContents() now returns Expected
Updated uses of object::SectionRef::getContents() since it now returns
an Expected<StringRef> instead of modifying the one it's passed.

See also: git-svn-id:
https://llvm.org/svn/llvm-project/llvm/trunk@360892
91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-20 16:02:41 -07:00
Adrian Prantl
807c2cfbe3 Make lldb-moduleimport more rubost when importing object files with multiple AST
blobs.
2019-05-08 11:34:21 -07:00
Adrian Prantl
b244b0928e Factor out the pre-registered MemoryBuffer functionality
form SerializedModuleLoader into its own ModuleLoader class. (NFC-ish)

This gives better control over the order in which the various module
load mechanisms are applied.
2019-04-22 09:17:08 -07:00
Saleem Abdulrasool
1fad3d60e0 lldb-moduleimport-test: handle COFF properly
lldb-moduleimport-test would only check for MachO and ELF object file
formats.  However, Windows uses COFF object files.  Add that to the list
of formats that we check.  This allows us to inspect content built for
Windows.
2019-03-22 13:13:48 -07:00
Slava Pestov
d0d5fbdf39 ASTDemangler: Introduce new getTypeDeclForMangling()
This will replace getDeclFromMangledSymbolName().

Progress on <rdar://problem/47819208>.
2019-02-22 16:13:02 -05:00
Slava Pestov
b2f0327516 IDE: Remove getTypeFromMangledSymbolname()
There was only one remaining usage other than in testing tools.

Note that when a declaration mangling was passed in, the old entry
point would (try to) return the type of the declaration.

The new entry point no longer has this behavior. I changed the
bridging-header-first test to run lldb-moduleimport-test with
-decl-from-mangled instead of -type-from-mangled-old to preserve
the behavior of the test.

Also, I removed test/DebugInfo/DumpTypeFromMangledName.swift
completely. This test only covered a handful of cases, and a bunch
of them were declaration manglings rather than type manglings.
The new tests in test/TypeDecoder/ are much more comprehensive.
2019-02-08 02:56:05 -05:00
Slava Pestov
9c8a5b599e ASTDemangler: Fix demangling of weak/unowned/unowned(unsafe)
The check here was incorrect because we might have an optional of a
reference type as well. Just remove the check to keep things simple.
2019-01-29 21:57:06 -05:00
Slava Pestov
a14f345c82 lldb-moduleimport-test: Add support for testing Demangle::getTypeForMangling()
The -type-from-mangled flag now uses the new API. The -type-from-mangled-old flag
uses the old API, ide::getTypeFromMangledSymbolname().

For now, just change all existing tests to use the -type-from-mangled-old flag;
I'll be adding new tests for the new API shortly.
2019-01-25 21:44:02 -05:00
Innovimax
335fe49b0e fix typo (#21473) 2018-12-20 21:37:55 -05:00
Adrian Prantl
d63debeb60 Experimental: Extend ClangImporter to import clang modules from DWARF
When debugging Objective-C or C++ code on Darwin, the debug info
collected by dsymutil in the .dSYM bundle is entirely
self-contained. It is possible to debug a program, set breakpoints and
print variables even without having the complete original source code
or a matching SDK available. With Swift, this is currently not the
case. Even though .dSYM bundles contain the binary .swiftmodule for
all Swift modules, any Clang modules that the Swift modules depend on,
still need to be imported from source to even get basic LLDB
functionality to work. If ClangImporter fails to import a Clang
module, effectively the entire Swift module depending on it gets
poisoned.

This patch is addressing this issue by introducing a ModuleLoader that
can ask queries about Clang Decls to LLDB, since LLDB knows how to
reconstruct Clang decls from DWARF and clang -gmodules producxes full
debug info for Clang modules that is embedded into the .dSYM budle.

This initial version does not contain any advanced functionality at
all, it merely produces an empty ModuleDecl. Intertestingly, even this
is a considerable improvement over the status quo. LLDB can now print
Swift-only variables in modules with failing Clang depenecies, and
becuase of fallback mechanisms that were implemented earlier, it can
even display the contents of pure Objective-C objects that are
imported into Swift. C structs obviously don't work yet.

rdar://problem/36032653
2018-12-05 13:54:13 -08:00
Saleem Abdulrasool
dd85d79105 tools: use target_link_libraries like clang (NFC)
Rather than using the `LINK_LIBRARIES` option, use target_link_libraries
like clang does.  Because these are all host tools, there is no name
mangling done for the libraries making this a no-op change.
2018-11-16 17:43:06 -08:00
swift-ci
8fb811262f Merge pull request #20577 from adrian-prantl/cl 2018-11-15 13:55:44 -08:00
Saleem Abdulrasool
e3e4d1ba0b tools: remove unnecessary LLVM_COMPONENT linkage
Remove the unncessary link against the DebugInfoCodeView component.  THe tools
seem to build without the dependency.  The dependency issue in the linkage
seems to have been resolved.
2018-11-14 18:29:19 -08:00
Adrian Prantl
7e6713ed76 Hide irreleveant command line options of lldb-moduleimport-test 2018-11-14 12:18:43 -08:00
Adrian Prantl
97cbd3b1cf Deserialize Swift compatibility version in CompilerInvocation::loadFromSerializedAST()
LLDB needs the -swift-version because the -D__swift__ macro affects
how Clang modules are built. This currently has the really odd effect
that when debugging a Swift program that is not using the very latest
Swift version, the first "po" takes several seconds, because the
module cache needs to be rebuilt.

rdar://problem/40241256
2018-08-28 13:04:27 -07:00
Doug Gregor
7a6ad36c7f [lldb-moduleimport-test] Add support for -resource-dir option. 2018-06-26 13:48:13 -07:00
Fred Riss
ec1ca50d8a Change the component of lldb-moduleimport-test so that it gets installed in toolchians
rdar://problem/39112397
2018-06-17 18:46:55 -07:00
Davide Italiano
73d01b0fed [lldb-moduleimport-test] Improve error detection. 2018-05-14 12:16:12 -07:00
Davide Italiano
5c99c35d24 [lldb-moduleimport-test] Validate input to prevent crashes. 2018-04-17 11:22:15 -07:00
Davide Italiano
eeac130ea3 [lldb-moduleimport-test] Get informations from the module.
This now mirrors what lldb does, and allows us to test this
codepath outside of the debugger.

<rdar://problem/38867076>
2018-04-02 13:05:34 -07:00
Davide Italiano
1c6d19a33c [lldb-moduleimport-test] Remove unused options. NFCI.
<rdar://problem/38867076>
2018-04-02 11:50:12 -07:00
Davide Italiano
23d551e655 [lldb-moduleimport-test] Refactor the whole tool.
This is in preparation for fetching informations directly from
the module instead of specifying them on the cmdline. It will
serve us better as it will mimick more accurately the way lldb
is behaving.

This refactoring moves the validation of the modules earlier
so that we can use the validation info to create the CompileUnit.

<rdar://problem/38867076>
2018-03-30 18:04:02 -07:00
Davide Italiano
5e463b1bc0 [lldb-moduleimport-test] Pass a target triple as a stopgap solution.
We're going to infer all these informations from the module, but
that's a large refactoring task which I'm going to do next.
In the meanwhile, this should allow Adrian's work to be unblocked.

<rdar://problem/38720742>
2018-03-23 13:13:26 -07:00
Davide Italiano
9dbd966e73 [lldb-moduleimport] Add the logic for testing getDeclBySymbolName().
Adrian already found and reported a bug, which I'm going to fix
in a later commit. Eventually this will go away, but in the meanwhile,
we should add test for this codepath.

<rdar://problem/38720742>
2018-03-22 10:47:24 -07:00
Davide Italiano
8cd5e8026b [lldb-moduleimport-test] Address Jordan's post commit review comments. 2018-03-22 10:07:10 -07:00
Davide Italiano
92c4c492a2 [lldb-moduleimport-test] Refactor dump of types from mangled name.
In preparation for adding dump decl from mangled name.
2018-03-22 09:03:08 -07:00
Davide Italiano
9ccdbc1cfa [lldb-moduleimport-test] Introduce a --verbose flag.
<rdar://problem/38323564>
2018-03-15 14:49:48 -07:00
Davide Italiano
06ae7eeff5 [lldb-moduleimport-test] Add a way to test getTypeFromMangledSymbolName.
The only way we had to test this path was through swift-ide-test,
which takes an input a source file, instead of a serialized module.

This is not the scenario that lldb tests, hence this patch.

<rdar://problem/38323564>
2018-03-15 14:39:44 -07:00
Jordan Rose
3cd9f166bc Don't spend time initializing LLVM when running the driver (#14896)
Tiny start-up time optimization noticed while looking at how we do
PrettyStackTraceProgram. Also add PrettyStackTraceProgram to a few
more of our testing tools, via the new PROGRAM_START macro.
2018-02-28 19:56:19 -08:00
Argyrios Kyrtzidis
ca906d1e99 Add '-Fsystem' framework search option to indicate path for frameworks that should be treated as 'system'
This has the effect of propagating the search path to the clang importer as '-iframework'.
It doesn't affect whether a swift module is treated as system or not, this can be done as follow-up enhancement.
2017-02-14 16:13:25 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Michael Gottesman
fa1bb95923 Merge remote-tracking branch 'origin/master' into master-next 2016-08-30 19:50:12 -07:00
Michael Gottesman
7e2568dcf0 [cmake-components] Introduce a new API add_swift_host_tool for creating/initializing swift tool targets.
The main action here is to sink the creation of the installation rule for all of
the swift host tools into this API. In a latter commit, I will use this API to
create include and build rules for add_swift_host_tool.
2016-08-28 14:12:14 -07:00
Saleem Abdulrasool
2d50ed9ca3 [upstream-update] Link LLVMDebugInfoCodeView into 6 executable tools. (#4489)
All of these cases seem to need the symbols from LLVM's new CodeView library to
link.

The specific executables are:

1. Swift Driver.
2. SIL Extract.
3. SIL Opt.
4. Swift IDE Test.
5. Swift LLVM Opt.
6. LLDB Module Import Test
2016-08-26 02:20:45 -04:00
Michael Gottesman
7803a440f6 Use COMPONENT_DEPENDS instead of LINK_LIBRARIES when linking against llvm libraries. 2016-05-20 21:30:27 -07:00
Mark Lacey
859b779f15 Speculatively try a different fix for LLVMCoverage linker issues.
We're still hitting undefined symbols on Linux. Hopefully this clears
those up as well.
2016-05-06 17:02:22 -07:00