]> granicus.if.org Git - clang/log
clang
6 years agoAdd predefined macro __gnu_linux__ for proper aux-triple
Yaxun Liu [Wed, 29 Aug 2018 20:39:22 +0000 (20:39 +0000)]
Add predefined macro __gnu_linux__ for proper aux-triple

Clang predefine macro __linx__ for aux-triple with Linux OS
but does not predefine macro __gnu_linux__. This causes
some compilation error for certain applications, e.g. Eigen.

This patch fixes that.

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

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

6 years ago[analyzer] Resolve the crash in ReturnUndefChecker
George Karpenkov [Wed, 29 Aug 2018 20:29:59 +0000 (20:29 +0000)]
[analyzer] Resolve the crash in ReturnUndefChecker

By making sure the returned value from getKnownSVal is consistent with
the value used inside expression engine.

PR38427

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

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

6 years ago[analyzer] [NFC] Move class definition out of the function
George Karpenkov [Wed, 29 Aug 2018 20:29:39 +0000 (20:29 +0000)]
[analyzer] [NFC] Move class definition out of the function

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

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

6 years ago[analyzer] Move analyzer-eagerly-assume to AnalyzerOptions, enable by default
George Karpenkov [Wed, 29 Aug 2018 20:29:17 +0000 (20:29 +0000)]
[analyzer] Move analyzer-eagerly-assume to AnalyzerOptions, enable by default

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

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

6 years ago[analyzer] [NFC] Remove unused "state" argument from makeSymExprValNN
George Karpenkov [Wed, 29 Aug 2018 20:28:54 +0000 (20:28 +0000)]
[analyzer] [NFC] Remove unused "state" argument from makeSymExprValNN

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

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

6 years ago[analyzer] Better retain count rules for OSObjects
George Karpenkov [Wed, 29 Aug 2018 20:28:33 +0000 (20:28 +0000)]
[analyzer] Better retain count rules for OSObjects

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

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

6 years ago[analyzer] [NFC] Follow the convention when naming classes
George Karpenkov [Wed, 29 Aug 2018 20:28:13 +0000 (20:28 +0000)]
[analyzer] [NFC] Follow the convention when naming classes

Renames InvalidateRegionsWorker and RemoveDeadBindingsWorker

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

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

6 years agoRevert "[libFuzzer] Port to Windows"
Matt Morehouse [Wed, 29 Aug 2018 18:40:41 +0000 (18:40 +0000)]
Revert "[libFuzzer] Port to Windows"

This reverts r340949 due to bot breakage again.

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

6 years ago[OPENMP][NVPTX] Add support for lightweight runtime.
Alexey Bataev [Wed, 29 Aug 2018 18:32:21 +0000 (18:32 +0000)]
[OPENMP][NVPTX] Add support for lightweight runtime.

If the target construct can be executed in SPMD mode + it is a loop
based directive with static scheduling, we can use lightweight runtime
support.

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

6 years ago[libFuzzer] Port to Windows
Matt Morehouse [Wed, 29 Aug 2018 18:08:34 +0000 (18:08 +0000)]
[libFuzzer] Port to Windows

Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.

Reviewers: morehouse, rnk

Reviewed By: morehouse, rnk

Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman

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

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

6 years ago[MinGW] Don't mark external variables as DSO local
Martin Storsjo [Wed, 29 Aug 2018 17:26:58 +0000 (17:26 +0000)]
[MinGW] Don't mark external variables as DSO local

Since MinGW supports automatically importing external variables from
DLLs even without the DLLImport attribute, we shouldn't mark them
as DSO local unless we actually know them to be local for sure.

Keep marking thread local variables as DSO local.

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

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

6 years ago[Tooling] Do not restore working dir in ClangTool
Ilya Biryukov [Wed, 29 Aug 2018 16:35:31 +0000 (16:35 +0000)]
[Tooling] Do not restore working dir in ClangTool

Summary:
Resolve all relative paths before running the tool instead.

This fixes the usage of ClangTool in AllTUsExecutor. The executor will
try running multiple ClangTool instances in parallel with compile
commands that usually have the same working directory.

Changing working directory is a global operation, so we end up
changing working directory in the middle of running other actions,
which leads to spurious compile errors.

Reviewers: ioeric, sammccall

Reviewed By: ioeric

Subscribers: cfe-commits

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

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

6 years ago[OPENMP] Create non-const ident_t objects.
Mike Rice [Wed, 29 Aug 2018 15:45:11 +0000 (15:45 +0000)]
[OPENMP] Create non-const ident_t objects.

Currently ident_t objects are created const when debug info is not
enabled, but the libittnotify libray in the OpenMP runtime writes to
the reserved_2 field (See __kmp_itt_region_forking in
openmp/runtime/src/kmp_itt.inl).  Now create ident_t objects non-const.

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

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

6 years ago[Preamble] Fix incorrect usage of std::error_category
Alexandre Ganea [Wed, 29 Aug 2018 14:28:04 +0000 (14:28 +0000)]
[Preamble] Fix incorrect usage of std::error_category

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

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

6 years ago[ARM] Set __ARM_FEATURE_SIMD32 for +dsp cores
Sam Parker [Wed, 29 Aug 2018 10:39:03 +0000 (10:39 +0000)]
[ARM] Set __ARM_FEATURE_SIMD32 for +dsp cores

ARM_FEATURE_DSP is already set for targets with the +dsp feature. In
the backend, this target feature is also used to represent the
availability of the of the instructions that the ACLE guard through
the __ARM_FEATURE_SIMD32 macro. We don't have any cores that
implement one and not the other, so set this macro for cores later
than V6 or for Cortex-M cores that the target parser, or user, reports
that the 'dsp' instructions are supported.

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

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

6 years agoStart reserving x18 by default on Android targets.
Peter Collingbourne [Wed, 29 Aug 2018 01:38:47 +0000 (01:38 +0000)]
Start reserving x18 by default on Android targets.

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

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

6 years ago[X86] Add kadd intrinsics to match gcc and icc.
Craig Topper [Tue, 28 Aug 2018 22:32:14 +0000 (22:32 +0000)]
[X86] Add kadd intrinsics to match gcc and icc.

This adds the following intrinsics:
_kadd_mask64
_kadd_mask32
_kadd_mask16
_kadd_mask8

These are missing from the Intel Intrinsics Guide, but are implemented by both gcc and icc.

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

6 years ago[HIP] Fix output file extension
Yaxun Liu [Tue, 28 Aug 2018 21:09:09 +0000 (21:09 +0000)]
[HIP] Fix output file extension

OffloadBundlingJobAction constructor accepts a list of JobAction as inputs.
The host JobAction is the last one. The file type of OffloadBundlingJobAction
should be determined by the host JobAction (the last one) instead of the first
one.

Since HIP emits LLVM bitcode for device compilation, device JobAction has
different file type as host Job Action. This bug causes incorrect output file
extension for HIP.

This patch fixes it by using the last input JobAction (host JobAction) to determine
file type of OffloadBundlingJobAction.

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

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

6 years agoRevert "[libFuzzer] Port to Windows"
Matt Morehouse [Tue, 28 Aug 2018 19:07:24 +0000 (19:07 +0000)]
Revert "[libFuzzer] Port to Windows"

This reverts commit r340860 due to failing tests.

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

6 years ago[libFuzzer] Port to Windows
Matt Morehouse [Tue, 28 Aug 2018 18:34:32 +0000 (18:34 +0000)]
[libFuzzer] Port to Windows

Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.

Patch By: metzman

Reviewers: morehouse, rnk

Reviewed By: morehouse, rnk

Subscribers: morehouse, kcc, eraman

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

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

6 years agoDefine variables in test case rather than using values from functions
Akira Hatanaka [Tue, 28 Aug 2018 18:18:01 +0000 (18:18 +0000)]
Define variables in test case rather than using values from functions
emitted ealier.

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

6 years ago[ubsan] Enable -fsanitize=vptr on Apple devices and simulators
Vedant Kumar [Tue, 28 Aug 2018 18:01:42 +0000 (18:01 +0000)]
[ubsan] Enable -fsanitize=vptr on Apple devices and simulators

It seems like an oversight that this check was not always enabled for
on-device or device simulator targets.

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

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

6 years ago[Driver] Delete last reference of lld -flavor old-gnu
Fangrui Song [Tue, 28 Aug 2018 17:20:28 +0000 (17:20 +0000)]
[Driver] Delete last reference of lld -flavor old-gnu

This is dead code because lld -flavor old-gnu was removed in 2016 by rLLD262158.

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

6 years agoParse compile commands lazily in InterpolatingCompilationDatabase
Ilya Biryukov [Tue, 28 Aug 2018 16:15:56 +0000 (16:15 +0000)]
Parse compile commands lazily in InterpolatingCompilationDatabase

Summary:
This greatly reduces the time to read 'compile_commands.json'.
For Chromium on my machine it's now 0.7 seconds vs 30 seconds before the
change.

Reviewers: sammccall, jfb

Reviewed By: sammccall

Subscribers: mgrang, jfb, cfe-commits

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

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

6 years ago[Analyzer] Iterator Checker - Part 3: Invalidation check, first for (copy) assignments
Adam Balogh [Tue, 28 Aug 2018 08:41:15 +0000 (08:41 +0000)]
[Analyzer] Iterator Checker - Part 3: Invalidation check, first for (copy) assignments

We add check for invalidation of iterators. The only operation we handle here
is the (copy) assignment.

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

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

6 years ago[X86] Add kortest intrinsics for 8, 32, and 64 bit masks. Add new intrinsic names...
Craig Topper [Tue, 28 Aug 2018 06:28:25 +0000 (06:28 +0000)]
[X86] Add kortest intrinsics for 8, 32, and 64 bit masks. Add new intrinsic names for 16 bit masks.

This matches gcc and icc despite not being documented in the Intel Intrinsics Guide.

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

6 years ago[OpenMP][NVPTX] Use appropriate _CALL_ELF macro when offloading
Gheorghe-Teodor Bercea [Mon, 27 Aug 2018 20:16:20 +0000 (20:16 +0000)]
[OpenMP][NVPTX] Use appropriate _CALL_ELF macro when offloading

Summary: When offloading to a device and using the powerpc64le version of the auxiliary triple, the _CALL_ELF macro is not set correctly to 2 resulting in the attempt to include a header that does not exist. This patch fixes this problem.

Reviewers: Hahnfeld, ABataev, caomhin

Reviewed By: Hahnfeld

Subscribers: guansong, cfe-commits

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

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

6 years ago[PPC] Remove Darwin support from POWER backend.
Kit Barton [Mon, 27 Aug 2018 19:53:19 +0000 (19:53 +0000)]
[PPC] Remove Darwin support from POWER backend.
This patch removes uses of the Darwin ABI for PowerPC related test cases. This
is the first step in removing Darwin support from the POWER backend.

clang/test/CodeGen/darwin-ppc-varargs.c  was deleted because it was a darwin/ppc
specific test case.

All other tests were updated to remove the darwin/ppc specific invocation.

Phabricator Review: https://reviews.llvm.org/D50989.

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

6 years ago[Sema/Attribute] Make types declared with address_space an AttributedType
Leonard Chan [Mon, 27 Aug 2018 17:57:29 +0000 (17:57 +0000)]
[Sema/Attribute] Make types declared with address_space an AttributedType

Currently an address_space is stored in a qualifier. This makes any type
declared with an address_space attribute in the form
`__attribute__((address_space(1))) int 1;` be wrapped in an AttributedType.

This is for a later patch where if `address_space` is declared in a macro,
any diagnostics that would normally print the address space will instead dump
the macro name. This will require saving any macro information in the
AttributedType.

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

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

6 years agofix comment typo
Nico Weber [Mon, 27 Aug 2018 14:23:50 +0000 (14:23 +0000)]
fix comment typo

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

6 years agoTry to fix this clang driver test case after r340709.
Chandler Carruth [Mon, 27 Aug 2018 08:49:20 +0000 (08:49 +0000)]
Try to fix this clang driver test case after r340709.

If any of the bots complain about this, I'll just revert. This test case
is essentially trying to test the exact change made, but I think this
matches the intent of the patch in question.

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

6 years ago[X86] Add intrinsics for kand/kandn/knot/kor/kxnor/kxor with 8, 32, and 64-bit mask...
Craig Topper [Mon, 27 Aug 2018 06:20:22 +0000 (06:20 +0000)]
[X86] Add intrinsics for kand/kandn/knot/kor/kxnor/kxor with 8, 32, and 64-bit mask registers.

This also adds a second intrinsic name for the 16-bit mask versions.

These intrinsics match gcc and icc. They just aren't published in the Intel Intrinsics Guide so I only recently found they existed.

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

6 years ago[X86] Remove min_vector_width 512 from some intrinsics that operate only on k-registers.
Craig Topper [Mon, 27 Aug 2018 06:20:20 +0000 (06:20 +0000)]
[X86] Remove min_vector_width 512 from some intrinsics that operate only on k-registers.

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

6 years ago[X86] Rename __DEFAULT_FN_ATTRS to a__DEFAULT_FN_ATTRS512 in avx512dqintrin.h and...
Craig Topper [Mon, 27 Aug 2018 06:20:19 +0000 (06:20 +0000)]
[X86] Rename __DEFAULT_FN_ATTRS to a__DEFAULT_FN_ATTRS512 in avx512dqintrin.h and avx512bwintrin.h.

This is preparation for adding removing min_vector_width 512 from some intrinsics.

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

6 years ago[X86] Undef __DEFAULT_FN_ATTRS in avx512fintrin.h.
Craig Topper [Mon, 27 Aug 2018 05:44:45 +0000 (05:44 +0000)]
[X86] Undef __DEFAULT_FN_ATTRS in avx512fintrin.h.

Fixes test failure after r340713

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

6 years ago[X86] Don't set min_vector_width to 512 on intrinsics that only operate on k registers.
Craig Topper [Mon, 27 Aug 2018 05:27:15 +0000 (05:27 +0000)]
[X86] Don't set min_vector_width to 512 on intrinsics that only operate on k registers.

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

6 years ago[Xray] Darwin - Enable in the driver side
David Carlier [Mon, 27 Aug 2018 05:16:09 +0000 (05:16 +0000)]
[Xray] Darwin - Enable in the driver side

Reviewers: dberris

Reviered By: dberris

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

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

6 years ago[Driver] Change MipsLinux default linker from "lld" to "ld.lld"
Fangrui Song [Sun, 26 Aug 2018 19:47:23 +0000 (19:47 +0000)]
[Driver] Change MipsLinux default linker from "lld" to "ld.lld"

Reviewers: kzhuravl, atanasyan

Reviewed By: atanasyan

Subscribers: sdardis, arichardson, jrtc27, atanasyan, cfe-commits

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

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

6 years ago[index] Introduce 'ProtocolInterface' as part of SymbolPropertySet
Argyrios Kyrtzidis [Sun, 26 Aug 2018 06:27:23 +0000 (06:27 +0000)]
[index] Introduce 'ProtocolInterface' as part of SymbolPropertySet

This is useful to directly infer that a method or property is from a protocol interface
at the point of the symbol occurrences.

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

6 years ago[CUDA/OpenMP] Define only some host macros during device compilation
Jonas Hahnfeld [Sat, 25 Aug 2018 13:42:40 +0000 (13:42 +0000)]
[CUDA/OpenMP] Define only some host macros during device compilation

When compiling CUDA or OpenMP device code Clang parses header files
that expect certain predefined macros from the host architecture. To
make this work the compiler passes the host triple via the -aux-triple
argument and (until now) pulls in all macros for that "auxiliary triple"
unconditionally.

However this results in defines like __SSE_MATH__ that will trigger
inline assembly making use of the "advertised" target features. See
the discussion of D47849 and PR38464 for a detailed explanation of
the encountered problems.

Instead of blacklisting "known bad" examples this patch starts adding
defines that are needed for certain headers like bits/wordsize.h and
bits/mathinline.h.
The disadvantage of this approach is that it decouples the definitions
from their target toolchain. However in my opinion it's more important
to keep definitions for one header close together. For one this will
include a clear documentation why these particular defines are needed.
Furthermore it simplifies maintenance because adding defines for a new
header or support for a new aux-triple only needs to touch one piece
of code.

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

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

6 years agoRevert r323281 "Adjust MaxAtomicInlineWidth for i386/i486 targets."
Hans Wennborg [Fri, 24 Aug 2018 22:46:33 +0000 (22:46 +0000)]
Revert r323281 "Adjust MaxAtomicInlineWidth for i386/i486 targets."

As reported on http://lists.llvm.org/pipermail/cfe-dev/2018-August/058760.html,
this broke i386-freebsd11 due to its lack of atomic 64 bit primitives.

While that's not really this commit's fault, let's revert back to the old
behaviour until this can be fixed. This means generating cmpxchg8b etc for i386
and i486 which don't technically support those, but that's been the behaviour
for a long time, so a little longer probably doesn't hurt that much.

> Adjust MaxAtomicInlineWidth for i386/i486 targets.
>
> This is to fix the bug reported in https://bugs.llvm.org/show_bug.cgi?id=34347#c6.
> Currently, all  MaxAtomicInlineWidth of x86-32 targets are set to 64. However,
> i386 doesn't support any cmpxchg related instructions. i486 only supports cmpxchg.
> So in this patch MaxAtomicInlineWidth is reset as follows:
> For i386, the MaxAtomicInlineWidth should be 0 because no cmpxchg is supported.
> For i486, the MaxAtomicInlineWidth should be 32 because it supports cmpxchg.
> For others 32 bits x86 cpu, the MaxAtomicInlineWidth should be 64 because of cmpxchg8b.
>
> Differential Revision: https://reviews.llvm.org/D42154

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

6 years agoReland r340552, "Driver: Enable address-significance tables by default when targeting...
Peter Collingbourne [Fri, 24 Aug 2018 20:38:15 +0000 (20:38 +0000)]
Reland r340552, "Driver: Enable address-significance tables by default when targeting COFF." which was reverted in r340579.

The underlying problem that caused the revert was fixed in r340648.

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

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

6 years agoAdd REQUIRES: x86-registered-target to test.
Eli Friedman [Fri, 24 Aug 2018 20:18:34 +0000 (20:18 +0000)]
Add REQUIRES: x86-registered-target to test.

(This isn't really x86-specific, but we have to pick some non-Apple
triple to exercise the right codepath.)

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

6 years ago[LTO] Fix -save-temps with LTO and unnamed globals.
Eli Friedman [Fri, 24 Aug 2018 19:31:52 +0000 (19:31 +0000)]
[LTO] Fix -save-temps with LTO and unnamed globals.

If all LLVM passes are disabled, we can't emit a summary because there
could be unnamed globals in the IR.

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

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

6 years agoThread safety analysis no longer hands when analyzing a self-referencing initializer.
Aaron Ballman [Fri, 24 Aug 2018 18:48:35 +0000 (18:48 +0000)]
Thread safety analysis no longer hands when analyzing a self-referencing initializer.

This fixes PR38640.

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

6 years ago[ASTImporter] Add test for PackExpansionExpr
Raphael Isemann [Fri, 24 Aug 2018 18:01:56 +0000 (18:01 +0000)]
[ASTImporter] Add test for PackExpansionExpr

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

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

6 years ago[clang-format] fix PR38557 - comments between "default" and ':' causes the case label...
Jonas Toth [Fri, 24 Aug 2018 17:25:06 +0000 (17:25 +0000)]
[clang-format] fix PR38557 - comments between "default" and ':' causes the case label to be treated as an identifier

Summary:
The Bug was reported and fixed by Owen Pan. See the original bug report here: https://bugs.llvm.org/show_bug.cgi?id=38557

Patch by Owen Pan!

Reviewers: krasimir, djasper, klimek

Reviewed By: klimek

Subscribers: JonasToth, cfe-commits

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

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

6 years ago[clang-format] fix PR38525 - Extraneous continuation indent spaces with BreakBeforeBi...
Jonas Toth [Fri, 24 Aug 2018 17:14:31 +0000 (17:14 +0000)]
[clang-format] fix PR38525 - Extraneous continuation indent spaces with BreakBeforeBinaryOperators set to All

Summary: See bug report https://bugs.llvm.org/show_bug.cgi?id=38525 for more details.

Reviewers: djasper, klimek, krasimir, sammccall

Reviewed By: sammccall

Subscribers: hiraditya, JonasToth, cfe-commits

Tags: #clang

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

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

6 years ago[Hexagon] Remove unneeded strings from builtin definitions, NFC
Krzysztof Parzyszek [Fri, 24 Aug 2018 17:13:42 +0000 (17:13 +0000)]
[Hexagon] Remove unneeded strings from builtin definitions, NFC

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

6 years agoFix build bot after r340598.
Eric Liu [Fri, 24 Aug 2018 09:53:44 +0000 (09:53 +0000)]
Fix build bot after r340598.

Revert to the original behavior: only calculate real file path when
file is opened and avoid using InterndPath for real path calculation.

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

6 years ago[Tooling] Add a isSingleProcess() helper to ToolExecutor
Ilya Biryukov [Fri, 24 Aug 2018 09:03:29 +0000 (09:03 +0000)]
[Tooling] Add a isSingleProcess() helper to ToolExecutor

Summary:
Used in clangd's symbol builder to optimize for the common
shared-memory executor case.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: kadircet, cfe-commits

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

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

6 years ago[FileManager] Do not call 'real_path' in getFile().
Eric Liu [Fri, 24 Aug 2018 08:59:54 +0000 (08:59 +0000)]
[FileManager] Do not call 'real_path' in getFile().

Summary:
This partially rolls back the change in D48903:
https://github.com/llvm-mirror/clang/commit/89aa7f45a1f728144935289d4ce69d8522999de0#diff-0025af005307891b5429b6a834823d5eR318

`real_path` can be very expensive on real file systems, and calling it on each
opened file can slow down the compilation. This also slows down deserialized
ASTs for which real paths need to be recalculated for each input files again.

For clangd code completion latency (using preamble):
Before
{F7039629}
After
{F7039630}

Reviewers: ilya-biryukov, simark

Reviewed By: ilya-biryukov

Subscribers: kadircet, cfe-commits

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

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

6 years ago[AVR] Fix inline asm calls now that the addrspace(0) there is explicit.
Chandler Carruth [Fri, 24 Aug 2018 04:45:04 +0000 (04:45 +0000)]
[AVR] Fix inline asm calls now that the addrspace(0) there is explicit.

This updates the test case for r340519 so it should pass again. r340522
only got some of the AVR tests that needed an update.

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

6 years ago[RISCV] RISC-V using -fuse-init-array by default
Kito Cheng [Fri, 24 Aug 2018 03:05:08 +0000 (03:05 +0000)]
[RISCV] RISC-V using -fuse-init-array by default

Reviewers: asb, apazos, mgrang

Reviewed By: asb

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

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

6 years agoFix typo
Stephen Kelly [Thu, 23 Aug 2018 22:41:52 +0000 (22:41 +0000)]
Fix typo

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

6 years agoRemove more const_casts by using ConstStmtVisitor [NFC]
Aaron Puchert [Thu, 23 Aug 2018 21:53:04 +0000 (21:53 +0000)]
Remove more const_casts by using ConstStmtVisitor [NFC]

Again, this required adding some const specifiers.

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

6 years agoRevert r340552, "Driver: Enable address-significance tables by default when targeting...
Peter Collingbourne [Thu, 23 Aug 2018 21:34:57 +0000 (21:34 +0000)]
Revert r340552, "Driver: Enable address-significance tables by default when targeting COFF."

Received multiple reports of breakage due to undefined symbols
suspected to be caused by this change.

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

6 years agoRemove unnecessary const_cast [NFC]
Aaron Puchert [Thu, 23 Aug 2018 21:13:32 +0000 (21:13 +0000)]
Remove unnecessary const_cast [NFC]

This required adding a few const specifiers on functions.

Also a minor formatting fix suggested in D49885.

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

6 years ago[docs] Regenerate ClangCommandLineReference.rst
Vedant Kumar [Thu, 23 Aug 2018 17:55:03 +0000 (17:55 +0000)]
[docs] Regenerate ClangCommandLineReference.rst

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

6 years ago[options] Document -(static|shared)-libsan
Vedant Kumar [Thu, 23 Aug 2018 17:54:48 +0000 (17:54 +0000)]
[options] Document -(static|shared)-libsan

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

6 years agoDriver: Enable address-significance tables by default when targeting COFF.
Peter Collingbourne [Thu, 23 Aug 2018 17:43:29 +0000 (17:43 +0000)]
Driver: Enable address-significance tables by default when targeting COFF.

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

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

6 years ago[ASTMatchers] Let hasObjectExpression also support UnresolvedMemberExpr, CXXDependent...
Shuai Wang [Thu, 23 Aug 2018 17:16:06 +0000 (17:16 +0000)]
[ASTMatchers] Let hasObjectExpression also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

6 years agoRe-land [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
Raphael Isemann [Thu, 23 Aug 2018 16:06:30 +0000 (16:06 +0000)]
Re-land [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt

Lands r340468 again, but this time we mark the test as unsupported on Windows
because it seems that try/catch crashes CodeGen at the moment.

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

6 years ago[analyzer] added cache for SMT queries in the SMTConstraintManager
Mikhail R. Gadelha [Thu, 23 Aug 2018 13:21:35 +0000 (13:21 +0000)]
[analyzer] added cache for SMT queries in the SMTConstraintManager

Summary:
This patch implements a new cache for the result of SMT queries; with this patch the regression tests are 25% faster.

It's implemented as a `llvm::DenseMap` where the key is the hash of the set of the constraints in a state.

There is still one method that does not use the cache, `getSymVal`, because it needs to get a symbol interpretation from the SMT, which is not cached yet.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin, Szelethus

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

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

6 years ago[analyzer] Moved all CSA code from the SMT API to a new header, `SMTConv.h`. NFC.
Mikhail R. Gadelha [Thu, 23 Aug 2018 13:21:31 +0000 (13:21 +0000)]
[analyzer] Moved all CSA code from the SMT API to a new header, `SMTConv.h`. NFC.

Summary:
With this patch, the SMT backend is almost completely detached from the CSA.

Unfortunate consequence is that we missed the `ConditionTruthVal` from the CSA and had to use `Optional<bool>`.

The Z3 solver implementation is still in the same file as the `Z3ConstraintManager`, in `lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp` though, but except for that, the SMT API can be moved to anywhere in the codebase.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin, Szelethus

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

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

6 years ago[analyzer] Templatefy SMTConstraintManager so more generic code can be moved from...
Mikhail R. Gadelha [Thu, 23 Aug 2018 13:21:00 +0000 (13:21 +0000)]
[analyzer] Templatefy SMTConstraintManager so more generic code can be moved from solver specific implementations. NFC.

Summary:
By making SMTConstraintManager a template and passing the SMT constraint type and expr, we can further move code from the Z3ConstraintManager class to the generic SMT constraint Manager.

Now, each SMT specific constraint manager only needs to implement the method `bool canReasonAbout(SVal X) const`.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: mgorny, xazax.hun, szepet, a.sidorin, Szelethus

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

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

6 years ago[analyzer] Delete SMTContext. NFC.
Mikhail R. Gadelha [Thu, 23 Aug 2018 13:20:18 +0000 (13:20 +0000)]
[analyzer] Delete SMTContext. NFC.

Summary: There is no reason to have a base class for a context anymore as each SMT object carries a reference to the specific solver context.

Reviewers: NoQ, george.karpenkov, hiraditya

Reviewed By: hiraditya

Subscribers: hiraditya, xazax.hun, szepet, a.sidorin, Szelethus

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

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

6 years agoChange dyn_cast<CXXMethodDecl>(FD) to isa<CXXMethodDecl>(FD) [NFC]
Mikael Holmen [Thu, 23 Aug 2018 13:18:27 +0000 (13:18 +0000)]
Change dyn_cast<CXXMethodDecl>(FD) to isa<CXXMethodDecl>(FD) [NFC]

The result of the dyn_cast wasn't used to we can just check isa.

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

6 years agoRemoved unused variable [NFC]
Mikael Holmen [Thu, 23 Aug 2018 10:59:49 +0000 (10:59 +0000)]
Removed unused variable [NFC]

The compiler warned:
../tools/clang/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp:329:19: error: unused variable 'MD' [-Werror,-Wunused-variable]
  if (const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
                  ^
1 error generated.

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

6 years agoUpdate avr attributes test for output change in r340519
Alexander Richardson [Thu, 23 Aug 2018 10:21:36 +0000 (10:21 +0000)]
Update avr attributes test for output change in r340519

After this commit there is an addrspace(1) before the attribute #. Since
these tests are only checking the value of the attribute add a {{.*}} to
make the test resilient to future output changes.

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

6 years ago[libclang] Fix cursors for arguments of Subscript and Call operators
Ivan Donchevskii [Thu, 23 Aug 2018 09:48:11 +0000 (09:48 +0000)]
[libclang] Fix cursors for arguments of Subscript and Call operators

The DeclRefExpr of CXXOperatorCallExpr refering to the custom operator
is visited before the arguments to the operator call. For the Call and
Subscript operator the range of this DeclRefExpr includes the whole call
expression, so that all tokens in that range were mapped to the operator
function, even the tokens of the arguments.

Fix this by ensuring that this particular DeclRefExpr is visited last.

Fixes PR25775.

Fix by Nikolai Kosjar.

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

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

6 years ago[x86/retpoline] Split the LLVM concept of retpolines into separate
Chandler Carruth [Thu, 23 Aug 2018 06:06:38 +0000 (06:06 +0000)]
[x86/retpoline] Split the LLVM concept of retpolines into separate
subtarget features for indirect calls and indirect branches.

This is in preparation for enabling *only* the call retpolines when
using speculative load hardening.

I've continued to use subtarget features for now as they continue to
seem the best fit given the lack of other retpoline like constructs so
far.

The LLVM side is pretty simple. I'd like to eventually get rid of the
old feature, but not sure what backwards compatibility issues that will
cause.

This does remove the "implies" from requesting an external thunk. This
always seemed somewhat questionable and is now clearly not desirable --
you specify a thunk the same way no matter which set of things are
getting retpolines.

I really want to keep this nicely isolated from end users and just an
LLVM implementation detail, so I've moved the `-mretpoline` flag in
Clang to no longer rely on a specific subtarget feature by that name and
instead to be directly handled. In some ways this is simpler, but in
order to preserve existing behavior I've had to add some fallback code
so that users who relied on merely passing -mretpoline-external-thunk
continue to get the same behavior. We should eventually remove this
I suspect (we have never tested that it works!) but I've not done that
in this patch.

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

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

6 years agoMissing quote in previous commit
JF Bastien [Thu, 23 Aug 2018 04:09:49 +0000 (04:09 +0000)]
Missing quote in previous commit

The test was failing because I missed a quote.

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

6 years agoImprove incompatible triple error
JF Bastien [Thu, 23 Aug 2018 03:55:24 +0000 (03:55 +0000)]
Improve incompatible triple error

When complaining that the triple is incompatible with all targets, print out the triple not just a generic error about triples not matching.

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

6 years ago[analyzer] Preliminary version of retain count checking for OSObjects
George Karpenkov [Thu, 23 Aug 2018 00:26:59 +0000 (00:26 +0000)]
[analyzer] Preliminary version of retain count checking for OSObjects

Has quite a lot of false positives, disabled behind the flag.

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

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

6 years agoRevert "[CStringSyntaxChecker] Check strlcat sizeof check"
George Karpenkov [Thu, 23 Aug 2018 00:02:35 +0000 (00:02 +0000)]
Revert "[CStringSyntaxChecker] Check strlcat sizeof check"

This reverts commit 3073790e87378fea9a68fb052185fec9596ef135.

The check is not correct, strlact(dest, "mystr", sizeof(dest)) is fine.

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

6 years agoRevert "[CStringSyntaxChecker] Reduces space around error message for strlcat."
George Karpenkov [Thu, 23 Aug 2018 00:02:12 +0000 (00:02 +0000)]
Revert "[CStringSyntaxChecker] Reduces space around error message for strlcat."

This reverts commit 6b43b80320722da41ca6ef7a3b57cc300fb83094.

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

6 years agowin: Omit ".exe" from clang and clang-cl driver-level diagnostics.
Nico Weber [Wed, 22 Aug 2018 23:53:39 +0000 (23:53 +0000)]
win: Omit ".exe" from clang and clang-cl driver-level diagnostics.

Like https://reviews.llvm.org/D51133 but for clang.
https://reviews.llvm.org/D51134

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

6 years agoRevert "[ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt"
Raphael Isemann [Wed, 22 Aug 2018 23:50:30 +0000 (23:50 +0000)]
Revert "[ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt"

This test breaks llvm-clang-x86_64-expensive-checks-win.

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

6 years ago[NFC] Add tags file to .gitignore
George Karpenkov [Wed, 22 Aug 2018 23:23:17 +0000 (23:23 +0000)]
[NFC] Add tags file to .gitignore

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

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

6 years ago[analyzer] Track non-zero values in ReturnVisitor
George Karpenkov [Wed, 22 Aug 2018 23:17:25 +0000 (23:17 +0000)]
[analyzer] Track non-zero values in ReturnVisitor

Tracking those can help to provide much better diagnostics in many cases.

In general, most of the visitor machinery should be refactored to allow
tracking the origin of arbitrary values.

rdar://36039765

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

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

6 years ago[analyzer] Track the problematic subexpression in UndefResultChecker
George Karpenkov [Wed, 22 Aug 2018 23:17:02 +0000 (23:17 +0000)]
[analyzer] Track the problematic subexpression in UndefResultChecker

This is tested in a subsequent commit, which allows tracking those values.

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

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

6 years ago[analyzer] [NFC] Minor refactoring of BugReporterVisitors
George Karpenkov [Wed, 22 Aug 2018 23:16:44 +0000 (23:16 +0000)]
[analyzer] [NFC] Minor refactoring of BugReporterVisitors

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

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

6 years ago[Driver] Check normalized triples for multiarch runtime path
Petr Hosek [Wed, 22 Aug 2018 22:56:46 +0000 (22:56 +0000)]
[Driver] Check normalized triples for multiarch runtime path

Previously we only used target triple as provided which matches the
GCC behavior, but it also means that all clients have to be consistent
in their spelling of target triples since e.g. x86_64-linux-gnu and
x86_64-unknown-linux-gnu will result in Clang driver looking at two
different paths when searching for runtime libraries.

Unfortunatelly, as it turned out many clients aren't consistent in
their spelling of target triples, e.g. many Linux distributions use
the shorter spelling but config.guess and rustc insist on using the
normalized variant which is causing issues. To avoid having to ship
multiple copies of runtimes for different triple spelling or rely on
symlinks which are not portable, we should also check the normalized
triple when constructing paths for multiarch runtimes.

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

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

6 years ago[ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
Raphael Isemann [Wed, 22 Aug 2018 22:51:37 +0000 (22:51 +0000)]
[ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

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

6 years ago[ASTImporter] Actually test ArrayInitLoopExpr in the array-init-loop-expr test.
Raphael Isemann [Wed, 22 Aug 2018 22:50:45 +0000 (22:50 +0000)]
[ASTImporter] Actually test ArrayInitLoopExpr in the array-init-loop-expr test.

Summary:
The `array-init-loop-expr` test is currently not testing the importing of ArrayInitLoopExprs.

This is because we import the `S` struct into the `test.cpp` context
and only do a copy-assignment in `test.cpp`, so the actual ArrayInitLoopExpr we wanted to
import is generated by clang directly in the target context. This means we actually
never test the importing of ArrayInitLoopExpr with this test, which becomes obvious
when looking at the missing test coverage for the respective  VisitArrayInitLoopExpr method.

This patch moves the copy-assignment of our struct to the `S.cpp` context, which means
that `test.cpp` now actually has to import the ArrayInitLoopExpr.

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

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

6 years ago[ASTImporter] Remove duplicated and dead CXXNamedCastExpr handling code.
Raphael Isemann [Wed, 22 Aug 2018 22:49:32 +0000 (22:49 +0000)]
[ASTImporter] Remove duplicated and dead CXXNamedCastExpr handling code.

Summary:
`CXXNamedCastExpr` importing is already handled in the respective `VisitCXXNamedCastExpr` method.
So this code here can never be reached under normal circumstances and we might as well remove it.

This patch shouldn't change any observable behavior of the ASTImporter.

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

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

6 years ago[ASTImporter] Add test for ObjCTypeParamDecl
Raphael Isemann [Wed, 22 Aug 2018 22:48:40 +0000 (22:48 +0000)]
[ASTImporter] Add test for ObjCTypeParamDecl

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

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

6 years ago[ASTImporter] Add test for SwitchStmt
Raphael Isemann [Wed, 22 Aug 2018 22:47:10 +0000 (22:47 +0000)]
[ASTImporter] Add test for SwitchStmt

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

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

6 years ago[ASTImporter] Add test for ObjCAutoreleasePoolStmt
Raphael Isemann [Wed, 22 Aug 2018 22:45:04 +0000 (22:45 +0000)]
[ASTImporter] Add test for ObjCAutoreleasePoolStmt

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

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

6 years agoThread safety analysis: Allow relockable scopes
Aaron Puchert [Wed, 22 Aug 2018 22:14:53 +0000 (22:14 +0000)]
Thread safety analysis: Allow relockable scopes

Summary:
It's already allowed to prematurely release a scoped lock, now we also
allow relocking it again, possibly even in another mode.

This is the second attempt, the first had been merged as r339456 and
reverted in r339558 because it caused a crash.

Reviewers: delesley, aaron.ballman

Reviewed By: delesley, aaron.ballman

Subscribers: hokein, cfe-commits

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

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

6 years ago[NFC] Test commit
Aaron Puchert [Wed, 22 Aug 2018 21:06:04 +0000 (21:06 +0000)]
[NFC] Test commit

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

6 years agoCurrently clang does not emit unused static constants. GCC emits these
Elizabeth Andrews [Wed, 22 Aug 2018 19:05:19 +0000 (19:05 +0000)]
Currently clang does not emit unused static constants. GCC emits these
constants by default when there is no optimization.

GCC's option -fno-keep-static-consts can be used to not emit
unused static constants.

In Clang, since default behavior does not keep unused static constants,
-fkeep-static-consts can be used to emit these if required. This could be
useful for producing identification strings like SVN identifiers
inside the object file even though the string isn't used by the program.

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

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

6 years ago[Android] Default to -fno-math-errno
Pirama Arumuga Nainar [Wed, 22 Aug 2018 17:43:05 +0000 (17:43 +0000)]
[Android] Default to -fno-math-errno

Summary: Android's libm does not set errno.

Reviewers: srhines, enh

Subscribers: cfe-commits

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

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

6 years ago[Tooling] Allow -flto flags and filter out -Wa, flags
Chih-Hung Hsieh [Wed, 22 Aug 2018 17:13:40 +0000 (17:13 +0000)]
[Tooling] Allow -flto flags and filter out -Wa, flags

This change fixes the problem in https://bugs.llvm.org/show_bug.cgi?id=38332
by allowing driver::Action::BackendJobClass to run with the analyzer.
Otherwise, such jobs will look up the non-existing compilation database
and then run without flags.
Also filter out the -Wa,* flags that could be passed to and ignored
by the clang compiler.  Clang-tidy gives warnings about unused -Wa,* flags.

Differential Revision: http://reviews.llvm.org/D51002

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

6 years ago[CodeGen] Look at the type of a block capture field rather than the type
Akira Hatanaka [Wed, 22 Aug 2018 13:41:19 +0000 (13:41 +0000)]
[CodeGen] Look at the type of a block capture field rather than the type
of the captured variable when determining whether the capture needs
special handing when the block is copied or disposed.

This fixes bugs in the handling of variables captured by a block that is
nested inside a lambda that captures the variables by reference.

rdar://problem/43540889

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

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

6 years ago[analyzer] Improve `CallDescription` to handle c++ method.
Henry Wong [Wed, 22 Aug 2018 13:30:46 +0000 (13:30 +0000)]
[analyzer] Improve `CallDescription` to handle c++ method.

Summary:
`CallDecription` can only handle function for the time being. If we want to match c++ method, we can only use method name to match and can't improve the matching accuracy through the qualifiers.

This patch add the support for `QualifiedName` matching to improve the matching accuracy.

Reviewers: xazax.hun, NoQ, george.karpenkov, rnkovacs

Reviewed By: xazax.hun, NoQ, rnkovacs

Subscribers: Szelethus, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits, MTC

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

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

6 years ago[Preamble] Fix an undefined behavior when checking an empty preamble can be reused.
Haojian Wu [Wed, 22 Aug 2018 12:34:04 +0000 (12:34 +0000)]
[Preamble] Fix an undefined behavior when checking an empty preamble can be reused.

Summary: Passing nullptr to memcmp is UB.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

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

6 years agoFix import of class templates partial specialization
Gabor Marton [Wed, 22 Aug 2018 11:52:14 +0000 (11:52 +0000)]
Fix import of class templates partial specialization

Summary:
Currently there are several issues with the import of class template
specializations.  (1) Different TUs may have class template specializations
with the same template arguments, but with different set of instantiated
MethodDecls and FieldDecls.  In this patch we provide a fix to merge these
methods and fields.  (2) Currently, we search the partial template
specializations in the set of simple specializations and we add partial
specializations as simple specializations. This is bad, this patch fixes it.

Reviewers: a_sidorin, xazax.hun, r.stahl

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[AArch64] Add Tiny Code Model for AArch64
David Green [Wed, 22 Aug 2018 11:34:28 +0000 (11:34 +0000)]
[AArch64] Add Tiny Code Model for AArch64

Adds a tiny code model to Clang along side rL340397.

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

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