Commit Graph

258219 Commits

Author SHA1 Message Date
Artem Dergachev 1488a93c45 [analyzer] MisusedMovedObject: Remove deprecated callback. NFC
wantsRegionChangeUpdate() checker callback is no longer used since recently.

Fixes a buildbot warning.

llvm-svn: 298699
2017-03-24 10:16:08 +00:00
Artem Dergachev 356151ff5f [analyzer] Add MisusedMovedObjectChecker for detecting use-after-move errors.
The checker currently warns on copying, moving, or calling methods on an object
that was recently std::move'd from. It understands a set of "state reset"
methods that bring a moved-from object back to a well-specified state.

Patch by Peter Szecsi!

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

llvm-svn: 298698
2017-03-24 09:52:30 +00:00
Krasimir Georgiev c4d5c25737 [libclang] Bury dead TemporaryFiles
Summary:
AllocatedCXCodeCompleteResults::TemporaryFiles have turned into zombies.
Seven years ago they used to do their job during [[ 313e26c4e8/tools/CIndex/CIndexCodeCompletion.cpp (diff-02d3e692ad507b10af9458b775c5750bL261) | file remapping]], but now they are created just to be torn down in the destructor.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 298697
2017-03-24 09:49:54 +00:00
Krasimir Georgiev af4adfa3ad [clangd] Add support for vscode extension configuration
Summary: Adds vscode workspace level configuration options for path to clangd binary and its arguments.
Contributed by stanionascu!

Reviewers: cfe-commits, bkramer, krasimir

Reviewed By: krasimir

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

llvm-svn: 298696
2017-03-24 09:29:00 +00:00
Chandler Carruth 45bbe0117b Revert r298491 and r298494 which changed Clang's handling of 'nonnull'
attributes.

These patches don't work because we can't currently access the parameter
information in a reliable way when building attributes. I thought this
would be relatively straightforward to fix, but it seems not to be the
case. Fixing this will requrie a substantial re-plumbing of machinery to
allow attributes to be handled in this location, and several other fixes
to the attribute machinery should probably be made at the same time. All
of this will make the patch .... substantially more complicated.

Reverting for now as there are active miscompiles caused by the current
version.

llvm-svn: 298695
2017-03-24 09:11:57 +00:00
Jason Molenda 0387364c4c The expression text in AppleObjCRuntimeV1::CreateObjectChecker
was formatted into a string inside an assert() expression.
Which is elided when lldb is built with asserts disabled;
the result is that all expressions will fail when debugging
programs using the objective-c v1 runtime.

<rdar://problem/30353271> 

llvm-svn: 298694
2017-03-24 08:01:16 +00:00
Max Kazantsev 7696a7edf9 Revert "[ScalarEvolution] Re-enable Predicate implication from operations"
This reverts commit rL298690

Causes failures on clang.

llvm-svn: 298693
2017-03-24 07:04:31 +00:00
Daniel Berlin ffc30781f4 NewGVN: Small cleanup of two dominance related functions to make
them easier to understand.

llvm-svn: 298692
2017-03-24 06:33:51 +00:00
Daniel Berlin 0e9001131d NewGVN: Small cleanup of useless expression deletion, and don't uselessly create two expressions in symbolic store evaluation.
llvm-svn: 298691
2017-03-24 06:33:48 +00:00
Max Kazantsev 89554446e7 [ScalarEvolution] Re-enable Predicate implication from operations
The patch rL298481 was reverted due to crash on clang-with-lto-ubuntu build.
The reason of the crash was type mismatch between either a or b and RHS in the following situation:

  LHS = sext(a +nsw b) > RHS.

This is quite rare, but still possible situation. Normally we need to cast all {a, b, RHS} to their widest type.
But we try to avoid creation of new SCEV that are not constants to avoid initiating recursive analysis that
can take a lot of time and/or cache a bad value for iterations number. To deal with this, in this patch we
reject this case and will not try to analyze it if the type of sum doesn't match with the type of RHS. In this
situation we don't need to create any non-constant SCEVs.

This patch also adds an assertion to the method IsProvedViaContext so that we could fail on it and not
go further into range analysis etc (because in some situations these analyzes succeed even when the passed
arguments have wrong types, what should not normally happen).

The patch also contains a fix for a problem with too narrow scope of the analysis caused by wrong
usage of predicates in recursive invocations.

The regression test on the said failure: test/Analysis/ScalarEvolution/implied-via-addition.ll

llvm-svn: 298690
2017-03-24 06:19:00 +00:00
Marshall Clow c97d8aa866 Implement P0298R3: 'std::byte'. Reviewed as https://reviews.llvm.org/D31022
llvm-svn: 298689
2017-03-24 05:45:39 +00:00
Craig Topper 059b98e044 [ValueTracking] Use uint64_t for CarryIn in computeKnownBitsAddSub instead of a creating a temporary APInt. NFC
llvm-svn: 298688
2017-03-24 05:38:09 +00:00
Daniel Berlin 9d0796e5d0 NewGVN: Fix PR32403 - Handling of undef in phis was not quite correct
due to LLVM's view of phi nodes.  It would cause NewGVN not to fixpoint
in some interesting edge cases.

llvm-svn: 298687
2017-03-24 05:30:34 +00:00
Marshall Clow 9f3fd40aad Move the scoped_lock inside the '#ifndef NO_THREADS' block to fix the no-threading build
llvm-svn: 298686
2017-03-24 05:19:15 +00:00
Martin Pelikan 1730dc789e [XRay] [compiler-rt] Plug a file descriptor leak in a failure case.
Summary: Fd needs to be closed before the number gets out of scope.

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 298685
2017-03-24 05:02:51 +00:00
Kuba Mracek 1082904d20 Fix a warning when running the GotsanRuntimeCheck test on Darwin.
llvm-svn: 298684
2017-03-24 03:57:27 +00:00
Craig Topper 2bd9514e8c [ValueTracking] Convert more places to use setHighBits/setLowBits/setSignBit. NFCI
llvm-svn: 298683
2017-03-24 03:57:24 +00:00
Kuba Mracek 38ded5a37f Update the Darwin/external.cc testcase to use rpath. This means we can move the test output executables and still be able to run them.
llvm-svn: 298682
2017-03-24 03:53:44 +00:00
Marshall Clow 6015dd11c8 Implement Pp0156r2: 'Variadic Lock Guard, version 5' Reviewed as https://reviews.llvm.org/D31163.
llvm-svn: 298681
2017-03-24 03:40:36 +00:00
Craig Topper 36f2e0eee8 [InstCombine] Use range-based for loop. NFC
llvm-svn: 298680
2017-03-24 02:58:02 +00:00
Craig Topper df73e7c5b7 [InstCombine] Fix 80 column violation I accidentally introduced. NFC
llvm-svn: 298679
2017-03-24 02:57:59 +00:00
Petr Hosek efadaac3d1 [CMake] Support single target builtins build on Darwin
This change allows cross-compiling compiler-rt builtins for
multiple targets as part of runtimes on Darwin. This functionality
is already supported on other platforms.

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

llvm-svn: 298678
2017-03-24 02:21:11 +00:00
Meador Inge 5d3c599e82 [AVR] Fix build after r298178
r298178 capitalized the fields in `ArgListEntry`.  All the official
targets were updated accordingly, but as an experimental target AVR
was missed.

llvm-svn: 298677
2017-03-24 01:57:29 +00:00
Richard Smith 49a6b6e91e Fix handling of initialization from parenthesized initializer list.
This change fixes a crash on initialization of a reference from ({}) during
template instantiation and incidentally improves diagnostics.

This reverts a prior attempt to handle this in r286721. Instead, we teach the
initialization code that initialization cannot be performed if a source type
is required and the initializer is an initializer list (which is not an
expression and does not have a type), and likewise for function-style cast
expressions.

llvm-svn: 298676
2017-03-24 01:14:25 +00:00
Rui Ueyama c3ddb655cc Return early.
llvm-svn: 298675
2017-03-24 01:13:30 +00:00
Kostya Serebryany e54785c6e9 [libFuzzer] split two tests to get more parallelism in test runs
llvm-svn: 298673
2017-03-24 00:51:18 +00:00
Rui Ueyama 2c88cee15c Early continue. NFC.
The original code is a big `if` and `else` which ends with `continue`
like this:

  if (cond) {
    ...
    // fall through
  } else {
    ...
    continue;
  }

This patch rewrites it with the following.

  if (!cond) {
    ...
    continue;
  }
  ...

llvm-svn: 298672
2017-03-24 00:50:37 +00:00
Kostya Serebryany 382730ab23 [libFuzzer] increase kFeatureSetSize to 2^21 and make InputCorpus scale to that size. This will potentially make libFuzzer more sensitive on targets with lots of signals
llvm-svn: 298671
2017-03-24 00:45:15 +00:00
Dean Michael Berris f96f04d602 [XRay] Do not depend on C++ stdlib for XRay builds
Summary:
Now that XRay doesn't require a runtime dependency on a C++ standard
library, we remove that dependency from the clang linker flags.

Reviewers: saugustine, pelikan

Subscribers: cfe-commits

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

llvm-svn: 298670
2017-03-24 00:20:05 +00:00
Rui Ueyama 81cb710784 Update comments.
llvm-svn: 298669
2017-03-24 00:15:57 +00:00
Rui Ueyama be68fe18cc Use `using namespace lld` for consistency with other files.
llvm-svn: 298668
2017-03-24 00:15:37 +00:00
Rui Ueyama 9b55e92a7f Move a few functions to a new file Filesystem.{cpp,h}.
llvm-svn: 298667
2017-03-24 00:15:16 +00:00
Kostya Serebryany 5f25495c4d [libFuzzer] fix non-linux build
llvm-svn: 298666
2017-03-23 23:48:47 +00:00
Adrian Prantl b216e3e935 Refactor code to reduce indentation and improve readability. (NFC)
llvm-svn: 298665
2017-03-23 23:35:09 +00:00
Adrian Prantl f0ffc5233d Fix a bug when emitting debug info for partially constant global variables.
While fixing a malformed testcase, I discovered that the code
exercised by it was wrong, too.

llvm-svn: 298664
2017-03-23 23:35:00 +00:00
Richard Smith 11873949e0 Remove uses of std::binary_function, removed in C++17.
llvm-svn: 298663
2017-03-23 23:32:03 +00:00
Reid Kleckner 392f062675 [sancov] Don't instrument blocks with no insertion point
This prevents crashes when attempting to instrument functions containing
C++ try.

Sanitizer coverage will still fail at runtime when an exception is
thrown through a sancov instrumented function, but that seems marginally
better than what we have now. The full solution is to color the blocks
in LLVM IR and only instrument blocks that have an unambiguous color,
using the appropriate token.

llvm-svn: 298662
2017-03-23 23:30:41 +00:00
Dehao Chen b197d5b0a0 Fix trellis layout to avoid mis-identify triangle.
Summary:
For the following CFG:

A->B
B->C
A->C

If there is another edge B->D, then ABC should not be considered as triangle.

Reviewers: davidxl, iteratee

Reviewed By: iteratee

Subscribers: nemanjai, llvm-commits

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

llvm-svn: 298661
2017-03-23 23:28:09 +00:00
Dehao Chen 722e94061b Set the prof weight correctly for call instructions in DeadArgumentElimination.
Summary: In DeadArgumentElimination, the call instructions will be replaced. We also need to set the prof weights so that function inlining can find the correct profile.

Reviewers: eraman

Reviewed By: eraman

Subscribers: llvm-commits

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

llvm-svn: 298660
2017-03-23 23:26:00 +00:00
Bryant Wong def79b21e4 [MetaRenamer] Don't rename library functions.
Library functions can have specific semantics that affect the behavior of
certain passes. DSE, for instance, gives special treatment to malloc-ed pointers
but not to pointers returned from an equivalently typed (but differently named)
function.

MetaRenamer ought not to alter program semantics, so library functions must
remain untouched.

Reviewers: mehdi_amini, majnemer, chandlerc, davide

Reviewed By: davide

Subscribers: davide, llvm-commits

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

llvm-svn: 298659
2017-03-23 23:21:07 +00:00
Alex Shlyapnikov d6848fc58f Add strtok interceptor for ASAN for Windows.
Summary: Fixes test broken by D30384

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 298658
2017-03-23 23:20:47 +00:00
Richard Smith 2c27df7603 Remove all uses of std::mem_fun and std::bind1st removed in C++17.
llvm-svn: 298657
2017-03-23 23:17:58 +00:00
Dehao Chen 775341a14c Use isFunctionHotInCallGraph to set the function section prefix.
Summary: The current prefix based function layout algorithm only looks at function's entry count, which is not sufficient. A function should be grouped together if its entry count or any call edge count is hot.

Reviewers: davidxl, eraman

Reviewed By: eraman

Subscribers: llvm-commits

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

llvm-svn: 298656
2017-03-23 23:14:11 +00:00
Krzysztof Parzyszek 10fbac009d [Hexagon] Avoid infinite loops in HexagonLoopIdiomRecognition
- Avoid explosive growth of the simplification queue by not queuing
  expressions that are alredy in it.
- Add an iteration counter and abort after a sufficiently large number
  of iterations (assuming that it's a symptom of an infinite loop).

llvm-svn: 298655
2017-03-23 23:01:22 +00:00
Kostya Serebryany 6ca44f9161 [libFuzzer] create experimental support for user-provided coverage signal
llvm-svn: 298654
2017-03-23 22:43:12 +00:00
Petr Hosek 2705226a2b [CMake] Provide an option to disable runtimes build
This could be used to either disable the runtimes build altogether
or avoid building them but still generate the build targets.

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

llvm-svn: 298653
2017-03-23 22:40:10 +00:00
Krzysztof Parzyszek 17bcb4393a Move spill size and alignment info from MC to TargetRegisterInfo
This is another step towards implementing register classes with
parametrized register/spill sizes.

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

llvm-svn: 298652
2017-03-23 22:32:22 +00:00
Jessica Paquette 5096a34726 [Outliner] Remove unused lambda capture.
Remove an unused lambda capture that made some bots unhappy.

llvm-svn: 298651
2017-03-23 22:17:20 +00:00
Alex Shlyapnikov 4ab77b9f28 [asan] Add an interceptor for strtok
Summary:
This change addresses https://github.com/google/sanitizers/issues/766. I
tested the change with make check-asan and the newly added test case.

Reviewers: ygribov, kcc, alekseyshl

Subscribers: kubamracek, llvm-commits

Patch by mrigger

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

llvm-svn: 298650
2017-03-23 21:39:52 +00:00
Reid Kleckner a5d187b0ff [PDB] Use two DBs when dumping the IPI stream
Summary:
When dumping these records from an object file section, we should use
only one type database. However, when dumping from a PDB, we should use
two: one for the type stream and one for the IPI stream.

Certain type records that normally live in the .debug$T object file
section get moved over to the IPI stream of the PDB file and they get
new indices.

So far, I've noticed that the MSVC linker always moves these records
into IPI:
- LF_FUNC_ID
- LF_MFUNC_ID
- LF_STRING_ID
- LF_SUBSTR_LIST
- LF_BUILDINFO
- LF_UDT_MOD_SRC_LINE

These records have index fields that can point into TPI or IPI. In
particular, LF_SUBSTR_LIST and LF_BUILDINFO point to LF_STRING_ID
records to describe compilation command lines.

I've modified the dumper to have an optional pointer to the item DB, and
to do type name lookup of these fields in that DB. See printItemIndex.
The result is that our pdbdump-headers.test is more faithful to the PDB
contents and the output is less confusing.

Reviewers: ruiu

Subscribers: amccarth, zturner, llvm-commits

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

llvm-svn: 298649
2017-03-23 21:36:25 +00:00