]> granicus.if.org Git - clang/log
clang
6 years ago[Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia
Petr Hosek [Sat, 3 Nov 2018 01:43:25 +0000 (01:43 +0000)]
[Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia

This avoids introducing unnecessary DT_NEEDED entries when using
C++ driver for linking C code or C++ code that doesn't use C++
standard library.

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

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

6 years ago[CMake][Fuchsia] Set -fuse-ld=lld explicitly for Linux runtimes
Petr Hosek [Fri, 2 Nov 2018 23:49:36 +0000 (23:49 +0000)]
[CMake][Fuchsia] Set -fuse-ld=lld explicitly for Linux runtimes

We set lld as the default linker on non-Darwin platforms, but we still
need to set -fuse-ld=lld explicitly in to support cross-compiling Linux
runtimes on Darwin.

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

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

6 years agoAdd an explicit -std=c++14 to this test.
Adrian Prantl [Fri, 2 Nov 2018 22:19:02 +0000 (22:19 +0000)]
Add an explicit -std=c++14 to this test.

rdar://problem/45642490

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

6 years ago[COFF, ARM64] Implement InterlockedExchange*_* builtins
Mandeep Singh Grang [Fri, 2 Nov 2018 21:18:23 +0000 (21:18 +0000)]
[COFF, ARM64] Implement InterlockedExchange*_* builtins

Summary: Windows SDK needs these intrinsics to be proper builtins.  This is second in a series of patches to move intrinsic defintions out of intrin.h.

Reviewers: rnk, mstorsjo, efriedma, TomTan

Reviewed By: rnk, efriedma

Subscribers: javed.absar, kristof.beyls, chrib, jfb, kristina, cfe-commits

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

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

6 years agoDiagnose parameter names that shadow the names of inherited fields under -Wshadow...
Aaron Ballman [Fri, 2 Nov 2018 21:04:44 +0000 (21:04 +0000)]
Diagnose parameter names that shadow the names of inherited fields under -Wshadow-field.

This addresses PR34120. Note, unlike GCC, we take into account the accessibility of the field when deciding whether to warn or not.

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

6 years agoAttempt to fix 'logical operation on address of string constant'
Kristof Umann [Fri, 2 Nov 2018 19:48:56 +0000 (19:48 +0000)]
Attempt to fix 'logical operation on address of string constant'

Caused a lot of warnings for Windows:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/21178/steps/build/logs/warnings%20%2867%29

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

6 years ago[analyzer] Fixup of the module build after https://reviews.llvm.org/D53277
George Karpenkov [Fri, 2 Nov 2018 18:28:52 +0000 (18:28 +0000)]
[analyzer] Fixup of the module build after https://reviews.llvm.org/D53277

Adds AnalyzerOptions.def to the list of textual headers.

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

6 years ago[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry
Mandeep Singh Grang [Fri, 2 Nov 2018 18:10:07 +0000 (18:10 +0000)]
[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry

Summary: ARM64 setjmp expects sp on entry instead of framepointer.

Patch by: Yin Ma (yinma@codeaurora.org)

Reviewers: mgrang, eli.friedman, ssijaric, mstorsjo, rnk, compnerd

Reviewed By: mgrang

Subscribers: efriedma, javed.absar, kristof.beyls, chrib, cfe-commits

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

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

6 years ago[CodeGen] Fix a crash when updating a designated initializer
Erik Pilkington [Fri, 2 Nov 2018 17:36:58 +0000 (17:36 +0000)]
[CodeGen] Fix a crash when updating a designated initializer

We need to handle the ConstantAggregateZero case here too.

rdar://45691981

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

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

6 years agoChange -fsanitize-address-poison-class-member-array-new-cookie to -fsanitize-address...
Filipe Cabecinhas [Fri, 2 Nov 2018 17:29:04 +0000 (17:29 +0000)]
Change -fsanitize-address-poison-class-member-array-new-cookie to -fsanitize-address-poison-custom-array-cookie

Handle it in the driver and propagate it to cc1

Reviewers: rjmccall, kcc, rsmith

Subscribers: cfe-commits

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

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

6 years agoRemove the duplicated definition of size_t
Kristof Umann [Fri, 2 Nov 2018 17:00:07 +0000 (17:00 +0000)]
Remove the duplicated definition of size_t

So hopefully windows won't complain.

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

6 years agoDidn't -> didnt, because #errors complains about untermianted '
Kristof Umann [Fri, 2 Nov 2018 16:32:15 +0000 (16:32 +0000)]
Didn't -> didnt, because #errors complains about untermianted '

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

6 years ago[analyzer] Fix diagnostics/explicit-suppression.cpp
Fangrui Song [Fri, 2 Nov 2018 16:23:37 +0000 (16:23 +0000)]
[analyzer] Fix diagnostics/explicit-suppression.cpp

*OI++ = *II++ is on line 670, not 668

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

6 years ago[OPENMP][NVPTX]Use __kmpc_data_sharing_coalesced_push_stack function.
Alexey Bataev [Fri, 2 Nov 2018 16:08:31 +0000 (16:08 +0000)]
[OPENMP][NVPTX]Use __kmpc_data_sharing_coalesced_push_stack function.

Coalesced memory access requires use of the new function
`__kmpc_data_sharing_coalesced_push_stack` instead of the
`__kmpc_data_sharing_push_stack`.

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

6 years ago[analyzer] Put llvm.Conventions back in alpha
Kristof Umann [Fri, 2 Nov 2018 16:02:10 +0000 (16:02 +0000)]
[analyzer] Put llvm.Conventions back in alpha

Interestingly, this many year old (when I last looked I remember 2010ish)
checker was committed without any tests, so I thought I'd implement them, but I
was shocked to see how I barely managed to get it working. The code is severely
outdated, I'm not even sure it has ever been used, so I'd propose to move it
back into alpha, and possibly even remove it.

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

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

6 years ago[analyzer] New flag to print all -analyzer-config options
Kristof Umann [Fri, 2 Nov 2018 15:59:37 +0000 (15:59 +0000)]
[analyzer] New flag to print all -analyzer-config options

A new -cc1 flag is avaible for the said purpose: -analyzer-config-help

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

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

6 years ago[analyzer][NFC] Collect all -analyzer-config options in a .def file
Kristof Umann [Fri, 2 Nov 2018 15:50:44 +0000 (15:50 +0000)]
[analyzer][NFC] Collect all -analyzer-config options in a .def file

I'm in the process of refactoring AnalyzerOptions. The main motivation behind
here is to emit warnings if an invalid -analyzer-config option is given from the
command line, and be able to list them all.

In this patch, I'm moving all analyzer options to a def file, and move 2 enums
to global namespace.

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

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

6 years ago[analyzer][NFC] Fix some incorrect uses of -analyzer-config options
Kristof Umann [Fri, 2 Nov 2018 15:48:10 +0000 (15:48 +0000)]
[analyzer][NFC] Fix some incorrect uses of -analyzer-config options

I'm in the process of refactoring AnalyzerOptions. The main motivation behind
here is to emit warnings if an invalid -analyzer-config option is given from
the command line, and be able to list them all.

In this patch, I found some flags that should've been used as checker options,
or have absolutely no mention of in AnalyzerOptions, or are nonexistent.

- NonLocalizedStringChecker now uses its "AggressiveReport" flag as a checker
    option
- lib/StaticAnalyzer/Frontend/ModelInjector.cpp now accesses the "model-path"
    option through a getter in AnalyzerOptions
- -analyzer-config path-diagnostics-alternate=false is not a thing, I removed it,
- lib/StaticAnalyzer/Checkers/AllocationDiagnostics.cpp and
    lib/StaticAnalyzer/Checkers/AllocationDiagnostics.h are weird, they actually
    only contain an option getter. I deleted them, and fixed RetainCountChecker
    to get it's "leak-diagnostics-reference-allocation" option as a checker option,
- "region-store-small-struct-limit" has a proper getter now.

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

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

6 years ago[OPENMP]Change the mapping type for lambda captures.
Alexey Bataev [Fri, 2 Nov 2018 15:25:06 +0000 (15:25 +0000)]
[OPENMP]Change the mapping type for lambda captures.

The previously used combination `PTR_AND_OBJ | PRIVATE` could be used for mapping of some data in Fortran. Changed it to `PTR_AND_OBJ | LITERAL`.

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

6 years ago[OPENMP][NVPTX]Improve emission of the globalized variables for
Alexey Bataev [Fri, 2 Nov 2018 14:54:07 +0000 (14:54 +0000)]
[OPENMP][NVPTX]Improve emission of the globalized variables for
target/teams/distribute regions.

Target/teams/distribute regions exist for all the time the kernel is
executed. Thus, if the variable is declared in their context and then
escape it, we can allocate global memory statically instead of
allocating it dynamically.
Patch captures all the globalized variables in target/teams/distribute
contexts, merges them into the records, one per each target region.
Those records are then joined into the union, one per compilation unit
(to save the global memory). Those units are organized into
2 x dimensional arrays, where the first dimension is
the number of blocks per SM and the second one is the number of SMs.
Runtime functions manage this global memory space between the executing
teams.

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

6 years agoReapply Logging: make os_log buffer size an integer constant expression.
Tim Northover [Fri, 2 Nov 2018 13:14:11 +0000 (13:14 +0000)]
Reapply Logging: make os_log buffer size an integer constant expression.

The size of an os_log buffer is known at any stage of compilation, so making it
a constant expression means that the common idiom of declaring a buffer for it
won't result in a VLA. That allows the compiler to skip saving and restoring
the stack pointer around such buffers.

This also moves the OSLog and other FormatString helpers from
libclangAnalysis to libclangAST to avoid a circular dependency.

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

6 years agoAdd support for 'atomic_default_mem_order' clause on 'requires' directive. Also renam...
Patrick Lyster [Fri, 2 Nov 2018 12:18:11 +0000 (12:18 +0000)]
Add support for 'atomic_default_mem_order' clause on 'requires' directive. Also renamed test files relating to 'requires'. Differntial review: https://reviews.llvm.org/D53513

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

6 years ago[analyzer][CTU] Correctly signal in the function index generation tool if there was...
Gabor Horvath [Fri, 2 Nov 2018 11:22:22 +0000 (11:22 +0000)]
[analyzer][CTU] Correctly signal in the function index generation tool if there was an error

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

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

6 years agoRevert "Fix regression in behavior of clang -x c++-header -fmodule-name=XXX"
Ilya Biryukov [Fri, 2 Nov 2018 10:50:26 +0000 (10:50 +0000)]
Revert "Fix regression in behavior of clang -x c++-header -fmodule-name=XXX"

This reverts commit r345803 and r345915 (a follow-up fix to r345803).

Reason: r345803 blocks our internal integrate because of the new
warnings showing up in too many places. The fix is actually correct,
we will reland it after figuring out how to integrate properly.

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

6 years agoFix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off builds
Fangrui Song [Fri, 2 Nov 2018 04:09:08 +0000 (04:09 +0000)]
Fix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off builds

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

6 years agoWhen building a header module, treat inputs as headers rather than
Richard Smith [Fri, 2 Nov 2018 00:24:40 +0000 (00:24 +0000)]
When building a header module, treat inputs as headers rather than
source files.

This suppresses certain warnings (eg, '#include_next in main source
file').

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

6 years ago[CodeGen] Fix assertion on referencing constexpr Obj-C object with ARC.
Volodymyr Sapsai [Thu, 1 Nov 2018 22:50:08 +0000 (22:50 +0000)]
[CodeGen] Fix assertion on referencing constexpr Obj-C object with ARC.

Failed assertion is
> Assertion failed: ((ND->isUsed(false) || !isa<VarDecl>(ND) || !E->getLocation().isValid()) && "Should not use decl without marking it used!"), function EmitDeclRefLValue, file llvm-project/clang/lib/CodeGen/CGExpr.cpp, line 2437.

`EmitDeclRefLValue` mentions
> // A DeclRefExpr for a reference initialized by a constant expression can
> // appear without being odr-used. Directly emit the constant initializer.

The fix is to use the similar approach for non-references as for references. It
is achieved by trying to emit a constant before we attempt to load non-odr-used
variable as LValue.

rdar://problem/40650504

Reviewers: ahatanak, rjmccall

Reviewed By: rjmccall

Subscribers: dexonsmith, erik.pilkington, cfe-commits

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

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

6 years ago[CodeGen] Move `emitConstant` from ScalarExprEmitter to CodeGenFunction. NFC.
Volodymyr Sapsai [Thu, 1 Nov 2018 21:57:05 +0000 (21:57 +0000)]
[CodeGen] Move `emitConstant` from ScalarExprEmitter to CodeGenFunction. NFC.

The goal is to use `emitConstant` in more places. Didn't move
`ComplexExprEmitter::emitConstant` because it returns a different type.

Reviewers: rjmccall, ahatanak

Reviewed By: rjmccall

Subscribers: dexonsmith, erik.pilkington, cfe-commits

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

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

6 years ago[CMake][Fuchsia] Don't restrict Linux runtimes to UNIX
Petr Hosek [Thu, 1 Nov 2018 20:36:33 +0000 (20:36 +0000)]
[CMake][Fuchsia] Don't restrict Linux runtimes to UNIX

This allows building Linux runtimes on any platform if the correct
sysroot is provided via CMake option.

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

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

6 years agoFix clang -Wimplicit-fallthrough warnings across llvm, NFC
Reid Kleckner [Thu, 1 Nov 2018 19:54:45 +0000 (19:54 +0000)]
Fix clang -Wimplicit-fallthrough warnings across llvm, NFC

This patch should not introduce any behavior changes. It consists of
mostly one of two changes:
1. Replacing fall through comments with the LLVM_FALLTHROUGH macro
2. Inserting 'break' before falling through into a case block consisting
   of only 'break'.

We were already using this warning with GCC, but its warning behaves
slightly differently. In this patch, the following differences are
relevant:
1. GCC recognizes comments that say "fall through" as annotations, clang
   doesn't
2. GCC doesn't warn on "case N: foo(); default: break;", clang does
3. GCC doesn't warn when the case contains a switch, but falls through
   the outer case.

I will enable the warning separately in a follow-up patch so that it can
be cleanly reverted if necessary.

Reviewers: alexfh, rsmith, lattner, rtrieu, EricWF, bollu

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

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

6 years agoOutput "rule" information in SARIF exports.
Aaron Ballman [Thu, 1 Nov 2018 18:57:38 +0000 (18:57 +0000)]
Output "rule" information in SARIF exports.

SARIF allows you to export descriptions about rules that are present in the SARIF log. Expose the help text table generated into Checkers.inc as the rule's "full description" and export all of the rules present in the analysis output. This information is useful for analysis result viewers like CodeSonar.

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

6 years agoAdd LLVM_FALLTHROUGH annotation after switch
Reid Kleckner [Thu, 1 Nov 2018 18:53:02 +0000 (18:53 +0000)]
Add LLVM_FALLTHROUGH annotation after switch

This silences a -Wimplicit-fallthrough warning from clang. GCC does not
appear to warn when the case body ends in a switch.

This is a somewhat surprising but intended fallthrough that I pulled out
from my mechanical patch. The code intends to handle 'Yi' and related
constraints as the 'x' constraint.

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

6 years agoRevert "[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry"
Mandeep Singh Grang [Thu, 1 Nov 2018 18:38:26 +0000 (18:38 +0000)]
Revert "[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry"

This reverts commit 619111f5ccf349b635e4987ec02d15777c571495.

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

6 years agoRevert "Reapply Logging: make os_log buffer size an integer constant expression."
Tim Northover [Thu, 1 Nov 2018 18:37:42 +0000 (18:37 +0000)]
Revert "Reapply Logging: make os_log buffer size an integer constant expression."

Still more dependency hell.

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

6 years agoReapply Logging: make os_log buffer size an integer constant expression.
Tim Northover [Thu, 1 Nov 2018 18:04:49 +0000 (18:04 +0000)]
Reapply Logging: make os_log buffer size an integer constant expression.

The size of an os_log buffer is known at any stage of compilation, so making it
a constant expression means that the common idiom of declaring a buffer for it
won't result in a VLA. That allows the compiler to skip saving and restoring
the stack pointer around such buffers.

This also moves the OSLog helpers from libclangAnalysis to libclangAST
to avoid a circular dependency.

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

6 years agoReplace two fallthrough annotations after covered switch with unreachable
Reid Kleckner [Thu, 1 Nov 2018 17:51:48 +0000 (17:51 +0000)]
Replace two fallthrough annotations after covered switch with unreachable

Both preceding switches handle all possible enumerators, so the
fallthrough is actually unreachable. This strengthens that to an
assertion.

The first instance had a comment from 2010 indicating that fallthrough
was possible, but that was back when we had a unary operator for
offsetof. Now it is its own expression kind, so the annotation was
stale.

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

6 years ago[Diagnostics] Implement -Wsizeof-pointer-div
David Bolvansky [Thu, 1 Nov 2018 16:26:10 +0000 (16:26 +0000)]
[Diagnostics] Implement -Wsizeof-pointer-div

Summary:
void test(int *arr) {
    int arr_len = sizeof(arr) / sizeof(*arr);  // warn, incorrect way to compute number of array elements
}

Enabled under -Wall (same behaviour as GCC)

Reviewers: rsmith, MTC, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: MTC, thakis, jfb, cfe-commits

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

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

6 years agoRevert "Logging: make os_log buffer size an integer constant expression.
Tim Northover [Thu, 1 Nov 2018 16:15:24 +0000 (16:15 +0000)]
Revert "Logging: make os_log buffer size an integer constant expression.

This also reverts a couple of follow-up commits trying to fix the
dependency issues. Latest revision added a cyclic dependency that can't
just be patched up in 5 minutes.

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

6 years ago[clang] Improve ctor initializer completions.
Kadir Cetinkaya [Thu, 1 Nov 2018 15:54:18 +0000 (15:54 +0000)]
[clang] Improve ctor initializer completions.

Summary:
Instead of providing generic "args" for member and base class
initializers, tries to fetch relevant constructors and show their signatures.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: ZaMaZaN4iK, eraman, arphaman, cfe-commits

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

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

6 years agoMultiversioning- Ensure all MV functions are emitted.
Erich Keane [Thu, 1 Nov 2018 15:11:43 +0000 (15:11 +0000)]
Multiversioning- Ensure all MV functions are emitted.

Multiverson function versions are always used (by the resolver), so ensure that
they are always emitted.

Change-Id: I5d2e0841fddf0d18918b3fb92ae76814add7ee96

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

6 years agoCPU-Dispatch- Fix type of a member function, prevent deferrals
Erich Keane [Thu, 1 Nov 2018 15:11:41 +0000 (15:11 +0000)]
CPU-Dispatch- Fix type of a member function, prevent deferrals

The member type creation for a cpu-dispatch function was not correctly
including the 'this' parameter, so ensure that the type is properly
determined. Also, disable defer in the cases of emitting the functoins,
as it can end up resulting in the wrong version being emitted.

Change-Id: I0b8fc5e0b0d1ae1a9d98fd54f35f27f6e5d5d083

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

6 years agoLogging: put link against libclangAnalysis rather than libLLVMAnalysis for os_log
Tim Northover [Thu, 1 Nov 2018 14:43:35 +0000 (14:43 +0000)]
Logging: put link against libclangAnalysis rather than libLLVMAnalysis for os_log

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

6 years agoLogging: add CMake dependency so libAST can use OSLog analysis.
Tim Northover [Thu, 1 Nov 2018 14:22:20 +0000 (14:22 +0000)]
Logging: add CMake dependency so libAST can use OSLog analysis.

Should fix bots on platforms with slightly different symbol resolution
semantics.

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

6 years agoLogging: make os_log buffer size an integer constant expression.
Tim Northover [Thu, 1 Nov 2018 13:49:54 +0000 (13:49 +0000)]
Logging: make os_log buffer size an integer constant expression.

The size of an os_log buffer is known at any stage of compilation, so making it
a constant expression means that the common idiom of declaring a buffer for it
won't result in a VLA. That allows the compiler to skip saving and restoring
the stack pointer around such buffers.

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

6 years agoCPU-Dispatch-- Fix conflict between 'generic' and 'pentium'
Erich Keane [Thu, 1 Nov 2018 12:50:37 +0000 (12:50 +0000)]
CPU-Dispatch-- Fix conflict between 'generic' and 'pentium'

When a dispatch function was being emitted that had both a generic and a
pentium configuration listed, we would assert.  This is because neither
configuration has any 'features' associated with it so they were both
considered the 'default' version.  'pentium' lacks any features because
we implement it in terms of __builtin_cpu_supports (instead of Intel
proprietary checks), which is unable to decern between the two.

The fix for this is to omit the 'generic' version from the dispatcher if
both are present. This permits existing code to compile, and still will
choose the 'best' version available (since 'pentium' is technically
better than 'generic').

Change-Id: I4b69f3e0344e74cbdbb04497845d5895dd05fda0

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

6 years agoAllow clk_event_t comparisons
Sven van Haastregt [Thu, 1 Nov 2018 12:43:00 +0000 (12:43 +0000)]
Allow clk_event_t comparisons

Also rename `invalid-clk-events-cl2.0.cl` to `clk_event_t.cl` and
repurpose it to include both positive and negative clk_event_t tests.

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

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

6 years agoUpdate to the 10-10 SARIF spec.
Aaron Ballman [Thu, 1 Nov 2018 11:52:07 +0000 (11:52 +0000)]
Update to the 10-10 SARIF spec.

This removes the Step property (which can be calculated by consumers trivially), and updates the schema and version numbers accordingly.

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

6 years ago[clang][CodeGen] ImplicitIntegerSignChangeSanitizer: actually ignore NOP casts.
Roman Lebedev [Thu, 1 Nov 2018 08:56:51 +0000 (08:56 +0000)]
[clang][CodeGen] ImplicitIntegerSignChangeSanitizer: actually ignore NOP casts.

I fully expected for that to be handled by the canonical type check,
but it clearly wasn't. Sadly, somehow it hide until now.

Reported by Eli Friedman.

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

6 years ago[Clang][PowerPC] Support constraint 'wi' in asm
Li Jia He [Thu, 1 Nov 2018 02:32:49 +0000 (02:32 +0000)]
[Clang][PowerPC] Support constraint 'wi' in asm
  From the gcc manual, we can see that the specific limit of wi inline asm is “FP or VSX register to hold 64-bit integers for VSX insns or NO_REGS”. The link is https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/Machine-Constraints.html#Machine-Constraints. We should accept this constraint.

Reviewed By: jsji

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

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

6 years ago[COFF, ARM64] Implement llvm.addressofreturnaddress intrinsic
Mandeep Singh Grang [Thu, 1 Nov 2018 01:35:34 +0000 (01:35 +0000)]
[COFF, ARM64] Implement llvm.addressofreturnaddress intrinsic

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

6 years ago[analyzer] SARIF: Suppress version testing in a more downstream-friendly manner.
Artem Dergachev [Thu, 1 Nov 2018 01:27:01 +0000 (01:27 +0000)]
[analyzer] SARIF: Suppress version testing in a more downstream-friendly manner.

No functional change intended.

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

6 years agoFix typo in comment.
Richard Smith [Thu, 1 Nov 2018 01:05:00 +0000 (01:05 +0000)]
Fix typo in comment.

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

6 years ago[WebAssembly] Fix type names in truncation builtins
Thomas Lively [Thu, 1 Nov 2018 01:03:17 +0000 (01:03 +0000)]
[WebAssembly] Fix type names in truncation builtins

Summary: Use the same convention as all the other WebAssembly builtin names.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits

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

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

6 years agoFix regression in behavior of clang -x c++-header -fmodule-name=XXX
Richard Smith [Thu, 1 Nov 2018 00:46:54 +0000 (00:46 +0000)]
Fix regression in behavior of clang -x c++-header -fmodule-name=XXX
-fsyntax-only.

The driver accidentally stopped passing the input filenames on to -cc1
in this mode due to confusion over what action was being requested.

This change also fixes a couple of crashes I encountered when passing
multiple files to such a -cc1 invocation.

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

6 years ago[analyzer] pr39348: MallocChecker: Realize that sized delete isn't custom delete.
Artem Dergachev [Thu, 1 Nov 2018 00:43:35 +0000 (00:43 +0000)]
[analyzer] pr39348: MallocChecker: Realize that sized delete isn't custom delete.

MallocChecker no longer thinks that operator delete() that accepts the size of
the object to delete (available since C++14 or under -fsized-deallocation)
is some weird user-defined operator. Instead, it handles it like normal delete.

Additionally, it exposes a regression in NewDelete-intersections.mm's
testStandardPlacementNewAfterDelete() test, where the diagnostic is delayed
from before the call of placement new into the code of placement new
in the header. This happens because the check for pass-into-function-after-free
for placement arguments is located in checkNewAllocator(), which happens after
the allocator is inlined, which is too late. Move this use-after-free check
into checkPreCall instead, where it works automagically because the guard
that prevents it from working is useless and can be removed as well.

This commit causes regressions under -analyzer-config
c++-allocator-inlining=false but this option is essentially unsupported
because the respective feature has been enabled by default quite a while ago.

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

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

6 years ago[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry
Mandeep Singh Grang [Wed, 31 Oct 2018 23:17:36 +0000 (23:17 +0000)]
[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry

Summary: ARM64 setjmp expects sp on entry instead of framepointer.

Reviewers: mgrang, rnk, TomTan, compnerd, mstorsjo, efriedma

Reviewed By: mstorsjo

Subscribers: javed.absar, kristof.beyls, chrib, cfe-commits

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

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

6 years agoRevert "[ASTImporter][Structural Eq] Check for isBeingDefined"
Shafik Yaghmour [Wed, 31 Oct 2018 21:53:15 +0000 (21:53 +0000)]
Revert "[ASTImporter][Structural Eq] Check for isBeingDefined"

This reverts commit r345760

because it caused an assertion in the lldb test suite. This is the log from the build bot: http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/12003/

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

6 years ago[AArch64] [Windows] Emit unwind tables by default.
Eli Friedman [Wed, 31 Oct 2018 21:39:41 +0000 (21:39 +0000)]
[AArch64] [Windows] Emit unwind tables by default.

Unwind tables are necessary even in code that doesn't support
exceptions.  The tables are used for setjmp(), and by debuggers.

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

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

6 years ago[ARM64] [Windows] Implement _InterlockedExchangeAdd*_* builtins.
Eli Friedman [Wed, 31 Oct 2018 21:31:09 +0000 (21:31 +0000)]
[ARM64] [Windows] Implement _InterlockedExchangeAdd*_* builtins.

These apparently need to be proper builtins to handle the Windows
SDK.

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

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

6 years agoPart of PR39508: Emit an @llvm.invariant.start after storing to
Richard Smith [Wed, 31 Oct 2018 20:39:26 +0000 (20:39 +0000)]
Part of PR39508: Emit an @llvm.invariant.start after storing to
__tls_guard.

__tls_guard can only ever transition from 0 to 1, and only once. This
permits LLVM to remove repeated checks for TLS initialization and
repeated initialization code in cases like:

  int g();
  thread_local int n = g();
  int a = n + n;

where we could not prove that __tls_guard was still 'true' when checking
it for the second reference to 'n' in the initializer of 'a'.

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

6 years ago[ASTImporter][Structural Eq] Check for isBeingDefined
Gabor Marton [Wed, 31 Oct 2018 18:46:13 +0000 (18:46 +0000)]
[ASTImporter][Structural Eq] Check for isBeingDefined

Summary:
If one definition is currently being defined, we do not compare for
equality and we assume that the decls are equal.

Reviewers: a_sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

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

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

6 years ago[clang-format] tweaked another case of lambda formatting
Krasimir Georgiev [Wed, 31 Oct 2018 17:56:57 +0000 (17:56 +0000)]
[clang-format] tweaked another case of lambda formatting

Summary:
This is done in order to improve cases where the lambda's body is moved too far to the right. Consider the following snippet with column limit set to 79:

```
void f() {
  leader::MakeThisCallHere(&leader_service_,
                           cq_.get(),
                           [this, liveness](const leader::ReadRecordReq& req,
                                            std::function<void()> done) {
                             logger_->HandleReadRecord(
                                 req, resp, std::move(done));
                           });

  leader::MakeAnother(&leader_service_,
                      cq_.get(),
                      [this, liveness](const leader::ReadRecordReq& req,
                                       std::function<void()> done) {
                        logger_->HandleReadRecord(
                            req, resp, std::move(done), a);
                      });
}
```

The tool favors extra indentation for the lambda body and so the code incurs extra wrapping and adjacent calls are indented to a different level. I find this behavior annoying and I'd like the tool to favor new lines and, thus, use the extra width.

The fix, reduced, brings the following formatting.

Before:

    function(1,
             [] {
               DoStuff();
               //
             },
             1);

After:

    function(
        1,
        [] {
          DoStuff();
          //
        },
        1);

Refer to the new tests in FormatTest.cpp

Contributed by oleg.smolsky!

Reviewers: djasper, klimek, krasimir

Subscribers: cfe-commits, owenpan

Tags: #clang

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

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

6 years agoRe-land r345676 "[Win64] Handle passing i128 by value"
Reid Kleckner [Wed, 31 Oct 2018 17:43:55 +0000 (17:43 +0000)]
Re-land r345676 "[Win64] Handle passing i128 by value"

Fix the unintended switch/case fallthrough to avoid changing long double
behavior.

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

6 years ago[analyzer] Re-add custom OSIterator rule for RetainCountChecker
George Karpenkov [Wed, 31 Oct 2018 17:38:46 +0000 (17:38 +0000)]
[analyzer] Re-add custom OSIterator rule for RetainCountChecker

Turns out the rule is quite ubiquitous.

Revert of https://reviews.llvm.org/D53628

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

6 years ago[analyzer] RetainCountChecker: for now, do not trust the summaries of inlined code
George Karpenkov [Wed, 31 Oct 2018 17:38:29 +0000 (17:38 +0000)]
[analyzer] RetainCountChecker: for now, do not trust the summaries of inlined code

Trusting summaries of inlined code would require a more thorough work,
as the current approach was causing too many false positives, as the new
example in test.  The culprit lies in the fact that we currently escape
all variables written into a field (but not passed off to unknown
functions!), which can result in inconsistent behavior.

rdar://45655344

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

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

6 years ago[analyzer] Enable retain count checking for OSObject by defa
George Karpenkov [Wed, 31 Oct 2018 17:38:12 +0000 (17:38 +0000)]
[analyzer] Enable retain count checking for OSObject by defa

The FP rate seems to be good enough now.

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

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

6 years ago[Lex] Make MacroDirective::findDirectiveAtLoc take const SourceManager
Kristof Umann [Wed, 31 Oct 2018 17:19:20 +0000 (17:19 +0000)]
[Lex] Make MacroDirective::findDirectiveAtLoc take const SourceManager

I'm currently working on including macro expansions in the Static Analyzer's
plist output, where I can only access a const SourceManager.

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

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

6 years ago[clang] try-fix broken documentation builder
Jonas Toth [Wed, 31 Oct 2018 17:00:50 +0000 (17:00 +0000)]
[clang] try-fix broken documentation builder

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

6 years ago[analyzer][PlistMacroExpansion] Part 1.: New expand-macros flag
Kristof Umann [Wed, 31 Oct 2018 14:54:27 +0000 (14:54 +0000)]
[analyzer][PlistMacroExpansion] Part 1.: New expand-macros flag

This is the first part of the implementation of the inclusion of macro
expansions into the plist output. It adds a new flag that adds a new
"macro_expansions" entry to each report that has PathDiagnosticPieces that were
expanded from a macro. While there's an entry for each macro expansion, both
the name of the macro and what it expands to is missing, and will be implemented
in followup patches.

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

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

6 years agoFollow-up to r345699: Call CheckStaticLocalForDllExport later for templates
Hans Wennborg [Wed, 31 Oct 2018 10:34:46 +0000 (10:34 +0000)]
Follow-up to r345699: Call CheckStaticLocalForDllExport later for templates

Calling it too early might cause dllimport to get inherited onto the
VarDecl before the initializer got attached. See the test case for an
example where this broke things.

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

6 years ago[clang-cl] Inherit dllexport to static locals also in template instantiations (PR39496)
Hans Wennborg [Wed, 31 Oct 2018 08:38:48 +0000 (08:38 +0000)]
[clang-cl] Inherit dllexport to static locals also in template instantiations (PR39496)

In the course of D51340, @takuto.ikuta discovered that Clang fails to put
dllexport/import attributes on static locals during template instantiation.

For regular functions, this happens in Sema::FinalizeDeclaration(), however for
template instantiations we need to do something in or around
TemplateDeclInstantiator::VisitVarDecl(). This patch does that, and extracts
the code to a utility function.

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

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

6 years agoChange "struct" to "class" to avoid warnings
Bill Wendling [Wed, 31 Oct 2018 04:58:34 +0000 (04:58 +0000)]
Change "struct" to "class" to avoid warnings

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

6 years agoCreate ConstantExpr class
Bill Wendling [Wed, 31 Oct 2018 03:48:47 +0000 (03:48 +0000)]
Create ConstantExpr class

A ConstantExpr class represents a full expression that's in a context where a
constant expression is required. This class reflects the path the evaluator
took to reach the expression rather than the syntactic context in which the
expression occurs.

In the future, the class will be expanded to cache the result of the evaluated
expression so that it's not needlessly re-evaluated

Reviewed By: rsmith

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

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

6 years agoRevert r345676 due to test failure.
Richard Trieu [Wed, 31 Oct 2018 02:10:51 +0000 (02:10 +0000)]
Revert r345676 due to test failure.

This was causing CodeGen/mingw-long-double.c to start failing.

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

6 years ago[Win64] Handle passing i128 by value
Reid Kleckner [Tue, 30 Oct 2018 23:58:41 +0000 (23:58 +0000)]
[Win64] Handle passing i128 by value

For arguments, pass it indirectly, since the ABI doc says pretty clearly
that arguments larger than 8 bytes are passed indirectly. This makes
va_list handling easier, anyway.

When returning, GCC returns in XMM0, and we match them.

Fixes PR39492.

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

6 years agoSilence unused variable warnings. NFC
Richard Trieu [Tue, 30 Oct 2018 23:01:15 +0000 (23:01 +0000)]
Silence unused variable warnings.  NFC

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

6 years ago[clang][ubsan] Implicit Conversion Sanitizer - integer sign change - clang part
Roman Lebedev [Tue, 30 Oct 2018 21:58:56 +0000 (21:58 +0000)]
[clang][ubsan] Implicit Conversion Sanitizer - integer sign change - clang part

This is the second half of Implicit Integer Conversion Sanitizer.
It completes the first half, and finally makes the sanitizer
fully functional! Only the bitfield handling is missing.

Summary:
C and C++ are interesting languages. They are statically typed, but weakly.
The implicit conversions are allowed. This is nice, allows to write code
while balancing between getting drowned in everything being convertible,
and nothing being convertible. As usual, this comes with a price:

```
void consume(unsigned int val);

void test(int val) {
  consume(val);
  // The 'val' is `signed int`, but `consume()` takes `unsigned int`.
  // If val is negative, then consume() will be operating on a large
  // unsigned value, and you may or may not have a bug.

  // But yes, sometimes this is intentional.
  // Making the conversion explicit silences the sanitizer.
  consume((unsigned int)val);
}
```

Yes, there is a `-Wsign-conversion`` diagnostic group, but first, it is kinda
noisy, since it warns on everything (unlike sanitizers, warning on an
actual issues), and second, likely there are cases where it does **not** warn.

The actual detection is pretty easy. We just need to check each of the values
whether it is negative, and equality-compare the results of those comparisons.
The unsigned value is obviously non-negative. Zero is non-negative too.
https://godbolt.org/g/w93oj2

We do not have to emit the check *always*, there are obvious situations
where we can avoid emitting it, since it would **always** get optimized-out.
But i do think the tautological IR (`icmp ult %x, 0`, which is always false)
should be emitted, and the middle-end should cleanup it.

This sanitizer is in the `-fsanitize=implicit-conversion` group,
and is a logical continuation of D48958 `-fsanitize=implicit-integer-truncation`.
As for the ordering, i'we opted to emit the check **after**
`-fsanitize=implicit-integer-truncation`. At least on these simple 16 test cases,
this results in 1 of the 12 emitted checks being optimized away,
as compared to 0 checks being optimized away if the order is reversed.

This is a clang part.
The compiler-rt part is D50251.

Finishes fixing [[ https://bugs.llvm.org/show_bug.cgi?id=21530 | PR21530 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=37552 | PR37552 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=35409 | PR35409 ]].
Finishes partially fixing [[ https://bugs.llvm.org/show_bug.cgi?id=9821 | PR9821 ]].
Finishes fixing https://github.com/google/sanitizers/issues/940.

Only the bitfield handling is missing.

Reviewers: vsk, rsmith, rjmccall, #sanitizers, erichkeane

Reviewed By: rsmith

Subscribers: chandlerc, filcab, cfe-commits, regehr

Tags: #sanitizers, #clang

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

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

6 years agoChanging the command line parameters sent to diff for this test.
Aaron Ballman [Tue, 30 Oct 2018 20:55:18 +0000 (20:55 +0000)]
Changing the command line parameters sent to diff for this test.

On some systems, -U 1 was being interpreted as -U -1. Trying -U1 to see if that's the universally accepted approach instead.

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

6 years agoNFC: Merge KEYOBJC and KEYARC
Erik Pilkington [Tue, 30 Oct 2018 20:51:28 +0000 (20:51 +0000)]
NFC: Merge KEYOBJC and KEYARC

We used to only define ARC keywords in -fobjc-arc mode, but now that we define
them in ObjC mode, there isn't any reason to keep them seperate.

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

6 years agoRevert "[ASTImporter] Reorder fields after structure import is finished"
Davide Italiano [Tue, 30 Oct 2018 20:46:29 +0000 (20:46 +0000)]
Revert "[ASTImporter] Reorder fields after structure import is finished"

This reverts commit r345545 because it breaks some lldb tests.

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

6 years agoNFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects)
Erik Pilkington [Tue, 30 Oct 2018 20:31:30 +0000 (20:31 +0000)]
NFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects)

We haven't supported compiling ObjC1 for a long time (and never will again), so
there isn't any reason to keep these separate. This patch replaces
LangOpts::ObjC1 and LangOpts::ObjC2 with LangOpts::ObjC.

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

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

6 years agoSpeculatively attempt to fix a failing testbot.
Aaron Ballman [Tue, 30 Oct 2018 19:49:17 +0000 (19:49 +0000)]
Speculatively attempt to fix a failing testbot.

A testbot ( http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/54690/) was failing with a complaint about an obsolete option that wasn't present in the command line in the first place. This replaces my guess at the "obsolete option" with a different spelling that will hopefully be more acceptable to this bot without breaking other bots.

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

6 years agoSilencing a -Wunused-variable warning; NFC.
Aaron Ballman [Tue, 30 Oct 2018 19:23:06 +0000 (19:23 +0000)]
Silencing a -Wunused-variable warning; NFC.

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

6 years agoFixing some build bot failures from r345628; NFC intended.
Aaron Ballman [Tue, 30 Oct 2018 19:06:58 +0000 (19:06 +0000)]
Fixing some build bot failures from r345628; NFC intended.

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

6 years agoAdd the ability to output static analysis results to SARIF.
Aaron Ballman [Tue, 30 Oct 2018 18:55:38 +0000 (18:55 +0000)]
Add the ability to output static analysis results to SARIF.

This allows users to specify SARIF (https://github.com/oasis-tcs/sarif-spec) as the output from the clang static analyzer so that the results can be read in by other tools, such as extensions to Visual Studio and VSCode, as well as static analyzers like CodeSonar.

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

6 years ago[OPENMP] Support for mapping of the lambdas in target regions.
Alexey Bataev [Tue, 30 Oct 2018 15:50:12 +0000 (15:50 +0000)]
[OPENMP] Support for mapping of the lambdas in target regions.

Added support for mapping of lambdas in the target regions. It scans all
the captures by reference in the lambda, implicitly maps those variables
in the target region and then later reinstate the addresses of
references in lambda to the correct addresses of the captured|privatized
variables.

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

6 years ago[AST] Only store data for the NRVO candidate in ReturnStmt if needed
Bruno Ricci [Tue, 30 Oct 2018 14:40:49 +0000 (14:40 +0000)]
[AST] Only store data for the NRVO candidate in ReturnStmt if needed

Only store the NRVO candidate if needed in ReturnStmt.
A good chuck of all of the ReturnStmt have no NRVO candidate
(more than half when parsing all of Boost). For all of them
this saves one pointer. This has no impact on children().

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

Reviewed By: rsmith

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

6 years ago[AST] Only store the needed data in WhileStmt
Bruno Ricci [Tue, 30 Oct 2018 13:42:41 +0000 (13:42 +0000)]
[AST] Only store the needed data in WhileStmt

Don't store the data for the condition variable if not needed.
This cuts the size of WhileStmt by up to a pointer.
The order of the children is kept the same.

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

Reviewed By: rjmccall

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

6 years ago[clang] Move two utility functions into SourceManager
Roman Lebedev [Tue, 30 Oct 2018 12:37:16 +0000 (12:37 +0000)]
[clang] Move two utility functions into SourceManager

Summary: So we can keep that not-so-great logic in one place.

Reviewers: rsmith, aaron.ballman

Reviewed By: rsmith

Subscribers: nemanjai, kbarton, cfe-commits

Tags: #clang

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

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

6 years ago[CodeGen] Disable the machine verifier on a ThinLTO test
Francis Visoiu Mistrih [Tue, 30 Oct 2018 12:18:33 +0000 (12:18 +0000)]
[CodeGen] Disable the machine verifier on a ThinLTO test

This allows us to turn the machine verifier on by default on X86.

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

6 years agoRemove trailing space from clang/Basic/LangOptions.h
Takuto Ikuta [Tue, 30 Oct 2018 09:42:49 +0000 (09:42 +0000)]
Remove trailing space from clang/Basic/LangOptions.h

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

6 years ago[OPENMP] Fix for "error: unused variable 'CED'"
Bjorn Pettersson [Tue, 30 Oct 2018 08:49:26 +0000 (08:49 +0000)]
[OPENMP] Fix for "error: unused variable 'CED'"

Quick fix to make code compile with -Werror,-Wunused-variable.

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

6 years agoPR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type
Richard Smith [Tue, 30 Oct 2018 02:02:49 +0000 (02:02 +0000)]
PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type
nullptr_t does not access memory.

We now reuse CK_NullToPointer to represent a conversion from a glvalue
of type nullptr_t to a prvalue of nullptr_t where necessary.

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

6 years ago[analyzer] Allow padding checker to traverse simple class hierarchies
Alexander Shaposhnikov [Tue, 30 Oct 2018 01:20:37 +0000 (01:20 +0000)]
[analyzer] Allow padding checker to traverse simple class hierarchies

The existing padding checker skips classes that have any base classes.
This patch allows the checker to traverse very simple cases:
classes that have no fields and have exactly one base class.
This is important mostly in the case of array declarations.

Patch by Max Bernstein!

Test plan: make check-all

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

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

6 years ago[CMake][Fuchsia] Drop the LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
Petr Hosek [Mon, 29 Oct 2018 23:10:49 +0000 (23:10 +0000)]
[CMake][Fuchsia] Drop the LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT

Now that libc++ uses __exclude_from_explicit_instantiation__ attribute,
this is no longer needed.

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

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

6 years ago[ASTImporter] Reorder fields after structure import is finished
Aleksei Sidorin [Mon, 29 Oct 2018 21:46:18 +0000 (21:46 +0000)]
[ASTImporter] Reorder fields after structure import is finished

There are multiple reasons why field structures can be imported
in wrong order. The simplest is the ability of field initializers
and method bodies to refer fields not in order they are listed in.
Unfortunately, there is no clean solution for that currently
so I'm leaving a FIXME.

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

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

6 years ago[Driver] Include missing touch files for sanitized library paths
Petr Hosek [Mon, 29 Oct 2018 21:04:12 +0000 (21:04 +0000)]
[Driver] Include missing touch files for sanitized library paths

These were forgotten in r345537 causing test failures on Clang builders.

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

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

6 years ago[Driver] Support sanitized libraries on Fuchsia
Petr Hosek [Mon, 29 Oct 2018 20:37:52 +0000 (20:37 +0000)]
[Driver] Support sanitized libraries on Fuchsia

When using sanitizers, add <resource_dir>/<target>/lib/<sanitizer>
to the list of library paths to support using sanitized version of
runtime libraries if available.

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

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

6 years agoIn swiftcall, don't merge FP/vector types within a chunk.
John McCall [Mon, 29 Oct 2018 20:32:36 +0000 (20:32 +0000)]
In swiftcall, don't merge FP/vector types within a chunk.

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

6 years ago[OPENMP]Fix PR39372: Does not complain about loop bound variable not
Alexey Bataev [Mon, 29 Oct 2018 20:17:42 +0000 (20:17 +0000)]
[OPENMP]Fix PR39372: Does not complain about loop bound variable not
being shared.

According to the standard, the variables with unspecified data-sharing
attributes in presence of `default(none)` clause must be reported to
users. Compiler did not generate error reports for the variables used in
other OpenMP regions. Patch fixes this.

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