]> granicus.if.org Git - clang/log
clang
6 years ago[ASTMatchers] Introduce a matcher for `ObjCIvarExpr`, support getting it's declaration.
George Karpenkov [Fri, 27 Jul 2018 17:26:11 +0000 (17:26 +0000)]
[ASTMatchers] Introduce a matcher for `ObjCIvarExpr`, support getting it's declaration.

ObjCIvarExpr is *not* a subclass of MemberExpr, and a separate matcher
is required to support it.
Adding a hasDeclaration support as well, as it's not very useful without
it.

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

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

6 years agoAdd missing temporary materialization conversion on left-hand side of .
Richard Smith [Fri, 27 Jul 2018 17:13:18 +0000 (17:13 +0000)]
Add missing temporary materialization conversion on left-hand side of .
in some member function calls.

Specifically, when calling a conversion function, we would fail to
create the AST node representing materialization of the class object.

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

6 years ago[AST] Sink 'part of explicit cast' down into ImplicitCastExpr
Roman Lebedev [Fri, 27 Jul 2018 07:27:14 +0000 (07:27 +0000)]
[AST] Sink 'part of explicit cast' down into ImplicitCastExpr

Summary:
As discussed in IRC with @rsmith, it is slightly not good to keep that in the `CastExpr` itself:
Given the explicit cast, which is represented in AST as an `ExplicitCastExpr` + `ImplicitCastExpr`'s,
only the  `ImplicitCastExpr`'s will be marked as `PartOfExplicitCast`, but not the `ExplicitCastExpr` itself.
Thus, it is only ever `true` for `ImplicitCastExpr`'s, so we don't need to write/read/dump it for `ExplicitCastExpr`'s.

We don't need to worry that we write the `PartOfExplicitCast` in PCH after `CastExpr::path_iterator`,
since the `ExprImplicitCastAbbrev` is only used when the `NumBaseSpecs == 0`, i.e. there is no 'path'.

Reviewers: rsmith, rjmccall, erichkeane, aaron.ballman

Reviewed By: rsmith, erichkeane

Subscribers: vsk, cfe-commits, rsmith

Tags: #clang

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

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

6 years ago[WWW] Fixing file permissions for the .html pages.
Mike Edwards [Fri, 27 Jul 2018 04:41:37 +0000 (04:41 +0000)]
[WWW] Fixing file permissions for the .html pages.

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

6 years agoadded shared library to fix buildbot
Emmett Neyman [Fri, 27 Jul 2018 00:43:26 +0000 (00:43 +0000)]
added shared library to fix buildbot

Summary: added shared library to fix buildbot

Subscribers: mgorny, cfe-commits

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

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

6 years ago[Sema] Fix a crash by completing a type before using it
Erik Pilkington [Thu, 26 Jul 2018 23:40:42 +0000 (23:40 +0000)]
[Sema] Fix a crash by completing a type before using it

Only apply this exception on a type that we're able to check.

rdar://41903969

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

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

6 years ago[WWW] Removing my test file as the auto-deployment script has been fixed.
Mike Edwards [Thu, 26 Jul 2018 23:29:54 +0000 (23:29 +0000)]
[WWW] Removing my test file as the auto-deployment script has been fixed.

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

6 years ago[WWW] Adding a test page to work out an auto-deployment issue.
Mike Edwards [Thu, 26 Jul 2018 23:23:40 +0000 (23:23 +0000)]
[WWW] Adding a test page to work out an auto-deployment issue.

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

6 years agoRevert r338057 "[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with...
Reid Kleckner [Thu, 26 Jul 2018 23:21:51 +0000 (23:21 +0000)]
Revert r338057 "[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name"

This broke clang/test/PCH/case-insensitive-include.c on Windows.

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

6 years ago[MS] Add L__FUNCSIG__ for compatibility
Reid Kleckner [Thu, 26 Jul 2018 23:18:44 +0000 (23:18 +0000)]
[MS] Add L__FUNCSIG__ for compatibility

Clang already has L__FUNCTION__ as a workaround for dealing with
pre-processor code that expects to be able to do L##__FUNCTION__ in a
macro. This patch implements the same logic for __FUNCSIG__.

Fixes PR38295.

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

6 years agoUpdated llvm-proto-fuzzer to execute the compiled code
Emmett Neyman [Thu, 26 Jul 2018 22:23:25 +0000 (22:23 +0000)]
Updated llvm-proto-fuzzer to execute the compiled code

Summary:
Made changes to the llvm-proto-fuzzer
- Added loop vectorizer optimization pass in order to have two IR versions
- Updated old fuzz target to handle two different IR versions
- Wrote code to execute both versions in memory

Reviewers: morehouse, kcc, alexshap

Reviewed By: morehouse

Subscribers: pcc, mgorny, cfe-commits, llvm-commits

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

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

6 years ago[ARM64] [Windows] Follow MS X86_64 C++ ABI when passing structs
Sanjin Sijaric [Thu, 26 Jul 2018 22:18:28 +0000 (22:18 +0000)]
[ARM64] [Windows] Follow MS X86_64 C++ ABI when passing structs

Summary: Microsoft's C++ object model for ARM64 is the same as that for X86_64.
For example, small structs with non-trivial copy constructors or virtual
function tables are passed indirectly.  Currently, they are passed in registers
when compiled with clang.

Reviewers: rnk, mstorsjo, TomTan, haripul, javed.absar

Reviewed By: rnk, mstorsjo

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

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

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

6 years ago[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested...
Simon Marchi [Thu, 26 Jul 2018 18:55:02 +0000 (18:55 +0000)]
[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

Summary:

InMemoryFileSystem::status behaves differently than
RealFileSystem::status.  The Name contained in the Status returned by
RealFileSystem::status will be the path as requested by the caller,
whereas InMemoryFileSystem::status returns the normalized path.

For example, when requested the status for "../src/first.h",
RealFileSystem returns a Status with "../src/first.h" as the Name.
InMemoryFileSystem returns "/absolute/path/to/src/first.h".

The reason for this change is that I want to make a unit test in the
clangd testsuite (where we use an InMemoryFileSystem) to reproduce a
bug I get with the clangd program (where a RealFileSystem is used).
This difference in behavior "hides" the bug in the unit test version.

Reviewers: malaperle, ilya-biryukov, bkramer

Subscribers: cfe-commits, ioeric, ilya-biryukov, bkramer, hokein, omtcyfz

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

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

6 years agoRefactor checking of switch conditions and case values.
Richard Smith [Thu, 26 Jul 2018 18:41:30 +0000 (18:41 +0000)]
Refactor checking of switch conditions and case values.

Check each case value in turn while parsing it, performing the
conversion to the switch type within the context of the expression
itself. This will become necessary in order to properly handle cleanups
for temporaries created as part of the case label (in an upcoming
patch). For now it's just good hygiene.

This necessitates moving the checking for the switch condition itself to
earlier, so that the destination type is available when checking the
case labels.

As a nice side-effect, we get slightly improved diagnostic quality and
error recovery by separating the case expression checking from the case
statement checking and from tracking whether there are discarded case
labels.

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

6 years ago[OPENMP, DOCS] Fixed typo, NFC.
Alexey Bataev [Thu, 26 Jul 2018 18:40:41 +0000 (18:40 +0000)]
[OPENMP, DOCS] Fixed typo, NFC.

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

6 years ago[COFF, ARM64] Decide when to mark struct returns as SRet
Mandeep Singh Grang [Thu, 26 Jul 2018 18:07:59 +0000 (18:07 +0000)]
[COFF, ARM64] Decide when to mark struct returns as SRet

Summary:
Refer the MS ARM64 ABI Convention for the behavior for struct returns:
https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions#return-values

Reviewers: mstorsjo, compnerd, rnk, javed.absar, yinma, efriedma

Reviewed By: rnk, efriedma

Subscribers: haripul, TomTan, yinma, efriedma, kristof.beyls, chrib, llvm-commits

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

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

6 years ago[OPENMP] What's new for OpenMP in clang.
Alexey Bataev [Thu, 26 Jul 2018 17:53:45 +0000 (17:53 +0000)]
[OPENMP] What's new for OpenMP in clang.

Updated ReleaseNotes + Status of the OpenMP support in clang.

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

6 years ago[Sema][ObjC] Do not propagate the nullability specifier on the receiver
Akira Hatanaka [Thu, 26 Jul 2018 17:51:13 +0000 (17:51 +0000)]
[Sema][ObjC] Do not propagate the nullability specifier on the receiver
to the result type of a message send if the result type cannot have a
nullability specifier.

Previously, clang would print the following message when the code in
nullability.m was compiled:

"incompatible integer to pointer conversion initializing 'int *' with
an expression of type 'int _Nullable'"

This is wrong as 'int' isn't supposed to have any nullability
specifiers.

rdar://problem/40830514

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

6 years ago [RISCV] Add support for interrupt attribute
Ana Pazos [Thu, 26 Jul 2018 17:37:45 +0000 (17:37 +0000)]
 [RISCV] Add support for interrupt attribute

Summary:
Clang supports the GNU style ``__attribute__((interrupt))`` attribute  on RISCV targets.
Permissible values for this parameter are user, supervisor, and machine.
If there is no parameter, then it defaults to machine.
Reference: https://gcc.gnu.org/onlinedocs/gcc/RISC-V-Function-Attributes.html
Based on initial patch by Zhaoshi Zheng.

Reviewers: asb, aaron.ballman

Reviewed By: asb, aaron.ballman

Subscribers: rkruppe, the_o, aaron.ballman, MartinMosbeck, brucehoult, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, cfe-commits

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

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

6 years ago[CodeGen][ObjC] Make block copy/dispose helper functions exception-safe.
Akira Hatanaka [Thu, 26 Jul 2018 16:51:21 +0000 (16:51 +0000)]
[CodeGen][ObjC] Make block copy/dispose helper functions exception-safe.

When an exception is thrown in a block copy helper function, captured
objects that have previously been copied should be destructed or
released. Similarly, captured objects that are yet to be released should
be released when an exception is thrown in a dispose helper function.

rdar://problem/42410255

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

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

6 years ago[OPENMP] Force OpenMP 4.5 when compiling for offloading.
Alexey Bataev [Thu, 26 Jul 2018 15:17:38 +0000 (15:17 +0000)]
[OPENMP] Force OpenMP 4.5 when compiling for offloading.

If the user requested compilation for OpenMP with the offloading
support, force the version of the OpenMP standard to 4.5 by default.

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

6 years agoAllow thread safety annotation lock upgrading and downgrading.
Aaron Ballman [Thu, 26 Jul 2018 13:03:16 +0000 (13:03 +0000)]
Allow thread safety annotation lock upgrading and downgrading.

Patch thanks to Aaron Puchert!

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

6 years ago[ASTMatchers] fix the missing documentation for new decltypeType matcher
Jonas Toth [Thu, 26 Jul 2018 13:02:05 +0000 (13:02 +0000)]
[ASTMatchers] fix the missing documentation for new decltypeType matcher

Summary: Regenerate the Matchers documentation, forgotten in the original patch.

Reviewers: alexfh, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years ago[analyzer] Fixed method to get APSInt model
Mikhail R. Gadelha [Thu, 26 Jul 2018 11:17:13 +0000 (11:17 +0000)]
[analyzer] Fixed method to get APSInt model

Summary:
This patch replaces the current method of getting an `APSInt` from Z3's model by calling generic API method `getBitvector` instead of `Z3_get_numeral_uint64`.

By calling `getBitvector`, there's no need to handle bitvectors with bit width == 128 separately.

And, as a bonus, clang now compiles correctly with Z3 4.7.1.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[ODRHash] Support hashing enums.
Richard Trieu [Wed, 25 Jul 2018 22:52:05 +0000 (22:52 +0000)]
[ODRHash] Support hashing enums.

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

6 years ago[OPENMP] ThreadId in serialized parallel regions is 0.
Alexey Bataev [Wed, 25 Jul 2018 20:03:01 +0000 (20:03 +0000)]
[OPENMP] ThreadId in serialized parallel regions is 0.

The first argument for the parallel outlined functions, called as
serialized parallel regions, should be a pointer to the global thread id
that always is 0.

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

6 years ago[analyzer] Update SMT API documentation and methods
Mikhail R. Gadelha [Wed, 25 Jul 2018 19:34:48 +0000 (19:34 +0000)]
[analyzer] Update SMT API documentation and methods

Summary:
Update the documentation of all the classes introduced with the new generic SMT API, most of them were referencing Z3 and how previous operations were being done (like including the context as parameter in a few methods).

Renamed the following methods, so it's clear that the operate on bitvectors:
*`mkSignExt` -> `mkBVSignExt`
*`mkZeroExt` -> `mkBVZeroExt`
*`mkExtract` -> `mkBVExtract`
*`mkConcat` -> `mkBVConcat`

Removed the unecessary methods:
* `getDataExpr`: it was an one line method that called `fromData`
* `mkBitvector(const llvm::APSInt Int)`: it was not being used anywhere

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[Preprocessor] Stop entering included files after hitting a fatal error.
Volodymyr Sapsai [Wed, 25 Jul 2018 19:16:26 +0000 (19:16 +0000)]
[Preprocessor] Stop entering included files after hitting a fatal error.

Fixes a problem when we have multiple inclusion cycles and try to
enumerate all possible ways to reach the max inclusion depth.

rdar://problem/38871876

Reviewers: bruno, rsmith, jkorous, aaron.ballman

Reviewed By: bruno, jkorous, aaron.ballman

Subscribers: dexonsmith, cfe-commits

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

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

6 years ago[analyzer] Fix compilation when LLVM_ENABLE_MODULES=ON
Mikhail R. Gadelha [Wed, 25 Jul 2018 18:26:50 +0000 (18:26 +0000)]
[analyzer] Fix compilation when LLVM_ENABLE_MODULES=ON

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

6 years ago[clang:sema] de-duplicate getDepthAndIndex helpers
Nick Desaulniers [Wed, 25 Jul 2018 18:11:01 +0000 (18:11 +0000)]
[clang:sema] de-duplicate getDepthAndIndex helpers

Summary:
Continuing off of:
https://reviews.llvm.org/D38382

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

Reviewers: srhines, pirama, vsk

Reviewed By: vsk

Subscribers: cfe-commits, vsk, maitesin

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

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

6 years ago[OPENMP] Exclude service expressions/statements from the list of
Alexey Bataev [Wed, 25 Jul 2018 17:27:45 +0000 (17:27 +0000)]
[OPENMP] Exclude service expressions/statements from the list of
the children.

Special internal helper expressions/statements for the OpenMP directives
should not be exposed as children, only the main substatement must be
represented as the child.

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

6 years ago[OPENMP] Fix PR38256: Fix locations of the artificial conditional op.
Alexey Bataev [Wed, 25 Jul 2018 14:40:26 +0000 (14:40 +0000)]
[OPENMP] Fix PR38256: Fix locations of the artificial conditional op.

Fixed the source locations of the conditional op so that they don'r
crash coverage pass.

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

6 years agoFix tsan doc
David Carlier [Wed, 25 Jul 2018 14:27:14 +0000 (14:27 +0000)]
Fix tsan doc

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

6 years ago[Docs] Update supported oses for safestack, ubsan, asan, tsan and msan
David Carlier [Wed, 25 Jul 2018 13:55:06 +0000 (13:55 +0000)]
[Docs] Update supported oses for safestack, ubsan, asan, tsan and msan

Adding oses others than Linux.

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

6 years ago[analyzer] Use the macro REGISTER_TRAIT_WITH_PROGRAMSTATE in the Z3 backend
Mikhail R. Gadelha [Wed, 25 Jul 2018 12:49:47 +0000 (12:49 +0000)]
[analyzer] Use the macro REGISTER_TRAIT_WITH_PROGRAMSTATE in the Z3 backend

Summary:
The macro was manually expanded in the Z3 backend and this patch adds it back.

Adding the expanded code is dangerous as the macro may change in the future and the expanded code might be left outdated.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[analyzer] Removed API used by the Refutation Manager from SMTConstraintManager and...
Mikhail R. Gadelha [Wed, 25 Jul 2018 12:49:43 +0000 (12:49 +0000)]
[analyzer] Removed API used by the Refutation Manager from SMTConstraintManager and replace by proper calls to SMTSolver

Summary:
Third patch in the refactoring series, to decouple the SMT Solver from the Refutation Manager (1st: D49668, 2nd: D49767).

The refutation API in the `SMTConstraintManager` was a hack to allow us to create an SMT solver and verify the constraints; it was conceptually wrong from the start. Now, we don't actually need to use the `SMTConstraintManager` and can create an SMT object directly, add the constraints and check them.

While updating the Falsification visitor, I inlined the two functions that were used to collect the constraints and add them to the solver.

As a result of this patch, we could move the SMT API elsewhere and as it's not really dependent on the CSA anymore. Maybe we can create a new dir (utils/smt) for Z3 and future solvers?

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[analyzer] Moved code from SMTConstraintManager to SMTSolver
Mikhail R. Gadelha [Wed, 25 Jul 2018 12:49:37 +0000 (12:49 +0000)]
[analyzer] Moved code from SMTConstraintManager to SMTSolver

Summary:
This is the second part of D49668, and moves all the code that's not specific to a ConstraintManager to SMTSolver.

No functional change intended.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[analyzer] Try to minimize the number of equivalent bug reports evaluated by the...
Mikhail R. Gadelha [Wed, 25 Jul 2018 12:49:32 +0000 (12:49 +0000)]
[analyzer] Try to minimize the number of equivalent bug reports evaluated by the refutation manager

Summary:
This patch changes how the SMT bug refutation runs in an equivalent bug report class.

Now, all other visitor are executed until they find a valid bug or mark all bugs as invalid. When the one valid bug is found (and crosscheck is enabled), the SMT refutation checks the satisfiability of this single bug.

If the bug is still valid after checking with Z3, it is returned and a bug report is created. If the bug is found to be invalid, the next bug report in the equivalent class goes through the same process, until we find a valid bug or all bugs are marked as invalid.

Massive speedups when verifying redis/src/rax.c, from 1500s to 10s.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[analyzer] Moved non solver specific code from Z3ConstraintManager to SMTConstraintMa...
Mikhail R. Gadelha [Wed, 25 Jul 2018 12:49:29 +0000 (12:49 +0000)]
[analyzer] Moved non solver specific code from Z3ConstraintManager to SMTConstraintManager

Summary:
This patch moves a lot of code from `Z3ConstraintManager` to `SMTConstraintManager`, leaving only the necessary:
* `canReasonAbout` which returns if a Solver can handle a given `SVal` (should be moved to `SMTSolver` in the future).
* `removeDeadBindings`, `assumeExpr` and `print`: methods that need to use `ConstraintZ3Ty`, can probably be moved to `SMTConstraintManager` in the future.

The patch creates a new file, `SMTConstraintManager.cpp` with the moved code. Conceptually, this is move in the right direction and needs further improvements: `SMTConstraintManager` still does a lot of things that are not required by a `ConstraintManager`.

We ought to move the unrelated to `SMTSolver` and remove everything that's not related to a `ConstraintManager`. In particular, we could remove `addRangeConstraints` and `isModelFeasible`, and make the refutation manager create an Z3Solver directly.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

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

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

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

6 years ago[analyzer] Implemented SMT generic API
Mikhail R. Gadelha [Wed, 25 Jul 2018 12:49:23 +0000 (12:49 +0000)]
[analyzer] Implemented SMT generic API

Summary:
Created new SMT generic API.

Small changes to `Z3ConstraintManager` because of the new generic objects (`SMTSort` and `SMTExpr`) returned by `SMTSolver`.

Reviewers: george.karpenkov, NoQ

Reviewed By: george.karpenkov

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

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

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

6 years ago[analyzer] Create generic SMT Expr class
Mikhail R. Gadelha [Wed, 25 Jul 2018 12:49:19 +0000 (12:49 +0000)]
[analyzer] Create generic SMT Expr class

Summary:
New base class for all future SMT Exprs.

No major changes except moving `areEquivalent` and `getFloatSemantics` outside of `Z3Expr` to keep the class minimal.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[analyzer] Create generic SMT Sort Class
Mikhail R. Gadelha [Wed, 25 Jul 2018 12:49:15 +0000 (12:49 +0000)]
[analyzer] Create generic SMT Sort Class

Summary:
New base class for all future SMT sorts.

The only change is that the class implements methods `isBooleanSort()`, `isBitvectorSort()` and `isFloatSort()` so it doesn't rely on `Z3`'s enum.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[analyzer] Moved static Context to class member
Mikhail R. Gadelha [Wed, 25 Jul 2018 12:49:11 +0000 (12:49 +0000)]
[analyzer] Moved static Context to class member

Summary:
Although it is a big patch, the changes are simple:
1. There is one `Z3_Context` now, member of the `SMTConstraintManager` class.
2. `Z3Expr`, `Z3Sort`, `Z3Model` and `Z3Solver` are constructed with a reference to the `Z3_Context` in `SMTConstraintManager`.
3. All static functions are now members of `Z3Solver`, e.g, the `SMTConstraintManager` now calls `Solver.fromBoolean(false)` instead of `Z3Expr::fromBoolean(false)`.

Most of the patch only move stuff around except:
1. New method `Z3Sort MkSort(const QualType &Ty, unsigned BitWidth)`, that creates a sort based on the `QualType` and its width. Used to simplify the `fromData` method.

Unfortunate consequence of this patch:
1. `getInterpretation` was moved from `Z3Model` class to `Z3Solver`, because it needs to create a `Z3Sort` before returning the interpretation. This can be fixed by changing both `toAPFloat` and `toAPSInt` by removing the dependency of `Z3Sort` (it's only used to check which Sort was created and to retrieve the type width).

Reviewers: NoQ, george.karpenkov, ddcc

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[analyzer] Create generic SMT Context class
Mikhail R. Gadelha [Wed, 25 Jul 2018 12:49:07 +0000 (12:49 +0000)]
[analyzer] Create generic SMT Context class

Summary:
This patch creates `SMTContext` which will wrap a specific SMT context, through `SMTSolverContext`.

The templated `SMTSolverContext` class it's a simple wrapper around a SMT specific context (currently only used in the Z3 backend), while `Z3Context` inherits `SMTSolverContext<Z3_context>` and implements solver specific operations like initialization and destruction of the context.

This separation was done because:

1. We might want to keep one single context, shared across different `SMTConstraintManager`s. It can be achieved by constructing a `SMTContext`, through a function like `CreateSMTContext(Z3)`, `CreateSMTContext(BOOLECTOR)`, etc. The rest of the CSA only need to know about `SMTContext`, so maybe it's a good idea moving `SMTSolverContext` to a separate header in the future.

2. Any generic SMT operation will only require one `SMTSolverContext`object, which can access the specific context by calling `getContext()`.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[clang-format ]Extend IncludeCategories regex documentation
Krasimir Georgiev [Wed, 25 Jul 2018 10:21:47 +0000 (10:21 +0000)]
[clang-format ]Extend IncludeCategories regex documentation

Summary:
Extend the Clang-Format IncludeCategories documentation by adding a link to the supported regular expression standard (POSIX).
And extenting the example with a system header regex.
[[ https://bugs.llvm.org/show_bug.cgi?id=35041 | bug 35041]]

Contributed by WimLeflere!

Reviewers: krasimir, Typz

Reviewed By: krasimir

Subscribers: cfe-commits

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

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

6 years ago[ASTImporter] Add support for import of CXXInheritedCtorInitExpr.
Balazs Keri [Wed, 25 Jul 2018 10:21:06 +0000 (10:21 +0000)]
[ASTImporter] Add support for import of CXXInheritedCtorInitExpr.

Reviewers: a.sidorin, martong

Reviewed By: martong

Subscribers: rnkovacs, a_sidorin, martong, cfe-commits

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

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

6 years agocc1_main: fix -Wsign-compare on FreeBSD
Fangrui Song [Wed, 25 Jul 2018 06:57:31 +0000 (06:57 +0000)]
cc1_main: fix -Wsign-compare on FreeBSD

Its __rlim_t is intentionally signed (__int64_t) because of legacy code
that uses -1 for RLIM_INFINITY.

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

6 years agoCodeGen: use non-zero memset when possible for automatic variables
JF Bastien [Wed, 25 Jul 2018 04:29:03 +0000 (04:29 +0000)]
CodeGen: use non-zero memset when possible for automatic variables

Summary:
Right now automatic variables are either initialized with bzero followed by a few stores, or memcpy'd from a synthesized global. We end up encountering a fair amount of code where memcpy of non-zero byte patterns would be better than memcpy from a global because it touches less memory and generates a smaller binary. The optimizer could reason about this, but it's not really worth it when clang already knows.

This code could definitely be more clever but I'm not sure it's worth it. In particular we could track a histogram of bytes seen and figure out (as we do with bzero) if a memset could be followed by a handful of stores. Similarly, we could tune the heuristics for GlobalSize, but using the same as for bzero seems conservatively OK for now.

<rdar://problem/42563091>

Reviewers: dexonsmith

Subscribers: cfe-commits

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

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

6 years ago[profile] Support profiling runtime on Fuchsia
Petr Hosek [Wed, 25 Jul 2018 03:01:35 +0000 (03:01 +0000)]
[profile] Support profiling runtime on Fuchsia

This ports the profiling runtime on Fuchsia and enables the
instrumentation. Unlike on other platforms, Fuchsia doesn't use
files to dump the instrumentation data since on Fuchsia, filesystem
may not be accessible to the instrumented process. We instead use
the data sink to pass the profiling data to the system the same
sanitizer runtimes do.

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

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

6 years ago[CMake] Link static libunwind and libc++abi into libc++ in Fuchsia toolchain
Petr Hosek [Wed, 25 Jul 2018 01:44:22 +0000 (01:44 +0000)]
[CMake] Link static libunwind and libc++abi into libc++ in Fuchsia toolchain

When building libc++ for Fuchsia, we want to distribute shared libc++,
libc++abi and libunwind as separate libraries, but for static versions
we would like to link all of them into libc++ so -lc++ flag has the same
effect whether shared or static library is being used.

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

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

6 years ago[analyzer] Syntactic matcher for leaks associated with run loop and autoreleasepool
George Karpenkov [Wed, 25 Jul 2018 01:27:15 +0000 (01:27 +0000)]
[analyzer] Syntactic matcher for leaks associated with run loop and autoreleasepool

A checker for detecting leaks resulting from allocating temporary
autoreleasing objects before starting the main run loop.

Checks for two antipatterns:

1. ObjCMessageExpr followed by [[NARunLoop mainRunLoop] run] in the same
autorelease pool.

2. ObjCMessageExpr followed by [[NARunLoop mainRunLoop] run] in no
autorelease pool.

Happens-before relationship is modeled purely syntactically.

rdar://39299145

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

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

6 years agoRevert "[analyzer] Extend NoStoreFuncVisitor to insert a note on IVars"
George Karpenkov [Tue, 24 Jul 2018 23:23:33 +0000 (23:23 +0000)]
Revert "[analyzer] Extend NoStoreFuncVisitor to insert a note on IVars"

This reverts commit a9e21bd727112cd69eabc1af648c5da6b773d06e.
Reverted because the dependency has not landed yet.

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

6 years ago[analyzer] Extend NoStoreFuncVisitor to insert a note on IVars
George Karpenkov [Tue, 24 Jul 2018 23:14:29 +0000 (23:14 +0000)]
[analyzer] Extend NoStoreFuncVisitor to insert a note on IVars

The note is added in the following situation:

 - We are throwing a nullability-related warning on an IVar
 - The path goes through a method which *could have* (syntactically
 determined) written into that IVar, but did not

rdar://42444460

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

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

6 years ago[Sema] Destroy tokens in DeclaratorChunk params
Benjamin Kramer [Tue, 24 Jul 2018 22:47:16 +0000 (22:47 +0000)]
[Sema] Destroy tokens in DeclaratorChunk params

Otherwise this leaks in some edge cases.

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

6 years agoDon't lifetime-extend or track lifetime problems through the LHS of '->*'.
Richard Smith [Tue, 24 Jul 2018 21:18:30 +0000 (21:18 +0000)]
Don't lifetime-extend or track lifetime problems through the LHS of '->*'.

Fixes a false-positive warning found by selfhost.

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

6 years agoRevert "[VFS] Cleanups to VFS interfaces."
Jordan Rupprecht [Tue, 24 Jul 2018 20:28:07 +0000 (20:28 +0000)]
Revert "[VFS] Cleanups to VFS interfaces."

This reverts commit r337834 due to test failures.

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

6 years agoRemove stale documentation from InternalsManual.rst
Erich Keane [Tue, 24 Jul 2018 16:11:30 +0000 (16:11 +0000)]
Remove stale documentation from InternalsManual.rst

The DuplicatesAllowedWhileMerging was removed a while ago,
but the documentation remained.

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

6 years ago[VFS] Cleanups to VFS interfaces.
Sam McCall [Tue, 24 Jul 2018 16:00:55 +0000 (16:00 +0000)]
[VFS] Cleanups to VFS interfaces.

Summary:
- add comments clarifying semantics
- Status::copyWithNewName(Status, Name) --> instance method
- Status::copyWithNewName(fs::file_status, Name) --> constructor (it's not a copy)
- File::getName() -> getRealPath(), reflecting its actual behavior/function
  and stop returning status().getName() in the base class (callers can do this
  fallback if they want to, it complicates the contracts).

This is mostly NFC, but the behavior of File::getName() affects FileManager's
FileEntry::tryGetRealPathName(), which now fails in more cases:
 - non-real file cases
 - real-file cases where the underlying vfs::File was opened in a way that
   doesn't call realpath().
(In these cases we don't know a distinct real name, so in principle it seems OK)

Reviewers: klimek

Subscribers: cfe-commits

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

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

6 years ago[Sema] Mark implicitly-inserted ICE's as being part of explicit cast (PR38166)
Roman Lebedev [Tue, 24 Jul 2018 08:16:50 +0000 (08:16 +0000)]
[Sema] Mark implicitly-inserted ICE's as being part of explicit cast (PR38166)

Summary:
As discussed in [[ https://bugs.llvm.org/show_bug.cgi?id=38166 | PR38166 ]], we need to be able to distinqush whether the cast
we are visiting is actually a cast, or part of an `ExplicitCast`.
There are at least four ways to get there:
1. Introduce a new `CastKind`, and use it instead of `IntegralCast` if we are in `ExplicitCast`.

   Would work, but does not scale - what if we will need more of these cast kinds?
2. Introduce a flag in `CastExprBits`, whether this cast is part of `ExplicitCast` or not.

   Would work, but it isn't immediately clear where it needs to be set.
2. Fix `ScalarExprEmitter::VisitCastExpr()` to visit these `NoOp` casts.

   As pointed out by @rsmith, CodeGenFunction::EmitMaterializeTemporaryExpr calls

   skipRValueSubobjectAdjustments, which steps over the CK_NoOp cast`,

   which explains why we currently don't visit those.

   This is probably impossible, as @efriedma points out, that is intentional as per `[class.temporary]` in the standard
3. And the simplest one, just record which NoOp casts we skip.

   It just kinda works as-is afterwards.

But, the approach with a flag is the least intrusive one, and is probably the best one overall.

Reviewers: rsmith, rjmccall, majnemer, efriedma

Reviewed By: rsmith

Subscribers: cfe-commits, aaron.ballman, vsk, llvm-commits, rsmith

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

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

6 years agoAdd a .keep file to prevent svn from skipping over an empty folder.
Jiading Gai [Tue, 24 Jul 2018 06:49:27 +0000 (06:49 +0000)]
Add a .keep file to prevent svn from skipping over an empty folder.

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

6 years agoFor x86_64, gcc 7.2 under Amazon Linux AMI sets its path to x86_64-amazon-linux.
Jiading Gai [Tue, 24 Jul 2018 06:07:22 +0000 (06:07 +0000)]
For x86_64, gcc 7.2 under Amazon Linux AMI sets its path to x86_64-amazon-linux.

gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux. Adding
this triple to the list of search, plus a test case to cover this.

The patch fixes the following bug reported in bugzilla:

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

Reviewers: echristo

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

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

6 years ago[Test commit] Fix a spelling error.
Jiading Gai [Tue, 24 Jul 2018 03:34:15 +0000 (03:34 +0000)]
[Test commit] Fix a spelling error.

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

6 years agoRevert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"
Shiva Chen [Tue, 24 Jul 2018 02:57:11 +0000 (02:57 +0000)]
Revert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"

This reverts commit 4288dd3bf082482e02c8a044c611c18168cb0180.

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

6 years ago[DebugInfo] Generate debug information for labels. (Fix PR37395)
Shiva Chen [Tue, 24 Jul 2018 02:23:59 +0000 (02:23 +0000)]
[DebugInfo] Generate debug information for labels. (Fix PR37395)

Generate DILabel metadata and call llvm.dbg.label after label
statement to associate the metadata with the label.

After fixing PR37395.

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

Patch by Hsiangkai Wang.

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

6 years agoAttempt to fix regression due to r337791
Yaxun Liu [Tue, 24 Jul 2018 02:12:24 +0000 (02:12 +0000)]
Attempt to fix regression due to r337791

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

6 years agoFix unused variable warnings; NFC
George Burgess IV [Tue, 24 Jul 2018 02:10:53 +0000 (02:10 +0000)]
Fix unused variable warnings; NFC

Looks like MTE was previously used for its SourceLoc, but we're now
using a seperate SourceLocation here.

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

6 years ago[HIP] pass -target-cpu when running the device-mode compiler
Yaxun Liu [Tue, 24 Jul 2018 01:40:44 +0000 (01:40 +0000)]
[HIP] pass -target-cpu when running the device-mode compiler

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

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

6 years agoAdd missing testcase update for r337790.
Richard Smith [Tue, 24 Jul 2018 01:23:36 +0000 (01:23 +0000)]
Add missing testcase update for r337790.

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

6 years agoEnable .hip files for test/Driver
Yaxun Liu [Tue, 24 Jul 2018 01:03:44 +0000 (01:03 +0000)]
Enable .hip files for test/Driver

Partially revert r334128 due to regressions.

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

6 years agoWarn if a local variable's initializer retains a pointer/reference to a
Richard Smith [Tue, 24 Jul 2018 00:55:08 +0000 (00:55 +0000)]
Warn if a local variable's initializer retains a pointer/reference to a
non-lifetime-extended temporary object.

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

6 years agoBorrow visibility from __fundamental_type_info for generated fundamental type infos
Thomas Anderson [Tue, 24 Jul 2018 00:43:47 +0000 (00:43 +0000)]
Borrow visibility from __fundamental_type_info for generated fundamental type infos

This is necessary so the clang gives hidden visibility to fundamental types when
-fvisibility=hidden is passed. Fixes
https://bugs.llvm.org/show_bug.cgi?id=35066

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

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

6 years ago[WebAssembly] Change size_t to `unsigned long`.
Dan Gohman [Tue, 24 Jul 2018 00:29:58 +0000 (00:29 +0000)]
[WebAssembly] Change size_t to `unsigned long`.

Changing it to unsigned long (which is 32-bit on wasm32) makes it the same
type as wasm64 (where unsigned long is 64-bit), which would eliminate the most
common cause for mangled names being different between wasm32 and wasm64. For
example, export lists containing symbol names could now often be the same
between wasm32 and wasm64.

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

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

6 years agoNFC: Add the emacs c++ mode hint "-*- C++ -*-" to the headers that don't have it
Erik Pilkington [Tue, 24 Jul 2018 00:07:49 +0000 (00:07 +0000)]
NFC: Add the emacs c++ mode hint "-*- C++ -*-" to the headers that don't have it

https://llvm.org/docs/CodingStandards.html#file-headers

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

6 years ago[analyzer] Add a no-crash to a recently added test.
Artem Dergachev [Mon, 23 Jul 2018 23:48:13 +0000 (23:48 +0000)]
[analyzer] Add a no-crash to a recently added test.

No functional change intended.

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

6 years ago[analyzer] pr38273: Legalize Loc<>NonLoc comparison symbols.
Artem Dergachev [Mon, 23 Jul 2018 23:09:44 +0000 (23:09 +0000)]
[analyzer] pr38273: Legalize Loc<>NonLoc comparison symbols.

Remove an assertion in RangeConstraintManager that expects such symbols to never
appear, while admitting that the constraint manager doesn't yet handle them.

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

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

6 years agoSupport lifetime-extension of conditional temporaries.
Richard Smith [Mon, 23 Jul 2018 22:56:45 +0000 (22:56 +0000)]
Support lifetime-extension of conditional temporaries.

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

6 years ago[Sema] Fix crash on BlockExprs in a default member initializers
Erik Pilkington [Mon, 23 Jul 2018 22:47:37 +0000 (22:47 +0000)]
[Sema] Fix crash on BlockExprs in a default member initializers

Clang would crash when instantiating a BlockDecl that appeared in a
default-member-initializer of a class template. Fix this by deferring the
instantiation until we instantate the BlockExpr.

rdar://41200624

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

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

6 years ago[ASTMatchers] Add an isMain() matcher
George Karpenkov [Mon, 23 Jul 2018 22:29:35 +0000 (22:29 +0000)]
[ASTMatchers] Add an isMain() matcher

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

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

6 years ago[ASTMatchers] [NFC] Regenerate HTML docs.
George Karpenkov [Mon, 23 Jul 2018 22:29:10 +0000 (22:29 +0000)]
[ASTMatchers] [NFC] Regenerate HTML docs.

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

6 years ago[clang-cl] Expose -fblocks and -fno-builtin as driver flags
Reid Kleckner [Mon, 23 Jul 2018 21:29:43 +0000 (21:29 +0000)]
[clang-cl] Expose -fblocks and -fno-builtin as driver flags

Users have requested them.

Helps with PR36427.

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

6 years agoDo not try to perform lifetime-extension through conditional
Richard Smith [Mon, 23 Jul 2018 21:21:24 +0000 (21:21 +0000)]
Do not try to perform lifetime-extension through conditional
expressions.

CodeGen can't cope with that yet. Instead, produce a "not supported"
warning for now and don't extend lifetime.

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

6 years agoFold -Wreturn-stack-address into general initialization lifetime
Richard Smith [Mon, 23 Jul 2018 21:21:22 +0000 (21:21 +0000)]
Fold -Wreturn-stack-address into general initialization lifetime
checking.

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

6 years agoUpdate to -r337585, allow scoped enum inits in -pedantic
Erich Keane [Mon, 23 Jul 2018 21:08:13 +0000 (21:08 +0000)]
Update to -r337585, allow scoped enum inits in -pedantic

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

6 years ago[CodeGen] Record if a C++ record is a trivial type
Aaron Smith [Mon, 23 Jul 2018 20:49:07 +0000 (20:49 +0000)]
[CodeGen] Record if a C++ record is a trivial type

Summary: This has a dependence on D45122

Reviewers: rnk, zturner, llvm-commits, aleksandr.urakov

Reviewed By: rnk

Subscribers: cfe-commits

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

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

6 years ago[ms] Fix mangling of vector types in QMM_Result contexts.
Nico Weber [Mon, 23 Jul 2018 20:04:00 +0000 (20:04 +0000)]
[ms] Fix mangling of vector types in QMM_Result contexts.

If QMM_Result is set (which it is for return types, RTTI descriptors, and
exception type descriptors), tag types (structs, enums, classes, unions) get
their qualifiers mangled in.

__m64 and friends is a struct/union thingy in MSVC, but not in clang's headers.
To make mangling work, we call mangleArtificalTagType(TTK_Union/TTK_Struct for
the vector types to mangle them as tag types -- but the isa<TagType> check when
mangling in QMM_Result mode isn't true for these vector types. Add an
isArtificialTagType() function and check for that too. Fixes PR37276 and some
other issues.

I tried to audit all references to TagDecl and TagType in MicrosoftMangle.cpp
to find other places where we need to call mangleArtificalTagType(), but
couldn't find any.

I tried to audit all calls to mangleArtificalTagType() to see if
isArtificialTagType() needs to handle more than just the vector types, but as
far as I can tell all other types we use it for are types that MSVC can't
handle at all (Objective-C types etc).

https://reviews.llvm.org/D49597

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

6 years agoSeparate out the initialization kind for a statement expression result
Richard Smith [Mon, 23 Jul 2018 19:19:08 +0000 (19:19 +0000)]
Separate out the initialization kind for a statement expression result
from that for a return value.

No functionality change intended: I don't believe any of the diagnostics
affected by this patch are reachable when initializing the result of
statement expression.

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

6 years agoFold dangling-field warning into general initialization lifetime checks.
Richard Smith [Mon, 23 Jul 2018 18:50:26 +0000 (18:50 +0000)]
Fold dangling-field warning into general initialization lifetime checks.

This reinstates r337627, reverted in r337671, with a fix to correctly
handle the lvalueness of array subscript expressions on pointers.

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

6 years agoRevert "[OPENMP] Fix PR38026: Link -latomic when -fopenmp is used."
Jonas Hahnfeld [Mon, 23 Jul 2018 18:27:09 +0000 (18:27 +0000)]
Revert "[OPENMP] Fix PR38026: Link -latomic when -fopenmp is used."

This reverts commit r336467: libatomic is not available on all Linux
systems and this commit completely breaks OpenMP on them, even if there
are no atomic operations or all of them can be lowered to hardware
instructions.

See http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180716/234816.html
for post-commit discussion.

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

6 years ago[CStringSyntaxChecker] Improvements of strlcpy check
David Carlier [Mon, 23 Jul 2018 18:26:38 +0000 (18:26 +0000)]
[CStringSyntaxChecker] Improvements of strlcpy check

Adding an additional check whenwe offset fro the buffer base address.

Reviewers: george.karpenkov,NoQ

Reviewed By: george.karpenkov

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

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

6 years ago[DebugInfo] Error out when enabling -fdebug-types-section on non-ELF target.
Jonas Devlieghere [Mon, 23 Jul 2018 17:50:15 +0000 (17:50 +0000)]
[DebugInfo] Error out when enabling -fdebug-types-section on non-ELF target.

Currently, support for debug_types is only present for ELF and trying to
pass -fdebug-types-section for other targets results in a crash in the
backend. Until this is fixed, we should emit a diagnostic in the front
end when the option is passed for non-linux targets.

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

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

6 years ago[MS] Update _MSVC_LANG values for C++17 and C++2a
Reid Kleckner [Mon, 23 Jul 2018 17:44:00 +0000 (17:44 +0000)]
[MS] Update _MSVC_LANG values for C++17 and C++2a

Fixes PR38262

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

6 years ago[Sema] Don't emit -Wmemset-transposed-args for memset(p,0,0)
Erik Pilkington [Mon, 23 Jul 2018 16:24:14 +0000 (16:24 +0000)]
[Sema] Don't emit -Wmemset-transposed-args for memset(p,0,0)

Thanks to Arthur O'Dwyer for the suggestion!

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

6 years ago[NEON] Define half-precision vmaxnm intrinsics only when available
Ivan A. Kosarev [Mon, 23 Jul 2018 16:01:35 +0000 (16:01 +0000)]
[NEON] Define half-precision vmaxnm intrinsics only when available

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

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

6 years ago[ASTMatchers] add matcher for decltypeType and its underlyingType
Jonas Toth [Mon, 23 Jul 2018 15:59:27 +0000 (15:59 +0000)]
[ASTMatchers] add matcher for decltypeType and its underlyingType

Summary:
This patch introduces a new matcher for `DecltypeType` and its underlying type
in order to fix a bug in clang-tidy, see https://reviews.llvm.org/D48717 for more.

Reviewers: aaron.ballman, alexfh, NoQ, dcoughlin

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years ago[NEON] Define half-precision vrnd intrinsics only when available
Ivan A. Kosarev [Mon, 23 Jul 2018 14:53:44 +0000 (14:53 +0000)]
[NEON] Define half-precision vrnd intrinsics only when available

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

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

6 years ago[NEON] Fix support for vrndi_f32(), vrndiq_f32() and vrndns_f32() intrinsics
Ivan A. Kosarev [Mon, 23 Jul 2018 13:26:37 +0000 (13:26 +0000)]
[NEON] Fix support for vrndi_f32(), vrndiq_f32() and vrndns_f32() intrinsics

This patch adds support for vrndi_f32() and vrndiq_f32()
intrinsics in AArch32 mode and for vrndns_f32() intrinsic in
AArch64 mode.

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

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

6 years ago[AST] Use llvm::TrailingObjects in CXXTryStmt
Benjamin Kramer [Mon, 23 Jul 2018 12:45:24 +0000 (12:45 +0000)]
[AST] Use llvm::TrailingObjects in CXXTryStmt

1. Use llvm::TrailingObjects in CXXTryStmt instead of manually doing the reinterpret_casts + pointer arithmetic. This is more consistent with other classes using this idiom and this make it clearer that this class has trailing objects.
2. Make the class CXXTryStmt final since it has trailing objects.
3. Move the friend declarations together.

No functional changes.

Patch by Bruno Ricci!

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

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

6 years ago[Tooling] Use UniqueStringSaver. NFC
Sam McCall [Mon, 23 Jul 2018 11:25:25 +0000 (11:25 +0000)]
[Tooling] Use UniqueStringSaver. NFC

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

6 years agoFix for last commit: adding new test file forgotten.
Adam Balogh [Mon, 23 Jul 2018 10:53:02 +0000 (10:53 +0000)]
Fix for last commit: adding new test file forgotten.

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

6 years ago[Analyzer] Quick Fix for exponential execution time when simpilifying complex additiv...
Adam Balogh [Mon, 23 Jul 2018 10:50:20 +0000 (10:50 +0000)]
[Analyzer] Quick Fix for exponential execution time when simpilifying complex additive expressions

Patch https://reviews.llvm.org/rC329780 not only rearranges comparisons but
also binary expressions. This latter behavior is not protected by the analyzer
option. Hower, since no complexity threshold is enforced to the symbols this
may result in exponential execution time if the expressions are too complex:
https://bugs.llvm.org/show_bug.cgi?id=38208. For a quick fix we extended the
analyzer option to also cover the additive cases.

This is only a temporary fix, the final solution should be enforcing the
complexity threshold to the symbols.

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

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