]> granicus.if.org Git - clang/log
clang
5 years agoAdd a release note for r372844
Hans Wennborg [Wed, 25 Sep 2019 11:53:17 +0000 (11:53 +0000)]
Add a release note for r372844

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

5 years agoRevert r370850 "Re-commit r363191 "[MS] Pretend constexpr variable template specializ...
Hans Wennborg [Wed, 25 Sep 2019 11:09:46 +0000 (11:09 +0000)]
Revert r370850 "Re-commit r363191 "[MS] Pretend constexpr variable template specializations are inline""

This work-around was necessary to handle standard library headers in
Visual Studio 2019 16.2. Now that 16.3 has shipped to stable, we can
remove it.

> Re-commit r363191 "[MS] Pretend constexpr variable template specializations are inline"
>
> While the next Visual Studio update (16.3) will fix this issue, that hasn't
> shipped yet. Until then Clang wouldn't work with MSVC's headers which seems
> unfortunate. Let's keep this in until VS 16.3 ships. (See also PR42843.)
>
>> Fixes link errors with clang and the latest Visual C++ 14.21.27702
>> headers, which was reported as PR42027.
>>
>> I chose to intentionally make these things linkonce_odr, i.e.
>> discardable, so that we don't emit definitions of these things in every
>> translation unit that includes STL headers.
>>
>> Note that this is *not* what MSVC does: MSVC has not yet implemented C++
>> DR2387, so they emit fully specialized constexpr variable templates with
>> static / internal linkage.
>>
>> Reviewers: rsmith
>>
>> Differential Revision: https://reviews.llvm.org/D63175

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

5 years ago[OpenCL] Add image query builtin functions
Sven van Haastregt [Wed, 25 Sep 2019 09:12:59 +0000 (09:12 +0000)]
[OpenCL] Add image query builtin functions

Add the image query builtin functions from the OpenCL C specification.

Patch by Pierre Gondois and Sven van Haastregt.

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

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

5 years ago[Driver] Always use -z separate-loadable-segments with lld on Fuchsia
Fangrui Song [Wed, 25 Sep 2019 07:06:50 +0000 (07:06 +0000)]
[Driver] Always use -z separate-loadable-segments with lld on Fuchsia

The option was added to lld in D67481/372807.

Reviewed By: phosek

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

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

5 years ago [x86] Adding support for some missing intrinsics: _castf32_u32, _castf64_u64, _castu...
Pengfei Wang [Wed, 25 Sep 2019 02:24:05 +0000 (02:24 +0000)]
 [x86] Adding support for some missing intrinsics: _castf32_u32, _castf64_u64, _castu32_f32, _castu64_f64

Summary:
Adding support for some missing intrinsics:
_castf32_u32, _castf64_u64, _castu32_f32, _castu64_f64

Reviewers: craig.topper, LuoYuanke, RKSimon, pengfei

Reviewed By: RKSimon

Subscribers: llvm-commits

Patch by yubing (Bing Yu)

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

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

5 years ago[NFC] Strenghten preconditions for warning
David Bolvansky [Tue, 24 Sep 2019 20:10:57 +0000 (20:10 +0000)]
[NFC] Strenghten preconditions for warning

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

5 years ago[HIP] Support new kernel launching API
Yaxun Liu [Tue, 24 Sep 2019 19:16:40 +0000 (19:16 +0000)]
[HIP] Support new kernel launching API

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

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

5 years ago[clang-format] [PR36858] Add missing .hh and .cs extensions from python support utilities
Paul Hoad [Tue, 24 Sep 2019 14:00:06 +0000 (14:00 +0000)]
[clang-format] [PR36858] Add missing .hh and .cs extensions from python support utilities

Summary: https://bugs.llvm.org/show_bug.cgi?id=36858 identifies .hh as a missing C++ header extension file while making this change I realized there was no support for .cs files which were added recently

Reviewers: pseyfert, klimek, owenpan

Reviewed By: klimek

Subscribers: cfe-commits

Tags: #clang-tools-extra, #clang

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

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

5 years ago[Diagnostics] Handle tautological left shifts in boolean context
David Bolvansky [Tue, 24 Sep 2019 13:14:18 +0000 (13:14 +0000)]
[Diagnostics] Handle tautological left shifts in boolean context

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

5 years ago[NFC] Update test after r372708
David Bolvansky [Tue, 24 Sep 2019 09:24:48 +0000 (09:24 +0000)]
[NFC] Update test after r372708

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

5 years ago[Diagnostics] Do not diagnose unsigned shifts in boolean context (-Wint-in-bool-context)
David Bolvansky [Tue, 24 Sep 2019 09:14:33 +0000 (09:14 +0000)]
[Diagnostics] Do not diagnose unsigned shifts in boolean context (-Wint-in-bool-context)

I was looking at old GCC's patch. Current "trunk" version avoids warning for unsigned case, GCC warns only for signed shifts.

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

5 years ago[ASTImporter] 4th attempt to fix Windows buildbot test errors
Gabor Marton [Tue, 24 Sep 2019 09:00:46 +0000 (09:00 +0000)]
[ASTImporter] 4th attempt to fix Windows buildbot test errors

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

5 years ago[clang-format] NFC clang-format the clang-format unit tests
Paul Hoad [Tue, 24 Sep 2019 06:35:37 +0000 (06:35 +0000)]
[clang-format] NFC clang-format the clang-format unit tests

Summary:
It is annoying that the clang-format tests aren't themselves clang-formatted, if you use a format on save option in VS or vim this file gets massively changed then you have to `git difftool` all the other changes back out, which is risky.

I know people don't like mass clang-format changes but sometimes it becomes unmanageable to not. There are no other changes here other than just the reformat.

clang-format tests all pass.

```
[==========] 691 tests from 21 test cases ran. (55990 ms total)
[  PASSED  ] 691 tests.
```

Reviewers: klimek, owenpan, timwoj

Reviewed By: owenpan

Subscribers: cfe-commits

Tags: #clang-tools-extra, #clang

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

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

5 years ago[ASTImporter] 3rd attempt to fix Windows buildbot test errors
Gabor Marton [Tue, 24 Sep 2019 05:50:02 +0000 (05:50 +0000)]
[ASTImporter] 3rd attempt to fix Windows buildbot test errors

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

5 years agoRevert "[static analyzer] Define __clang_analyzer__ macro in driver"
Jan Korous [Tue, 24 Sep 2019 03:21:22 +0000 (03:21 +0000)]
Revert "[static analyzer] Define __clang_analyzer__ macro in driver"

This reverts commit fbd13570b0d5f92ef2cf6bcfe7cc2f6178500187.

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

5 years agoRevert "[static analyzer][test] Test directly that driver sets D__clang_analyzer__"
Jan Korous [Tue, 24 Sep 2019 03:19:20 +0000 (03:19 +0000)]
Revert "[static analyzer][test] Test directly that driver sets D__clang_analyzer__"

This reverts commit c7541903d72765a38808e9973572a8d50c9d94fb.

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

5 years ago[static analyzer][test] Test directly that driver sets D__clang_analyzer__
Jan Korous [Tue, 24 Sep 2019 02:06:59 +0000 (02:06 +0000)]
[static analyzer][test] Test directly that driver sets D__clang_analyzer__

Follow-up to fbd13570b0d

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

5 years agoSupport for DWARF-5 C++ language tags.
Adrian Prantl [Tue, 24 Sep 2019 00:38:49 +0000 (00:38 +0000)]
Support for DWARF-5 C++ language tags.

This patch provides support for DW_LANG_C_plus_plus_11,
DW_LANG_C_plus_plus_14 tags in the Clang C++ frontend.

Patch by Sourabh Singh Tomar!
Differential Revision: https://reviews.llvm.org/D67613

Reapplies r372663 after adapting a failing test in the LLDB testsuite.

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

5 years ago[static analyzer] Remove --analyze-auto
Jan Korous [Tue, 24 Sep 2019 00:37:25 +0000 (00:37 +0000)]
[static analyzer] Remove --analyze-auto

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

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

5 years ago[static analyzer] Define __clang_analyzer__ macro in driver
Jan Korous [Tue, 24 Sep 2019 00:33:47 +0000 (00:33 +0000)]
[static analyzer] Define __clang_analyzer__ macro in driver

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

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

5 years agoRevert "Support for DWARF-5 C++ language tags."
Jonas Devlieghere [Mon, 23 Sep 2019 23:49:36 +0000 (23:49 +0000)]
Revert "Support for DWARF-5 C++ language tags."

This reverts commit bf9c8ffb54943c6d77398adbedddf05ef9724007.

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

5 years ago[NFCI] Return PathSensitiveBugReport where appropriate
Alex Langford [Mon, 23 Sep 2019 22:24:47 +0000 (22:24 +0000)]
[NFCI] Return PathSensitiveBugReport where appropriate

Some compilers have trouble converting unique_ptr<PathSensitiveBugReport> to
unique_ptr<BugReport> causing some functions to fail to compile.
Changing the return type of the functions that fail to compile does not
appear to have any issues.
I ran into this issue building with clang 3.8 on Ubuntu 16.04.

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

5 years ago[Diagnostics] Warn for enum constants in bool context (-Wint-in-bool-context; GCC...
David Bolvansky [Mon, 23 Sep 2019 22:09:49 +0000 (22:09 +0000)]
[Diagnostics] Warn for enum constants in bool context (-Wint-in-bool-context; GCC compatibility)

Extracted from D63082.

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

5 years agoSupport for DWARF-5 C++ language tags.
Adrian Prantl [Mon, 23 Sep 2019 22:01:49 +0000 (22:01 +0000)]
Support for DWARF-5 C++ language tags.

This patch provides support for DW_LANG_C_plus_plus_11,
DW_LANG_C_plus_plus_14 tags in the Clang C++ frontend.

Patch by Sourabh Singh Tomar!
Differential Revision: https://reviews.llvm.org/D67613

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

5 years ago[ASTImporter] 2nd attempt to fix Windows buildbot test errors
Gabor Marton [Mon, 23 Sep 2019 19:49:45 +0000 (19:49 +0000)]
[ASTImporter] 2nd attempt to fix Windows buildbot test errors

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

5 years ago[Sema] Fix the atomic expr rebuilding order.
Michael Liao [Mon, 23 Sep 2019 18:48:06 +0000 (18:48 +0000)]
[Sema] Fix the atomic expr rebuilding order.

Summary:
- Rearrange the atomic expr order to the API order when rebuilding
  atomic expr during template instantiation.

Reviewers: erichkeane

Subscribers: jfb, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP]Use standard parsing for 'match' clause, NFC.
Alexey Bataev [Mon, 23 Sep 2019 18:13:31 +0000 (18:13 +0000)]
[OPENMP]Use standard parsing for 'match' clause, NFC.

Reused standard clauses parsing scheme for parsing/matching 'match'
clause in 'declare variant' directive.

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

5 years ago[ASTImporter] Attempt to fix Windows buildbot test errors
Gabor Marton [Mon, 23 Sep 2019 17:29:08 +0000 (17:29 +0000)]
[ASTImporter] Attempt to fix Windows buildbot test errors

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

5 years agoNFC: Fix a poorly-written test
Erik Pilkington [Mon, 23 Sep 2019 17:16:55 +0000 (17:16 +0000)]
NFC: Fix a poorly-written test

The author of r364954 foolishly forgot that == binds tighter than ?:

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

5 years ago Fix __is_fundamental to accept nullptr_t
Zoe Carver [Mon, 23 Sep 2019 16:02:46 +0000 (16:02 +0000)]
Fix __is_fundamental to accept nullptr_t

    Summary: This patch updates the __is_fundamental builtin type trait to return true for nullptr_t.

    Reviewers: rsmith, EricWF, efriedma, craig.topper, erichkeane

    Subscribers: cfe-commits

    Tags: #clang

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

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

5 years ago[OPENMP]Fix PR43355: DO not emit target calls if only -fopenmp-targets
Alexey Bataev [Mon, 23 Sep 2019 15:53:51 +0000 (15:53 +0000)]
[OPENMP]Fix PR43355: DO not emit target calls if only -fopenmp-targets
is not provided.

We should not emit any target-dependent code if only -fopenmp flag is
used and device targets are not provided to prevent compiler crash.

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

5 years ago Fix __is_signed builtin
Zoe Carver [Mon, 23 Sep 2019 15:41:20 +0000 (15:41 +0000)]
Fix __is_signed builtin

    Summary: This patch fixes the __is_signed builtin type trait to work with floating point types and enums. Now, the builtin will return true if it is passed a floating point type and false for an enum type.

    Reviewers: EricWF, rsmith, erichkeane, craig.topper, efriedma

    Subscribers: cfe-commits

    Tags: #clang

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

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

5 years ago[docs] Fix some typos in InternalsManual
Sven van Haastregt [Mon, 23 Sep 2019 14:24:29 +0000 (14:24 +0000)]
[docs] Fix some typos in InternalsManual

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

5 years ago[Diagnostics] Warn if '<<' in bool context with -Wint-in-bool-context (GCC compatibility)
David Bolvansky [Mon, 23 Sep 2019 14:21:08 +0000 (14:21 +0000)]
[Diagnostics] Warn if '<<' in bool context with -Wint-in-bool-context (GCC compatibility)

Extracted from D63082, addressed review comments related to a warning message.

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

5 years agoFix test atomic-expr.cpp after R372422
Erich Keane [Mon, 23 Sep 2019 14:12:13 +0000 (14:12 +0000)]
Fix test atomic-expr.cpp after R372422

The test tried to match a path in a printout by doing '^:' which failed
on windows, since C:\... is a path.

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

5 years ago[OPENMP]Call __kmpc_push_tripcount in task context.
Alexey Bataev [Mon, 23 Sep 2019 14:06:51 +0000 (14:06 +0000)]
[OPENMP]Call __kmpc_push_tripcount in task context.

Runtime function __kmpc_push_tripcount better to call inside of the task
context for target regions. Otherwise, the libomptarget is unable to
link the provided tripcount value for nowait target regions and
completely looses this information.

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

5 years ago[libTooling] Add `access` and `ifBound` combinators to Stencil library.
Yitzhak Mandelbaum [Mon, 23 Sep 2019 13:21:42 +0000 (13:21 +0000)]
[libTooling] Add `access` and `ifBound` combinators to Stencil library.

Summary:
This revision add the `access` and `ifBound` combinators to the Stencil library:
* `access` -- constructs an idiomatic expression for accessing a member (a
  `MemberExpr`).
* `ifBound` -- chooses between two `StencilParts` based on the whether an id is
  bound in the match (corresponds to the combinator of the same name in
  RangeSelector).

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[Diagnostics] Avoid -Wsizeof-array-div when dividing the size of a nested array by...
David Bolvansky [Mon, 23 Sep 2019 12:54:35 +0000 (12:54 +0000)]
[Diagnostics] Avoid -Wsizeof-array-div when dividing the size of a nested array by the size of the deepest base type

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

5 years ago[libTooling] Introduce new library of source-code builders.
Yitzhak Mandelbaum [Mon, 23 Sep 2019 12:40:10 +0000 (12:40 +0000)]
[libTooling] Introduce new library of source-code builders.

Summary:
Introduces facilities for easily building source-code strings, including
idiomatic use of parentheses and the address-of, dereference and member-access
operators (dot and arrow) and queries about need for parentheses.

Reviewers: gribozavr

Subscribers: mgorny, cfe-commits, ilya-biryukov

Tags: #clang

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

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

5 years agoRemoved dead code from Stencil.h
Dmitri Gribenko [Mon, 23 Sep 2019 12:15:48 +0000 (12:15 +0000)]
Removed dead code from Stencil.h

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

5 years ago[NFC] Fixed clang wasm test after rL372573
David Bolvansky [Mon, 23 Sep 2019 10:14:07 +0000 (10:14 +0000)]
[NFC] Fixed clang wasm test after rL372573

These tests should not depend on -O1..

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

5 years ago[ASTImporter][NFC] Add comprehensive tests for ODR violation handling strategies
Gabor Marton [Mon, 23 Sep 2019 09:32:07 +0000 (09:32 +0000)]
[ASTImporter][NFC] Add comprehensive tests for ODR violation handling strategies

Summary:
In this patch we provide additional and comprehensive tests for the ODR
handling strategies. This is the continuation of
https://reviews.llvm.org/D59692.

Reviewers: shafik, a_sidorin, balazske, a.sidorin

Subscribers: mgorny, rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

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

5 years ago[Alignment] fix build
Guillaume Chatelet [Mon, 23 Sep 2019 09:04:12 +0000 (09:04 +0000)]
[Alignment] fix build

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

5 years agoFor P0784R7: add further testing of requirements on constexpr
Richard Smith [Mon, 23 Sep 2019 05:08:55 +0000 (05:08 +0000)]
For P0784R7: add further testing of requirements on constexpr
destructors.

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

5 years agoFor P0784R7: add support for constexpr destructors, and call them as
Richard Smith [Mon, 23 Sep 2019 03:48:44 +0000 (03:48 +0000)]
For P0784R7: add support for constexpr destructors, and call them as
appropriate during constant evaluation.

Note that the evaluator is sometimes invoked on incomplete expressions.
In such cases, if an object is constructed but we never reach the point
where it would be destroyed (and it has non-trivial destruction), we
treat the expression as having an unmodeled side-effect.

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

5 years ago[X86] Require last argument to LWPINS/LWPVAL builtins to be an ICE. Add ImmArg to...
Craig Topper [Sun, 22 Sep 2019 23:48:50 +0000 (23:48 +0000)]
[X86] Require last argument to LWPINS/LWPVAL builtins to be an ICE. Add ImmArg to the llvm intrinsics.

Update the isel patterns to use timm instead of imm.

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

5 years ago[NFC] Fixed failed test
David Bolvansky [Sun, 22 Sep 2019 22:15:11 +0000 (22:15 +0000)]
[NFC] Fixed failed test

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

5 years ago[Diagnostics] Warn if ?: with integer constants always evaluates to true
David Bolvansky [Sun, 22 Sep 2019 22:00:48 +0000 (22:00 +0000)]
[Diagnostics] Warn if ?: with integer constants always evaluates to true

Extracted from D63082. GCC has this warning under -Wint-in-bool-context, but as noted in the D63082's review, we should put it under TautologicalConstantCompare.

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

5 years ago[clang] fixing conditional explicit for out-of-line definition PR42980
Gauthier Harnisch [Sun, 22 Sep 2019 21:59:10 +0000 (21:59 +0000)]
[clang] fixing conditional explicit for out-of-line definition PR42980

Summary: not every read in CXXConstructorDecl::getExplicitSpecifierInternal() was made on the canonical declaration.

Reviewers: rsmith, aaron.ballman

Reviewed By: rsmith

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[clang] [Basic] Enable __has_feature(leak_sanitizer)
Michal Gorny [Sun, 22 Sep 2019 20:55:01 +0000 (20:55 +0000)]
[clang] [Basic] Enable __has_feature(leak_sanitizer)

Add a 'leak_sanitizer' feature akin to existing '*_sanitizer' features
to let programmers switch code paths accounting for leak sanitizers
being enabled.

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

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

5 years ago[CLANG][BPF] permit any argument type for __builtin_preserve_access_index()
Yonghong Song [Sun, 22 Sep 2019 17:33:48 +0000 (17:33 +0000)]
[CLANG][BPF] permit any argument type for __builtin_preserve_access_index()

Commit c15aa241f821 ("[CLANG][BPF] change __builtin_preserve_access_index()
signature") changed the builtin function signature to
  PointerT __builtin_preserve_access_index(PointerT ptr)
with a pointer type as the argument/return type, where argument and
return types must be the same.

There is really no reason for this constraint. The builtin just
presented a code region so that IR builtins
  __builtin_{array, struct, union}_preserve_access_index
can be applied.

This patch removed the pointer type restriction to permit any
argument type as long as it is permitted by the compiler.

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

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

5 years agoClang-format: Add Whitesmiths indentation style
Paul Hoad [Sun, 22 Sep 2019 12:00:34 +0000 (12:00 +0000)]
Clang-format: Add Whitesmiths indentation style

Summary:
This patch adds support for the Whitesmiths indentation style to clang-format. It’s an update to a patch submitted in 2015 (D6833), but reworks it to use the newer API.

There are still some issues with this patch, primarily around `switch` and `case` support. The added unit test won’t currently pass because of the remaining issues.

Reviewers: mboehme, MyDeveloperDay, djasper

Reviewed By: MyDeveloperDay

Subscribers: krasimir, MyDeveloperDay, echristo, cfe-commits

Patch By: @timwoj (Tim Wojtulewicz)

Tags: #clang

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

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

5 years agoMove classes into anonymous namespaces. NFC.
Benjamin Kramer [Sun, 22 Sep 2019 09:28:47 +0000 (09:28 +0000)]
Move classes into anonymous namespaces. NFC.

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

5 years agoNFC: Change ObjCQualified*TypesAreCompatible to take
James Y Knight [Sat, 21 Sep 2019 22:31:28 +0000 (22:31 +0000)]
NFC: Change ObjCQualified*TypesAreCompatible to take
ObjCObjectPointerType arguments.

All callers already had one, just creating a QualType to pass, after
which the function cast it right back.

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

5 years agoAttempt to fix a windows buildbot failure
Kristof Umann [Sat, 21 Sep 2019 07:56:40 +0000 (07:56 +0000)]
Attempt to fix a windows buildbot failure

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

5 years ago[Clang Interpreter] Fixed Bug 43362, build failure on GCC
Nandor Licker [Sat, 21 Sep 2019 05:29:18 +0000 (05:29 +0000)]
[Clang Interpreter] Fixed Bug 43362, build failure on GCC

free() was not directly included in InterpStack.cpp, added include now.

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

5 years agoFix bad APInt compare.
Richard Trieu [Sat, 21 Sep 2019 04:18:54 +0000 (04:18 +0000)]
Fix bad APInt compare.

APInt comparison require both to have the same bitwidth.  Since only the value
is needed, use the compare function APInt::isSameValue instead.

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

5 years agoMerge and improve code that detects same value in comparisons.
Richard Trieu [Sat, 21 Sep 2019 03:02:26 +0000 (03:02 +0000)]
Merge and improve code that detects same value in comparisons.

-Wtautological-overlap-compare and self-comparison from -Wtautological-compare
relay on detecting the same operand in different locations.  Previously, each
warning had it's own operand checker.  Now, both are merged together into
one function that each can call.  The function also now looks through member
access and array accesses.

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

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

5 years agoRevert assertion added by r372394
Yaxun Liu [Sat, 21 Sep 2019 02:51:44 +0000 (02:51 +0000)]
Revert assertion added by r372394

The assertion added by r372394 causes CUDA test in test-suite to assert.

The assertion was not there originally, so revert it.

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

5 years agoImprove -Wtautological-overlap-compare
Richard Trieu [Sat, 21 Sep 2019 02:37:10 +0000 (02:37 +0000)]
Improve -Wtautological-overlap-compare

Allow this warning to detect a larger number of constant values, including
negative numbers, and handle non-int types better.

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

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

5 years ago[clang-scan-deps] strip the --serialize-diagnostics argument
Alex Lorenz [Sat, 21 Sep 2019 00:17:26 +0000 (00:17 +0000)]
[clang-scan-deps] strip the --serialize-diagnostics argument

This ensures that clang-scan-deps won't write out diagnostics when
scanning dependencies.

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

5 years agoRemove outdated FIXME.
Richard Smith [Fri, 20 Sep 2019 23:12:51 +0000 (23:12 +0000)]
Remove outdated FIXME.

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

5 years agoFix assertion failure when constant evaluation of a switch jumps over an
Richard Smith [Fri, 20 Sep 2019 23:08:59 +0000 (23:08 +0000)]
Fix assertion failure when constant evaluation of a switch jumps over an
uninitialized variable in an init-statement of a 'for' or 'if'.

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

5 years ago[SystemZ] Support z15 processor name
Ulrich Weigand [Fri, 20 Sep 2019 23:06:03 +0000 (23:06 +0000)]
[SystemZ] Support z15 processor name

The recently announced IBM z15 processor implements the architecture
already supported as "arch13" in LLVM.  This patch adds support for
"z15" as an alternate architecture name for arch13.

Corrsponding LLVM support was committed as rev. 372435.

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

5 years agoEnsure AtomicExpr goes through SEMA checking after TreeTransform
Erich Keane [Fri, 20 Sep 2019 19:17:31 +0000 (19:17 +0000)]
Ensure AtomicExpr goes through SEMA checking after TreeTransform

RebuildAtomicExpr was skipping doing semantic analysis which broke in
the cases where the expressions were not dependent. This resulted in the
ImplicitCastExpr from an array to a pointer being lost, causing a crash
in IR CodeGen.

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

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

5 years agoFix a documentation error
Kristof Umann [Fri, 20 Sep 2019 18:28:04 +0000 (18:28 +0000)]
Fix a documentation error

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

5 years ago[www] Turn 'Clang 9' boxes green in C++ status pages now Clang 9 is
Richard Smith [Fri, 20 Sep 2019 18:09:05 +0000 (18:09 +0000)]
[www] Turn 'Clang 9' boxes green in C++ status pages now Clang 9 is
released.

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

5 years agoReland '[analyzer][MallocChecker][NFC] Document and reorganize some functions'
Kristof Umann [Fri, 20 Sep 2019 17:59:20 +0000 (17:59 +0000)]
Reland '[analyzer][MallocChecker][NFC] Document and reorganize some functions'

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

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

5 years ago[libTooling] Add `ifBound`, `elseBranch` RangeSelector combinators.
Yitzhak Mandelbaum [Fri, 20 Sep 2019 17:11:03 +0000 (17:11 +0000)]
[libTooling] Add `ifBound`, `elseBranch` RangeSelector combinators.

Summary:
Adds two new combinators and corresponding tests to the RangeSelector library.
* `ifBound` -- conditional evaluation of range-selectors, based on whether a
   given node id is bound in the match.
* `elseBranch` -- selects the source range of the else and its statement.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[CUDA][HIP] Fix hostness of defaulted constructor
Yaxun Liu [Fri, 20 Sep 2019 14:28:09 +0000 (14:28 +0000)]
[CUDA][HIP] Fix hostness of defaulted constructor
Clang does not respect the explicit device host attributes of defaulted special members.
Also clang does not respect the hostness of special members determined by their
first declarations.
Clang also adds duplicate implicit device or host attributes in certain cases.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D67509

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

5 years ago[SystemZ] Add SystemZ as supporting target in help text for -mfentry.
Jonas Paulsson [Fri, 20 Sep 2019 13:13:50 +0000 (13:13 +0000)]
[SystemZ]  Add SystemZ as supporting target in help text for -mfentry.

=> "Insert calls to fentry at function entry (x86/SystemZ only)"

Review: Ulrich Weigand

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

5 years ago[StaticAnalyzer] Use llvm::StringLiteral instead of StringRef in few places
Benjamin Kramer [Fri, 20 Sep 2019 12:59:29 +0000 (12:59 +0000)]
[StaticAnalyzer] Use llvm::StringLiteral instead of StringRef in few places

StringRef's constexpr constructor seems to be extremely slow in MSVC
2017, so don't use it for generated tables. Should make PR43369 a bit
better, no functionality change.

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

5 years agoFinish building the full-expression for a static_assert expression
Richard Smith [Fri, 20 Sep 2019 03:29:19 +0000 (03:29 +0000)]
Finish building the full-expression for a static_assert expression
before evaluating it rather than afterwards.

This is groundwork for C++20's P0784R7, where non-trivial destructors
can be constexpr, so we need ExprWithCleanups markers in constant
expressions.

No significant functionality change intended (though this fixes a bug
only visible through libclang / -ast-dump / tooling: we now store the
converted condition on the StaticAssertDecl rather than the original).

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

5 years ago[NFCI] Always initialize const members of AttributeCommonInfo
Alex Langford [Fri, 20 Sep 2019 00:16:32 +0000 (00:16 +0000)]
[NFCI] Always initialize const members of AttributeCommonInfo

Some compilers require that const fields of an object must be explicitly
initialized by the constructor. I ran into this issue building with
clang 3.8 on Ubuntu 16.04.

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

5 years ago[Consumed] Treat by-value class arguments as consuming by default, like rvalue refs.
Nicholas Allegra [Thu, 19 Sep 2019 23:00:31 +0000 (23:00 +0000)]
[Consumed] Treat by-value class arguments as consuming by default, like rvalue refs.

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

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

5 years agoFix for stringized function-macro args continued across lines
Alex Lorenz [Thu, 19 Sep 2019 22:39:24 +0000 (22:39 +0000)]
Fix for stringized function-macro args continued across lines

In case of certain #define'd macros, there's a space just before line continuation
that the minimized-source lexer was missing to include, resulting in invalid stringize.

Patch by: kousikk (Kousik Kumar)

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

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

5 years agoModel converted constant expressions as full-expressions.
Richard Smith [Thu, 19 Sep 2019 22:00:16 +0000 (22:00 +0000)]
Model converted constant expressions as full-expressions.

This is groundwork for C++20's P0784R7, where non-trivial destructors
can be constexpr, so we need ExprWithCleanups markers in constant
expressions.

No functionality change intended.

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

5 years ago[CUDA][HIP] Re-apply part of r372318.
Michael Liao [Thu, 19 Sep 2019 21:26:18 +0000 (21:26 +0000)]
[CUDA][HIP] Re-apply part of r372318.

- r372318 causes violation of `use-of-uninitialized-value` detected by
  MemorySanitizer. Once `Viable` field is set to false, `FailureKind`
  needs setting as well as it will be checked during destruction if
  `Viable` is not true.
- Revert the part trying to skip `std::vector` erasing.

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

5 years agoRevert "[CUDA][HIP] Fix typo in `BestViableFunction`"
Mitch Phillips [Thu, 19 Sep 2019 21:11:28 +0000 (21:11 +0000)]
Revert "[CUDA][HIP] Fix typo in `BestViableFunction`"

Broke the msan buildbots (see comments on rL372318 for more details).

This reverts commit eb231d15825ac345b546f4c99372d1cac8f14f02.

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

5 years agoRevert r372325 - Reverting r372323 because it broke color tests on Linux.
Aaron Ballman [Thu, 19 Sep 2019 15:10:51 +0000 (15:10 +0000)]
Revert r372325 - Reverting r372323 because it broke color tests on Linux.

This corrects the testing issues.

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

5 years agoReverting r372323 because it broke color tests on Linux.
Aaron Ballman [Thu, 19 Sep 2019 13:59:53 +0000 (13:59 +0000)]
Reverting r372323 because it broke color tests on Linux.

http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/17919

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

5 years agoRemove an unsafe member variable that wasn't needed; NFC.
Aaron Ballman [Thu, 19 Sep 2019 13:51:50 +0000 (13:51 +0000)]
Remove an unsafe member variable that wasn't needed; NFC.

People use the AST dumping interface while debugging, so it's not safe to assume that a declaration will be dumped before a constant expression is dumped. This means the Context member may not get set properly and problems would happen. Rather than rely on the interface that requires the ASTContext, call the generic dump() interface instead; this allows us to remove the Context member variable.

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

5 years ago[OpenCL] Add version handling and add vector ld/st builtins
Sven van Haastregt [Thu, 19 Sep 2019 13:41:51 +0000 (13:41 +0000)]
[OpenCL] Add version handling and add vector ld/st builtins

Allow setting a MinVersion, stating from which OpenCL version a
builtin function is available, and a MaxVersion, stating from which
OpenCL version a builtin function should not be available anymore.

Guard some definitions of the "work-item" builtin functions according
to the OpenCL versions from which they are available.

Add the "vector data load and store" builtin functions (e.g.
vload/vstore), whose signatures differ before and after OpenCL 2.0 in
the pointer argument address spaces.

Patch by Pierre Gondois and Sven van Haastregt.

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

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

5 years agoClean out unused diagnostics. NFC.
Benjamin Kramer [Thu, 19 Sep 2019 13:35:27 +0000 (13:35 +0000)]
Clean out unused diagnostics. NFC.

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

5 years ago[CUDA][HIP] Fix typo in `BestViableFunction`
Michael Liao [Thu, 19 Sep 2019 13:14:03 +0000 (13:14 +0000)]
[CUDA][HIP] Fix typo in `BestViableFunction`

Summary:
- Should consider viable ones only when checking SameSide candidates.
- Replace erasing with clearing viable flag to reduce data
  moving/copying.
- Add one and revise another one as the diagnostic message are more
  relevant compared to previous one.

Reviewers: tra

Subscribers: cfe-commits, yaxunl

Tags: #clang

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

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

5 years ago[TestCommit] Trivial change to test commit access.
Mark Murray [Thu, 19 Sep 2019 09:24:42 +0000 (09:24 +0000)]
[TestCommit] Trivial change to test commit access.

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

5 years ago[TestCommit] Trivial change to test commit access.
Mark Murray [Thu, 19 Sep 2019 09:02:12 +0000 (09:02 +0000)]
[TestCommit] Trivial change to test commit access.

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

5 years ago[Builtins] Delete setjmp_syscall and qsetjmp
Fangrui Song [Thu, 19 Sep 2019 04:41:38 +0000 (04:41 +0000)]
[Builtins] Delete setjmp_syscall and qsetjmp

Similar to the resolution of gcc PR71876.
Nobody uses them or needs the [-Wincomplete-setjmp-declaration]
diagnostic.

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

5 years ago[CLANG][BPF] change __builtin_preserve_access_index() signature
Yonghong Song [Thu, 19 Sep 2019 02:59:43 +0000 (02:59 +0000)]
[CLANG][BPF] change __builtin_preserve_access_index() signature

The clang intrinsic __builtin_preserve_access_index() currently
has signature:
  const void * __builtin_preserve_access_index(const void * ptr)

This may cause compiler warning when:
  - parameter type is "volatile void *" or "const volatile void *", or
  - the assign-to type of the intrinsic does not have "const" qualifier.
Further, this signature does not allow dereference of the
builtin result pointer as it is a "const void *" type, which
adds extra step for the user to do type casting.

Let us change the signature to:
  PointerT __builtin_preserve_access_index(PointerT ptr)
such that the result and argument types are the same.
With this, directly dereferencing the builtin return value
becomes possible.

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

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

5 years agoInitialize all fields in ABIArgInfo.
Serge Guelton [Thu, 19 Sep 2019 00:54:40 +0000 (00:54 +0000)]
Initialize all fields in ABIArgInfo.

Due to usage of an uninitialized fields, we end up with
a Conditional jump or move depends on uninitialised value

Fixes https://bugs.llvm.org/show_bug.cgi?id=40547

Commited on behalf of Martin Liska <mliska@suse.cz>

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

5 years ago[analyzer] PR43102: Fix an assertion and an out-of-bounds error for diagnostic locati...
Kristof Umann [Wed, 18 Sep 2019 22:24:26 +0000 (22:24 +0000)]
[analyzer] PR43102: Fix an assertion and an out-of-bounds error for diagnostic location construction

Summary:
https://bugs.llvm.org/show_bug.cgi?id=43102

In today's edition of "Is this any better now that it isn't crashing?", I'd like to show you a very interesting test case with loop widening.

Looking at the included test case, it's immediately obvious that this is not only a false positive, but also a very bad bug report in general. We can see how the analyzer mistakenly invalidated `b`, instead of its pointee, resulting in it reporting a null pointer dereference error. Not only that, the point at which this change of value is noted at is at the loop, rather then at the method call.

It turns out that `FindLastStoreVisitor` works correctly, rather the supplied explodedgraph is faulty, because `BlockEdge` really is the `ProgramPoint` where this happens.
{F9855739}
So it's fair to say that this needs improving on multiple fronts. In any case, at least the crash is gone.

Full ExplodedGraph: {F9855743}

Reviewers: NoQ, xazax.hun, baloghadamsoftware, Charusso, dcoughlin, rnkovacs, TWeaver

Subscribers: JesperAntonsson, uabelho, Ka-Ka, bjope, whisperity, szepet, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, cfe-commits

Tags: #clang

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

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

5 years agofix build, adjust test also for Windows path separator
Lubos Lunak [Wed, 18 Sep 2019 21:41:45 +0000 (21:41 +0000)]
fix build, adjust test also for Windows path separator

Introduced in 1e9c1d2b7bfc.

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

5 years agoOn PowerPC, Secure-PLT by default for FreeBSD 13 and higher
Dimitry Andric [Wed, 18 Sep 2019 20:58:03 +0000 (20:58 +0000)]
On PowerPC, Secure-PLT by default for FreeBSD 13 and higher

Summary:
In https://svnweb.freebsd.org/changeset/base/349351, FreeBSD 13 and
higher transitioned to Secure-PLT for PowerPC.  This part contains the
changes in clang's PPC architecture defaults.

Reviewers: emaste, jhibbits, hfinkel

Reviewed By: jhibbits

Subscribers: wuzish, nemanjai, krytarowski, kbarton, MaskRay, jsji, shchenz, steven.zhang, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP]Fix for PR43349: Crash for privatized loop bound.
Alexey Bataev [Wed, 18 Sep 2019 19:24:07 +0000 (19:24 +0000)]
[OPENMP]Fix for PR43349: Crash for privatized loop bound.

If the variable, used in the loop boundaries, is not captured in the
construct, this variable must be considered as undefined if it was
privatized.

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

5 years agoactually also compile output in tests for -frewrite-includes
Lubos Lunak [Wed, 18 Sep 2019 19:12:14 +0000 (19:12 +0000)]
actually also compile output in tests for -frewrite-includes

Checking that the created output matches something is nice, but
this should also check whether the output makes sense.

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

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

5 years ago[clang-format][PR41899] PointerAlignment: Left leads to useless space in lambda intia...
Paul Hoad [Wed, 18 Sep 2019 19:11:40 +0000 (19:11 +0000)]
[clang-format][PR41899] PointerAlignment: Left leads to useless space in lambda intializer expression

Summary:
https://bugs.llvm.org/show_bug.cgi?id=41899

```auto lambda = [&a = a]() { a = 2; };```

is formatted as

```auto lambda = [& a = a]() { a = 2; };```

With an extra space if PointerAlignment is set to Left

> The space "& a" looks strange when there is no type in the lambda's intializer expression. This can be worked around with by setting "PointerAlignment: Right", but ideally "PointerAlignment: Left" would not add a space in this case.

Reviewers: klimek, owenpan, krasimir, timwoj

Reviewed By: klimek

Subscribers: cfe-commits

Tags: #clang-tools-extra, #clang

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

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

5 years agomake -frewrite-includes also rewrite conditions in #if/#elif
Lubos Lunak [Wed, 18 Sep 2019 19:09:41 +0000 (19:09 +0000)]
make -frewrite-includes also rewrite conditions in #if/#elif

Those conditions may use __has_include, which needs to be rewritten.
The existing code has already tried to rewrite just __has_include,
but it didn't work with macro expansion, so e.g. Qt's
"#define QT_HAS_INCLUDE(x) __has_include(x)" didn't get handled
properly. Since the preprocessor run knows what each condition evaluates
to, just rewrite the entire condition. This of course requires that
the -frewrite-include pass has the same setup as the following
compilation, but that has always been the requirement.

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

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

5 years ago[Sema] Suppress -Wformat diagnostics for bool types when printed using %hhd
Erik Pilkington [Wed, 18 Sep 2019 19:05:14 +0000 (19:05 +0000)]
[Sema] Suppress -Wformat diagnostics for bool types when printed using %hhd

Also, add a diagnostic under -Wformat for printing a boolean value as a
character.

rdar://54579473

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

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

5 years ago[clang-format][PR41964] Fix crash with SIGFPE when TabWidth is set to 0 and line...
Paul Hoad [Wed, 18 Sep 2019 18:57:09 +0000 (18:57 +0000)]
[clang-format][PR41964] Fix crash with SIGFPE when TabWidth is set to 0 and line starts with tab

Summary:
clang-format 8.0 crashes with SIGFPE (floating point exception) when formatting following file:
app.cpp:
void a() {
//line starts with '\t'
}

$ clang-format -style='{TabWidth: 0}' app.cpp

Reviewers: owenpan, klimek, russellmcc, timwoj

Reviewed By: klimek

Subscribers: cfe-commits

Tags: #clang-tools-extra, #clang

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

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

5 years ago[c++20] P1331R2: Allow transient use of uninitialized objects in
Richard Smith [Wed, 18 Sep 2019 17:37:44 +0000 (17:37 +0000)]
[c++20] P1331R2: Allow transient use of uninitialized objects in
constant evaluation.

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