]> granicus.if.org Git - clang/log
clang
7 years ago[analyzer] Handle ObjC messages conservatively in CallDescription
Gabor Horvath [Mon, 30 Oct 2017 08:47:13 +0000 (08:47 +0000)]
[analyzer] Handle ObjC messages conservatively in CallDescription

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316885 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDriver: default to `unsigned int` `wchar_t` for ARM
Saleem Abdulrasool [Sun, 29 Oct 2017 06:01:14 +0000 (06:01 +0000)]
Driver: default to `unsigned int` `wchar_t` for ARM

AAPCS and AAPCS64 mandate that `wchar_t` with `-fno-short-wchar` is an
`unsigned int` rather than a `signed int`.  Ensure that the driver does
not flip the signedness of `wchar_t` for those targets.

Add additional tests to ensure that this does not regress.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316858 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] MisusedMovedObjectChecker: More precise warning message
Peter Szecsi [Sat, 28 Oct 2017 23:24:00 +0000 (23:24 +0000)]
[analyzer] MisusedMovedObjectChecker: More precise warning message

Added new enum in order to differentiate the warning messages on "misusing" into
3 categories: function calls, moving an object, copying an object. (At the
moment the checker gives the same message in case of copying and moving.)

Additional test cases added as well.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316852 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] MisusedMovedObjectChecker: Fix false positive on state-resetting, handling...
Peter Szecsi [Sat, 28 Oct 2017 23:09:37 +0000 (23:09 +0000)]
[analyzer] MisusedMovedObjectChecker: Fix false positive on state-resetting, handling method calls on base-class sub-objects

An earlier solution from Artem r315301 solves the reset problem, however, the
reports should be handled the same way in case of method calls. We should not
just report the base class of the object where the method was defined but the
whole object.

Fixed false positive which came from not removing the subobjects in case of a
state-resetting function. (Just replaced the State->remove(...) call to
removeFromState(..) which was defined exactly for that purpose.)

Some minor typos fixed in this patch as well which did not worth a whole new
patch in my opinion, so included them here.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316850 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPR35039: Materialize temporary objects before wrapping them in an
Richard Smith [Sat, 28 Oct 2017 18:59:51 +0000 (18:59 +0000)]
PR35039: Materialize temporary objects before wrapping them in an
OpaqueValueExpr in a GNU binary conditional expression.

It's not meaningful for a non-materialized temporary object to be used as a
common subexpression of multiple expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316836 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] LoopUnrolling: check the bitwidth of the used numbers (pr34943)
Peter Szecsi [Sat, 28 Oct 2017 12:19:08 +0000 (12:19 +0000)]
[analyzer] LoopUnrolling: check the bitwidth of the used numbers (pr34943)

The loop unrolling feature aims to track the maximum possible steps a loop can
make. In order to implement this, it investigates the initial value of the
counter variable and the bound number. (It has to be known.)
These numbers are used as llvm::APInts, however, it was not checked if their
bitwidths are the same which lead to some crashes.
This revision solves this problem by extending the "shorter" one (to the length
of the "longer" one).
For the detailed bug report, see: https://bugs.llvm.org/show_bug.cgi?id=34943

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316830 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoBasic: improve coverage for Darwin targets and fix ABI
Saleem Abdulrasool [Sat, 28 Oct 2017 06:00:43 +0000 (06:00 +0000)]
Basic: improve coverage for Darwin targets and fix ABI

The existing coverage for the Darwin targets wasn't enough to catch all
the variations.  Improve the coverage a bit further and fix a few cases
for Darwin targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316826 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoNever try to instantiate a deduction guide's "definition". Fixes bogus warning when...
Richard Smith [Sat, 28 Oct 2017 01:15:00 +0000 (01:15 +0000)]
Never try to instantiate a deduction guide's "definition". Fixes bogus warning when there inevitably isn't one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316820 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoARM: centralise SizeType, PtrDiffType, and IntPtrType
Saleem Abdulrasool [Fri, 27 Oct 2017 23:04:27 +0000 (23:04 +0000)]
ARM: centralise SizeType, PtrDiffType, and IntPtrType

Centralise the definitions of these compiler vended types to aid
inspection to ensure that they are defined similarly.  The one case that
stands out is the Darwin case where the types do not match up.  This
fixes the API conformance for APCS-GNU as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316810 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] [Tests] Fixing typo from the previous commit.
George Karpenkov [Fri, 27 Oct 2017 22:52:36 +0000 (22:52 +0000)]
[Analyzer] [Tests] Fixing typo from the previous commit.

Can not open a non-existent file with r+.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316808 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[MS] Allow access to ambiguous, inaccessible direct bases
Reid Kleckner [Fri, 27 Oct 2017 22:48:41 +0000 (22:48 +0000)]
[MS] Allow access to ambiguous, inaccessible direct bases

Summary:
Clang typically warns that in the following class hierarchy, 'A' is
inaccessible because there is no series of casts that the user can
write to access it unambiguously:
  struct A { };
  struct B : A { };
  struct C : A, B { };

MSVC allows the user to convert from C* to A*, though, and we've
encountered this issue in the latest Windows SDK headers.

This patch allows this conversion when -fms-compatibility is set and
adds a warning for it under -Wmicrosoft-inaccessible-base.

Reviewers: rsmith

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316807 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] [Tests] Dump the output of scan-build to stdout on failure.
George Karpenkov [Fri, 27 Oct 2017 22:39:54 +0000 (22:39 +0000)]
[Analyzer] [Tests] Dump the output of scan-build to stdout on failure.

Eliminates extra lookup step during debugging.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316806 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoStaticAnalyzer: Modularize/fix ODR violations making functions inline but non-static...
David Blaikie [Fri, 27 Oct 2017 20:40:46 +0000 (20:40 +0000)]
StaticAnalyzer: Modularize/fix ODR violations making functions inline but non-static in headers

Also move these out of the llvm namespace & rely on ADL as is
appropriate for these op<< overloads.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316794 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSanitizers.h: Modularize/Fix ODR violations by making inline functions non-static
David Blaikie [Fri, 27 Oct 2017 20:40:45 +0000 (20:40 +0000)]
Sanitizers.h: Modularize/Fix ODR violations by making inline functions non-static

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316793 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCharInfo.h: Modularize/fix ODR violations by making inline functions in header not...
David Blaikie [Fri, 27 Oct 2017 20:40:45 +0000 (20:40 +0000)]
CharInfo.h: Modularize/fix ODR violations by making inline functions in header not static

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316792 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoASTContext.h: Modularize/fix ODR violations by removing 'static' from inline function...
David Blaikie [Fri, 27 Oct 2017 20:40:44 +0000 (20:40 +0000)]
ASTContext.h: Modularize/fix ODR violations by removing 'static' from inline functions in headers

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316791 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReplace a few usages of llvm::join with range-version[NFC]
Erich Keane [Fri, 27 Oct 2017 18:45:06 +0000 (18:45 +0000)]
Replace a few usages of llvm::join with range-version[NFC]

I noticed a few usages of llvm::join that were using
begin/end rather than just the range version.  This patch
just replaces those.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316784 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFilter out invalid 'target' items from being passed to LLVM
Erich Keane [Fri, 27 Oct 2017 18:32:23 +0000 (18:32 +0000)]
Filter out invalid 'target' items from being passed to LLVM

Craig noticed that CodeGen wasn't properly ignoring the
values sent to the target attribute. This patch ignores
them.

This patch also sets the 'default' for this checking to
'supported', since only X86 has implemented the support
for checking valid CPU names and Feature Names.

One test was changed to i686, since it uses a lakemont,
which would otherwise be prohibited in x86_64.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316783 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove x86,x86_32/64 from isValidFeatureName
Erich Keane [Fri, 27 Oct 2017 18:29:02 +0000 (18:29 +0000)]
Remove x86,x86_32/64 from isValidFeatureName

These are not valid values for this, and are pretty
non-sensical, since LLVM doesn't understand them.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316781 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[refactor] Describe refactorings in the operation classes
Alex Lorenz [Fri, 27 Oct 2017 18:19:11 +0000 (18:19 +0000)]
[refactor] Describe refactorings in the operation classes

This commit changes the way that the refactoring operation classes are
structured:
- Users have to call `initiate` instead of constructing an instance of the
  class. The `initiate` is now supposed to have custom initiation logic, and
  you don't need to subclass the builtin requirements.
- A new `describe` function returns a structure with the id, title and the
  description of the refactoring operation.

The refactoring action classes are now placed into one common place in
RefactoringActions.cpp instead of being separate.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316780 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Sema] Fix an assert-on-invalid by avoiding function template specialisation
Alex Lorenz [Fri, 27 Oct 2017 18:13:31 +0000 (18:13 +0000)]
[Sema] Fix an assert-on-invalid by avoiding function template specialisation
deduction for invalid functions

The fabricated template parameters cause an assertion because their depth
is invalid.

rdar://34109988

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316778 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[WebAssembly] Add crt1.o with calling lld
Sam Clegg [Fri, 27 Oct 2017 18:10:19 +0000 (18:10 +0000)]
[WebAssembly] Add crt1.o with calling lld

Also, for OS unknown targets like wasm, don't include
'unknown' in the library path. This is a fix for rL316719.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316777 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoNew lldb python module for managing diagnostic breakpoints
Don Hinton [Fri, 27 Oct 2017 17:02:33 +0000 (17:02 +0000)]
New lldb python module for managing diagnostic breakpoints

Summary:
Can be used to set breakpoints for either the diagnostics actually
emitted for the current compilation, a particular DiagID, or all
DiagIDs for a particular warning.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316773 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CrossTU] Fix handling of Cross Translation Unit directory path
Gabor Horvath [Fri, 27 Oct 2017 12:53:37 +0000 (12:53 +0000)]
[CrossTU] Fix handling of Cross Translation Unit directory path

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316764 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTest commit
Ivan Donchevskii [Fri, 27 Oct 2017 11:05:40 +0000 (11:05 +0000)]
Test commit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316758 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix test/Driver/wasm-toolchain.c on windows
Sam Clegg [Fri, 27 Oct 2017 01:20:16 +0000 (01:20 +0000)]
Fix test/Driver/wasm-toolchain.c on windows

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316725 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeGen] Add support for IncompleteArrayType in Obj-C ivars.
Volodymyr Sapsai [Fri, 27 Oct 2017 00:56:23 +0000 (00:56 +0000)]
[CodeGen] Add support for IncompleteArrayType in Obj-C ivars.

Fixes an assertion failure when ivar is a struct containing incomplete
array. Also completes support for direct flexible array members.

rdar://problem/21054495

Reviewers: rjmccall, theraven

Reviewed By: rjmccall

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316723 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[WebAssembly] Include libclang_rt.builtins in the standard way
Sam Clegg [Fri, 27 Oct 2017 00:26:07 +0000 (00:26 +0000)]
[WebAssembly] Include libclang_rt.builtins in the standard way

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316719 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Add 'sse4' to X86TargetInfo::isValidFeatureName
Craig Topper [Fri, 27 Oct 2017 00:18:16 +0000 (00:18 +0000)]
[X86] Add 'sse4' to X86TargetInfo::isValidFeatureName

sse4 is valid for target attribute and functions as an alias of sse4.2.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316718 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse -fuse-init-array if no gcc installation is found.
Nico Weber [Thu, 26 Oct 2017 23:26:29 +0000 (23:26 +0000)]
Use -fuse-init-array if no gcc installation is found.

clang currently uses .init_array instead of .ctors on Linux if it detects gcc
4.7+. Make it so that it also uses .init_array if no gcc installation is found
at all – if there's no old gcc, there's nothing we need to be compatible with.

icecc for example runs clang in a very small chroot, so before this change
clang would use .ctors if run under icecc. And lld currently silently mislinks
inputs with .ctors sections, so before this clang + icecc + lld would produce
broken binaries. (But this seems like a good change independent of that lld
bug.)

https://reviews.llvm.org/D39317

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316713 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Make -march=i686 an alias of -march=pentiumpro
Craig Topper [Thu, 26 Oct 2017 23:06:19 +0000 (23:06 +0000)]
[X86] Make -march=i686 an alias of -march=pentiumpro

I think the only reason they are different is because we don't set tune_i686 for -march=i686 to match GCC. But GCC 4.9.0 seems to have changed this behavior and they do set it now. So I think they can aliases now.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316712 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][Driver] Move all of the X86 feature flags to one spot in the Options.td file...
Craig Topper [Thu, 26 Oct 2017 21:28:33 +0000 (21:28 +0000)]
[X86][Driver] Move all of the X86 feature flags to one spot in the Options.td file and pair them up with their negations.

It looks like at one time Options.td was in alphabetical order, but that looks to have long been broken. The result is that it all the no- x86 options got separated from their other friends for no good reason.

This patch puts them all together in one place with the no- paired with its none negated version.

I've kept all the SSE and AVX/AVX512 bits together since they represent a somewhat linear progression of features. The rest I just put in alphabetical order after.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316705 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CGBlocks] Improve line info in backtraces containing *_helper_block
Vedant Kumar [Thu, 26 Oct 2017 21:27:24 +0000 (21:27 +0000)]
[CGBlocks] Improve line info in backtraces containing *_helper_block

Instead of only setting a non-zero debug location on the return
instruction in *_helper_block functions, set a proper location on all
instructions within these functions. Pick the start location of the
block literal expr for maximum clarity.

The debugger does not step into *_helper_block functions during normal
single-stepping because we mark their parameters as artificial. This is
what we want (the functions are implicitly generated and uninteresting
to most users). The stepping behavior is unchanged by this patch.

rdar://32907581

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316704 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[www] Regenerate diagnostics reference.
Richard Smith [Thu, 26 Oct 2017 21:06:52 +0000 (21:06 +0000)]
[www] Regenerate diagnostics reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316701 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix C++ testcase I forgot to add to r316689.
Adrian Prantl [Thu, 26 Oct 2017 20:16:03 +0000 (20:16 +0000)]
Fix C++ testcase I forgot to add to r316689.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316695 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSimplify codegen and debug info generation for block context parameters.
Adrian Prantl [Thu, 26 Oct 2017 20:08:52 +0000 (20:08 +0000)]
Simplify codegen and debug info generation for block context parameters.

The exisiting code goes out of its way to put block parameters into an
alloca only at -O0, and then describes the funciton argument with a
dbg.declare, which is undocumented in the LLVM-CFE contract and does
not actually behave as intended after LLVM r642022.

This patch just generates the alloca unconditionally, the mem2reg pass
will eliminate it at -O1 and up anyway and points the dbg.declare to
the alloca as intended (which mem2reg will then correctly rewrite into
a dbg.value).

This reapplies r316684 with some dead code removed.

rdar://problem/35043980

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316689 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] [Tests] Write analyzers crashes to stdout, and not to a separate file
George Karpenkov [Thu, 26 Oct 2017 19:00:22 +0000 (19:00 +0000)]
[Analyzer] [Tests] Write analyzers crashes to stdout, and not to a separate file

With this change it would be sufficient to look at CI console to see the
failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316687 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Simplify codegen and debug info generation for block context parameters."
Adrian Prantl [Thu, 26 Oct 2017 18:32:16 +0000 (18:32 +0000)]
Revert "Simplify codegen and debug info generation for block context parameters."

This reverts commit r316684 while investigating buildbot breakage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316686 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSimplify codegen and debug info generation for block context parameters.
Adrian Prantl [Thu, 26 Oct 2017 18:16:05 +0000 (18:16 +0000)]
Simplify codegen and debug info generation for block context parameters.

The exisiting code goes out of its way to put block parameters into an
alloca only at -O0, and then describes the funciton argument with a
dbg.declare, which is undocumented in the LLVM-CFE contract and does
not actually behave as intended after LLVM r642022.

This patch just generates the alloca unconditionally, the mem2reg pass
will eliminate it at -O1 and up anyway and points the dbg.declare to
the alloca as intended (which mem2reg will then correctly rewrite into
a dbg.value).

rdar://problem/35043980

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316684 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Add a target attribute test for no-sse4.
Craig Topper [Thu, 26 Oct 2017 17:54:22 +0000 (17:54 +0000)]
[X86] Add a target attribute test for no-sse4.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316681 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMove MS inline asm parser methods out of line to reduce indentation, NFC
Reid Kleckner [Thu, 26 Oct 2017 17:07:48 +0000 (17:07 +0000)]
Move MS inline asm parser methods out of line to reduce indentation, NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316674 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd objcCategoryImplDecl matcher
Dave Lee [Thu, 26 Oct 2017 15:53:37 +0000 (15:53 +0000)]
Add objcCategoryImplDecl matcher

Summary:
Add `objcCategoryImplDecl` which matches ObjC category definitions
(`@implementation`). This matcher complements `objcCategoryDecl` (`@interface`)
which was added in D30854.

Reviewers: aaron.ballman, malcolm.parsons, alexshap

Reviewed By: aaron.ballman

Subscribers: klimek, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316670 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Sema] -Wzero-as-null-pointer-constant: don't warn for system macros other than NULL.
Roman Lebedev [Thu, 26 Oct 2017 13:18:14 +0000 (13:18 +0000)]
[Sema] -Wzero-as-null-pointer-constant: don't warn for system macros other than NULL.

Summary:
The warning was initially introduced in D32914 by @thakis,
and the concerns were raised there, and later in rL302247
and PR33771.

I do believe that it makes sense to relax the diagnostic
e.g. in this case, when the expression originates from the
system header, which can not be modified. This prevents
adoption for the diagnostic for codebases which use pthreads
(`PTHREAD_MUTEX_INITIALIZER`), gtest, etc.

As @malcolm.parsons suggests, it *may* make sense to also
not warn for the template types, but it is not obvious to
me how to do that in here.

Though, it still makes sense to complain about `NULL` macro.

While there, add more tests.

Reviewers: dblaikie, thakis, rsmith, rjmccall, aaron.ballman

Reviewed By: thakis

Subscribers: Rakete1111, hans, cfe-commits, thakis, malcolm.parsons

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316662 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTry to fix warnings and windows test failures caused by r316653
Eric Liu [Thu, 26 Oct 2017 13:09:50 +0000 (13:09 +0000)]
Try to fix warnings and windows test failures caused by r316653

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316661 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd a new attribute definition spelling, Clang<"attr">, that expands to two attribute...
Aaron Ballman [Thu, 26 Oct 2017 12:19:02 +0000 (12:19 +0000)]
Add a new attribute definition spelling, Clang<"attr">, that expands to two attribute spellings: GNU<"attr"> and CXX11<"clang", "attr">. This is similar to how the GCC spelling works and is intended to be used for attributes introduced for Clang.

Changes all existing attributes that currently use GNU<"attr"> and CXX11<"clang", "attr> spellings to instead use the Clang<"attr"> spelling.

No additional tests are necessary because the existing tests already use both spellings for the attributes converted to the new spelling. No functional changes are expected.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316658 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Tooling] A new framework for executing clang frontend actions.
Eric Liu [Thu, 26 Oct 2017 10:38:14 +0000 (10:38 +0000)]
[Tooling] A new framework for executing clang frontend actions.

Summary:
This defines a `clang::tooling::ToolExecutor` interface that can be extended to support different execution plans including standalone execution on a given set of TUs or parallel execution on all TUs in a codebase.

In order to enable multiprocessing execution, tool actions are expected to output result into a `ToolResults` interface provided by executors. The `ToolResults` interface abstracts how results are stored e.g. in-memory for standalone executions or on-disk for large-scale execution.

New executors can be registered as `ToolExecutorPlugin`s via the `ToolExecutorPluginRegistry`. CLI tools can use `createExecutorFromCommandLineArgs` to create a specific registered executor according to the command-line arguments.

This patch also implements `StandaloneToolExecutor` which has the same behavior as the current `ClangTool` interface, i.e. execute frontend actions on a given set of TUs. At this point, it's simply a wrapper around `ClangTool` at this point.

This is still experimental but expected to replace the existing `ClangTool` interface so that specific tools would not need to worry about execution.

Reviewers: klimek, arphaman, hokein, sammccall

Reviewed By: klimek

Subscribers: cfe-commits, djasper, mgorny, omtcyfz

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316653 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix overloaded static functions in SemaCodeComplete
Benjamin Kramer [Thu, 26 Oct 2017 08:41:28 +0000 (08:41 +0000)]
Fix overloaded static functions in SemaCodeComplete

https://bugs.llvm.org/show_bug.cgi?id=33904
Happens when static function is accessed via the class variable. That leads to incorrect overloads number because the variable is considered as the first argument.

struct Bar {
  static void foo(); static void foo(int);
};

int main() {
  Bar b;
  b.foo(/*complete here*/); // did not work before
  Bar::foo(/*complete here*/); // worked fine
}

Patch by Ivan Donchevskii!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316646 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LSan] Enable -fsanitize=leak for PPC64 Linux.
Alex Shlyapnikov [Thu, 26 Oct 2017 03:09:53 +0000 (03:09 +0000)]
[LSan] Enable -fsanitize=leak for PPC64 Linux.

Summary: .

Reviewers: eugenis

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316636 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] [Tests] Consistently use exit codes. Use code=42 to signify different...
George Karpenkov [Thu, 26 Oct 2017 01:13:22 +0000 (01:13 +0000)]
[Analyzer] [Tests] Consistently use exit codes. Use code=42 to signify different results

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316632 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAllow StmtPrinter to supress implicit 'this' and 'self' base expressions
Alex Lorenz [Thu, 26 Oct 2017 00:56:54 +0000 (00:56 +0000)]
Allow StmtPrinter to supress implicit 'this' and 'self' base expressions

This will be useful for certain refactoring actions.

rdar://34202062

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316631 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoHandle PragmaDebug in PPChainedCallbacks
Alex Lorenz [Wed, 25 Oct 2017 22:01:23 +0000 (22:01 +0000)]
Handle PragmaDebug in PPChainedCallbacks

The test is in clang-tools-extra/test/pp-trace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316621 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] [Tests] Do not discard output from CmpRuns.py when running integration...
George Karpenkov [Wed, 25 Oct 2017 21:49:46 +0000 (21:49 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316618 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] Give more descriptive name to BdyFrm field.
George Karpenkov [Wed, 25 Oct 2017 21:49:41 +0000 (21:49 +0000)]
[Analyzer] Give more descriptive name to BdyFrm field.

Discussion at: https://reviews.llvm.org/D39220

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316617 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CUDA] Print an error if you try to compile with < sm_30 on CUDA 9.
Justin Lebar [Wed, 25 Oct 2017 21:32:06 +0000 (21:32 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316611 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoEnable -pie and --enable-new-dtags by default on Android.
Evgeniy Stepanov [Wed, 25 Oct 2017 20:39:22 +0000 (20:39 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316606 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIgnore implicity casts for zero-as-null-pointer-constant warning
Erich Keane [Wed, 25 Oct 2017 20:23:13 +0000 (20:23 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316605 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: fix PPC Darwin variadics
Saleem Abdulrasool [Wed, 25 Oct 2017 17:56:50 +0000 (17:56 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316599 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Add avx512vpopcntdq to Knights Mill
Craig Topper [Wed, 25 Oct 2017 17:10:58 +0000 (17:10 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316593 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OPENMP] Improve debug info for taskgroup implicitly generated
Alexey Bataev [Wed, 25 Oct 2017 15:54:04 +0000 (15:54 +0000)]
[OPENMP] Improve debug info for taskgroup implicitly generated
expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316585 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OPENMP] Constify function parameters, NFC.
Alexey Bataev [Wed, 25 Oct 2017 15:44:52 +0000 (15:44 +0000)]
[OPENMP] Constify function parameters, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316584 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd support of the next Debian (Debian buster - version 10)
Sylvestre Ledru [Wed, 25 Oct 2017 14:25:28 +0000 (14:25 +0000)]
Add support of the next Debian (Debian buster - version 10)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316579 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAlso update IsUbuntu() with Ubuntu Bionic
Sylvestre Ledru [Wed, 25 Oct 2017 14:23:27 +0000 (14:23 +0000)]
Also update IsUbuntu() with Ubuntu Bionic
Follow up of r316577

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316578 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd support of the next Ubuntu (Ubuntu 18.04 - Bionic Beaver)
Sylvestre Ledru [Wed, 25 Oct 2017 14:21:33 +0000 (14:21 +0000)]
Add support of the next Ubuntu (Ubuntu 18.04 - Bionic Beaver)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316577 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[rename] support renaming class member.
Haojian Wu [Wed, 25 Oct 2017 11:54:45 +0000 (11:54 +0000)]
[rename] support renaming class member.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316571 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[clang-rename] Fix and enable the failing TemplatedClassFunction test.
Haojian Wu [Wed, 25 Oct 2017 08:25:25 +0000 (08:25 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316561 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: fix a case of incorrect checks for ivars
Saleem Abdulrasool [Wed, 25 Oct 2017 03:58:15 +0000 (03:58 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316545 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CMake] Build host builtins in Fuchsia toolchain even on Darwin
Petr Hosek [Wed, 25 Oct 2017 02:35:22 +0000 (02:35 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316542 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CMake] Include clang-refactor in Fuchsia toolchain
Petr Hosek [Wed, 25 Oct 2017 02:31:38 +0000 (02:31 +0000)]
[CMake] Include clang-refactor in Fuchsia toolchain

This includes the clang-refactor in the toolchain distribution.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316541 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[clang-refactor] Use add_clang_tool CMake template
Petr Hosek [Wed, 25 Oct 2017 01:11:27 +0000 (01:11 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316540 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] Remove spaces inside comments mentioning the parameter name,
George Karpenkov [Wed, 25 Oct 2017 00:03:45 +0000 (00:03 +0000)]
[Analyzer] Remove spaces inside comments mentioning the parameter name,

to aid clang-tidy comprehension.
Requested by @alexfh in https://reviews.llvm.org/D39015

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316539 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] Remove unnecessary semicolon in analyzer tests.
George Karpenkov [Wed, 25 Oct 2017 00:03:45 +0000 (00:03 +0000)]
[Analyzer] Remove unnecessary semicolon in analyzer tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316538 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] Store BodyFarm in std::unique_ptr
George Karpenkov [Tue, 24 Oct 2017 23:53:19 +0000 (23:53 +0000)]
[Analyzer] Store BodyFarm in std::unique_ptr

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316536 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] [Tests] Minor refactor of testing infrastructure:
George Karpenkov [Tue, 24 Oct 2017 23:52:48 +0000 (23:52 +0000)]
[Analyzer] [Tests] Minor refactor of testing infrastructure:

Move utilities functions into a separate file to make comprehension
easier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316535 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] [Tests] Remove temporary fields from generated reference results.
George Karpenkov [Tue, 24 Oct 2017 23:52:46 +0000 (23:52 +0000)]
[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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316534 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Sema][ObjC] Look for either objc_bridge or objc_bridge_mutable when
Akira Hatanaka [Tue, 24 Oct 2017 23:38:14 +0000 (23:38 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316531 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCorrect behavior of fastcall when default CC is set.
Erich Keane [Tue, 24 Oct 2017 23:12:01 +0000 (23:12 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316528 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] Fix bug in testing scripts, which always marked result as failure.
George Karpenkov [Tue, 24 Oct 2017 22:24:13 +0000 (22:24 +0000)]
[Analyzer] Fix bug in testing scripts, which always marked result as failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316522 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReplaced unicode characters with ASCII, as introduced in r316518.
Erich Keane [Tue, 24 Oct 2017 22:00:25 +0000 (22:00 +0000)]
Replaced unicode characters with ASCII, as introduced in r316518.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316521 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agomplement __has_unique_object_representations
Erich Keane [Tue, 24 Oct 2017 21:31:50 +0000 (21:31 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316518 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Sema] Document+test the -Wsign-compare change for enums in C code [NFC]
Roman Lebedev [Tue, 24 Oct 2017 21:05:43 +0000 (21:05 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316500 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OPENMP] Fix PR35013: Fix passing VLAs captures to outlined functions.
Alexey Bataev [Tue, 24 Oct 2017 19:52:31 +0000 (19:52 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316488 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: Fix missing debug loc due to alloca
Yaxun Liu [Tue, 24 Oct 2017 19:14:43 +0000 (19:14 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316484 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd missing clangRewrite lib dependency for clangToolingRefactor
Alex Lorenz [Tue, 24 Oct 2017 17:23:53 +0000 (17:23 +0000)]
Add missing clangRewrite lib dependency for clangToolingRefactor

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316467 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[refactor] Initial outline of implementation of "extract function" refactoring
Alex Lorenz [Tue, 24 Oct 2017 17:18:45 +0000 (17:18 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316465 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[code completion] Complete ObjC methods in @implementation without leading
Alex Lorenz [Tue, 24 Oct 2017 16:39:37 +0000 (16:39 +0000)]
[code completion] Complete ObjC methods in @implementation without leading
'-'/'+' prefix

rdar://12040840

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316458 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove repeated function name in doxygen comment.
Erich Keane [Tue, 24 Oct 2017 16:16:34 +0000 (16:16 +0000)]
Remove repeated function name in doxygen comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316453 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix spelling in comment, field is isMsStruct, not Strust
Erich Keane [Tue, 24 Oct 2017 15:34:59 +0000 (15:34 +0000)]
Fix spelling in comment, field is isMsStruct, not Strust

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316447 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[modules] Add a regression test for merging anon decls in extern C contexts.
Vassil Vassilev [Tue, 24 Oct 2017 14:52:35 +0000 (14:52 +0000)]
[modules] Add a regression test for merging anon decls in extern C contexts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316444 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd Forgotten test for: Fix template parameter default args missed if redecled
Erich Keane [Tue, 24 Oct 2017 13:51:07 +0000 (13:51 +0000)]
Add Forgotten test for: Fix template parameter default args missed if redecled

Addendum to differential revision: https://reviews.llvm.org/D39127

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316437 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDo not add a colon chunk to the code completion of class inheritance access modifiers
Erik Verbruggen [Tue, 24 Oct 2017 13:46:58 +0000 (13:46 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316436 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Tooling] Add a factory method for CommonOptionsParser
Eric Liu [Tue, 24 Oct 2017 13:10:58 +0000 (13:10 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316433 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Fix PR34625 -mtune without -mcpu should not set -target-cpu
Peter Smith [Tue, 24 Oct 2017 09:51:55 +0000 (09:51 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316424 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[test] Fix clang-test for FreeBSD and NetBSD
Tim Shen [Tue, 24 Oct 2017 03:11:02 +0000 (03:11 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316411 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUnnamed bitfields don't block constant evaluation of constexpr ctors
Jordan Rose [Tue, 24 Oct 2017 02:17:07 +0000 (02:17 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316408 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix template parameter default args missed if redecled
Erich Keane [Tue, 24 Oct 2017 01:39:56 +0000 (01:39 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316405 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] Fix for the memory leak: fix typo in if-statement.
George Karpenkov [Tue, 24 Oct 2017 01:09:43 +0000 (01:09 +0000)]
[Analyzer] Fix for the memory leak: fix typo in if-statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316403 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] Handle implicit function reference in bodyfarming std::call_once
George Karpenkov [Tue, 24 Oct 2017 00:13:18 +0000 (00:13 +0000)]
[Analyzer] Handle implicit function reference in bodyfarming std::call_once

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316402 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Analyzer] Do not use static storage to for implementations created in BodyFarm.cpp
George Karpenkov [Mon, 23 Oct 2017 23:59:52 +0000 (23:59 +0000)]
[Analyzer] Do not use static storage to for implementations created in BodyFarm.cpp

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316400 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Fix handling of labels in getLValueElement
Alexander Shaposhnikov [Mon, 23 Oct 2017 23:46:06 +0000 (23:46 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316399 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Sema] Add support for flexible array members in Obj-C.
Volodymyr Sapsai [Mon, 23 Oct 2017 22:01:41 +0000 (22:01 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316381 91177308-0d34-0410-b5e6-96231b3b80d8