platform/upstream/llvm.git
5 years ago[DWARF] Refactor RelocVisitor and fix computation of SHT_RELA-typed relocation entries
Fangrui Song [Fri, 22 Mar 2019 02:43:11 +0000 (02:43 +0000)]
[DWARF] Refactor RelocVisitor and fix computation of SHT_RELA-typed relocation entries

Summary:
getRelocatedValue may compute incorrect value for SHT_RELA-typed relocation entries.

// DWARFDataExtractor.cpp
uint64_t DWARFDataExtractor::getRelocatedValue(uint32_t Size, uint32_t *Off,
...
  // This formula is correct for REL, but may be incorrect for RELA if the value
  // stored in the location (getUnsigned(Off, Size)) is not zero.
  return getUnsigned(Off, Size) + Rel->Value;

In this patch, we

* refactor these visit* functions to include a new parameter `uint64_t A`.
  Since these visit* functions are no longer used as visitors, rename them to resolve*.
  + REL: A is used as the addend. A is the value stored in the location where the
    relocation applies: getUnsigned(Off, Size)
  + RELA: The addend encoded in RelocationRef is used, e.g. getELFAddend(R)
* and add another set of supports* functions to check if a given relocation type is handled.
  DWARFObjInMemory uses them to fail early.

Reviewers: echristo, dblaikie

Reviewed By: echristo

Subscribers: mgorny, aprantl, aheejin, fedor.sergeev, llvm-commits

Tags: #llvm

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

llvm-svn: 356729

5 years ago[NFC][TSan][libdispatch] Don't use ignore_noninstrumented_modules on Linux
Julian Lettner [Fri, 22 Mar 2019 01:43:43 +0000 (01:43 +0000)]
[NFC][TSan][libdispatch] Don't use ignore_noninstrumented_modules on Linux

llvm-svn: 356728

5 years ago[BPF] handle derived type properly for computing type id
Yonghong Song [Fri, 22 Mar 2019 01:30:50 +0000 (01:30 +0000)]
[BPF] handle derived type properly for computing type id

Currently, the type id for a derived type is computed incorrectly.
For example,
  type #1: int
  type #2: ptr to #1

For a global variable "int *a", type #1 will be attributed to variable "a".
This is due to a bug which assigns the type id of the basetype of
that derived type as the derived type's type id. This happens
to "const", "volatile", "restrict", "typedef" and "pointer" types.

This patch fixed this bug, fixed existing test cases and added
a new one focusing on pointers plus other derived types.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 356727

5 years agoFix a vector test to not use a local type as a template parameter. This causes a...
Marshall Clow [Fri, 22 Mar 2019 00:49:41 +0000 (00:49 +0000)]
Fix a vector test to not use a local type as a template parameter. This causes a warning on C++03. NFC

llvm-svn: 356726

5 years ago[Reproducers] Fix log statements
Jonas Devlieghere [Thu, 21 Mar 2019 23:58:51 +0000 (23:58 +0000)]
[Reproducers] Fix log statements

This isn't python where you can omit the index inside `{}`.

llvm-svn: 356725

5 years agoThis test assumes that -rtlib defaults to libgcc. But that isn't true in the face...
Sterling Augustine [Thu, 21 Mar 2019 23:30:50 +0000 (23:30 +0000)]
This test assumes that -rtlib defaults to libgcc. But that isn't true in the face of -DCLANG_DEFAULT_RTLIB=compiler-rt.

Subscribers: dberris, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 356724

5 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Thu, 21 Mar 2019 23:09:56 +0000 (23:09 +0000)]
[X86] Autogenerate complete checks. NFC

llvm-svn: 356723

5 years ago[AArch64] Split the neon.addp intrinsic into integer and fp variants.
Amara Emerson [Thu, 21 Mar 2019 22:31:37 +0000 (22:31 +0000)]
[AArch64] Split the neon.addp intrinsic into integer and fp variants.

This is the result of discussions on the list about how to deal with intrinsics
which require codegen to disambiguate them via only the integer/fp overloads.
It causes problems for GlobalISel as some of that information is lost during
translation, while with other operations like IR instructions the information is
encoded into the instruction opcode.

This patch changes clang to emit the new faddp intrinsic if the vector operands
to the builtin have FP element types. LLVM IR AutoUpgrade has been taught to
upgrade existing calls to aarch64.neon.addp with fp vector arguments, and
we remove the workarounds introduced for GlobalISel in r355865.

This is a more permanent solution to PR40968.

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

llvm-svn: 356722

5 years ago[X86] Use LoadInst->getType() instead of LoadInst->getPointerOperandType()->getElemen...
Craig Topper [Thu, 21 Mar 2019 21:37:18 +0000 (21:37 +0000)]
[X86] Use LoadInst->getType() instead of LoadInst->getPointerOperandType()->getElementType(). NFCI

For the future day when the pointer's don't have element types, we shoudl just use the type of the load result instead.

llvm-svn: 356721

5 years ago[InstSimplify] Add tests for signed icmp of and/or; NFC
Nikita Popov [Thu, 21 Mar 2019 21:13:08 +0000 (21:13 +0000)]
[InstSimplify] Add tests for signed icmp of and/or; NFC

Even if a signed predicate is used, the ranges computed for and/or
are unsigned, resulting in missed simplifications.

llvm-svn: 356720

5 years ago[libc++] Remove too-stringent XFAILs for file_clock tests
Louis Dionne [Thu, 21 Mar 2019 21:07:33 +0000 (21:07 +0000)]
[libc++] Remove too-stringent XFAILs for file_clock tests

Those tests actually pass because we don't use anything that's marked
as unavailable.

llvm-svn: 356719

5 years ago[Object] Fix reading objects created with -fembed-bitcode-marker
Steven Wu [Thu, 21 Mar 2019 21:01:31 +0000 (21:01 +0000)]
[Object] Fix reading objects created with -fembed-bitcode-marker

Currently, this fails with many tools, e.g.

$ clang -fembed-bitcode-marker -c -o test.o test.c
$ nm test.o
nm: test.o The file was not recognized as a valid object file

-fembed-bitcode-marker creates a LLVM,bitcode section consisting of a single
byte. When reading the object file, IRObjectFile::findBitcodeInObject succeeds,
causing SymbolicFile::createSymbolicFile to try to read the "bitcode" rather
than using the outer Mach-O data - when then fails.

Fix this by making findBitcodeInObject return an error if the section size <= 1.

Patched by: Nicholas Allegra

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

llvm-svn: 356718

5 years agoMips: Fix typo in assert message
Matt Arsenault [Thu, 21 Mar 2019 20:56:06 +0000 (20:56 +0000)]
Mips: Fix typo in assert message

llvm-svn: 356717

5 years agoMips: Don't create copy of nothing
Matt Arsenault [Thu, 21 Mar 2019 20:56:05 +0000 (20:56 +0000)]
Mips: Don't create copy of nothing

This was creating a copy of the register the pseudo itself was
def'ing, leaving a copy of an undefined register. I'm not sure how
the verifier is not catching this, but this avoids asserting in a
future change to RegAllocFast

llvm-svn: 356716

5 years ago[OPENMP]Fix a warning about unused variable, NFC.
Alexey Bataev [Thu, 21 Mar 2019 20:52:04 +0000 (20:52 +0000)]
[OPENMP]Fix a warning about unused variable, NFC.

llvm-svn: 356715

5 years agoGlobalISel: Fix RegBankSelect for REG_SEQUENCE
Matt Arsenault [Thu, 21 Mar 2019 20:45:36 +0000 (20:45 +0000)]
GlobalISel: Fix RegBankSelect for REG_SEQUENCE

The AArch64 test was broken since the result register already had a
set register class, so this test was a no-op. The mapping verify call
would fail because the result size is not the same as the inputs like
in a copy or phi.

The AMDGPU testcases are half broken and introduce illegal VGPR->SGPR
copies which need much more work to handle correctly (same for phis),
but add them as a baseline.

llvm-svn: 356713

5 years agoImprove the diagnostic for #include_next occurring in a file not found
Richard Smith [Thu, 21 Mar 2019 20:42:13 +0000 (20:42 +0000)]
Improve the diagnostic for #include_next occurring in a file not found
in the include path.

Instead of making the incorrect claim that the included file has an
absolute path, describe the actual problem: the including file was found
either by absolute path, or relative to such a file, or relative to the
primary source file.

llvm-svn: 356712

5 years agoMakefile.rules: Normalize use of trailing slashes in path variables.
Adrian Prantl [Thu, 21 Mar 2019 20:36:23 +0000 (20:36 +0000)]
Makefile.rules: Normalize use of trailing slashes in path variables.

llvm-svn: 356711

5 years ago[OPENMP] Simplify codegen for allocate directive on local variables.
Alexey Bataev [Thu, 21 Mar 2019 20:36:16 +0000 (20:36 +0000)]
[OPENMP] Simplify codegen for allocate directive on local variables.

Simplified codegen for the allocate directive for local variables,
initial implementation of the codegen for NVPTX target.

llvm-svn: 356710

5 years ago[X86] Correct the value of MaxAtomicInlineWidth for pre-586 cpus
Craig Topper [Thu, 21 Mar 2019 20:36:08 +0000 (20:36 +0000)]
[X86] Correct the value of MaxAtomicInlineWidth for pre-586 cpus

Use the new cx8 feature flag that was added to the backend to represent support for cmpxchg8b. Use this flag to set the MaxAtomicInlineWidth.

This also assumes all the cmpxchg instructions are enabled for CK_Generic which is what cc1 defaults to when nothing is specified.

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

llvm-svn: 356709

5 years agoDon't add a tail keyword to calls to ObjC runtime functions if the calls
Akira Hatanaka [Thu, 21 Mar 2019 20:16:09 +0000 (20:16 +0000)]
Don't add a tail keyword to calls to ObjC runtime functions if the calls
are annotated with notail.

r356705 annotated calls to objc_retainAutoreleasedReturnValue with
notail on x86-64. This commit teaches ARC optimizer to check the notail
marker on the call before turning it into a tail call.

rdar://problem/38675807

llvm-svn: 356707

5 years ago[Driver] Pass -malign-double from the driver to the cc1 command line
Craig Topper [Thu, 21 Mar 2019 20:07:24 +0000 (20:07 +0000)]
[Driver] Pass -malign-double from the driver to the cc1 command line

-malign-double is currently only implemented in the -cc1 interface. But its declared in Options.td so it is a driver option too. But you try to use it with the driver you'll get a message about the option being unused.

This patch teaches the driver to pass the option through to cc1 so it won't be unused. The Options.td says the option is x86 only but I didn't see any x86 specific code in its impementation in cc1 so not sure if the documentation is wrong or if I should only pass this option through the driver on x86 targets.

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

llvm-svn: 356706

5 years ago[CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue
Akira Hatanaka [Thu, 21 Mar 2019 19:59:49 +0000 (19:59 +0000)]
[CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue
with notail on x86-64.

On x86-64, the epilogue code inserted before the tail jump blocks the
autoreleased return optimization.

rdar://problem/38675807

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

llvm-svn: 356705

5 years agoRefactor handling of #include directives to cleanly separate the
Richard Smith [Thu, 21 Mar 2019 19:44:17 +0000 (19:44 +0000)]
Refactor handling of #include directives to cleanly separate the
"skipped header because it should be imported as a module" cases from
the "skipped header because of some other reason" cases.

llvm-svn: 356704

5 years ago[lldb] Add missing EINTR handling
Michal Gorny [Thu, 21 Mar 2019 19:35:55 +0000 (19:35 +0000)]
[lldb] Add missing EINTR handling

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

llvm-svn: 356703

5 years ago[OPENMP]Codegen support for allocate directive on global variables.
Alexey Bataev [Thu, 21 Mar 2019 19:35:27 +0000 (19:35 +0000)]
[OPENMP]Codegen support for allocate directive on global variables.

For the global variables the allocate directive must specify only the
predefined allocator. This allocator must be translated into the correct
form of the address space for the targets that support different address
spaces.

llvm-svn: 356702

5 years agoEnable `asan/TestCases/Posix/start-deactivated.cc` test for iOS.
Dan Liew [Thu, 21 Mar 2019 19:20:44 +0000 (19:20 +0000)]
Enable `asan/TestCases/Posix/start-deactivated.cc` test for iOS.

Summary:
To make this test pass it was necesary to change `iossim_run.py` to
propagate the `ASAN_ACTIVATION_OPTIONS` environment variable into the
testing environment.

rdar://problem/49114807

Reviewers: kubamracek, yln, serge-sans-paille

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 356701

5 years ago[clang][OpenMP] Fix another test when using libgomp.
Jordan Rupprecht [Thu, 21 Mar 2019 19:13:22 +0000 (19:13 +0000)]
[clang][OpenMP] Fix another test when using libgomp.

Similarly to r356614, -fopenmp=libomp needs to be used for some omp-related AST matching.

llvm-svn: 356700

5 years ago[OPENMP]Simplify the check for the predefined allocators, NFC.
Alexey Bataev [Thu, 21 Mar 2019 19:05:07 +0000 (19:05 +0000)]
[OPENMP]Simplify the check for the predefined allocators, NFC.

Previously implemented check required the reevaluation of the already
evaluated predefined allocator kind for the global variables. Patch
simplifies this evaluation and removes extra code.

llvm-svn: 356699

5 years ago[AArch64] Update for Exynos
Evandro Menezes [Thu, 21 Mar 2019 18:54:58 +0000 (18:54 +0000)]
[AArch64] Update for Exynos

Fix the feature set for Exynos M4 by removing support for `+fp16fml` and fix test case.

llvm-svn: 356698

5 years ago[llvm-objdump] Support arg grouping for -j and -M (e.g. llvm-objdump -sj.foo -dMreg...
Jordan Rupprecht [Thu, 21 Mar 2019 18:45:44 +0000 (18:45 +0000)]
[llvm-objdump] Support arg grouping for -j and -M (e.g. llvm-objdump -sj.foo -dMreg-names-raw)

Summary:
r354375 added support for most objdump groupings, but didn't add support for -j|--sections, because that wasn't possible.
r354870 added --disassembler options, but grouping still wasn't available.
r355185 supported values for grouped options.

This just puts the three of them together. This supports -j in modes like `-s -j .foo`, `-sj .foo`, `-sj=.foo`, or `-sj.foo`, and similar for `-M`.

Reviewers: ormris, jhenderson, ikudrin

Reviewed By: jhenderson, ikudrin

Subscribers: javed.absar, llvm-commits

Tags: #llvm

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

llvm-svn: 356697

5 years ago[X86] canonicalizeBitSelect - don't attempt to canonicalize mask registers
Simon Pilgrim [Thu, 21 Mar 2019 18:32:38 +0000 (18:32 +0000)]
[X86] canonicalizeBitSelect - don't attempt to canonicalize mask registers

We don't use X86ISD::ANDNP for mask registers.

Test case from @craig.topper (Craig Topper)

llvm-svn: 356696

5 years agoPython 2/3 compatibility: from __future__ import print_function
Serge Guelton [Thu, 21 Mar 2019 18:27:40 +0000 (18:27 +0000)]
Python 2/3 compatibility: from __future__ import print_function

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

llvm-svn: 356695

5 years agoFix lld wasm tests after r356610
Reid Kleckner [Thu, 21 Mar 2019 18:24:05 +0000 (18:24 +0000)]
Fix lld wasm tests after r356610

Apparently stdout is not opened in binary mode, so the executable gets
corrupted when piping to obj2yaml.

llvm-svn: 356694

5 years ago[NFC][libc++] Reindent #ifdefs
Louis Dionne [Thu, 21 Mar 2019 18:19:21 +0000 (18:19 +0000)]
[NFC][libc++] Reindent #ifdefs

I don't understand why we don't always do that. We do it for normal `if`s
in the code, but not for preprocessor `if`s? It's a lot more readable when
indented properly.

llvm-svn: 356693

5 years ago[llvm-pdbutil] Add -type-ref-stats to help find unused type info
Reid Kleckner [Thu, 21 Mar 2019 18:02:34 +0000 (18:02 +0000)]
[llvm-pdbutil] Add -type-ref-stats to help find unused type info

Summary:
This considers module symbol streams and the global symbol stream to be
roots. Most types that this considers "unreferenced" are referenced by
LF_UDT_MOD_SRC_LINE id records, which VC seems to always include.
Essentially, they are types that the user can only find in the debugger
if they call them by name, they cannot be found by traversing a symbol.

In practice, around 80% of type information in a PDB is referenced by a
symbol. That seems like a reasonable number.

I don't really plan to do anything with this tool. It mostly just exists
for informational purposes, and to confirm that we probably don't need
to implement type reference tracking in LLD. We can continue to merge
all types as we do today without wasting space.

Reviewers: zturner, aganea

Subscribers: mgorny, hiraditya, arphaman, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 356692

5 years ago[x86] add tests with movmsk potential (PR39665); NFC
Sanjay Patel [Thu, 21 Mar 2019 17:57:56 +0000 (17:57 +0000)]
[x86] add tests with movmsk potential (PR39665); NFC

llvm-svn: 356691

5 years ago[InstCombine] Don't transform ((C1 OP zext(X)) & C2) -> zext((C1 OP X) & C2) if eithe...
Craig Topper [Thu, 21 Mar 2019 17:50:49 +0000 (17:50 +0000)]
[InstCombine] Don't transform ((C1 OP zext(X)) & C2) -> zext((C1 OP X) & C2) if either zext or OP has another use.

If they have other users we'll just end up increasing the instruction count.

We might be able to weaken this to only one of them having a single use if we can prove that the and will be removed.

Fixes PR41164.

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

llvm-svn: 356690

5 years ago[X86] Add __popcntd and __popcntq to ia32intrin.h to match gcc and icc. Remove popcnt...
Craig Topper [Thu, 21 Mar 2019 17:43:53 +0000 (17:43 +0000)]
[X86] Add __popcntd and __popcntq to ia32intrin.h to match gcc and icc. Remove popcnt feature flag from _popcnt32/_popcnt64 and move to ia32intrin.h to match gcc

gcc and icc both implement popcntd and popcntq which we did not. gcc doesn't seem to require a feature flag for the _popcnt32/_popcnt64 spelling and will use a libcall if its not supported.

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

llvm-svn: 356689

5 years ago[X86] Don't avoid folding multiple use sign extended 8-bit immediate into instruction...
Craig Topper [Thu, 21 Mar 2019 17:38:58 +0000 (17:38 +0000)]
[X86] Don't avoid folding multiple use sign extended 8-bit immediate into instructions under optsize.

Under optsize we try to avoid folding immediates into instructions under optsize. But if the immediate is 16-bits or 32 bits, but can be encoded as an 8-bit immediate we don't save enough from disabling the folding unless the immediate has enough uses to make up for the size of the move which is either 3 bytes or 5 bytes since there are no sign extended 8-bit moves. We would also save something if the immediate was a live out of the basic block and thus a move was unavoidable, but that would require a more advanced heuristic than just counting uses.

Note we only avoid folding multiple use immediates into the patterns that use X86ISD::ADD/SUB/XOR/OR/AND/CMP/ADC/SBB nodes and not the more common ISD::ADD/SUB/XOR/OR/AND nodes.

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

llvm-svn: 356688

5 years ago[ScalarizeMaskedMemIntrin] Add support for scalarizing expandload and compressstore...
Craig Topper [Thu, 21 Mar 2019 17:38:52 +0000 (17:38 +0000)]
[ScalarizeMaskedMemIntrin] Add support for scalarizing expandload and compressstore intrinsics.

This adds support for scalarizing these intrinsics as well the X86TargetTransformInfo support to avoid scalarizing them in the cases X86 can handle.

I've omitted handling special cases for constant masks for this first pass. Though CodeGenPrepare can constant fold the branch conditions and remove some of the control flow anyway.

Fixes PR40994 and is covers most of PR3666. Might want to implement constant masks to close that.

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

llvm-svn: 356687

5 years ago[X86] Use the CPUKind enum from PROC_ALIAS to directly get the CPUKind in fillValidCP...
Craig Topper [Thu, 21 Mar 2019 17:33:20 +0000 (17:33 +0000)]
[X86] Use the CPUKind enum from PROC_ALIAS to directly get the CPUKind in fillValidCPUList.

We were using getCPUKind which translates the string to the enum also using PROC_ALIAS. This just cuts out the string compares.

llvm-svn: 356686

5 years ago[ValueTracking] Use ConstantRange based overflow check for signed sub
Nikita Popov [Thu, 21 Mar 2019 17:23:51 +0000 (17:23 +0000)]
[ValueTracking] Use ConstantRange based overflow check for signed sub

This is D59450, but for signed sub. This case is not NFC, because
the overflow logic in ConstantRange is more powerful than the existing
check. This resolves the TODO in the function.

I've added two tests to show that this indeed catches more cases than
the previous logic, but the main correctness test coverage here is in
the existing ConstantRange unit tests.

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

llvm-svn: 356685

5 years ago[ELF][ARM] Revert Redesign of .ARM.exidx handling to use a SyntheticSection
Peter Smith [Thu, 21 Mar 2019 17:17:54 +0000 (17:17 +0000)]
[ELF][ARM] Revert Redesign of .ARM.exidx handling to use a SyntheticSection

There is a reproducible buildbot failure (segfault) on the 2 stage
clang-cmake-armv8-lld bot. Reverting while I investigate.

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

llvm-svn: 356684

5 years agoAdd more rotate tests, including ORs of rotates
Krzysztof Parzyszek [Thu, 21 Mar 2019 17:14:22 +0000 (17:14 +0000)]
Add more rotate tests, including ORs of rotates

This is a part of https://reviews.llvm.org/D47735.

llvm-svn: 356683

5 years agoMove the rest of the sections over to DWARFContext.
Zachary Turner [Thu, 21 Mar 2019 16:34:58 +0000 (16:34 +0000)]
Move the rest of the sections over to DWARFContext.

This is mostly mechanical, and just moves the remaining non-DWO
related sections over to DWARFContext.

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

llvm-svn: 356682

5 years ago[libc++] Re-document how to use <filesystem> with various versions of libc++
Louis Dionne [Thu, 21 Mar 2019 16:21:09 +0000 (16:21 +0000)]
[libc++] Re-document how to use <filesystem> with various versions of libc++

This documentation was removed when we added <filesystem> to the dylib
in r356518, but it really should have been updated to reflect the new
state of things. Keeping documentation around doesn't hurt and users
will have an easier time migrating.

llvm-svn: 356681

5 years agoAdd relational benchmark against a string constant.
Samuel Benzaquen [Thu, 21 Mar 2019 16:06:15 +0000 (16:06 +0000)]
Add relational benchmark against a string constant.

Summary:
Add relational benchmark against a string constant.
These can potentially trigger inlining of the operations. We want to
benchmark that.

Reviewers: EricWF

Subscribers: christof, jdoerfert, libcxx-commits

Tags: #libc

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

llvm-svn: 356680

5 years ago[AST] OMPStructuredBlockTest: two matchers were promoted into ASTMatchers.h
Roman Lebedev [Thu, 21 Mar 2019 15:50:54 +0000 (15:50 +0000)]
[AST] OMPStructuredBlockTest: two matchers were promoted into ASTMatchers.h

llvm-svn: 356679

5 years ago[libc++] Mark bad_any_cast tests as unsupported when the dylib doesn't support bad_an...
Louis Dionne [Thu, 21 Mar 2019 15:37:11 +0000 (15:37 +0000)]
[libc++] Mark bad_any_cast tests as unsupported when the dylib doesn't support bad_any_cast

With the latest compiler fix to availability, some availability failures
that didn't trigger before now trigger.

llvm-svn: 356678

5 years ago[ASTMatcher] Add clang-query disclaimer to two more matchers that take enum
Roman Lebedev [Thu, 21 Mar 2019 15:33:43 +0000 (15:33 +0000)]
[ASTMatcher] Add clang-query disclaimer to two more matchers that take enum

As we have figured out in
https://reviews.llvm.org/D57112
and
https://bugs.llvm.org/show_bug.cgi?id=41176

this kind-of works, but needs special care.

llvm-svn: 356677

5 years ago[ASTMatchers][OpenMP] OpenMP Structured-block-related matchers
Roman Lebedev [Thu, 21 Mar 2019 15:33:35 +0000 (15:33 +0000)]
[ASTMatchers][OpenMP] OpenMP Structured-block-related matchers

Summary: Exposes to the  for ASTMatchers the interface/modelling
of OpenMP structured-block.

Reviewers: gribozavr, aaron.ballman, JonasToth, george.karpenkov

Reviewed By: gribozavr, aaron.ballman

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang, #openmp

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

llvm-svn: 356676

5 years ago[ASTTypeTraits][ASTMatchers][OpenMP] OMPClause handling
Roman Lebedev [Thu, 21 Mar 2019 15:33:24 +0000 (15:33 +0000)]
[ASTTypeTraits][ASTMatchers][OpenMP] OMPClause handling

Summary:
`OMPClause` is the base class, it is not descendant from **any**
other class, therefore for it to work with e.g.
`VariadicDynCastAllOfMatcher<>`, it needs to be handled here.

Reviewers: sbenza, bkramer, pcc, klimek, hokein, gribozavr, aaron.ballman, george.karpenkov

Reviewed By: gribozavr, aaron.ballman

Subscribers: guansong, jdoerfert, alexfh, ABataev, cfe-commits

Tags: #openmp, #clang

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

llvm-svn: 356675

5 years ago[ASTMatchers][OpenMP] Add base ompExecutableDirective() matcher.
Roman Lebedev [Thu, 21 Mar 2019 15:33:10 +0000 (15:33 +0000)]
[ASTMatchers][OpenMP] Add base ompExecutableDirective() matcher.

Summary:
A simple matcher for `OMPExecutableDirective` Stmt type.
Split off from D57113.

Reviewers: gribozavr, aaron.ballman, JonasToth, george.karpenkov

Reviewed By: gribozavr, aaron.ballman

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 356674

5 years agoWorkaround items/iteritems difference between Python2 and Python3
Serge Guelton [Thu, 21 Mar 2019 14:47:40 +0000 (14:47 +0000)]
Workaround items/iteritems difference between Python2 and Python3

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

llvm-svn: 356673

5 years agoWorkaround Python's map difference between Python2/3
Serge Guelton [Thu, 21 Mar 2019 14:44:58 +0000 (14:44 +0000)]
Workaround Python's map difference between Python2/3

When the output of map is not used, using a list comprehension or an explicit
call to list looks awkward.

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

llvm-svn: 356672

5 years agoPortable int/long conversion across Python 2 / Python 3
Serge Guelton [Thu, 21 Mar 2019 14:41:34 +0000 (14:41 +0000)]
Portable int/long conversion across Python 2 / Python 3

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

llvm-svn: 356671

5 years agoPortable exception value access across Python 2 / Python 3
Serge Guelton [Thu, 21 Mar 2019 14:39:55 +0000 (14:39 +0000)]
Portable exception value access across Python 2 / Python 3

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

llvm-svn: 356670

5 years agoFixup opt-remarks.ll gold plugin test. NFC
David Green [Thu, 21 Mar 2019 14:35:06 +0000 (14:35 +0000)]
Fixup opt-remarks.ll gold plugin test. NFC

Now that rL356594 has added a TailCallElim pass to LTO, the call gets marked as
tail.

llvm-svn: 356669

5 years ago[DAGCombiner] Use getTokenFactor in a few more cases.
Florian Hahn [Thu, 21 Mar 2019 14:32:09 +0000 (14:32 +0000)]
[DAGCombiner] Use getTokenFactor in a few more cases.

SDNodes can only have 64k operands and for some inputs (e.g. large
number of stores), we can reach this limit when creating TokenFactor
nodes. This patch is a follow up to D56740 and updates a few more places
that potentially can create TokenFactors with too many operands.

Reviewers: efriedma, craig.topper, aemerson, RKSimon

Reviewed By: RKSimon

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

llvm-svn: 356668

5 years ago[DAGCombine] SimplifySelectCC - call FoldSetCC with the setcc result type
Simon Pilgrim [Thu, 21 Mar 2019 14:07:18 +0000 (14:07 +0000)]
[DAGCombine] SimplifySelectCC - call FoldSetCC with the setcc result type

We were calling FoldSetCC with the compare operand type instead of the result type.

Found by OSS-Fuzz #13838 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13838)

llvm-svn: 356667

5 years ago[ELF][ARM] Redesign of .ARM.exidx handling to use a SyntheticSection
Peter Smith [Thu, 21 Mar 2019 14:06:40 +0000 (14:06 +0000)]
[ELF][ARM] Redesign of .ARM.exidx handling to use a SyntheticSection

Instead of creating extra Synthetic .ARM.exidx sections to account for
gaps in the table, create a single .ARM.exidx SyntheticSection that can
derive the contents of the gaps from a sorted list of the executable
InputSections. This has the benefit of moving the ARM specific code for
SyntheticSections in SHF_LINK_ORDER processing and the table merging code
into the ARM specific SyntheticSection. This also makes it easier to create
EXIDX_CANTUNWIND table entries for executable InputSections that don't
have an associated .ARM.exidx section.

Fixes pr40277

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

llvm-svn: 356666

5 years ago[CodeGenPrepare] limit formation of overflow intrinsics (PR41129)
Sanjay Patel [Thu, 21 Mar 2019 13:57:07 +0000 (13:57 +0000)]
[CodeGenPrepare] limit formation of overflow intrinsics (PR41129)

This is probably a bigger limitation than necessary, but since we don't have any evidence yet
that this transform led to real-world perf improvements rather than regressions, I'm making a
quick, blunt fix.

In the motivating x86 example from:
https://bugs.llvm.org/show_bug.cgi?id=41129
...and shown in the regression test, we want to avoid an extra instruction in the dominating
block because that could be costly.

The x86 LSR test diff is reversing the changes from D57789. There's no evidence that 1 version
is any better than the other yet.

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

llvm-svn: 356665

5 years ago[llvm-readobj] Format codes. NFC.
Xing GUO [Thu, 21 Mar 2019 13:42:06 +0000 (13:42 +0000)]
[llvm-readobj] Format codes. NFC.

llvm-svn: 356664

5 years agoPermit redeclarations of a builtin to specify calling convention.
Erich Keane [Thu, 21 Mar 2019 13:30:56 +0000 (13:30 +0000)]
Permit redeclarations of a builtin to specify calling convention.

After https://reviews.llvm.org/rL355317 we noticed that quite a decent
amount of code redeclares builtins (memcpy in particular, I believe
reduced from an MSVC header) with a calling convention specified.
This gets particularly troublesome when the user specifies a new
'default' calling convention on the command line.

When looking to add a diagnostic for this case, it was noticed that we
had 3 other diagnostics that differed only slightly.  This patch ALSO
unifies those under a 'select'.  Unfortunately, the order of words in
ONE of these diagnostics was reversed ("'thiscall' calling convention"
vs "calling convention 'thiscall'"), so this patch also standardizes on
the former.

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

Change-Id: I79f99fe7c2301640755ffdd774b46eb44526bb22
llvm-svn: 356663

5 years ago[clang-format] Add basic support for formatting C# files
Paul Hoad [Thu, 21 Mar 2019 13:09:22 +0000 (13:09 +0000)]
[clang-format] Add basic support for formatting C# files

Summary:

This revision adds basic support for formatting C# files with clang-format, I know the barrier to entry is high here  so I'm sending this revision in to test the water as to whether this might be something we'd consider landing.

Tracking in Bugzilla as:
https://bugs.llvm.org/show_bug.cgi?id=40850

Justification:
C# code just looks ugly in comparison to the C++ code in our source tree which is clang-formatted.

I've struggled with Visual Studio reformatting to get a clean and consistent style, I want to format our C# code on saving like I do now for C++ and i want it to have the same style as defined in our .clang-format file, so it consistent as it can be with C++.  (Braces/Breaking/Spaces/Indent etc..)

Using clang format without this patch leaves the code in a bad state, sometimes when the BreakStringLiterals is set, it  fails to compile.

Mostly the C# is similar to Java, except instead of JavaAnnotations I try to reuse the TT_AttributeSquare.

Almost the most valuable portion is to have a new Language in order to partition the configuration for C# within a common .clang-format file, with the auto detection on the .cs extension. But there are other C# specific styles that could be added later if this is accepted. in particular how  `{ set;get }` is formatted.

Reviewers: djasper, klimek, krasimir, benhamilton, JonasToth

Reviewed By: klimek

Subscribers: llvm-commits, mgorny, jdoerfert, cfe-commits

Tags: #clang, #clang-tools-extra

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

llvm-svn: 356662

5 years ago[Thumb] Fix infinite loop in ABS expansion (PR41160)
Simon Pilgrim [Thu, 21 Mar 2019 12:41:18 +0000 (12:41 +0000)]
[Thumb] Fix infinite loop in ABS expansion (PR41160)

Don't expand ISD::ABS node if its legal.

llvm-svn: 356661

5 years ago[AMDGPU] Support for v3i32/v3f32
Tim Renouf [Thu, 21 Mar 2019 12:01:21 +0000 (12:01 +0000)]
[AMDGPU] Support for v3i32/v3f32

Added support for dwordx3 for most load/store types, but not DS, and not
intrinsics yet.

SI (gfx6) does not have dwordx3 instructions, so they are not enabled
there.

Some of this patch is from Matt Arsenault, also of AMD.

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

Change-Id: I913ef54f1433a7149da8d72f4af54dbb13436bd9
llvm-svn: 356659

5 years agoFix -Wmisleading-indentation gcc7 warning. NFCI.
Simon Pilgrim [Thu, 21 Mar 2019 11:58:22 +0000 (11:58 +0000)]
Fix -Wmisleading-indentation gcc7 warning. NFCI.

llvm-svn: 356658

5 years ago[AArch64] Allow -mattr=tpidr-el[1|2|3]
Oliver Stannard [Thu, 21 Mar 2019 11:30:17 +0000 (11:30 +0000)]
[AArch64] Allow -mattr=tpidr-el[1|2|3]

Added subtarget features for AArch64 to use TPIDR_EL[1|2|3] as the TLS base
register, rather than the default TPIDR_EL0.

Patch by Philip Derrin!

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

llvm-svn: 356657

5 years ago[SelectionDAG] Add scalarization of ABS node (PR41149)
Simon Pilgrim [Thu, 21 Mar 2019 11:18:54 +0000 (11:18 +0000)]
[SelectionDAG] Add scalarization of ABS node (PR41149)

Patch by: @ikulagin (Ivan Kulagin)

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

llvm-svn: 356656

5 years agoFix two more issues with r356652
Pavel Labath [Thu, 21 Mar 2019 10:21:55 +0000 (10:21 +0000)]
Fix two more issues with r356652

The first problem was a use-after-free in the tests (detected by asan
bots). The temporary array created for the "create" call is guaranteed
to live only until the end of the statement. The fix there is to store
the test data in a local variable to ensure it has the right lifetime

The second issue is broken BUILD_SHARED_LIBS build, which I fix by
adding the appropriate BinaryFormat dependency to the Object unit tests.

llvm-svn: 356655

5 years ago[RISCV][NFC] Remove old CHECK lines from linker-relaxation.s test
Alex Bradbury [Thu, 21 Mar 2019 09:53:19 +0000 (09:53 +0000)]
[RISCV][NFC] Remove old CHECK lines from linker-relaxation.s test

The RELOC: check lines are no longer used.

llvm-svn: 356654

5 years agoAttempt to fix modules build for r356652
Pavel Labath [Thu, 21 Mar 2019 09:44:07 +0000 (09:44 +0000)]
Attempt to fix modules build for r356652

The commit added a new .def file. This adds it to the list of textual
headers.

llvm-svn: 356653

5 years ago[Object] Add basic minidump support
Pavel Labath [Thu, 21 Mar 2019 09:18:59 +0000 (09:18 +0000)]
[Object] Add basic minidump support

Summary:
This patch adds basic support for reading minidump files. It contains
the definitions of various important minidump data structures (header,
stream directory), and of one minidump stream (SystemInfo). The ability
to read other streams will be added in follow-up patches. However, all
streams can be read even now as raw data, which means lldb's minidump
support (where this code is taken from) can be immediately rebased on
top of this patch as soon as it lands.

As we don't have any support for generating minidump files (yet), this
tests the code via unit tests with some small handcrafted binaries in
the form of c char arrays.

Reviewers: Bigcheese, jhenderson, zturner

Subscribers: srhines, dschuff, mgorny, fedor.sergeev, lemo, clayborg, JDevlieghere, aprantl, lldb-commits, llvm-commits

Tags: #llvm

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

llvm-svn: 356652

5 years ago[BasicAA] Use DenseMap::try_emplace after D59151. NFC
Fangrui Song [Thu, 21 Mar 2019 08:47:40 +0000 (08:47 +0000)]
[BasicAA] Use DenseMap::try_emplace after D59151. NFC

llvm-svn: 356651

5 years agoReland r356547 after fixing the YAML module missing issue.
Zinovy Nis [Thu, 21 Mar 2019 08:32:07 +0000 (08:32 +0000)]
Reland r356547 after fixing the YAML module missing issue.

[clang-tidy] Parallelize clang-tidy-diff.py

This patch has 2 rationales:

- large patches lead to long command lines and often cause max command line length restrictions imposed by OS;
- clang-tidy runs on modified files are independent and can be done in parallel, the same as done for run-clang-tidy.

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

llvm-svn: 356649

5 years agoSilence warning about unused variable in builds without asserts [NFC]
Mikael Holmen [Thu, 21 Mar 2019 07:54:44 +0000 (07:54 +0000)]
Silence warning about unused variable in builds without asserts [NFC]

llvm-svn: 356648

5 years agoUse list comprehension instead of map/filter to prepare Python2/3 compat
Serge Guelton [Thu, 21 Mar 2019 07:19:09 +0000 (07:19 +0000)]
Use list comprehension instead of map/filter to prepare Python2/3 compat

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

llvm-svn: 356647

5 years ago[ScalarizeMaskedMemIntrinsics] Reverse some if conditions to reduce indentations...
Craig Topper [Thu, 21 Mar 2019 05:54:37 +0000 (05:54 +0000)]
[ScalarizeMaskedMemIntrinsics] Reverse some if conditions to reduce indentations to remove curly braces.

Pre-commit for D59180

llvm-svn: 356646

5 years ago[InstCombine] Add test case for PR41164. NFC
Craig Topper [Thu, 21 Mar 2019 05:33:10 +0000 (05:33 +0000)]
[InstCombine] Add test case for PR41164. NFC

llvm-svn: 356645

5 years ago[BasicAA] Reduce no of map seaches [NFCI].
Alina Sbirlea [Thu, 21 Mar 2019 05:02:05 +0000 (05:02 +0000)]
[BasicAA] Reduce no of map seaches [NFCI].

Summary:
This is a refactoring patch.
- Reduce the number of map searches by reusing the iterator.
- Add asserts to check that the entry is in the cache, as this is something BasicAA relies on to avoid infinite recursion.

Reviewers: chandlerc, aschwaighofer

Subscribers: sanjoy, jlebar, llvm-commits

Tags: #llvm

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

llvm-svn: 356644

5 years ago[Reproducers] Properly handle QEnvironment packets
Jonas Devlieghere [Thu, 21 Mar 2019 04:08:31 +0000 (04:08 +0000)]
[Reproducers] Properly handle QEnvironment packets

On Linux, a QEnvironment packet is sent for every environment variable.
This breaks replay when the number of environment variables is different
then during capture. The solution is to always reply with OK.

llvm-svn: 356643

5 years ago[instcombine] Add some todos, and arrange code for readibility
Philip Reames [Thu, 21 Mar 2019 03:23:40 +0000 (03:23 +0000)]
[instcombine] Add some todos, and arrange code for readibility

llvm-svn: 356642

5 years ago[MSSA] Delete move ctor; remove dynamic never-moved verification
George Burgess IV [Thu, 21 Mar 2019 03:11:34 +0000 (03:11 +0000)]
[MSSA] Delete move ctor; remove dynamic never-moved verification

Code archaeology in D59315 revealed that MSSA should never be moved.
Rather than trying to check dynamically that this hasn't happened in the
verify() functions of Walkers, it's likely best to just delete its move
constructor.

Since all these verify() functions did is check that MSSA hasn't moved,
this allows us to remove these verify functions.

I can readd the verification checks if someone's super concerned about
us trying to `memcpy` MemorySSA or something somewhere, but I imagine we
have other problems if we're trying anything like that...

llvm-svn: 356641

5 years agoAdd dylib-has-no-filesystem when filesystem is disabled
Eric Fiselier [Thu, 21 Mar 2019 02:13:30 +0000 (02:13 +0000)]
Add dylib-has-no-filesystem when filesystem is disabled

llvm-svn: 356640

5 years agoMark debug death tests as unsupported on Windows
Eric Fiselier [Thu, 21 Mar 2019 02:07:55 +0000 (02:07 +0000)]
Mark debug death tests as unsupported on Windows

llvm-svn: 356639

5 years ago[Reproducers] Log inconsistencies during replay (NFC)
Jonas Devlieghere [Thu, 21 Mar 2019 01:57:33 +0000 (01:57 +0000)]
[Reproducers] Log inconsistencies during replay (NFC)

Make debugging of the GDB remote packet aspect of reproducers easier by
logging both requests and replies. This enables some sanity checking
during replay.

llvm-svn: 356638

5 years agoRemove type visibility specifiers from new chrono types.
Eric Fiselier [Thu, 21 Mar 2019 01:48:15 +0000 (01:48 +0000)]
Remove type visibility specifiers from new chrono types.

_LIBCPP_TYPE_VIS is only really needed on types with a vtable.
And on Windows it doesn't work with types that have only inline methods.

This patch removes the unneeded attributes.

llvm-svn: 356637

5 years agocreduce-clang-crash.py: preprocess file + reduce commandline
George Burgess IV [Thu, 21 Mar 2019 01:01:53 +0000 (01:01 +0000)]
creduce-clang-crash.py: preprocess file + reduce commandline

This CL causes our creduce-clang-crash.py util to:

- try to preprocess the file before reducing
- try to remove some command line arguments
- now require a llvm bin directory, since the generated crash script
  doesn't have an absolute path for clang

It also marks it as executable, since I forgot to do that in the last
commit. :)

Patch by Amy Huang!

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

llvm-svn: 356636

5 years ago[libcxx] [test] Revert r356632 add (void) casts to operator new calls, to suppress...
Billy Robert O'Neal III [Thu, 21 Mar 2019 00:24:43 +0000 (00:24 +0000)]
[libcxx] [test] Revert r356632 add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]]."

llvm-svn: 356635

5 years ago[CFG] [analyzer] pr41142: C++17: Skip transparent InitListExprs in constructors.
Artem Dergachev [Thu, 21 Mar 2019 00:15:07 +0000 (00:15 +0000)]
[CFG] [analyzer] pr41142: C++17: Skip transparent InitListExprs in constructors.

When searching for construction contexts, i.e. figuring out which statements
define the object that is constructed by each construct-expression, ignore
transparent init-list expressions because they don't add anything to the
context. This allows the Static Analyzer to model construction, destruction,
materialization, lifetime extension correctly in more cases. Also fixes
a crash caused by incorrectly evaluating initial values of variables
initialized with such expressions.

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

llvm-svn: 356634

5 years agoAllow disabling of filesystem library.
Eric Fiselier [Thu, 21 Mar 2019 00:04:31 +0000 (00:04 +0000)]
Allow disabling of filesystem library.

Summary: Filesystem doesn't work on Windows, so we need a mechanism to turn it off for the time being.

Reviewers: ldionne, serge-sans-paille, EricWF

Reviewed By: EricWF

Subscribers: mstorsjo, mgorny, christof, jdoerfert, libcxx-commits

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

llvm-svn: 356633

5 years ago[libcxx] [test] Add (void) casts to operator new calls, to suppress warnings generate...
Billy Robert O'Neal III [Wed, 20 Mar 2019 23:58:46 +0000 (23:58 +0000)]
[libcxx] [test] Add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]].

This allows these tests to pass when compiled by MSVC++.

llvm-svn: 356632

5 years ago[X86] Add CMPXCHG8B feature flag. Set it for all CPUs except i386/i486 including...
Craig Topper [Wed, 20 Mar 2019 23:35:49 +0000 (23:35 +0000)]
[X86] Add CMPXCHG8B feature flag. Set it for all CPUs except i386/i486 including 'generic'. Disable use of CMPXCHG8B when this flag isn't set.

CMPXCHG8B was introduced on i586/pentium generation.

If its not enabled, limit the atomic width to 32 bits so the AtomicExpandPass will expand to lib calls. Unclear if we should be using a different limit for other configs. The default is 1024 and experimentation shows that using an i256 atomic will cause a crash in SelectionDAG.

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

llvm-svn: 356631

5 years agoRevert "Reland r356547 after fixing the tests for Linux."
Douglas Yung [Wed, 20 Mar 2019 23:21:43 +0000 (23:21 +0000)]
Revert "Reland r356547 after fixing the tests for Linux."

This reverts commit 538fb72226cf6dff95af83f7777e12b8dbd061ea (r356565).

This is still breaking a build bot:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/45557

llvm-svn: 356630

5 years agoFix Mach-O bind and rebase validation errors in libObject
Michael Trent [Wed, 20 Mar 2019 23:21:16 +0000 (23:21 +0000)]
Fix Mach-O bind and rebase validation errors in libObject

Summary:
llvm-objdump (via libObject) validates DYLD_INFO rebase and bind
entries against the basic structure found in the Mach-O file before
evaluating the contents of those entries. Certain malformed Mach-Os can
defeat the validation check and force llvm-objdump (libObject) to crash.

The previous logic verified a rebase or bind started in a valid Mach-O
section, but did not verify that the section wholely contained the
fixup. It also generally allows rebases or binds to start immediately
after a valid section even if that range is not itself part of a valid
section. Finally, bind and rebase opcodes that indicate more than one
fixup (apply N times...) are not completely validated: only the first
and final fixups are checked.

The previous logic also rejected certain binaries as false positives.
Some bind and rebase opcodes can modify the state machine such that the
next bind or rebase will fail. libObject will reject these opcodes as
invalid in order to be helpful and print an error message associated
with the instruction that caused the problem, even though the binary is
not actually illegal until it consumes the invalid state in the state
machine. In other words, libObject may reject a Mach-O binary that
Apple's dynamic linker may consider legal. The original version of
macho-rebase-add-addr-uleb-too-big is an example of such a binary.

I have replaced the existing checkSegAndOffset and checkCountAndSkip
functions with a single function, checkSegAndOffsets, which validates
all of the fixups realized by a DYLD_INFO opcode. checkSegAndOffsets
verifies that a Mach-O section fully contains each fixup. Every fixup
realized by an opcode is validated, and some (but not all!)
inconsistencies in the state machine are allowed until a fixup is
realized. This means that libObject may fail on an opcode that realizes
a fixup, not on the opcode that introduced the arithmetic error.

Existing test cases have been modified to reflect the changes in error
messages returned by libObject. What's more, the test case for
macho-rebase-add-addr-uleb-too-big has been modified so that it actually
triggers the error condition; the new code in libObject considers the
original test binary "legal".

rdar://47797757

Reviewers: lhames, pete, ab

Reviewed By: pete

Subscribers: rupprecht, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 356629

5 years agoRemove extra white spaces
Jennifer Yu [Wed, 20 Mar 2019 23:05:18 +0000 (23:05 +0000)]
Remove extra white spaces

llvm-svn: 356628

5 years ago[clang-tidy] Disable google-runtime-int in Objective-C++ 🔓
Stephane Moore [Wed, 20 Mar 2019 23:05:00 +0000 (23:05 +0000)]
[clang-tidy] Disable google-runtime-int in Objective-C++ 🔓

Summary:
In contrast to Google C++, Objective-C often uses built-in integer types
other than `int`. In fact, the Objective-C runtime itself defines the
types NSInteger¹ and NSUInteger² which are variant types depending on
the target architecture. The Objective-C style guide indicates that
usage of system types with variant sizes is appropriate when handling
values provided by system interfaces³. Objective-C++ is commonly the
result of conversion from Objective-C to Objective-C++ for the purpose
of integrating C++ functionality. The opposite of Objective-C++ being
used to expose Objective-C functionality to C++ is less common,
potentially because Objective-C has a signficantly more uneven presence
on different platforms compared to C++. This generally predisposes
Objective-C++ to commonly being more Objective-C than C++. Forcing
Objective-C++ developers to perform conversions between variant system types
and fixed size integer types depending on target architecture when
Objective-C++ commonly uses variant system types from Objective-C is
likely to lead to more bugs and overhead than benefit. For that reason,
this change proposes to disable google-runtime-int in Objective-C++.

[1] https://developer.apple.com/documentation/objectivec/nsinteger?language=objc
[2] https://developer.apple.com/documentation/objectivec/nsuinteger?language=objc
[3] "Types long, NSInteger, NSUInteger, and CGFloat vary in size between
32- and 64-bit builds. Use of these types is appropriate when handling
values exposed by system interfaces, but they should be avoided for most
other computations."
https://github.com/google/styleguide/blob/gh-pages/objcguide.md#types-with-inconsistent-sizes

Subscribers: xazax.hun, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 356627

5 years agoChange the logging on ptrace(PT_KILL) in MachProcess::Kill to log
Jason Molenda [Wed, 20 Mar 2019 22:59:16 +0000 (22:59 +0000)]
Change the logging on ptrace(PT_KILL) in MachProcess::Kill to log
if LOG_PROCESS is enabled or if there was an error making that call.

<rdar://problem/49036508>

llvm-svn: 356626