Skip to content

[pull] swiftwasm from swift/master #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 467 commits into from
Apr 22, 2020
Merged

[pull] swiftwasm from swift/master #6

merged 467 commits into from
Apr 22, 2020

Conversation

pull[bot]
Copy link

@pull pull bot commented Apr 22, 2020

See Commits and Changes for more details.


Created by pull[bot]. Want to support this open source service? Please star it : )

augusto2112 and others added 30 commits March 31, 2020 21:46
[Swift] Replace calls to FuncDecl::getName & EnumElementDecl::getName with ValueDecl::getBaseIdentifier
[20200108] [pch] Honour -fallow-pch-with-compiler-errors for overall compilation status
[debugserver/ARM64] Make sure watchpoints hit are attributed correctly.
Summary:
This change makes the labels on the x-axis of a comparison chart look
like: "0%", "(0%, 10%)", "[10%, 20%)", and so on.

Previously, each label was the same (a concatenation of all the possible
coverage buckets).

Reviewers: djtodoro

Subscribers: llvm-commits

Tags: #llvm

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

(cherry picked from commit 3a7865d)
…location verifier

The legalizer has a tendency to lose DebugLoc's when expanding or
combining instructions. The verifier that detected these isn't ready
for upstreaming yet but this patch fixes the cases that came up when
applying it to our out-of-tree backend's CodeGen tests.

This pattern comes up a few more times in this file and probably in
the backends too but I'd prefer to fix the others separately (and
preferably when the lost-location verifier detects them).

(cherry picked from commit e65e677)
Previously, this was reverted in bf65f19 becuase it checked whether
TARGET_OS_EMBEDDED is defined, but that macro is always defined.

Update the condition to check that TARGET_OS_OSX is true.

(cherry picked from commit f203100)
The message has a format specifier but was being printed unformatted.
This corrects the macro usage to use the formatting version.  Improves
the debug logging only.
I don't have a reproducer but the failing assert is that
LHS.isValid() && RHS.isValid() in SourceManager::isBeforeInTranslationUnit()
which is called from ASTSlice constructor.

We might be hitting some implicit declarations.

rdar://problem/59811864
…ion (#993)

* [Sema] Check that return and argument types of a virtual member function
are complete if the address of the member function is taken

If they aren't complete, reject the code.

rdar://problem/60888064

* Address review comments

Explain why the types must be complete when pointer authentication is
enabled. Check that virual function pointers aren't diagnosed in
unevaluated contexts. Change the variable and diagnostic names to
improve indentation.

* Check that a pointer to a virtual function pointer with a dependent
noexcept clause isn't diagnosed

Test virtual functions of templated classes.

(cherry picked from commit 7cd35e2)
Fix for locstats chart, target conditionals issue in Host.mm, and a dropped location bug
Target: print the message with formatting
[Sema] Check that return and argument types of a virtual member funct…
When a swiftmodule cannot be found, we may crash when attempting to find
the display name for a generic type.

rdar://59228966
Diagnostics from modules do not have a `main-file` listed.  Tweak
`clang-parse-diagnostics-file` to patch this up.  Previously, the call
to `os.path.basename` would crash.

Radar-Id: rdar://problem/59000292
This fixes a miscompile when the parameter is actually underaligned.
rdar://58316406

Differential revision: https://reviews.llvm.org/D74183

Conflicts:
	clang/test/CodeGen/systemz-abi.c
	clang/test/CodeGen/systemz-abi.cpp
	clang/test/CodeGen/wasm-arguments.c
	clang/test/CodeGenObjC/arc.m
[Refactor] Speculative fix for assert in isBeforeInTranslationUnit()
SwiftASTContext: Fix crash in GetArchetypeNames with missing debug info
that were not reported by the OS plugin.  To facilitate this, move
adding/updating the ThreadPlans for a Thread to the ThreadPlanStackMap.
Also move dumping thread plans there as well.

Added some tests for "thread plan list" and "thread plan discard" since
I didn't seem to have written any originally.

Differential Revision: https://reviews.llvm.org/D76814
clang with -flto does not handle -foptimization-record-path=<path>

This dulicates the code from ToolChains/Clang.cpp with modifications to
support everything in the same fashion.

(cherry picked from commit ba8b305)

rdar://61243768
Add some very basic support for `DoLoadImage` and `UnloadImage` for
Windows.  This was previously not implemented and would result in a
failure at runtime that is hard to detect.

This implementation is extremely limited but serves as a starting point
for proper support for loading a library. Ideally, the user input would
be converted from UTF-8 to UTF-16. This requires additional heap
allocations and conversion logic. Error recovery there requires
additional allocations both from the local heap and the global heap.

This support enables the use of LLDB's Swift REPL on Windows.
[Driver] Handle all optimization-record options for Darwin LTO
Make sure both arguments to assertIn are of type str. This should fix
the following error:

TypeError: a bytes-like object is required, not 'str'.
(cherry picked from commit 17bdb7a)
[lldb/Test] Convert stdout to str by calling decode('utf-8') on it.
ahatanaka and others added 27 commits April 20, 2020 00:19
Fixes a bug in Sema where it was incorrectly rejecting the following
code:

```
typedef void * __ptrauth(ptrauth_key_process_dependent_data, 1, 42) T;

bool compare(T *a, T *b) {
return a == b;
}
```

rdar://problem/54603670
Don't drop ptrauth qualifiers when constructing C++ composite types
Verify that the ShouldStopHere callback actually can produce a step o…
This reverts commit a041c4e.

This looks like a non-trivial change and there has been no code
reviews (at least there were no phabricator revisions attached to the
commit description). It is also causing a regression in one of our
downstream integration tests, we haven't been able to come up with a
minimal reproducer yet.

(cherry picked from commit b212eb7)
[lldb] Update for removal of SourceFile::addImports
[AArch64][GlobalISel] Fixup <32b heterogeneous regbanks of G_PHIs jus…
Revert "[InstCombine] fold zext of masked bit set/clear"
Lit's to_string will just return the string when it's a `str` instance,
which in Python 2 can still contain UTF-8 characters.

Differential revision: https://reviews.llvm.org/D76955

(cherry picked from commit 2de5242)
The current implementation of the JSONWriter does not support writing
out directory entries. Earlier today I added a unit test to illustrate
the problem. When an entry is added to the YAMLVFSWriter and the path is
a directory, it will incorrectly emit the directory as a file, and any
files inside that directory will not be found by the VFS.

It's possible to partially work around the issue by only adding "leaf
nodes" (files) to the YAMLVFSWriter. However, this doesn't work for
representing empty directories. This is a problem for clients of the VFS
that want to iterate over a directory. The directory not being there is
not the same as the directory being empty.

This is not just a hypothetical problem. The FileCollector for example
does not differentiate between file and directory paths. I temporarily
worked around the issue for LLDB by ignoring directories, but I suspect
this will prove problematic sooner rather than later.

This patch fixes the issue by extending the JSONWriter to support
writing out directory entries. We store whether an entry should be
emitted as a file or directory.

Differential revision: https://reviews.llvm.org/D76670

(cherry picked from commit 3ef33e6)
… contents."

Extend the FileCollector's API with addDirectory which adds a directory
and its contents to the VFS mapping.

Differential revision: https://reviews.llvm.org/D76671

(cherry picked from commit 4151f2d)
The FileCollector in LLDB collects every files that's used during a
debug session when capture is enabled. This ensures that the reproducer
only contains the files necessary to reproduce. This approach is not a
good fit for the dSYM bundle, which is a directory on disk, but should
be treated as a single unit.

On macOS LLDB have automatically find the matching dSYM for a binary by
its UUID. Having a incomplete dSYM in a reproducer can break debugging
even when reproducers are disabled.

This patch adds a was to specify a directory of interest to the
reproducers. It is called from SymbolVendorMacOSX with the path of the
dSYMs used by LLDB.

Differential revision: https://reviews.llvm.org/D76672

(cherry picked from commit 38ddb49)
…2b45599f77c14ce1b2cec2b81

[lldb/Test] Decode stdout and stderr in case it contains Unicode.
Implement TypeSystemSwiftTypeRef::GetArrayElementType() (NFC)
Fix error: conditional expression is ambiguous; 'const std::string' (aka
'const basic_string<char, char_traits<char>, allocator<char> >') can be
converted to 'llvm::StringRef' and vice versa.
Summary:
861b69f (rdar://problem/58789439) while
fixing symbolization for TSan completely broke ASan's runtime for the
simulators.

The problem with the previous patch is that the memory passed to
`putenv()` was poisoned and when passed to `putenv()` it tripped
an interceptor for `strchr()` which saw the memory was poisoned and
raised an ASan issue.

The memory was poisoned because `AtosSymbolizerProcess` objects
are created using ASan's internal allocator. Memory from this
allocator gets poisoned with `kAsanInternalHeapMagic`.

To workaround this, this patch makes the memory for the environment
variable entry a global variable that isn't poisoned.

This pass also adds a `DCHECK(getenv(K_ATOS_ENV_VAR))` because the
following DCHECK would crash because `internal_strcmp()` doesn't
work on nullptr.

rdar://problem/62067724

Reviewers: kubamracek, yln

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

(cherry picked from commit 7039773)
…one init.

Summary:
This fixes symbolization in Standalone UBSan mode for the Darwin simulators.

861b69f (rdar://problem/58789439) tried to fix
symbolization for all sanitizers on Darwin simulators but unfortunately it only
fixed the problem for TSan.

For UBSan in standalone mode the fix wasn't sufficient because UBSan's
standalone init doesn't call `Symbolizer::LateInitialize()` like ASan
and TSan do. This meant that `AtosSymbolizerProcess::LateInitialize()`
was never being called before
`AtosSymbolizerProcess::StartSymbolizerSubprocess()` which breaks an
invariant we expect to hold.

The missing call to `Symbolizer::LateInitialize()` during UBSan's
standalone init seems like an accidently omission so this patch simply
adds it.

rdar://problem/62083617

Reviewers: vitalybuka, kubamracek, yln, samsonov

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

(cherry picked from commit 564530e)
…94bb1a930df1655e3dd4188e7

[lldb/Reproducers] Always collect the whole dSYM in the reproducer
Unbreak ASan runtime in the simulators.
Add missing call to `Symbolizer::LateInitialize()` in UBSan's standalone init.
@pull pull bot merged commit c6b3a6a into swiftwasm Apr 22, 2020
MaxDesiatov pushed a commit that referenced this pull request Sep 4, 2020
When `Target::GetEntryPointAddress()` calls `exe_module->GetObjectFile()->GetEntryPointAddress()`, and the returned
`entry_addr` is valid, it can immediately be returned.

However, just before that, an `llvm::Error` value has been setup, but in this case it is not consumed before returning, like is done further below in the function.

In https://bugs.freebsd.org/248745 we got a bug report for this, where a very simple test case aborts and dumps core:

```
* thread #1, name = 'testcase', stop reason = breakpoint 1.1
    frame #0: 0x00000000002018d4 testcase`main(argc=1, argv=0x00007fffffffea18) at testcase.c:3:5
   1	int main(int argc, char *argv[])
   2	{
-> 3	    return 0;
   4	}
(lldb) p argc
Program aborted due to an unhandled Error:
Error value was Success. (Note: Success values must still be checked prior to being destroyed).

Thread 1 received signal SIGABRT, Aborted.
thr_kill () at thr_kill.S:3
3	thr_kill.S: No such file or directory.
(gdb) bt
#0  thr_kill () at thr_kill.S:3
#1  0x00000008049a0004 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
#2  0x0000000804916229 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
#3  0x000000000451b5f5 in fatalUncheckedError () at /usr/src/contrib/llvm-project/llvm/lib/Support/Error.cpp:112
#4  0x00000000019cf008 in GetEntryPointAddress () at /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Error.h:267
#5  0x0000000001bccbd8 in ConstructorSetup () at /usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:67
#6  0x0000000001bcd2c0 in ThreadPlanCallFunction () at /usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:114
#7  0x00000000020076d4 in InferiorCallMmap () at /usr/src/contrib/llvm-project/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp:97
#8  0x0000000001f4be33 in DoAllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp:604
#9  0x0000000001fe51b9 in AllocatePage () at /usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:347
#10 0x0000000001fe5385 in AllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:383
#11 0x0000000001974da2 in AllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2301
#12 CanJIT () at /usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2331
#13 0x0000000001a1bf3d in Evaluate () at /usr/src/contrib/llvm-project/lldb/source/Expression/UserExpression.cpp:190
#14 0x00000000019ce7a2 in EvaluateExpression () at /usr/src/contrib/llvm-project/lldb/source/Target/Target.cpp:2372
#15 0x0000000001ad784c in EvaluateExpression () at /usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:414
#16 0x0000000001ad86ae in DoExecute () at /usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:646
#17 0x0000000001a5e3ed in Execute () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandObject.cpp:1003
#18 0x0000000001a6c4a3 in HandleCommand () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:1762
#19 0x0000000001a6f98c in IOHandlerInputComplete () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2760
#20 0x0000000001a90b08 in Run () at /usr/src/contrib/llvm-project/lldb/source/Core/IOHandler.cpp:548
#21 0x00000000019a6c6a in ExecuteIOHandlers () at /usr/src/contrib/llvm-project/lldb/source/Core/Debugger.cpp:903
#22 0x0000000001a70337 in RunCommandInterpreter () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2946
#23 0x0000000001d9d812 in RunCommandInterpreter () at /usr/src/contrib/llvm-project/lldb/source/API/SBDebugger.cpp:1169
#24 0x0000000001918be8 in MainLoop () at /usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:675
#25 0x000000000191a114 in main () at /usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:890```

Fix the incorrect error catch by only instantiating an `Error` object if it is necessary.

Reviewed By: JDevlieghere

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

(cherry picked from commit 1ce07cd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.