Erich Keane [Thu, 15 Jun 2017 00:27:23 +0000 (00:27 +0000)]
Update Append Argument to more efficiently traverse tokens
This function was previously making (correct) assumptions
without complete knowledge of MacroArgs guarantees for
Arguments. After going through Macro Args a bunch, I'd
corrected the getNumArguments (and changed its name),
however didn't realize this was depending on the behavior.
This patch has version that depends on the corrected
getNumMacroArguments's behavior, with the rest checked against
my knowledge of the MacroArgs' token list. Commiting no-wait
since the test is broken.
llvm-svn: 305434
Vitaly Buka [Thu, 15 Jun 2017 00:19:13 +0000 (00:19 +0000)]
[asan] Return allow_user_segv_handler=0 to fix compatibility issues.
Summary:
After r303941 it was not possible to setup ASAN_OPTIONS to have the same
behavior for pre r303941 and post r303941 builds.
Pre r303941 Asan does not accept handle_sigbus=2.
Post r303941 Asan does not accept allow_user_segv_handler.
This fix ignores allow_user_segv_handler=1, but for allow_user_segv_handler=0
it will upgrade flags like handle_sigbus=1 to handle_sigbus=2. So user can set
ASAN_OPTIONS=allow_user_segv_handler=0 and have same behavior on old and new
clang builds (except range from r303941 to this revision).
In future users which need to prevent third party handlers should switch to
handle_sigbus=2 and remove allow_user_segv_handler as soon as suport of older
builds is not needed.
Related bugs:
https://github.com/google/oss-fuzz/issues/675
https://bugs.chromium.org/p/chromium/issues/detail?id=731130
Reviewers: eugenis
Subscribers: llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D34227
llvm-svn: 305433
Aaron Ballman [Thu, 15 Jun 2017 00:00:08 +0000 (00:00 +0000)]
Handle -ast-dump-all when passed as the only option.
Patch by Don Hinton
llvm-svn: 305432
Wolfgang Pieb [Wed, 14 Jun 2017 23:55:39 +0000 (23:55 +0000)]
Removal of accidental duplication in test assembly file. NFC.
llvm-svn: 305431
Spyridoula Gravani [Wed, 14 Jun 2017 23:40:26 +0000 (23:40 +0000)]
[DWARF] Minor coding style modifications, no functionality change.
llvm-svn: 305430
George Karpenkov [Wed, 14 Jun 2017 23:40:25 +0000 (23:40 +0000)]
Fixing section name for Darwin platforms for sanitizer coverage
On Darwin, section names have a 16char length limit.
llvm-svn: 305429
Rui Ueyama [Wed, 14 Jun 2017 23:37:37 +0000 (23:37 +0000)]
Inline a small function. NFC.
llvm-svn: 305428
Aditya Kumar [Wed, 14 Jun 2017 23:17:45 +0000 (23:17 +0000)]
[locale] Avoid copy of __atoms when char_type is char
The function num_get<_CharT>::stage2_int_prep makes unnecessary copy of src
into atoms when char_type is char. This can be avoided by creating
a switch on type and just returning __src when char_type is char.
Added the test case to demonstrate performance improvement.
In order to avoid ABI incompatibilities, the changes are guarded
with a macro _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
Differential Revision: https://reviews.llvm.org/D30268
Reviewed by: EricWF
llvm-svn: 305427
Erich Keane [Wed, 14 Jun 2017 23:15:51 +0000 (23:15 +0000)]
Update callbacks tracker to match change in 305425
llvm-svn: 305426
Erich Keane [Wed, 14 Jun 2017 23:09:01 +0000 (23:09 +0000)]
[Preprocessor]Correct Macro-Arg allocation of StringifiedArguments,
correct getNumArguments
StringifiedArguments is allocated (resized) based on the size the
getNumArguments function. However, this function ACTUALLY currently
returns the amount of total UnexpArgTokens which is minimum the same as
the new implementation of getNumMacroArguments, since empty/omitted arguments
result in 1 UnexpArgToken, and included ones at minimum include 2
(1 for the arg itself, 1 for eof).
This patch renames the otherwise unused getNumArguments to be more clear
that it is the number of arguments that the Macro expects, and thus the maximum
number that can be stringified. This patch also replaces the explicit memset
(which results in value instantiation of the new tokens, PLUS clearing the
memory) with brace initialization.
Differential Revision: https://reviews.llvm.org/D32046
llvm-svn: 305425
Sean Callanan [Wed, 14 Jun 2017 23:01:43 +0000 (23:01 +0000)]
[testsuite] xfailed two tests that depend on NSString conforming to NSCopying.
NSString is loaded from the DWARF, which doesn't have the concept of protocols.
When this is used with the NSMutableDictionary type from Objective-C modules,
this produces errors of the form
error: cannot initialize a parameter of type 'id<NSCopying> _Nonnull' with an rvalue of type 'NSString *'
We're aware of these problems and have an internal bug report filed
(<rdar://problem/
32777981>)
llvm-svn: 305424
Eli Friedman [Wed, 14 Jun 2017 22:43:28 +0000 (22:43 +0000)]
Don't check side effects for functions outside of SCoP
In r304074 we introduce a patch to accept results from side effect free
functions into SCEV modeling. This causes rejection of cases where the
call is happening outside the SCoP. This patch checks if the call is
outside the Region and treats the results as a parameter (SCEVType::PARAM)
to the SCoP instead of returning SCEVType::INVALID.
Patch by Sameer Abu Asal.
llvm-svn: 305423
Peter Collingbourne [Wed, 14 Jun 2017 22:35:27 +0000 (22:35 +0000)]
IR: Tweak the API around adding modules to the summary index.
The current name (addModulePath) and return value
(ModulePathStringTableTy::iterator) is a little confusing. This
API adds a module, not just a path. And the iterator is basically
just an implementation detail of the summary index. Address
both of those issues by renaming to addModule and introducing a
ModuleSummaryIndex::ModuleInfo type that the function returns.
Differential Revision: https://reviews.llvm.org/D34124
llvm-svn: 305422
Zachary Turner [Wed, 14 Jun 2017 22:33:43 +0000 (22:33 +0000)]
Don't include TestingSupport in LLVM_LINK_COMPONENTS.
Instead use target_link_libraries directly. Thanks to
Juergen Ributzka for the suggestion, which fixes an issue
when llvm is configured with no targets.
llvm-svn: 305421
Eugene Zelenko [Wed, 14 Jun 2017 21:42:24 +0000 (21:42 +0000)]
[ADT] Partial re-commit of r303383. Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 305419
Duncan P. N. Exon Smith [Wed, 14 Jun 2017 21:26:31 +0000 (21:26 +0000)]
AST: Add missing break at end of switch
llvm-svn: 305418
Marshall Clow [Wed, 14 Jun 2017 21:23:57 +0000 (21:23 +0000)]
Rework some metaprogramming to use the detection idiom; no functional change
llvm-svn: 305417
Daniel Berlin [Wed, 14 Jun 2017 21:19:52 +0000 (21:19 +0000)]
PredicateInfo: Don't insert conditional info when a conditional branch jumps to the same target regardless of condition
llvm-svn: 305416
Daniel Berlin [Wed, 14 Jun 2017 21:19:28 +0000 (21:19 +0000)]
NewGVN: This is wrong by inspection, it will not cause an issue currently due to other limitations, i believe. This also means i can't make a test for it.
llvm-svn: 305415
Sanjay Patel [Wed, 14 Jun 2017 20:37:11 +0000 (20:37 +0000)]
[x86] avoid unnecessary shuffle mask math in combineX86ShufflesRecursively()
This is a follow-up to https://reviews.llvm.org/D34174 / https://reviews.llvm.org/rL305398.
We mentioned replacing the multiplies with shifts, but the real win seems to be in
bypassing the extra ops in the common case when the RootRatio and OpRatio are one.
This gives us another 1-2% overall win for the test in PR32037:
https://bugs.llvm.org/show_bug.cgi?id=32037
llvm-svn: 305414
David Callahan [Wed, 14 Jun 2017 20:35:33 +0000 (20:35 +0000)]
Allow -profile-guided-section-prefix more than once
Summary:
At present, `-profile-guided-section-prefix` is a `cl::Optional` option, which means it demands to be passed exactly zero or one times. Our build system makes it pretty tricky to guarantee this. We often accidentally pass the flag more than once (but always with the same "false" value) which results in an error, after which compilation fails:
```
clang (LLVM option parsing): for the -profile-guided-section-prefix option: may only occur zero or one times!
```
While we work on improving our build system, it also seems reasonable just to allow `-profile-guided-section-prefix` to be passed more than once, by to `cl::ZeroOrMore`. Quoting [[ http://llvm.org/docs/CommandLine.html#controlling-the-number-of-occurrences-required-and-allowed | the documentation ]]:
> The cl::ZeroOrMore modifier ... indicates that your program will allow the option to be specified zero or more times.
> ...
> If an option is specified multiple times for an option of the cl::opt class, only the last value will be retained.
Reviewers: danielcdh
Reviewed By: danielcdh
Subscribers: twoh, david2050, llvm-commits
Differential Revision: https://reviews.llvm.org/D34219
llvm-svn: 305413
Zachary Turner [Wed, 14 Jun 2017 20:20:11 +0000 (20:20 +0000)]
Remove lld toStringRef function.
I added the same function in llvm, so this is causing an
ambiguous symbol.
llvm-svn: 305412
Zachary Turner [Wed, 14 Jun 2017 20:11:46 +0000 (20:11 +0000)]
[StringExtras] overload toHex for ArrayRef<uint8_t>
llvm-svn: 305411
Marshall Clow [Wed, 14 Jun 2017 20:00:36 +0000 (20:00 +0000)]
Add some const_casts in places where we were implicitly casting away constness. No functional change, but now they're explicit
llvm-svn: 305410
Davide Italiano [Wed, 14 Jun 2017 19:29:53 +0000 (19:29 +0000)]
[EarlyCSE] Make PhiToCheck in removeMSSA() a set.
This way we end up not looking at PHI args already removed.
MemSSA now goes through the updater so we can prune
it to avoid having redundant MemoryPHI arguments, but that
doesn't quite work for the general case.
Discussed with Daniel Berlin, fixes PR33406.
llvm-svn: 305409
Frederich Munch [Wed, 14 Jun 2017 19:16:22 +0000 (19:16 +0000)]
Hide dbgs() stream for when built with -fmodules.
Summary: Make DebugCounter::print and dump methods to be const correct.
Reviewers: aprantl
Reviewed By: aprantl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34214
llvm-svn: 305408
Peter Collingbourne [Wed, 14 Jun 2017 18:52:12 +0000 (18:52 +0000)]
MC, Object: Reserve a section type, SHT_LLVM_ODRTAB, for the ODR table.
This is part of the ODR checker proposal:
http://lists.llvm.org/pipermail/llvm-dev/2017-June/113820.html
Per discussion on the gnu-gabi mailing list [1] the section type range
0x6fff4c00..0x6fff4cff is reserved for LLVM.
[1] https://sourceware.org/ml/gnu-gabi/2017-q2/msg00030.html
Differential Revision: https://reviews.llvm.org/D33978
llvm-svn: 305407
Rui Ueyama [Wed, 14 Jun 2017 18:18:20 +0000 (18:18 +0000)]
Fix documentation.
We do not actually accept .rc files. We only accept .res files.
Pointed out by Eric Beckmann.
llvm-svn: 305406
Galina Kistanova [Wed, 14 Jun 2017 17:32:53 +0000 (17:32 +0000)]
Specified ReportError as noreturn friendly to old compilers.
llvm-svn: 305405
Kostya Kortchinsky [Wed, 14 Jun 2017 17:32:26 +0000 (17:32 +0000)]
[sanitizer] Reverting D34152
Summary:
This broke thread_local_quarantine_pthread_join.cc on some architectures, due
to the overhead of the stashed regions. Reverting while figuring out the best
way to deal with it.
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D34213
llvm-svn: 305404
Galina Kistanova [Wed, 14 Jun 2017 17:30:35 +0000 (17:30 +0000)]
Supressed warning: declared ‘static’ but never defined.
llvm-svn: 305403
Lei Huang [Wed, 14 Jun 2017 17:25:55 +0000 (17:25 +0000)]
Test commit - NFC.
Modified a comment to confirm commit access functionality.
llvm-svn: 305402
Tony Jiang [Wed, 14 Jun 2017 17:23:43 +0000 (17:23 +0000)]
[PPC] Enhance altivec conversion function macros implementation.
Add checking for the second parameter of altivec conversion builtin to make sure
it is compile-time constant int.
This patch fixes PR33212: PPC vec_cst useless at -O0
Differential Revision: https://reviews.llvm.org/D34092
llvm-svn: 305401
Craig Topper [Wed, 14 Jun 2017 17:04:59 +0000 (17:04 +0000)]
[ValueTracking] Correct early out in computeKnownBitsFromOperator to work with non power of 2 bit widths
There's an early out that's trying to detect when we don't know any bits that make up the legal range of a shift. The code subtracts one from BitWidth which creates a mask in the lower bits for power of 2 bit widths. This is then ANDed with the known bits to see if any of those bits are known. If the bit width isn't a power of 2 this creates a non-sensical mask.
This patch corrects this by rounding up to a power of 2 before doing the subtract and mask.
Differential Revision: https://reviews.llvm.org/D34165
llvm-svn: 305400
James Y Knight [Wed, 14 Jun 2017 17:01:18 +0000 (17:01 +0000)]
Define _GNU_SOURCE for rtems c++
This is required by the libc++ locale support.
Patch by Walter Lee.
Differential Revision: https://reviews.llvm.org/D34105
llvm-svn: 305399
Sanjay Patel [Wed, 14 Jun 2017 17:00:57 +0000 (17:00 +0000)]
[x86] replace div/rem with shift/mask for better shuffle combining perf
We know that shuffle masks are power-of-2 sizes, but there's no way (?) for LLVM to know that,
so hack combineX86ShufflesRecursively() to be much faster by replacing div/rem with shift/mask.
This makes the motivating compile-time bug in PR32037 ( https://bugs.llvm.org/show_bug.cgi?id=32037 )
about 9% faster overall.
Differential Revision: https://reviews.llvm.org/D34174
llvm-svn: 305398
Marshall Clow [Wed, 14 Jun 2017 16:54:43 +0000 (16:54 +0000)]
In several places in std::allocator<const T> (and one in shared_ptr, we were casting a 'const T*' to a 'void *' - implicitly casting away the const. Add const_cast to make that explicit. No functional change.
llvm-svn: 305397
Zachary Turner [Wed, 14 Jun 2017 16:49:38 +0000 (16:49 +0000)]
Add an include of gtest-printers.h to appease the buildbots.
llvm-svn: 305396
Zachary Turner [Wed, 14 Jun 2017 16:41:50 +0000 (16:41 +0000)]
[gtest] Create a shared include directory for gtest utilities.
Many times unit tests for different libraries would like to use
the same helper functions for checking common types of errors.
This patch adds a common library with helpers for testing things
in Support, and introduces helpers in here for integrating the
llvm::Error and llvm::Expected<T> classes with gtest and gmock.
Normally, we would just be able to write:
EXPECT_THAT(someFunction(), succeeded());
but due to some quirks in llvm::Error's move semantics, gmock
doesn't make this easy, so two macros EXPECT_THAT_ERROR() and
EXPECT_THAT_EXPECTED() are introduced to gloss over the difficulties.
Consider this an exception, and possibly only temporary as we
look for ways to improve this.
Differential Revision: https://reviews.llvm.org/D33059
llvm-svn: 305395
James Y Knight [Wed, 14 Jun 2017 16:40:03 +0000 (16:40 +0000)]
PR32476: __nop_locale_mgmt.h not needed with newlib 2.5+
Newlib 2.5 added the locale management functions, so it should not
include __nop_local_mgmt.h. This change adds proper guard around that
include statement.
For newlib 2.4, some releases contain these functions and some don't,
and they all have the same version numbers. This patch will work
properly with the initial "2.4.0" release which does not include these
functions and require __nop_local_mgmt.h.
This has been tested against newlib 2.2 and 2.5, and also sanity
checks against other different version numbers.
Patch by Martin J. O'Riordan and Walter Lee
Differential Revision: https://reviews.llvm.org/D32146
llvm-svn: 305394
Zachary Turner [Wed, 14 Jun 2017 15:59:27 +0000 (15:59 +0000)]
Resubmit "[codeview] Make obj2yaml/yaml2obj support .debug$S..."
This was originally reverted because of some non-deterministic
failures on certain buildbots. Luckily ASAN eventually caught
this as a stack-use-after-scope, so the fix is included in
this patch.
llvm-svn: 305393
Yuka Takahashi [Wed, 14 Jun 2017 15:37:11 +0000 (15:37 +0000)]
Be more strict when checking the -flto option value
Summary:
It seems -flto must be either "thin" or "full". I think the use of
containValue is just a typo.
Reviewers: ruiu, tejohnson
Subscribers: mehdi_amini, inglorion
Differential Revision: https://reviews.llvm.org/D34055
llvm-svn: 305392
Kostya Kortchinsky [Wed, 14 Jun 2017 15:32:17 +0000 (15:32 +0000)]
[sanitizer] MmapAlignedOrDie changes to reduce fragmentation
Summary:
The reasoning behind this change is explained in D33454, which unfortunately
broke the Windows version (due to the platform not supporting partial unmapping
of a memory region).
This new approach changes `MmapAlignedOrDie` to allow for the specification of
a `padding_chunk`. If non-null, and the initial allocation is aligned, this
padding chunk will hold the address of the extra memory (of `alignment` bytes).
This allows `AllocateRegion` to get 2 regions if the memory is aligned
properly, and thus help reduce fragmentation (and saves on unmapping
operations). As with the initial D33454, we use a stash in the 32-bit Primary
to hold those extra regions and return them on the fast-path.
The Windows version of `MmapAlignedOrDie` will always return a 0
`padding_chunk` if one was requested.
Reviewers: alekseyshl, dvyukov, kcc
Reviewed By: alekseyshl
Subscribers: llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D34152
llvm-svn: 305391
Alexandros Lamprineas [Wed, 14 Jun 2017 15:00:08 +0000 (15:00 +0000)]
Revert "[ARM] Support constant pools in data when generating execute-only code."
This reverts commit
3a204faa093c681a1e96c5e0622f50649b761ee0.
I've upset a buildbot which runs the address sanitizer:
ERROR: AddressSanitizer: stack-use-after-scope
lib/Target/ARM/ARMISelLowering.cpp:2690
That Twine variable is used illegally.
llvm-svn: 305390
Simon Dardis [Wed, 14 Jun 2017 14:46:30 +0000 (14:46 +0000)]
[mips] Fix multiprecision arithmetic.
For multiprecision arithmetic on MIPS, rather than using ISD::ADDE / ISD::ADDC,
get SelectionDAG to break down the operation into ISD::ADDs and ISD::SETCCs.
For MIPS, only the DSP ASE has a carry flag, so in the general case it is not
useful to directly support ISD::{ADDE, ADDC, SUBE, SUBC} nodes.
Also improve the generation code in such cases for targets with
TargetLoweringBase::ZeroOrOneBooleanContent by directly using the result of the
comparison node rather than using it in selects. Similarly for ISD::SUBE /
ISD::SUBC.
Address optimization breakage by moving the generation of MIPS specific integer
multiply-accumulate nodes to before legalization.
This revolves PR32713 and PR33424.
Thanks to Simonas Kazlauskas and Pirama Arumuga Nainar for reporting the issue!
Reviewers: slthakur
Differential Revision: https://reviews.llvm.org/D33494
llvm-svn: 305389
Sanjay Patel [Wed, 14 Jun 2017 14:28:24 +0000 (14:28 +0000)]
[MathExtras] fix documentation comments; NFC
llvm-svn: 305388
Alexandros Lamprineas [Wed, 14 Jun 2017 13:22:41 +0000 (13:22 +0000)]
[ARM] Support constant pools in data when generating execute-only code.
The ARM backend asserts against constant pool lowering when it generates
execute-only code in order to prevent the generation of constant pools in
the text section. It appears that target independent optimizations might
generate DAG nodes that represent constant pools. By lowering such nodes
as global addresses we don't violate the semantics of execute-only code
and also it is guaranteed that execute-only behaves correct with the
position-independent addressing modes that support execute-only code.
Differential Revision: https://reviews.llvm.org/D33773
llvm-svn: 305387
Florian Hahn [Wed, 14 Jun 2017 13:14:38 +0000 (13:14 +0000)]
Align definition of DW_OP_plus with DWARF spec [3/3]
Summary:
This patch is part of 3 patches that together form a single patch, but must be introduced in stages in order not to break things.
The way that LLVM interprets DW_OP_plus in DIExpression nodes is basically that of the DW_OP_plus_uconst operator since LLVM expects an unsigned constant operand. This unnecessarily restricts the DW_OP_plus operator, preventing it from being used to describe the evaluation of runtime values on the expression stack. These patches try to align the semantics of DW_OP_plus and DW_OP_minus with that of the DWARF definition, which pops two elements off the expression stack, performs the operation and pushes the result back on the stack.
This is done in three stages:
• The first patch (LLVM) adds support for DW_OP_plus_uconst.
• The second patch (Clang) contains changes all its uses from DW_OP_plus to DW_OP_plus_uconst.
• The third patch (LLVM) changes the semantics of DW_OP_plus and DW_OP_minus to be in line with its DWARF meaning. This patch includes the bitcode upgrade from legacy DIExpressions.
Patch by Sander de Smalen.
Reviewers: echristo, pcc, aprantl
Reviewed By: aprantl
Subscribers: fhahn, javed.absar, aprantl, llvm-commits
Differential Revision: https://reviews.llvm.org/D33894
llvm-svn: 305386
Aaron Ballman [Wed, 14 Jun 2017 12:48:18 +0000 (12:48 +0000)]
Corrected some comment typos; NFC.
llvm-svn: 305385
Francois Ferrand [Wed, 14 Jun 2017 12:29:47 +0000 (12:29 +0000)]
clang-format: Add CompactNamespaces option
Summary:
Add CompactNamespaces option, to pack namespace declarations on the
same line (somewhat similar to C++17 nested namespace definition).
With this option, consecutive namespace declarations are kept on the
same line:
namespace foo { namespace bar {
...
}} // namespace foo::bar
Reviewers: krasimir, djasper, klimek
Reviewed By: djasper
Subscribers: kimgr, cfe-commits, klimek
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D32480
llvm-svn: 305384
Nitesh Jain [Wed, 14 Jun 2017 12:21:26 +0000 (12:21 +0000)]
[LLDB][MIPS] Skip TestGdbRemoteSingleStep and TestGdbRemote_vCont.py.
The step count depends on code generated by compiler (GCC/Clang).
It will also vary for different MIPS arch variant. Hence skipping these test for MIPS.
Subscribers: jaydeep, bhushan, lldb-commits, slthakur
llvm-svn: 305383
Simon Dardis [Wed, 14 Jun 2017 12:16:47 +0000 (12:16 +0000)]
[mips] Fix machine verifier errors in the long branch pass
This patch fixes two systemic machine verifier errors in the long
branch pass. The first is the incorrect basic block successors
and the second was the incorrect construction of several jump
instructions.
This partially resolves PR27458 and the associated PR32146.
Reviewers: slthakur
Differential Revision: https://reviews.llvm.org/D33378
llvm-svn: 305382
Serge Pavlov [Wed, 14 Jun 2017 10:57:56 +0000 (10:57 +0000)]
Reverted 305379 (Function with unparsed body is a definition)
It broke clang-x86_64-linux-selfhost-modules-2 and some other buildbots.
llvm-svn: 305381
Nitesh Jain [Wed, 14 Jun 2017 10:47:25 +0000 (10:47 +0000)]
[LLDB][MIPS] Fix TestNoreturnUnwind.py.
bugnumber=llvm.org/pr33452
Subscribers: jaydeep, bhushan, lldb-commits, slthakur
llvm-svn: 305380
Serge Pavlov [Wed, 14 Jun 2017 10:07:02 +0000 (10:07 +0000)]
Function with unparsed body is a definition
While a function body is being parsed, the function declaration is not considered
as a definition because it does not have a body yet. In some cases it leads to
incorrect interpretation, the case is presented in
https://bugs.llvm.org/show_bug.cgi?id=14785:
```
template<typename T> struct Somewhat {
void internal() const {}
friend void operator+(int const &, Somewhat<T> const &) {}
};
void operator+(int const &, Somewhat<char> const &x) { x.internal(); }
```
When statement `x.internal()` in the body of global `operator+` is parsed, the type
of `x` must be completed, so the instantiation of `Somewhat<char>` is started. It
instantiates the declaration of `operator+` defined inline, and makes a check for
redefinition. The check does not detect another definition because the declaration
of `operator+` is still not defining as does not have a body yet.
To solves this problem the function `isThisDeclarationADefinition` considers
a function declaration as a definition if it has flag `WillHaveBody` set.
This change fixes PR14785.
Differential Revision: https://reviews.llvm.org/D30375
llvm-svn: 305379
Nitesh Jain [Wed, 14 Jun 2017 10:02:56 +0000 (10:02 +0000)]
[LLDB][MIPS] Fix TestRegisterVariables.py.
Clang does not accept regparm attribute on these platforms.
Fortunately, the default calling convention passes arguments
in registers any way
Subscribers: jaydeep, bhushan, lldb-commits, slthakur
llvm-svn: 305378
Dmitry Polukhin [Wed, 14 Jun 2017 09:47:47 +0000 (09:47 +0000)]
Fix for Itanium mangler issue with templates
Patch by Serge Preis
Differential Revision: https://reviews.llvm.org/D32428
llvm-svn: 305377
Ilya Biryukov [Wed, 14 Jun 2017 09:46:44 +0000 (09:46 +0000)]
[clangd] Add a filename parameter to FileSystemProvider.
Reviewers: krasimir
Reviewed By: krasimir
Subscribers: klimek, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D34151
llvm-svn: 305376
Eugene Leviant [Wed, 14 Jun 2017 08:25:38 +0000 (08:25 +0000)]
[ELF] Add armelf emulation mode
Differential revision: https://reviews.llvm.org/D34140
llvm-svn: 305375
Yuka Takahashi [Wed, 14 Jun 2017 08:01:26 +0000 (08:01 +0000)]
Use getLastArgValue instead of getString
Summary: I found that getString defined in the LLD's Driver.cpp is
exactly the same as Arg::getLastArgValue defined in
llvm/Option/ArgLIst.h. This patch removes that local function and use
the function that the Arg class provides.
Reviewers: ruiu
Subscribers: emaste, llvm-commits
Differential Revision: https://reviews.llvm.org/D34196
llvm-svn: 305374
Michael Park [Wed, 14 Jun 2017 07:12:55 +0000 (07:12 +0000)]
Mark `__is_inplace_*` tests as UNSUPPORTED in <= C++14.
llvm-svn: 305373
Nemanja Ivanovic [Wed, 14 Jun 2017 07:05:42 +0000 (07:05 +0000)]
Revert r304907 as it is causing some failures that I cannot reproduce.
Reverting this until a test case can be provided to aid the investigation.
llvm-svn: 305372
Zachary Turner [Wed, 14 Jun 2017 06:24:24 +0000 (06:24 +0000)]
Revert "[codeview] Make obj2yaml/yaml2obj support .debug$S..."
This is causing failures on linux bots with an invalid stream
read. It doesn't repro in any configuration on Windows, so
reverting until I have a chance to investigate on Linux.
llvm-svn: 305371
Michael Park [Wed, 14 Jun 2017 05:51:18 +0000 (05:51 +0000)]
Add an `__is_inplace_index` metafunction.
Summary: This is used to constrain `variant`'s converting constructor correctly.
Reviewers: EricWF, mclow.lists
Reviewed By: EricWF, mclow.lists
Differential Revision: https://reviews.llvm.org/D34111
llvm-svn: 305370
Zachary Turner [Wed, 14 Jun 2017 05:48:33 +0000 (05:48 +0000)]
Use make_shared instead of make_unique.
llvm-svn: 305369
Zachary Turner [Wed, 14 Jun 2017 05:44:38 +0000 (05:44 +0000)]
Fix some more errors.
llvm-svn: 305368
Zachary Turner [Wed, 14 Jun 2017 05:38:34 +0000 (05:38 +0000)]
Add some #includes to appease the build.
llvm-svn: 305367
Zachary Turner [Wed, 14 Jun 2017 05:31:00 +0000 (05:31 +0000)]
[codeview] Make obj2yaml/yaml2obj support .debug$S/T sections.
This allows us to use yaml2obj and obj2yaml to round-trip CodeView
symbol and type information without having to manually specify the bytes
of the section. This makes for much easier to maintain tests. See the
tests under lld/COFF in this patch for example. Before they just said
SectionData: <blob> whereas now we can use meaningful record
descriptions. Note that it still supports the SectionData yaml field,
which could be useful for initializing a section to invalid bytes for
testing, for example.
Differential Revision: https://reviews.llvm.org/D34127
llvm-svn: 305366
Marshall Clow [Wed, 14 Jun 2017 04:48:45 +0000 (04:48 +0000)]
Implement the non-parallel versions of reduce and transform_reduce for C++17
llvm-svn: 305365
Rui Ueyama [Wed, 14 Jun 2017 04:02:40 +0000 (04:02 +0000)]
Use StringRef::split instead of StringRef::find and StringRef::substr.
Summary: Pointed out by Yuka Takahashi.
Differential Revision: https://reviews.llvm.org/D34192
llvm-svn: 305364
Eric Fiselier [Wed, 14 Jun 2017 03:24:55 +0000 (03:24 +0000)]
[coroutines] Fix co_await for range statement
Summary:
Currently we build the co_await expressions on the wrong implicit statements of the implicit ranged for; Specifically we build the co_await expression wrapping the range declaration, but it should wrap the begin expression.
This patch fixes co_await on range for.
Reviewers: rsmith, GorNishanov
Reviewed By: GorNishanov
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D34021
llvm-svn: 305363
Richard Trieu [Wed, 14 Jun 2017 03:19:58 +0000 (03:19 +0000)]
[ODRHash] Remove debugging code from r305361
llvm-svn: 305362
Richard Trieu [Wed, 14 Jun 2017 03:17:26 +0000 (03:17 +0000)]
[ODRHash] Hash Template and TemplateExpansion in TemplateArgument.
llvm-svn: 305361
Richard Trieu [Wed, 14 Jun 2017 01:28:00 +0000 (01:28 +0000)]
[ODRHash] Hash Expr for TemplateArgument::Expression
llvm-svn: 305360
Peter Collingbourne [Wed, 14 Jun 2017 00:36:21 +0000 (00:36 +0000)]
Support: Remove MSVC 2013 workarounds in ThreadPool class.
I have confirmed that these are no longer needed with MSVC 2015.
Differential Revision: https://reviews.llvm.org/D34187
llvm-svn: 305347
Kostya Serebryany [Wed, 14 Jun 2017 00:34:42 +0000 (00:34 +0000)]
[libFuzzer] really restrict the new test to Linux (fails on Mac/Windows currently)
llvm-svn: 305346
Eric Beckmann [Wed, 14 Jun 2017 00:22:43 +0000 (00:22 +0000)]
Re-enable tests on power pc since the bug has been fixed.
Summary: just flip them on.
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34186
llvm-svn: 305345
Spyridoula Gravani [Wed, 14 Jun 2017 00:17:55 +0000 (00:17 +0000)]
Added partial verification for .apple_names accelerator table in llvm-dwarfdump output.
This patch adds code which verifies that each bucket in the .apple_names
accelerator table is either empty or has a valid hash index.
Differential Revision: https://reviews.llvm.org/D34177
llvm-svn: 305344
Galina Kistanova [Tue, 13 Jun 2017 23:57:51 +0000 (23:57 +0000)]
Reverted r305339 as MSVC is not happy with noreturn in lambda.
llvm-svn: 305343
Alex Shlyapnikov [Tue, 13 Jun 2017 23:57:24 +0000 (23:57 +0000)]
[ASan] Move rss_limit_is_exceeded_ flag to ASan.
Summary:
Move the OOM decision based on RSS limits out of generic allocator to
ASan allocator, where it makes more sense at the moment.
Reviewers: eugenis
Subscribers: kubamracek, llvm-commits
Differential Revision: https://reviews.llvm.org/D34180
llvm-svn: 305342
Rafael Espindola [Tue, 13 Jun 2017 23:54:34 +0000 (23:54 +0000)]
Simplify. NFC.
llvm-svn: 305341
Daniel Sanders [Tue, 13 Jun 2017 23:42:32 +0000 (23:42 +0000)]
[globalisel][legalizer] G_LOAD/G_STORE NarrowScalar should not emit G_GEP x, 0.
Summary:
When legalizing G_LOAD/G_STORE using NarrowScalar, we should avoid emitting
%0 = G_CONSTANT ty 0
%1 = G_GEP %x, %0
since it's cheaper to not emit the redundant instructions than it is to fold them
away later.
Reviewers: qcolombet, t.p.northover, ab, rovka, aditya_nandakumar, kristof.beyls
Reviewed By: qcolombet
Subscribers: javed.absar, llvm-commits, igorb
Differential Revision: https://reviews.llvm.org/D32746
llvm-svn: 305340
Galina Kistanova [Tue, 13 Jun 2017 23:39:42 +0000 (23:39 +0000)]
Specified LLVM_ATTRIBUTE_NORETURN for ReportError.
llvm-svn: 305339
Craig Topper [Tue, 13 Jun 2017 23:30:41 +0000 (23:30 +0000)]
[InstCombine] Add test cases demonstrating failure to handle (select (icmp eq (and X, C1), 0), Y, (or Y, C2)) when the icmp portion gets turned into a truncate and a signed compare with 0.
InstCombine has an optimization that recognizes an and with the sign bit of legal type size and turns it into a truncate and compare that checks the sign bit. But the select handling code doesn't recognize this idiom.
llvm-svn: 305338
Rafael Espindola [Tue, 13 Jun 2017 23:26:31 +0000 (23:26 +0000)]
Make OutputSections and OutputSectionCommands globals.
This is similar to what we do for InputSections and makes them easier
to access.
llvm-svn: 305337
Tobias Grosser [Tue, 13 Jun 2017 23:09:54 +0000 (23:09 +0000)]
[www] Add missing '.' at the end of the sentence
llvm-svn: 305336
Kostya Serebryany [Tue, 13 Jun 2017 23:09:11 +0000 (23:09 +0000)]
[libFuzzer] restrict the new test to Linux (fails on Mac currently)
llvm-svn: 305335
Tobias Grosser [Tue, 13 Jun 2017 23:09:09 +0000 (23:09 +0000)]
[www] Add the new AOSP buildbot to release notes
llvm-svn: 305334
Rafael Espindola [Tue, 13 Jun 2017 22:36:20 +0000 (22:36 +0000)]
Move clearOutputSections earlier. NFC.
llvm-svn: 305333
Eugene Zelenko [Tue, 13 Jun 2017 22:32:38 +0000 (22:32 +0000)]
[ADT] Revert r305326 changes in BitVector.h to fix broken builds.
llvm-svn: 305332
Kostya Serebryany [Tue, 13 Jun 2017 22:31:21 +0000 (22:31 +0000)]
[libFuzzer] initial support of -fsanitize-coverage=inline-8bit-counters in libFuzzer. This is not fully functional yet, but simple tests work
llvm-svn: 305331
Evgeniy Stepanov [Tue, 13 Jun 2017 22:29:15 +0000 (22:29 +0000)]
[sanitize] Remove stack size limits from secondary threads.
If pthread_attr_getstack tell us the stack is 2G, why would we doubt that?
Differential Revision: https://reviews.llvm.org/D34169
llvm-svn: 305330
Davide Italiano [Tue, 13 Jun 2017 22:24:24 +0000 (22:24 +0000)]
[AMDGPU] Remove now dead defaultOffsetS13(). NFCI.
Fixes the GCC7 build with -Werror.
llvm-svn: 305329
Richard Trieu [Tue, 13 Jun 2017 22:21:18 +0000 (22:21 +0000)]
[ODRHash] Add TemplateArgument kind to hash.
llvm-svn: 305328
Vedant Kumar [Tue, 13 Jun 2017 22:12:35 +0000 (22:12 +0000)]
[InstrProf] Don't take the address of alwaysinline available_externally functions
Doing so breaks compilation of the following C program
(under -fprofile-instr-generate):
__attribute__((always_inline)) inline int foo() { return 0; }
int main() { return foo(); }
At link time, we fail because taking the address of an
available_externally function creates an undefined external reference,
which the TU cannot provide.
Emitting the function definition into the object file at all appears to
be a violation of the langref: "Globals with 'available_externally'
linkage are never emitted into the object file corresponding to the LLVM
module."
Differential Revision: https://reviews.llvm.org/D34134
llvm-svn: 305327
Eugene Zelenko [Tue, 13 Jun 2017 22:11:49 +0000 (22:11 +0000)]
[ADT] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 305326
Xinliang David Li [Tue, 13 Jun 2017 21:14:07 +0000 (21:14 +0000)]
Preserve cold attribute for function decls
Differential Revision: http://reviews.llvm.org/D34133
llvm-svn: 305325
Eric Beckmann [Tue, 13 Jun 2017 21:05:42 +0000 (21:05 +0000)]
Use reference to iterate through string table instead of copying.
Summary: just a quick patch
Subscribers: ruiu, llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D34171
llvm-svn: 305324
Rafael Espindola [Tue, 13 Jun 2017 20:57:43 +0000 (20:57 +0000)]
Set non alloc section address to 0 earlier.
Currently we do layout as if non alloc sections had an actual address
and then set it to zero. This produces a few odd results where a
symbol has an address that is inconsistent with the section address.
The simplest way to fix it is probably to just set the address earlier.
The behavior of bfd seems to be similar, but it only sets the non
alloc section address is missing from the linker script or if the
script has an explicit " : 0" setting the address of the output
section (which the default script does).
llvm-svn: 305323
Eric Beckmann [Tue, 13 Jun 2017 20:53:31 +0000 (20:53 +0000)]
Fix a bug introduced in r305092 on big-endian systems.
Summary:
We were writing the length of the string based on system-endianness, and
not universally little-endian. This fixes that.
Reviewers: zturner
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D34159
llvm-svn: 305322