Commit Graph

70930 Commits

Author SHA1 Message Date
Alex Lorenz fbd17e17f5 Handle PragmaDebug in PPChainedCallbacks
The test is in clang-tools-extra/test/pp-trace

llvm-svn: 316621
2017-10-25 22:01:23 +00:00
George Karpenkov a932c8745c [Analyzer] [Tests] Do not discard output from CmpRuns.py when running integration tests
Contrary to the deleted comment, in most cases CmpRuns.py produces a
fairly small amount of output, which is useful to see straight away to
see what has changed when executing the integration tests.

llvm-svn: 316618
2017-10-25 21:49:46 +00:00
George Karpenkov 134d8473ef [Analyzer] Give more descriptive name to BdyFrm field.
Discussion at: https://reviews.llvm.org/D39220

llvm-svn: 316617
2017-10-25 21:49:41 +00:00
Justin Lebar 066494d8c1 [CUDA] Print an error if you try to compile with < sm_30 on CUDA 9.
Summary:
CUDA 9's minimum sm is sm_30.

Ideally we should also make sm_30 the default when compiling with CUDA
9, but that seems harder than it should be.

Subscribers: sanjoy

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

llvm-svn: 316611
2017-10-25 21:32:06 +00:00
Evgeniy Stepanov 117627c9a1 Enable -pie and --enable-new-dtags by default on Android.
Summary:
Also enable -no-pie on Gnu toolchain (previously available on Darwin only).

Non-PIE executables won't even start on recent Android, and DT_RPATH is ignored by the loader.

Reviewers: srhines, danalbert

Subscribers: cfe-commits

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

llvm-svn: 316606
2017-10-25 20:39:22 +00:00
Erich Keane 818cf5bcb3 Ignore implicity casts for zero-as-null-pointer-constant warning
The repro in https://bugs.llvm.org/show_bug.cgi?id=34362
caused the left nullptr to be cast to a int* implicitly, which
resulted diagnosing this falsely.

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

llvm-svn: 316605
2017-10-25 20:23:13 +00:00
Saleem Abdulrasool 2a5015b11b CodeGen: fix PPC Darwin variadics
Darwin uses char * for the variadic list type (va_list).  We use the PPC
SVR4 ABI for PPC, which uses a structure type for the va_list.  When
constructing the GEP, we would fail due to the incorrect handling for
the va_list.  Correct this to use the right type.

llvm-svn: 316599
2017-10-25 17:56:50 +00:00
Craig Topper 009cebfed8 [X86] Add avx512vpopcntdq to Knights Mill
As indicated by Table 1-1 in Intel Architecture Instruction Set Extensions and Future Features Programming Reference from October 2017.

llvm-svn: 316593
2017-10-25 17:10:58 +00:00
Alexey Bataev d070a585f6 [OPENMP] Improve debug info for taskgroup implicitly generated
expressions.

llvm-svn: 316585
2017-10-25 15:54:04 +00:00
Alexey Bataev c551406ba2 [OPENMP] Constify function parameters, NFC.
llvm-svn: 316584
2017-10-25 15:44:52 +00:00
Sylvestre Ledru a3436bb21a Add support of the next Debian (Debian buster - version 10)
llvm-svn: 316579
2017-10-25 14:25:28 +00:00
Sylvestre Ledru de828bad7e Also update IsUbuntu() with Ubuntu Bionic
Follow up of r316577

llvm-svn: 316578
2017-10-25 14:23:27 +00:00
Sylvestre Ledru f8e9ffa56f Add support of the next Ubuntu (Ubuntu 18.04 - Bionic Beaver)
llvm-svn: 316577
2017-10-25 14:21:33 +00:00
Haojian Wu f8bfb34010 [rename] support renaming class member.
Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits, mgorny

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

llvm-svn: 316571
2017-10-25 11:54:45 +00:00
Haojian Wu 6ec2b8ac77 [clang-rename] Fix and enable the failing TemplatedClassFunction test.
Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits

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

llvm-svn: 316561
2017-10-25 08:25:25 +00:00
Saleem Abdulrasool ad75c7d194 CodeGen: fix a case of incorrect checks for ivars
Ensure that we check the ivar containing decl for the DLL storage
attribute rather than the ivar itself as the dll storage is associated
to the interface decl not the ivar decl.

llvm-svn: 316545
2017-10-25 03:58:15 +00:00
Petr Hosek 9f46ece85a [CMake] Build host builtins in Fuchsia toolchain even on Darwin
This is nedeeded for the toolchain to be actually usable as a host
toolchain on Darwin.

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

llvm-svn: 316542
2017-10-25 02:35:22 +00:00
Petr Hosek a9eaf1d226 [CMake] Include clang-refactor in Fuchsia toolchain
This includes the clang-refactor in the toolchain distribution.

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

llvm-svn: 316541
2017-10-25 02:31:38 +00:00
Petr Hosek 3cad20023b [clang-refactor] Use add_clang_tool CMake template
This allows including clang-refactor in LLVM_DISTRIBUTION_COMPONENTS
to build clang-refactor as part of the toolchain distribution.

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

llvm-svn: 316540
2017-10-25 01:11:27 +00:00
George Karpenkov a132938295 [Analyzer] Remove spaces inside comments mentioning the parameter name,
to aid clang-tidy comprehension.
Requested by @alexfh in https://reviews.llvm.org/D39015

llvm-svn: 316539
2017-10-25 00:03:45 +00:00
George Karpenkov f671bd26b7 [Analyzer] Remove unnecessary semicolon in analyzer tests.
llvm-svn: 316538
2017-10-25 00:03:45 +00:00
George Karpenkov 506ecbb946 [Analyzer] Store BodyFarm in std::unique_ptr
Differential Revision: https://reviews.llvm.org/D39220

llvm-svn: 316536
2017-10-24 23:53:19 +00:00
George Karpenkov bf92c44616 [Analyzer] [Tests] Minor refactor of testing infrastructure:
Move utilities functions into a separate file to make comprehension
easier.

llvm-svn: 316535
2017-10-24 23:52:48 +00:00
George Karpenkov 318cd1f263 [Analyzer] [Tests] Remove temporary fields from generated reference results.
Pointer to HTML diagnostics is removed (as it is not stored) as well as
the version (as it would be available from the commit message).

llvm-svn: 316534
2017-10-24 23:52:46 +00:00
Akira Hatanaka bc1d56eafa [Sema][ObjC] Look for either objc_bridge or objc_bridge_mutable when
determining whether a RecordDecl is CFError.

CFErrorRef used to be declared with "objc_bridge(NSError)" but is now
declared with "objc_bridge_mutable(NSError)". Look for either when
checking whether a RecordDecl is CFError.

rdar://problem/35034779

llvm-svn: 316531
2017-10-24 23:38:14 +00:00
Erich Keane 5759fa798b Correct behavior of fastcall when default CC is set.
Fastcall doesn't support variadic function calls, so
setting the default calling convention to Fastcall would
result in incorrect code being emitted for these conditions.

This patch adds a 'variadic' test to the default calling conv
test, as well as fixes the behavior of fastcall.

llvm-svn: 316528
2017-10-24 23:12:01 +00:00
George Karpenkov 43f683cb33 [Analyzer] Fix bug in testing scripts, which always marked result as failure.
llvm-svn: 316522
2017-10-24 22:24:13 +00:00
Erich Keane 9fed6c6501 Replaced unicode characters with ASCII, as introduced in r316518.
llvm-svn: 316521
2017-10-24 22:00:25 +00:00
Erich Keane e63e9d72b8 mplement __has_unique_object_representations
A helper builtin to facilitate implementing the
std::has_unique_object_representations type trait.

Requested here: https://bugs.llvm.org/show_bug.cgi?id=34942
Also already exists in GCC and MSVC.

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

llvm-svn: 316518
2017-10-24 21:31:50 +00:00
Roman Lebedev 7ade0173df [Sema] Document+test the -Wsign-compare change for enums in C code [NFC]
rL316268 / D39122 has fixed PR35009, and now when in C,
these three(?) diagnostics properly use the enum's underlying
datatype.

While it was fixed, the test coverage was clearly insufficient,
because the -Wsign-compare change didn't show up in any of the
tests, until it was reported in the post-commit mail for rL316268.

So add the test for the -Wsign-compare diagnostic for enum
for C code, and while there, document this in the release notes.

The fix itself was obviously correct, so unless we want to silence
this new diagnosed case, i deem this commit to be NFC.

llvm-svn: 316500
2017-10-24 21:05:43 +00:00
Alexey Bataev 1b48c5e56b [OPENMP] Fix PR35013: Fix passing VLAs captures to outlined functions.
Fixed passing of VLAs and variably-modified types to outlined functions.
Synchronized passing with the types codegen.

llvm-svn: 316488
2017-10-24 19:52:31 +00:00
Yaxun Liu e45b3d5dad CodeGen: Fix missing debug loc due to alloca
Builder save/restores insertion pointer when emitting addr space cast
for alloca, but does not save/restore debug loc, which causes verifier
failure for certain call instructions.

This patch fixes that.

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

llvm-svn: 316484
2017-10-24 19:14:43 +00:00
Alex Lorenz 4953114db9 Add missing clangRewrite lib dependency for clangToolingRefactor
llvm-svn: 316467
2017-10-24 17:23:53 +00:00
Alex Lorenz 7fe441b20d [refactor] Initial outline of implementation of "extract function" refactoring
This commit adds an initial, skeleton outline of the "extract function"
refactoring. The extracted function doesn't capture variables / rewrite code
yet, it just basically does a simple copy-paste.
The following initiation rules are specified:

- extraction can only be done for executable code in a function/method/block.
  This means that you can't extract a global variable initialize into a function
  right now.
- simple literals and references are not extractable.

This commit also adds support for full source ranges to clang-refactor's test
mode.

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

llvm-svn: 316465
2017-10-24 17:18:45 +00:00
Alex Lorenz b874042e32 [code completion] Complete ObjC methods in @implementation without leading
'-'/'+' prefix

rdar://12040840

llvm-svn: 316458
2017-10-24 16:39:37 +00:00
Erich Keane d232e2c726 Remove repeated function name in doxygen comment.
llvm-svn: 316453
2017-10-24 16:16:34 +00:00
Erich Keane 1216acc3c4 Fix spelling in comment, field is isMsStruct, not Strust
llvm-svn: 316447
2017-10-24 15:34:59 +00:00
Vassil Vassilev 92e22794bd [modules] Add a regression test for merging anon decls in extern C contexts.
llvm-svn: 316444
2017-10-24 14:52:35 +00:00
Erich Keane daa5f777b4 Add Forgotten test for: Fix template parameter default args missed if redecled
Addendum to differential revision: https://reviews.llvm.org/D39127

llvm-svn: 316437
2017-10-24 13:51:07 +00:00
Erik Verbruggen 6524c05d2c Do not add a colon chunk to the code completion of class inheritance access modifiers
With enabled CINDEXTEST_CODE_COMPLETE_PATTERNS env option (which enables
IncludeCodePatterns in completion options) code completion after colon
currently suggests access modifiers with 2 completion chunks which is
incorrect.

Example:
class A : <Cursor>B
{
}

Currently we get 'NotImplemented:{TypedText public}{Colon :} (40)'
but the correct line is just 'NotImplemented:{TypedText public} (40)'

The fix introduces more specific scope that occurs between ':' and '{'
It allows us to determine when we don't need to add ':' as a second
chunk to the public/protected/private access modifiers.

Patch by Ivan Donchevskii!

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

llvm-svn: 316436
2017-10-24 13:46:58 +00:00
Eric Liu e6f854353e [Tooling] Add a factory method for CommonOptionsParser
Summary: This returns error instead of exiting the program in case of error.

Reviewers: klimek, hokein

Reviewed By: hokein

Subscribers: cfe-commits

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

llvm-svn: 316433
2017-10-24 13:10:58 +00:00
Peter Smith 820e46f3b2 [AArch64] Fix PR34625 -mtune without -mcpu should not set -target-cpu
When -mtune is used on AArch64 the -target-cpu is passed the value of the
cpu given to -mtune. As well as setting micro-architectural features of the
-mtune cpu, this will also add the architectural features such as support
for instructions. This can result in the backend using instructions that
are supported in the -mtune cpu but not supported in the target
architecture. For example use of the v8.1-a LSE extensions with -march=v8.
    
This change removes the setting of -target-cpu for -mtune, the -mcpu must
be used to set -target-cpu. This has the effect of removing all non-hard
coded benefits of mtune but it does produce correct output when -mtune cpu
with a later architecture than v8 is used.
    
Fixes PR34625
    
Differential Revision: https://reviews.llvm.org/D39179

llvm-svn: 316424
2017-10-24 09:51:55 +00:00
Tim Shen cc5bf00f1d [test] Fix clang-test for FreeBSD and NetBSD
Lit tries to inject the shared library paths, but no action is taken
when platform.system() is not recognized, results in an environment
variable with an empty name, which is illegal.

The patch fixes this mechanism for FreeBSD and NetBSD, and gives an
warning on other platforms, so that the latecomers don't have to spend
time on debugging lit.

Thanks Zhihao Yuan for the patch!

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

llvm-svn: 316411
2017-10-24 03:11:02 +00:00
Jordan Rose d4503da40c Unnamed bitfields don't block constant evaluation of constexpr ctors
C++14 [dcl.constexpr]p4 states that in the body of a constexpr
constructor,

> every non-variant non-static data member and base class sub-object
  shall be initialized

However, [class.bit]p2 notes that

> Unnamed bit-fields are not members and cannot be initialized.

Therefore, we should make sure to filter them out of the check that
all fields are initialized.

Fixing this makes the constant evaluator a bit smarter, and
specifically allows constexpr constructors to avoid tripping
-Wglobal-constructors when the type contains unnamed bitfields.

Reviewed at https://reviews.llvm.org/D39035.

llvm-svn: 316408
2017-10-24 02:17:07 +00:00
Erich Keane af0795b906 Fix template parameter default args missed if redecled
This bug was found via self-build on lld, and worked around
here: https://reviews.llvm.org/rL316180

The issue is that the 'using' causes the lookup to pick up the
first decl. However, when setting inherited default parameters,
we only update 'forward', not 'backward'. SO, only the newest param
list has all the information about the default arguments.

This patch ensures that the list of parameters we look through checks
the newest decl's template parameter list so it doesn't miss a default.

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

llvm-svn: 316405
2017-10-24 01:39:56 +00:00
George Karpenkov 0501f97cef [Analyzer] Fix for the memory leak: fix typo in if-statement.
llvm-svn: 316403
2017-10-24 01:09:43 +00:00
George Karpenkov 98e81cd3be [Analyzer] Handle implicit function reference in bodyfarming std::call_once
Differential Revision: https://reviews.llvm.org/D39201

llvm-svn: 316402
2017-10-24 00:13:18 +00:00
George Karpenkov 3d64d6ee54 [Analyzer] Do not use static storage to for implementations created in BodyFarm.cpp
Differential Revision: https://reviews.llvm.org/D39208

llvm-svn: 316400
2017-10-23 23:59:52 +00:00
Alexander Shaposhnikov 9a21d28b5d [analyzer] Fix handling of labels in getLValueElement
In getLValueElement Base may represent the address of a label 
(as in the newly-added test case), in this case it's not a loc::MemRegionVal 
and Base.castAs<loc::MemRegionVal>() triggers an assert, this diff makes 
getLValueElement return UnknownVal instead.

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

llvm-svn: 316399
2017-10-23 23:46:06 +00:00
Volodymyr Sapsai 30680e9437 [Sema] Add support for flexible array members in Obj-C.
Allow Obj-C ivars with incomplete array type but only as the last ivar.
Also add a requirement for ivars that contain a flexible array member to
be at the end of class too. It is possible to add in a subclass another
ivar at the end but we'll emit a warning in this case. Also we'll emit a
warning if a variable sized ivar is declared in class extension or in
implementation because subclasses won't know they should avoid adding
new ivars.

In ARC incomplete array objects are treated as __unsafe_unretained so
require them to be marked as such.

Prohibit synthesizing ivars with flexible array members because order of
synthesized ivars is not obvious and tricky to control. Spelling out
ivar explicitly gives control to developers and helps to avoid surprises
with unexpected ivar ordering.

For C and C++ changed diagnostic to tell explicitly a field is not the
last one and point to the next field. It is not as useful as in Obj-C
but it is an improvement and it is consistent with Obj-C. For C for
unions emit more specific err_flexible_array_union instead of generic
err_field_incomplete.

rdar://problem/21054495

Reviewers: rjmccall, theraven

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 316381
2017-10-23 22:01:41 +00:00