]> granicus.if.org Git - clang/log
clang
6 years ago[Sema] Remove location from implicit capture init expr
Vedant Kumar [Thu, 13 Sep 2018 23:28:25 +0000 (23:28 +0000)]
[Sema] Remove location from implicit capture init expr

A lambda's closure is initialized when the lambda is declared. For
implicit captures, the initialization code emitted from EmitLambdaExpr
references source locations *within the lambda body* in the function
containing the lambda. This results in a poor debugging experience: we
step to the line containing the lambda, then into lambda, out again,
over and over, until every capture's field is initialized.

To improve stepping behavior, assign the starting location of the lambda
to expressions which initialize an implicit capture within it.

rdar://39807527

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

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

6 years agoFix crash on call to __builtin_memcpy with a null pointer to an
Richard Smith [Thu, 13 Sep 2018 22:47:33 +0000 (22:47 +0000)]
Fix crash on call to __builtin_memcpy with a null pointer to an
incomplete type.

Also improve the diagnostics for similar situations.

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

6 years agoDiagnose likely typos in #include directives.
Richard Smith [Thu, 13 Sep 2018 21:10:08 +0000 (21:10 +0000)]
Diagnose likely typos in #include directives.

Summary:
When someone writes

  #include "<some_file>"

or

  #include " some_file "

the compiler returns "file not fuond..." with fonts and quotes that may
make it hard to see there are excess quotes or surprising bytes in the
filename.  Assuming that files are usually logically named and start and
end with an alphanumeric character, we can check for the file's
existence by stripping the non-alphanumeric leading or trailing
characters.  If the file is found, emit a non-fatal error with a
FixItHint.

Patch by Christy Lee!

Reviewers: aaron.ballman, erikjv, rsmith

Reviewed By: rsmith

Subscribers: lebedev.ri, xbolva00, sammccall, modocache, erikjv, aaron.ballman, cfe-commits

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

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

6 years agoSupport -fno-omit-frame-pointer with -pg.
Stephen Hines [Thu, 13 Sep 2018 19:50:02 +0000 (19:50 +0000)]
Support -fno-omit-frame-pointer with -pg.

Summary:
Previously, any instance of -fomit-frame-pointer would make it such that
-pg was an invalid flag combination. If -fno-omit-frame-pointer is
passed later on the command line (such that it actually takes effect),
-pg should be allowed.

Reviewers: nickdesaulniers

Reviewed By: nickdesaulniers

Subscribers: manojgupta, nickdesaulniers, cfe-commits, kongyi, chh, pirama

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

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

6 years ago[NFC]Refactor MultiVersion Resolver Emission to combine types
Erich Keane [Thu, 13 Sep 2018 16:58:24 +0000 (16:58 +0000)]
[NFC]Refactor MultiVersion Resolver Emission to combine types

Previously, both types (plus the future target-clones) of
multiversioning had a separate ResolverOption structure and emission
function.  This patch combines the two, at the expense of a slightly
more expensive sorting function.

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

6 years ago[OPENMP] Fix PR38903: Crash on instantiation of the non-dependent
Alexey Bataev [Thu, 13 Sep 2018 16:54:05 +0000 (16:54 +0000)]
[OPENMP] Fix PR38903: Crash on instantiation of the non-dependent
declare reduction.

If the declare reduction construct with the non-dependent type is
defined in the template construct, the compiler might crash on the
template instantition. Reworked the whole instantiation scheme for the
declare reduction constructs to fix this problem correctly.

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

6 years agoPrint correctly dependency paths on Windows
David Bolvansky [Thu, 13 Sep 2018 14:27:32 +0000 (14:27 +0000)]
Print correctly dependency paths on Windows

Summary:
Before:
main.o: main.c ../include/lib\test.h

After:
main.o: main.c ../include/lib/test.h

Fixes PR38877

Reviewers: zturner

Subscribers: xbolva00, cfe-commits

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

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

6 years ago[AArch64] Enable return address signing for static ctors
Oliver Stannard [Thu, 13 Sep 2018 10:25:36 +0000 (10:25 +0000)]
[AArch64] Enable return address signing for static ctors

Functions generated by clang and included in the .init_array section (such as
static constructors) do not follow the usual code path for adding
target-specific function attributes, so we have to add the return address
signing attribute here too, as is currently done for the sanitisers.

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

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

6 years agoFix MSVC "illegal conversion; more than one user-defined conversion has been implicit...
Simon Pilgrim [Thu, 13 Sep 2018 10:10:18 +0000 (10:10 +0000)]
Fix MSVC "illegal conversion; more than one user-defined conversion has been implicitly applied" warning. NFCI.

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

6 years ago[clang-format] Wrapped block after case label should not be merged into one line
Owen Pan [Thu, 13 Sep 2018 07:27:15 +0000 (07:27 +0000)]
[clang-format] Wrapped block after case label should not be merged into one line

PR38854

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

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

6 years ago[AArch64] Support reserving x1-7 registers.
Tri Vo [Wed, 12 Sep 2018 23:45:04 +0000 (23:45 +0000)]
[AArch64] Support reserving x1-7 registers.

Summary: Reserving registers x1-7 is used to support CONFIG_ARM64_LSE_ATOMICS in Linux kernel. This change adds support for reserving registers x1 through x7.

Reviewers: javed.absar, efriedma, nickdesaulniers, srhines, phosek

Reviewed By: nickdesaulniers

Subscribers: manojgupta, jfb, cfe-commits, kristof.beyls

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

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

6 years agoRemove dead code made unnecessary by r342018.
Richard Smith [Wed, 12 Sep 2018 23:37:58 +0000 (23:37 +0000)]
Remove dead code made unnecessary by r342018.

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

6 years agoTrack definition merging on the canonical declaration even when local
Richard Smith [Wed, 12 Sep 2018 23:37:00 +0000 (23:37 +0000)]
Track definition merging on the canonical declaration even when local
submodule visibility is disabled.

Attempting to pick a specific declaration to make visible when the
module containing the merged declaration becomes visible is error-prone,
as we don't yet know which declaration we'll choose to be the definition
when we are informed of the merging.

This reinstates r342019, reverted in r342020. The regression previously
observed after this commit was fixed in r342096.

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

6 years agoWhen we leave a module header, make that header visible in its
Richard Smith [Wed, 12 Sep 2018 23:09:23 +0000 (23:09 +0000)]
When we leave a module header, make that header visible in its
includer's context, even if its overall module is unavailable.

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

6 years ago[Hexagon] Remove fp-contract=fast setting for at O3
Brendon Cahoon [Wed, 12 Sep 2018 20:35:56 +0000 (20:35 +0000)]
[Hexagon] Remove fp-contract=fast setting for at O3

Change Hexagon so that the setting for fp-contract is the default setting.
This makes Hexagon consistent with all other targets.

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

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

6 years ago[Diagnostic] Fix a warning typo. NFC.
Matt Davis [Wed, 12 Sep 2018 18:27:21 +0000 (18:27 +0000)]
[Diagnostic] Fix a warning typo. NFC.

s/aligment/alignment/

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

6 years ago[OPENMP] Fix PR38902: support ADL for declare reduction constructs.
Alexey Bataev [Wed, 12 Sep 2018 16:31:59 +0000 (16:31 +0000)]
[OPENMP] Fix PR38902: support ADL for declare reduction constructs.

Added support for argument-dependent lookup when trying to find the
required declare reduction decl.

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

6 years ago[RISCV] Explicitly set an empty --sysroot in the test
Roger Ferrer Ibanez [Wed, 12 Sep 2018 15:55:14 +0000 (15:55 +0000)]
[RISCV] Explicitly set an empty --sysroot in the test

In rL341655 we added additional behaviour to the Driver for riscv32-unknown-elf
when the sysroot is empty.

The new tests that check the new behaviour expect that the absence of --sysroot
in the command-line implies that the sysroot empty. This doesn't hold if clang
is built with a non-empty DEFAULT_SYSROOT in cmake. When this is the case, this
test fails.

Since the new behaviour is triggered when the sysroot is empty, pass an empty
--sysroot to avoid using the default (if any).

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

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

6 years ago[CodeGen] Align rtti and vtable data
David Green [Wed, 12 Sep 2018 14:09:06 +0000 (14:09 +0000)]
[CodeGen] Align rtti and vtable data

Previously the alignment on the newly created rtti/typeinfo data was largely
not set, meaning that DataLayout::getPreferredAlignment was free to overalign
it to 16 bytes. This causes unnecessary code bloat.

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

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

6 years ago[CodeGen][ARM] Coerce FP16 vectors to integer vectors when needed
Mikhail Maltsev [Wed, 12 Sep 2018 09:19:19 +0000 (09:19 +0000)]
[CodeGen][ARM] Coerce FP16 vectors to integer vectors when needed

Summary:
On targets that do not support FP16 natively LLVM currently legalizes
vectors of FP16 values by scalarizing them and promoting to FP32. This
causes problems for the following code:

  void foo(int, ...);

  typedef __attribute__((neon_vector_type(4))) __fp16 float16x4_t;
  void bar(float16x4_t x) {
    foo(42, x);
  }

According to the AAPCS (appendix A.2) float16x4_t is a containerized
vector fundamental type, so 'foo' expects that the 4 16-bit FP values
are packed into 2 32-bit registers, but instead bar promotes them to
4 single precision values.

Since we already handle scalar FP16 values in the frontend by
bitcasting them to/from integers, this patch adds similar handling for
vector types and homogeneous FP16 vector aggregates.

One existing test required some adjustments because we now generate
more bitcasts (so the patch changes the test to target a machine with
native FP16 support).

Reviewers: eli.friedman, olista01, SjoerdMeijer, javed.absar, efriedma

Reviewed By: javed.absar, efriedma

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

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

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

6 years agoFix Check test to avoid output string mismatch
Christian Bruel [Wed, 12 Sep 2018 08:59:17 +0000 (08:59 +0000)]
Fix Check test to avoid output string mismatch

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

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

6 years ago[Tooling] Wait for all threads to finish before resetting CWD.
Eric Liu [Wed, 12 Sep 2018 08:29:47 +0000 (08:29 +0000)]
[Tooling] Wait for all threads to finish before resetting CWD.

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

6 years ago[Driver] Search LibraryPaths when handling -print-file-name
Petr Hosek [Wed, 12 Sep 2018 03:26:10 +0000 (03:26 +0000)]
[Driver] Search LibraryPaths when handling -print-file-name

This is necessary to handle the multiarch runtime directories.

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

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

6 years agoRevert r342019, "Track definition merging on the canonical declaration
Richard Smith [Wed, 12 Sep 2018 02:28:14 +0000 (02:28 +0000)]
Revert r342019, "Track definition merging on the canonical declaration
even when [...]"

Further testing has revealed that this causes build breaks during
explicit module compilations.

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

6 years agoTrack definition merging on the canonical declaration even when local
Richard Smith [Wed, 12 Sep 2018 02:13:48 +0000 (02:13 +0000)]
Track definition merging on the canonical declaration even when local
submodule visibility is disabled.

Attempting to pick a specific declaration to make visible when the
module containing the merged declaration becomes visible is error-prone,
as we don't yet know which declaration we'll choose to be the definition
when we are informed of the merging.

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

6 years agoConsistently create a new declaration when merging a pre-existing but
Richard Smith [Wed, 12 Sep 2018 02:13:47 +0000 (02:13 +0000)]
Consistently create a new declaration when merging a pre-existing but
hidden definition with a would-be-parsed redefinition.

This permits a bunch of cleanups. In particular, we no longer need to
take merged definitions into account when checking declaration
visibility, only when checking definition visibility, which makes
certain visibility checks take linear instead of quadratic time.

We could also now remove the UPD_DECL_EXPORTED update record and track
on each declaration whether it was demoted from a definition (as we
already do for variables), but I'm not doing that in this patch to keep
the changes here simpler.

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

6 years agoFix tracking of merged definitions when the merge target is also merged
Richard Smith [Wed, 12 Sep 2018 02:13:46 +0000 (02:13 +0000)]
Fix tracking of merged definitions when the merge target is also merged
into something else.

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

6 years ago[NFC] Fix build breakage caused by D51948
Shuai Wang [Tue, 11 Sep 2018 22:41:14 +0000 (22:41 +0000)]
[NFC] Fix build breakage caused by D51948

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

6 years ago[analyzer] Add ExprMutationAnalyzer
Shuai Wang [Tue, 11 Sep 2018 21:13:20 +0000 (21:13 +0000)]
[analyzer] Add ExprMutationAnalyzer

Summary:
This is 1/2 of moving ExprMutationAnalyzer from clangtidy to
clang/Analysis.
This diff along simply copies the ExprMutationAnalyzer over with trivial
modifications (e.g. include path, namespace)
2/2 will migrate existing usage of ExprMutationAnalyzer and remove the
original copy inside clangtidy.

Reviewers: george.karpenkov

Subscribers: mgorny, xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits, JonasToth

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

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

6 years agoIntroduce the VTable interleaving scheme to the CFI design documentation
Peter Collingbourne [Tue, 11 Sep 2018 20:43:52 +0000 (20:43 +0000)]
Introduce the VTable interleaving scheme to the CFI design documentation

Dimitar et. al. in [1] proposed a novel VTable layout scheme that enables efficient implementation of virtual call CFI.

This patch adds an introduction of this scheme to the CFI design documentation.

[1] Protecting C++ Dynamic Dispatch Through VTable Interleaving. Dimitar Bounov, Rami Gökhan Kıcı, Sorin Lerner. https://cseweb.ucsd.edu/~lerner/papers/ivtbl-ndss16.pdf

Patch by Zhaomo Yang!

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

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

6 years ago[gcov] Update a clang test for r341977
Vedant Kumar [Tue, 11 Sep 2018 19:42:58 +0000 (19:42 +0000)]
[gcov] Update a clang test for r341977

Update test/CodeGen/code-coverage.c so that it doesn't refer to a gcov
function which is no longer emitted after r341977.

Fixes bot failure:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/23831

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

6 years ago[analyzer] [NFC] Change the tests by making the version check more resilient
George Karpenkov [Tue, 11 Sep 2018 18:45:15 +0000 (18:45 +0000)]
[analyzer] [NFC] Change the tests by making the version check more resilient

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

6 years ago[clang-cl, PCH] Support for /Yc and /Yu without filename and #pragma hdrstop
Mike Rice [Tue, 11 Sep 2018 17:10:44 +0000 (17:10 +0000)]
[clang-cl, PCH] Support for /Yc and /Yu without filename and #pragma hdrstop

With clang-cl, when the user specifies /Yc or /Yu without a filename
the compiler uses a #pragma hdrstop in the main source file to
determine the end of the PCH. If a header is specified with /Yc or
/Yu #pragma hdrstop has no effect.

The optional #pragma hdrstop filename argument is not yet supported.

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

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

6 years ago[ASTMatchers] add three matchers for dependent expressions
Jonas Toth [Tue, 11 Sep 2018 16:09:19 +0000 (16:09 +0000)]
[ASTMatchers] add three matchers for dependent expressions

Summary:
The new matchers can be used to check if an expression is type-, value- or instantiation-dependent
in a templated context.
These matchers are used in a clang-tidy check and generally useful as the
problem of unresolved templates occurs more often in clang-tidy and they
provide an easy way to check for this issue.

Reviewers: aaron.ballman, alexfh, klimek

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years ago[CodeCompletion] Enable signature help when initializing class/struct/union members.
Kadir Cetinkaya [Tue, 11 Sep 2018 15:02:18 +0000 (15:02 +0000)]
[CodeCompletion] Enable signature help when initializing class/struct/union members.

Summary:
Factors out member decleration gathering and uses it in parsing to call signature
help. Doesn't support signature help for base class constructors, the code was too
coupled with diagnostic handling, but still can be factored out but just needs
more afford.

Reviewers: sammccall, ilya-biryukov, ioeric

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

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

6 years ago[OPENMP] Simplified checks for declarations in declare target regions.
Alexey Bataev [Tue, 11 Sep 2018 13:59:10 +0000 (13:59 +0000)]
[OPENMP] Simplified checks for declarations in declare target regions.

Sema analysis should not mark functions as an implicit declare target,
it may break codegen. Simplified semantic analysis and removed extra
code for implicit declare target functions.

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

6 years ago[python bindings] Expose getNumTemplateArguments
Jonathan Coe [Tue, 11 Sep 2018 12:44:52 +0000 (12:44 +0000)]
[python bindings] Expose getNumTemplateArguments

Expose the C bindings for clang_Type_getNumTemplateArguments() and
clang_Type_getTemplateArgumentAsType() in the python API.

Patch by kjteske (Kyle Teske).

Reviewed By: jbcoe

Subscribers: cfe-commits

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

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

6 years ago[Tooling] Restore working dir in ClangTool.
Ilya Biryukov [Tue, 11 Sep 2018 07:29:09 +0000 (07:29 +0000)]
[Tooling] Restore working dir in ClangTool.

Summary:
And add an option to disable this behavior. The option is only used in
AllTUsExecutor to avoid races when running concurrently on multiple
threads.

This fixes PR38869 introduced by r340937.

Reviewers: ioeric, steveire

Reviewed By: ioeric

Subscribers: cfe-commits

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

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

6 years agoMake test more robust in case the expected output appears in clang version string.
Douglas Yung [Tue, 11 Sep 2018 06:48:45 +0000 (06:48 +0000)]
Make test more robust in case the expected output appears in clang version string.

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

6 years ago[Modules] Add imported modules to the output of -module-file-info
Bruno Cardoso Lopes [Tue, 11 Sep 2018 05:17:13 +0000 (05:17 +0000)]
[Modules] Add imported modules to the output of -module-file-info

Fix a bug in the deserialization of IMPORTS section and allow for
imported modules to also be printed with -module-file-info.

rdar://problem/43867753

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

6 years agoclang-check: rename the local FixItAction
Saleem Abdulrasool [Mon, 10 Sep 2018 22:57:26 +0000 (22:57 +0000)]
clang-check: rename the local FixItAction

Resolve the ambiguity in the FixItAction definition by renaming the type.  With
Xcode 9.2, you would fail to build this with:

  llvm/tools/clang/tools/clang-check/ClangCheck.cpp:183:48: error: reference to 'FixItAction' is ambiguous
      FrontendFactory = newFrontendActionFactory<FixItAction>();
                                                 ^

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

6 years ago[Sema][ObjC] Infer availability of +new from availability of -init.
Erik Pilkington [Mon, 10 Sep 2018 22:20:09 +0000 (22:20 +0000)]
[Sema][ObjC] Infer availability of +new from availability of -init.

When defined in NSObject, +new will call -init. If -init has been marked
unavailable, diagnose uses of +new.

rdar://18335828

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

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

6 years agoFix test regression in r341862
Erich Keane [Mon, 10 Sep 2018 21:57:53 +0000 (21:57 +0000)]
Fix test regression in r341862

The commit updates when AES is enabled, but failed to update the tests.
This patch fixes them.

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

6 years ago[AST] Fix a crash on invalid.
Erik Pilkington [Mon, 10 Sep 2018 21:54:04 +0000 (21:54 +0000)]
[AST] Fix a crash on invalid.

Problem was that we were appending to the source location info buffer in the
copy assignment operator (instead of overwriting).

rdar://42746401

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

6 years agoMove AESNI generation to Skylake and Goldmont
Erich Keane [Mon, 10 Sep 2018 21:12:21 +0000 (21:12 +0000)]
Move AESNI generation to Skylake and Goldmont

The instruction set first appeared with Westmere, but not all processors
in that and the next few generations have the instructions. According to
Wikipedia[1], the first generation in which all SKUs have AES
instructions are Skylake and Goldmont. I can't find any Skylake,
Kabylake, Kabylake-R or Cannon Lake currently listed at
https://ark.intel.com that says "Intel® AES New Instructions" "No".

This matches GCC commit
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01940.html

[1] https://en.wikipedia.org/wiki/AES_instruction_set

Patch By: thiagomacieira
Differential Revision: https://reviews.llvm.org/D51510

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

6 years agoImplement -Watomic-implicit-seq-cst
JF Bastien [Mon, 10 Sep 2018 20:42:56 +0000 (20:42 +0000)]
Implement -Watomic-implicit-seq-cst

Summary:
_Atomic and __sync_* operations are implicitly sequentially-consistent. Some
codebases want to force explicit usage of memory order instead. This warning
allows them to know where implicit sequentially-consistent memory order is used.
The warning isn't on by default because _Atomic was purposefully designed to
have seq_cst as the default: the idea was that it's the right thing to use most
of the time. This warning allows developers who disagree to enforce explicit
usage instead.

A follow-up patch will take care of C++'s std::atomic. It'll be different enough
from this patch that I think it should be separate: for C++ the atomic
operations all have a memory order parameter (or two), but it's defaulted. I
believe this warning should trigger when the default is used, but not when
seq_cst is used explicitly (or implicitly as the failure order for cmpxchg).

<rdar://problem/28172966>

Reviewers: rjmccall

Subscribers: dexonsmith, cfe-commits

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

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

6 years agoEnhance -Wc++14-compat for class template argument deduction to list the
Richard Smith [Mon, 10 Sep 2018 20:31:03 +0000 (20:31 +0000)]
Enhance -Wc++14-compat for class template argument deduction to list the
deduced type (if known).

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

6 years ago[clang-cl] Enable -march option
Alexandre Ganea [Mon, 10 Sep 2018 17:54:32 +0000 (17:54 +0000)]
[clang-cl] Enable -march option

This change allows usage of -march when using the clang-cl driver. This is similar to MSVC's /arch; however -march can target precisely all supported CPUs, while /arch has a more restricted set.

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

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

6 years agoRemove all uses of DIFlagBlockByrefStruct
Adrian Prantl [Mon, 10 Sep 2018 16:14:28 +0000 (16:14 +0000)]
Remove all uses of DIFlagBlockByrefStruct

This patch removes the last reason why DIFlagBlockByrefStruct from
Clang by directly implementing the drilling into the member type done
in DwarfDebug::DbgVariable::getType() into the frontend.

rdar://problem/31629055

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

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

6 years agoPrevent cpu-specific/cpu-dispatch from giong on a lambda.
Erich Keane [Mon, 10 Sep 2018 14:31:56 +0000 (14:31 +0000)]
Prevent cpu-specific/cpu-dispatch from giong on a lambda.

It is non-sensical to use cpu-specific/cpu-dispatch multiversioning
on a lambda, so prevent it when trying to add the attribute.

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

6 years ago[clang] Make sure codecompletion is called for calls even when inside a token.
Kadir Cetinkaya [Mon, 10 Sep 2018 13:46:28 +0000 (13:46 +0000)]
[clang] Make sure codecompletion is called for calls even when inside a token.

Summary:
Currently CodeCompleteCall only gets called after a comma or parantheses. This
patch makes sure it is called even at the cases like:
```foo(1^);```

Reviewers: ilya-biryukov, ioeric, hokein

Reviewed By: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

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

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

6 years ago[Analyzer] Commit fix for rL341790/rC341790
Adam Balogh [Mon, 10 Sep 2018 09:19:54 +0000 (09:19 +0000)]
[Analyzer] Commit fix for rL341790/rC341790

Test file was accidentally not added for rL341790/rC341790 and subsequant patches.

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

6 years ago[Analyzer] Iterator Checker - Part 8: Support for assign, clear, insert, emplace...
Adam Balogh [Mon, 10 Sep 2018 09:07:47 +0000 (09:07 +0000)]
[Analyzer] Iterator Checker - Part 8: Support for assign, clear, insert, emplace and erase operations

This patch adds support for the following operations in the iterator checkers: assign, clear, insert, insert_after, emplace, emplace_after, erase and erase_after. This affects mismatched iterator checks ("this" and parameter must match) and invalidation checks (according to the standard).

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

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

6 years ago[Analyzer] Iterator Checker - Part 7: Support for push and pop operations
Adam Balogh [Mon, 10 Sep 2018 09:06:31 +0000 (09:06 +0000)]
[Analyzer] Iterator Checker - Part 7: Support for push and pop operations

This patch adds support for the following operations in the iterator checkers: push_back, push_front, emplace_back, emplace_front, pop_back and pop_front. This affects iterator range checks (range is extended after push and emplace and reduced after pop operations) and invalidation checks (according to the standard).

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

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

6 years ago[Analyzer] Iterator Checker - Part 6: Mismatched iterator checker for constructors...
Adam Balogh [Mon, 10 Sep 2018 09:05:31 +0000 (09:05 +0000)]
[Analyzer] Iterator Checker - Part 6: Mismatched iterator checker for constructors and comparisons

Extension of the mismatched iterator checker for constructors taking range of first..last (first and last must be iterators of the same container) and also for comparisons of iterators of different containers (one does not compare iterators of different containers, since the set of iterators is partially ordered, there are no relations between iterators of different containers, except that they are always non-equal).

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

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

6 years ago[Analyzer] Iterator Checker - Part 5: Move Assignment of Containers
Adam Balogh [Mon, 10 Sep 2018 09:04:27 +0000 (09:04 +0000)]
[Analyzer] Iterator Checker - Part 5: Move Assignment of Containers

If a container is moved by its move assignment operator, according to the standard all their iterators except the past-end iterators remain valid but refer to the new container. This patch introduces support for this case in the iterator checkers.

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

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

6 years ago[Analyzer] Iterator Checker - Part 4: Mismatched iterator checker for function parameters
Adam Balogh [Mon, 10 Sep 2018 09:03:22 +0000 (09:03 +0000)]
[Analyzer] Iterator Checker - Part 4: Mismatched iterator checker for function parameters

New check added to the checker which checks whether iterator parameters of template functions typed by the same template parameter refer to the same container.

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

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

6 years agoReleaseNotes: update links to use https
Hans Wennborg [Mon, 10 Sep 2018 08:51:25 +0000 (08:51 +0000)]
ReleaseNotes: update links to use https

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

6 years agoPR33222: Require the declared return type not the actual return type to
Richard Smith [Mon, 10 Sep 2018 06:35:32 +0000 (06:35 +0000)]
PR33222: Require the declared return type not the actual return type to
match when checking for redeclaration of a function template.

This properly handles differences in deduced return types, particularly
when performing redeclaration checks for a friend function template.

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

6 years agoPart of PR33222: defer enforcing return type mismatch for dependent
Richard Smith [Mon, 10 Sep 2018 05:32:13 +0000 (05:32 +0000)]
Part of PR33222: defer enforcing return type mismatch for dependent
friend function declarations of class templates.

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

6 years ago[OpenMP] Add support for nested 'declare target' directives
Kelvin Li [Mon, 10 Sep 2018 02:07:09 +0000 (02:07 +0000)]
[OpenMP] Add support for nested 'declare target' directives

Add the capability to nest multiple declare target directives
- including header files within a declare target region.

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

Patch by Patrick Lyster

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

6 years ago[Sema] Make typo correction slightly more efficient
Fangrui Song [Sun, 9 Sep 2018 17:20:03 +0000 (17:20 +0000)]
[Sema] Make typo correction slightly more efficient

edit_distance returns UpperBound+1 if the distance will exceed UpperBound. We can subtract 1 from UpperBound and change >= to > in the if condition. The threshold does not change but edit_distance will have more opportunity to bail out earlier.

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

6 years agoFix build bots after a mistake in r341760
Hamza Sood [Sun, 9 Sep 2018 13:12:53 +0000 (13:12 +0000)]
Fix build bots after a mistake in r341760

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

6 years ago[Tooling] Improve handling of CL-style options
Hamza Sood [Sun, 9 Sep 2018 12:06:35 +0000 (12:06 +0000)]
[Tooling] Improve handling of CL-style options

This patch fixes the handling of clang-cl options in InterpolatingCompilationDatabase.
They were previously ignored completely, which led to a lot of bugs:

Additional options were being added with the wrong syntax. E.g. a file was
specified as C++ by adding -x c++, which causes an error in CL mode.

The args were parsed and then rendered, which means that the aliasing information
was lost. E.g. /W4 was rendered to -Wall, which in CL mode means -Weverything.

CL options were ignored when checking things like -std=, so a lot of logic was
being bypassed.

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

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

6 years agoRevert r341754.
Akira Hatanaka [Sun, 9 Sep 2018 05:22:49 +0000 (05:22 +0000)]
Revert r341754.

The commit broke a couple of bots:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/12347
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/7310

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

6 years ago[Parser] Remove an unnecessary `mutable`
Fangrui Song [Sun, 9 Sep 2018 01:54:18 +0000 (01:54 +0000)]
[Parser] Remove an unnecessary `mutable`

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

6 years agoms: Insert $$Z in mangling between directly consecutive parameter packs.
Nico Weber [Sat, 8 Sep 2018 20:58:39 +0000 (20:58 +0000)]
ms: Insert $$Z in mangling between directly consecutive parameter packs.

Fixes PR38783.
Differential Revision: https://reviews.llvm.org/D51784

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

6 years agoDistinguish `__block` variables that are captured by escaping blocks
Akira Hatanaka [Sat, 8 Sep 2018 20:03:00 +0000 (20:03 +0000)]
Distinguish `__block` variables that are captured by escaping blocks
from those that aren't.

This patch changes the way __block variables that aren't captured by
escaping blocks are handled:

- Since non-escaping blocks on the stack never get copied to the heap
  (see https://reviews.llvm.org/D49303), Sema shouldn't error out when
  the type of a non-escaping __block variable doesn't have an accessible
  copy constructor.

- IRGen doesn't have to use the specialized byref structure (see
  https://clang.llvm.org/docs/Block-ABI-Apple.html#id8) for a
  non-escaping __block variable anymore. Instead IRGen can emit the
  variable as a normal variable and copy the reference to the block
  literal. Byref copy/dispose helpers aren't needed either.

rdar://problem/39352313

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

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

6 years agoDo not use optimized atomic libcalls for misaligned atomics.
Richard Smith [Fri, 7 Sep 2018 23:57:54 +0000 (23:57 +0000)]
Do not use optimized atomic libcalls for misaligned atomics.

Summary:
The optimized (__atomic_foo_<n>) libcalls assume that the atomic object
is properly aligned, so should never be called on an underaligned
object.

This addresses one of several problems identified in PR38846.

Reviewers: jyknight, t.p.northover

Subscribers: jfb, cfe-commits

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

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

6 years ago[analyzer] [NFC] Move methods for dumping the coverage in HTMLDiagnostics into the...
George Karpenkov [Fri, 7 Sep 2018 22:13:35 +0000 (22:13 +0000)]
[analyzer] [NFC] Move methods for dumping the coverage in HTMLDiagnostics into the class

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

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

6 years ago[analyzer] [NFC] Use StringRef when returning a large string literal in HTMLDiagnostics
George Karpenkov [Fri, 7 Sep 2018 22:13:15 +0000 (22:13 +0000)]
[analyzer] [NFC] Use StringRef when returning a large string literal in HTMLDiagnostics

(NB: could be a clang-tidy / analyzer check)

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

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

6 years ago[analyzer] Remove the "postponed" hack, deal with derived symbols using an extra map
George Karpenkov [Fri, 7 Sep 2018 22:07:57 +0000 (22:07 +0000)]
[analyzer] Remove the "postponed" hack, deal with derived symbols using an extra map

The "derived" symbols indicate children fields of a larger symbol.
As parents do not have pointers to their children, the garbage
collection algorithm the analyzer currently uses adds such symbols into
a "postponed" category, and then keeps running through the worklist
until the fixed point is reached.

The current patch rectifies that by instead using a helper map which
stores pointers from parents to children, so that no fixed point
calculation is necessary.

The current patch yields ~5% improvement in running time on sqlite.

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

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

6 years agoRevert "Revert "Revert "Revert "[analyzer] Add coverage information to plist output...
George Karpenkov [Fri, 7 Sep 2018 21:58:24 +0000 (21:58 +0000)]
Revert "Revert "Revert "Revert "[analyzer] Add coverage information to plist output, update tests""""

This reverts commit 2f5d71d9fa135be86bb299e7d773036e50bf1df6.

Hopefully fixing tests on Windows.

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

6 years agoMake -Watomic-alignment say whether the atomic operation was oversized
Richard Smith [Fri, 7 Sep 2018 21:24:27 +0000 (21:24 +0000)]
Make -Watomic-alignment say whether the atomic operation was oversized
or misaligned.

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

6 years agoPR38870: Add warning for zero-width unicode characters appearing in
Richard Smith [Fri, 7 Sep 2018 19:25:39 +0000 (19:25 +0000)]
PR38870: Add warning for zero-width unicode characters appearing in
identifiers.

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

6 years ago[X86] Custom emit __builtin_rdtscp so we can emit an explicit store for the out parameter
Craig Topper [Fri, 7 Sep 2018 19:14:24 +0000 (19:14 +0000)]
[X86] Custom emit __builtin_rdtscp so we can emit an explicit store for the out parameter

This is the clang side of D51803. The llvm intrinsic now returns two results. So we need to emit an explicit store in IR for the out parameter. This is similar to addcarry/subborrow/rdrand/rdseed.

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

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

6 years agowarn_stdlibcxx_not_found: suggest '-stdlib=libc++' instead of '-std'
Alex Lorenz [Fri, 7 Sep 2018 18:59:45 +0000 (18:59 +0000)]
warn_stdlibcxx_not_found: suggest '-stdlib=libc++' instead of '-std'

Addresses first post-commit feedback for r335081 from Nico

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

6 years ago[X86] Modify addcarry/subborrow builtins to emit an 2 result and intrinsic and an...
Craig Topper [Fri, 7 Sep 2018 16:58:57 +0000 (16:58 +0000)]
[X86] Modify addcarry/subborrow builtins to emit an 2 result and intrinsic and an store instruction.

This is the clang side of D51769. The llvm intrinsics now return two results instead of using an out parameter.

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

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

6 years agoRevert "[OPENMP][NVPTX] Disable runtime-type info for CUDA devices."
Alexey Bataev [Fri, 7 Sep 2018 14:50:25 +0000 (14:50 +0000)]
Revert "[OPENMP][NVPTX] Disable runtime-type info for CUDA devices."

Still need the RTTI for NVPTX target to pass sema checks.

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

6 years ago[CodeComplete] Clearly distinguish signature help and code completion.
Ilya Biryukov [Fri, 7 Sep 2018 14:04:39 +0000 (14:04 +0000)]
[CodeComplete] Clearly distinguish signature help and code completion.

Summary:
Code completion in clang is actually a mix of two features:
- Code completion is a familiar feature. Results are exposed via the
  CodeCompleteConsumer::ProcessCodeCompleteResults callback.
- Signature help figures out if the current expression is an argument of
  some function call and shows corresponding signatures if so.
  Results are exposed via CodeCompleteConsumer::ProcessOverloadCandidates.

This patch refactors the implementation to untangle those two from each
other and makes some naming tweaks to avoid confusion when reading the
code.

The refactoring is required for signature help fixes, see D51038.

The only intended behavior change is the order of callbacks.
ProcessOverloadCandidates is now called before ProcessCodeCompleteResults.

Reviewers: sammccall, kadircet

Reviewed By: sammccall

Subscribers: cfe-commits

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

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

6 years ago[libclang] Return the proper pointee type for 'auto' deduced to pointer
Ivan Donchevskii [Fri, 7 Sep 2018 13:23:51 +0000 (13:23 +0000)]
[libclang] Return the proper pointee type for 'auto' deduced to pointer

Currently the resulting type is always invalid in such case.

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

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

6 years agoDifferential Revision: https://reviews.llvm.org/D50246
Kristina Brooks [Fri, 7 Sep 2018 13:03:31 +0000 (13:03 +0000)]
Differential Revision: https://reviews.llvm.org/D50246

[RISCV] Add support for computing sysroot for riscv32-unknown-elf

Extends r338385 to allow the driver to compute the sysroot when an explicit path is not provided. This allows the linker to find C runtime files and the correct include directory for header files.

Patch by lewis-revill (Lewis Revill)

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

6 years agoReland r341390 clang-cl: Pass /Brepro to linker if it was passed to the compiler
Nico Weber [Fri, 7 Sep 2018 12:47:02 +0000 (12:47 +0000)]
Reland r341390 clang-cl: Pass /Brepro to linker if it was passed to the compiler

The test was missing  '--' on mac as pointed out by -Wslash-u-filename:
<stdin>:5:69: note: possible intended match here
clang: warning: '/Users/thakis/src/llvm-mono/clang/test/Driver/msvc-link.c' treated as the '/U' option [-Wslash-u-filename]

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

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

6 years agoRevert "Revert "Revert "[analyzer] Add coverage information to plist output, update...
Simon Pilgrim [Fri, 7 Sep 2018 10:27:16 +0000 (10:27 +0000)]
Revert "Revert "Revert "[analyzer] Add coverage information to plist output, update tests"""

Reverts analyzer tests from rL341627 again as they still broke windows buildbots

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

6 years agoReplaces __inline by __inline__ / C89 compatible
Diogo N. Sampaio [Fri, 7 Sep 2018 09:37:27 +0000 (09:37 +0000)]
Replaces __inline by __inline__ / C89 compatible

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

6 years ago[MSan] add KMSAN support to Clang driver
Alexander Potapenko [Fri, 7 Sep 2018 09:21:09 +0000 (09:21 +0000)]
[MSan] add KMSAN support to Clang driver

Boilerplate code for using KMSAN instrumentation in Clang.

We add a new command line flag, -fsanitize=kernel-memory, with a
corresponding SanitizerKind::KernelMemory, which, along with
SanitizerKind::Memory, maps to the memory_sanitizer feature.

KMSAN is only supported on x86_64 Linux.

It's incompatible with other sanitizers, but supports code coverage
instrumentation.

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

6 years ago[Sema] Check that the destructor for each element of class type is
Akira Hatanaka [Fri, 7 Sep 2018 02:38:01 +0000 (02:38 +0000)]
[Sema] Check that the destructor for each element of class type is
accessible from the context where aggregate initialization occurs.

rdar://problem/38168772

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

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

6 years agoRevert "Revert "[analyzer] Add coverage information to plist output, update tests""
George Karpenkov [Fri, 7 Sep 2018 02:02:35 +0000 (02:02 +0000)]
Revert "Revert "[analyzer] Add coverage information to plist output, update tests""

This reverts commit a39bcab414dd7ace7e490363ecdf01ecce7743fc.

Reverting the revert, fixing tests.

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

6 years agoRevert "[analyzer] Add coverage information to plist output, update tests"
George Karpenkov [Fri, 7 Sep 2018 01:39:23 +0000 (01:39 +0000)]
Revert "[analyzer] Add coverage information to plist output, update tests"

This reverts commit 03d183b6b94eda27ce66a4f9b87a00b0a148cf9e.

Temporary revert until the tests are fixed.

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

6 years ago[analyzer] Add coverage information to plist output, update tests
George Karpenkov [Fri, 7 Sep 2018 00:44:17 +0000 (00:44 +0000)]
[analyzer] Add coverage information to plist output, update tests

Split tests which were still using FileCheck to compare plists.

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

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

6 years ago[analyzer] [NFC] Prefer passing around reference to std::unique_ptr&
George Karpenkov [Fri, 7 Sep 2018 00:43:55 +0000 (00:43 +0000)]
[analyzer] [NFC] Prefer passing around reference to std::unique_ptr&

When object is owned elsewhere

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

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

6 years ago[analyzer] Executed lines: store file IDs, not hashes.
George Karpenkov [Fri, 7 Sep 2018 00:43:37 +0000 (00:43 +0000)]
[analyzer] Executed lines: store file IDs, not hashes.

Raw FileIDs are needed for the PlistDiagnostics to produce stable filenames.

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

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

6 years ago[analyzer] Do not add invalid source location to the coverage information
George Karpenkov [Fri, 7 Sep 2018 00:43:17 +0000 (00:43 +0000)]
[analyzer] Do not add invalid source location to the coverage information

Invalid source locations may arise from generated code.

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

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

6 years ago[analyzer] Push updating-the-executed-lines logic into the BugReporter.
George Karpenkov [Fri, 7 Sep 2018 00:42:53 +0000 (00:42 +0000)]
[analyzer] Push updating-the-executed-lines logic into the BugReporter.

So it can be reused across different consumers.

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

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

6 years ago[analyzer] Skip printing trivial nodes in exploded graph
George Karpenkov [Fri, 7 Sep 2018 00:42:32 +0000 (00:42 +0000)]
[analyzer] Skip printing trivial nodes in exploded graph

A node is considered to be trivial if it only has one successor, one
predecessor, and a state equal to the predecessor.
Can drastically (> 2x) reduce the size of the generated exploded
graph.

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

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

6 years ago[analyzer] [NFC] Move dumping program point into a separate function
George Karpenkov [Thu, 6 Sep 2018 23:08:27 +0000 (23:08 +0000)]
[analyzer] [NFC] Move dumping program point into a separate function

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

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

6 years ago[analyzer] Dump stable identifiers for exploded nodes
George Karpenkov [Thu, 6 Sep 2018 23:08:07 +0000 (23:08 +0000)]
[analyzer] Dump stable identifiers for exploded nodes

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

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

6 years ago[analyzer] Remove traces of ubigraph visualization
George Karpenkov [Thu, 6 Sep 2018 23:07:47 +0000 (23:07 +0000)]
[analyzer] Remove traces of ubigraph visualization

Ubigraph project has been dead since about 2008, and to the best of my
knowledge, no one was using it.
Previously, I wasn't able to launch the existing binary at all.

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

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

6 years ago[analyzer] Dump a reproducible, deterministic ID of program state to exploded graph
George Karpenkov [Thu, 6 Sep 2018 23:07:26 +0000 (23:07 +0000)]
[analyzer] Dump a reproducible, deterministic ID of program state to exploded graph

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

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

6 years agoRemove deprecated API
Stephen Kelly [Thu, 6 Sep 2018 18:26:30 +0000 (18:26 +0000)]
Remove deprecated API

Reviewers: teemperor!

Subscribers: cfe-commits

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

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