]> granicus.if.org Git - clang/log
clang
6 years ago[ASTMatchers] Overload isConstexpr for ifStmts
Gabor Horvath [Tue, 8 May 2018 11:53:32 +0000 (11:53 +0000)]
[ASTMatchers] Overload isConstexpr for ifStmts

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

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

6 years agoFix 'not all control paths return a value' MSVC warnings. NFCI.
Simon Pilgrim [Tue, 8 May 2018 09:40:32 +0000 (09:40 +0000)]
Fix 'not all control paths return a value' MSVC warnings. NFCI.

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

6 years ago[clang-format] Add raw string formatting to release notes
Krasimir Georgiev [Tue, 8 May 2018 09:25:12 +0000 (09:25 +0000)]
[clang-format] Add raw string formatting to release notes

Reviewers: hans

Reviewed By: hans

Subscribers: cfe-commits

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

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

6 years ago[C++2a] Implement operator<=>: Fix another bug in the code gen tests.
Eric Fiselier [Tue, 8 May 2018 07:56:05 +0000 (07:56 +0000)]
[C++2a] Implement operator<=>: Fix another bug in the code gen tests.

Sorry for the failures. I'm quite new at writing code gen tests, and
I'm not sure the best way to make them portable.

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

6 years ago[x86] Introduce the encl[u|s|v] intrinsics
Gabor Buella [Tue, 8 May 2018 07:12:34 +0000 (07:12 +0000)]
[x86] Introduce the encl[u|s|v] intrinsics

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

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

6 years ago[x86] Introduce the pconfig intrinsic
Gabor Buella [Tue, 8 May 2018 06:49:41 +0000 (06:49 +0000)]
[x86] Introduce the pconfig intrinsic

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

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

6 years ago[CMake] Pass additional CMake flags in Fuchsia cache files
Petr Hosek [Tue, 8 May 2018 02:47:13 +0000 (02:47 +0000)]
[CMake] Pass additional CMake flags in Fuchsia cache files

This allows passing additional CMake flags to builtins and runtimes
build through Fuchsia cache files.

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

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

6 years ago[C++2a] operator<=>: Fix incorrect use of Twine.
Eric Fiselier [Tue, 8 May 2018 02:28:47 +0000 (02:28 +0000)]
[C++2a] operator<=>: Fix incorrect use of Twine.

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

6 years ago[C++2a] Implement operator<=>: Address bugs and post-commit review comments after...
Eric Fiselier [Tue, 8 May 2018 00:52:19 +0000 (00:52 +0000)]
[C++2a] Implement operator<=>: Address bugs and post-commit review comments after r331677.

This patch addresses some mostly trivial post-commit review comments received
on r331677.

Additionally, this patch fixes an assertion in `getNarrowingKind` caused by
the use of an uninitialized value from `checkThreeWayNarrowingConversion`.

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

6 years agoMove test input file into same directory as test. NFC
Richard Trieu [Tue, 8 May 2018 00:29:21 +0000 (00:29 +0000)]
Move test input file into same directory as test.  NFC

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

6 years agoFix failing codegen test on non-x86_64 platforms
Eric Fiselier [Mon, 7 May 2018 23:15:34 +0000 (23:15 +0000)]
Fix failing codegen test on non-x86_64 platforms

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

6 years agoPR37352: mangle numbering for decomposition declarations.
Richard Smith [Mon, 7 May 2018 22:23:38 +0000 (22:23 +0000)]
PR37352: mangle numbering for decomposition declarations.

In order to match our mangling scheme, use a different set of numbers for
decomposition declarations, and consider all binding names when forming the
numbering. This does not yet affect any mangled names we produce, because
local decomposition declarations can't yet have linkage, but a C++ standard
proposal to change that is currently being processed.

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

6 years ago[NFC] Move 2 variable initialization from Ctor to member initializers.
Erich Keane [Mon, 7 May 2018 22:01:06 +0000 (22:01 +0000)]
[NFC] Move 2 variable initialization from Ctor to member initializers.

In response to dblaikie's suggestion on r331536, replace the two enum
typed variable initializers in the constructor with member initializers.

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

6 years ago[X86] Use target feature defines in tests instead of defining our own flag on the...
Craig Topper [Mon, 7 May 2018 21:47:13 +0000 (21:47 +0000)]
[X86] Use target feature defines in tests instead of defining our own flag on the command line. NFCI

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

6 years ago[X86] Make _mm256_gf2p8mul_epi8 require avx features since its 256 bits.
Craig Topper [Mon, 7 May 2018 21:47:11 +0000 (21:47 +0000)]
[X86] Make _mm256_gf2p8mul_epi8 require avx features since its 256 bits.

Without this we throw an error on the header file instead of the user code when the right features aren't enabled in clang.

Rename the other DEFAULT_FN_ATTRS defines to _Z for 512-bit since I used _Y for this case.

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

6 years agoRelax a FileCheck pattern to make it pass on Windows.
Peter Collingbourne [Mon, 7 May 2018 21:40:53 +0000 (21:40 +0000)]
Relax a FileCheck pattern to make it pass on Windows.

Should fix Windows bot failure:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/16956

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

6 years ago[C++2a] Implement operator<=> CodeGen and ExprConstant
Eric Fiselier [Mon, 7 May 2018 21:07:10 +0000 (21:07 +0000)]
[C++2a] Implement operator<=> CodeGen and ExprConstant

Summary:
This patch tackles long hanging fruit for the builtin operator<=> expressions. It is currently needs some cleanup before landing, but I want to get some initial feedback.

The main changes are:

* Lookup, build, and store the required standard library types and expressions in `ASTContext`. By storing them in ASTContext we don't need to store (and duplicate) the required expressions in the BinaryOperator AST nodes.

* Implement [expr.spaceship] checking, including diagnosing narrowing conversions.

* Implement `ExprConstant` for builtin spaceship operators.

* Implement builitin operator<=> support in `CodeGenAgg`. Initially I emitted the required comparisons using `ScalarExprEmitter::VisitBinaryOperator`, but this caused the operand expressions to be emitted once for every required cmp.

* Implement [builtin.over] with modifications to support the intent of P0946R0. See the note on `BuiltinOperatorOverloadBuilder::addThreeWayArithmeticOverloads` for more information about the workaround.

Reviewers: rsmith, aaron.ballman, majnemer, rnk, compnerd, rjmccall

Reviewed By: rjmccall

Subscribers: rjmccall, rsmith, aaron.ballman, junbuml, mgorny, cfe-commits

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

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

6 years ago[CFI] Force LLVM to die if the implicit blacklist files cannot be found.
Peter Collingbourne [Mon, 7 May 2018 20:54:05 +0000 (20:54 +0000)]
[CFI] Force LLVM to die if the implicit blacklist files cannot be found.

Currently LLVM CFI tries to use an implicit blacklist file, currently
in /usr/lib64/clang/<version>/share. If the file is not there, LLVM
happily continues, which causes CFI to add checks to files/functions
that are known to fail, generating binaries that fail. This CL causes
LLVM to die (I hope) if it can't find these implicit blacklist files.

Patch by Caroline Tice!

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

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

6 years agoCorrect warning on Float->Integer conversions.
Erich Keane [Mon, 7 May 2018 20:52:56 +0000 (20:52 +0000)]
Correct warning on Float->Integer conversions.

As identified and briefly discussed here:
https://bugs.llvm.org/show_bug.cgi?id=37305

Converting a floating point number to an integer type when
the integral part is out of the range of the integer type is
undefined behavior in C. Additionally, CodeGen emits an undef
in this situation.

HOWEVER, we've been giving a warning that says that the value is
changed. This patch corrects the warning to list that it is actually
undefined behavior.

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

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

6 years ago[Driver] Use -fuse-line-directives by default in MSVC mode
Martin Storsjo [Mon, 7 May 2018 20:26:09 +0000 (20:26 +0000)]
[Driver] Use -fuse-line-directives by default in MSVC mode

Don't use the GNU extension form of line markers in MSVC mode.

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

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

6 years ago[OPENMP, NVPTX] Small test fix, NFC.
Alexey Bataev [Mon, 7 May 2018 17:38:13 +0000 (17:38 +0000)]
[OPENMP, NVPTX] Small test fix, NFC.

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

6 years ago[OPENMP, NVPTX] Codegen for critical construct.
Alexey Bataev [Mon, 7 May 2018 17:23:05 +0000 (17:23 +0000)]
[OPENMP, NVPTX] Codegen for critical construct.

Added correct codegen for the critical construct on NVPTX devices.

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

6 years agoFix explicit template parameter reporting for narrowing conversions
Erich Keane [Mon, 7 May 2018 17:05:20 +0000 (17:05 +0000)]
Fix explicit template parameter reporting for narrowing conversions

I found that explicit template parameters that caused a
narrowing integer conversion resulted in the incorrect parameter
being mentioned in the note (see test attached). This is because
the argument checking code doesn't check to see if it caused
SFINAE errors when checking the arguments, so instead of giving
up on the first error, it continues through the list. This
makes the error reporting pick up the last template param every time.

This patch checks these parameters on each argument and gives up
if there is an error. The result is that only the required amount
of arguments are checked, and that the 'Converted' array contains
only the successful arguments before the first failure, as the
calls seem to all expect.

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

6 years ago[docs] Fix typos in the Clang User's Manual.
Joel Galenson [Mon, 7 May 2018 16:23:46 +0000 (16:23 +0000)]
[docs] Fix typos in the Clang User's Manual.

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

6 years ago[OPENMP, NVPTX] Added support for L2 parallelism.
Alexey Bataev [Mon, 7 May 2018 14:50:05 +0000 (14:50 +0000)]
[OPENMP, NVPTX] Added support for L2 parallelism.

Added initial codegen for level 2, 3 etc. parallelism. Currently, all
the second, the third etc. parallel regions will run sequentially.

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

6 years ago[mips] Improve handling of -fno-[pic/PIC] option
Aleksandar Beserminji [Mon, 7 May 2018 14:30:49 +0000 (14:30 +0000)]
[mips] Improve handling of -fno-[pic/PIC] option

In order to disable PIC and to match GCC behaviour, -mno-abicalls
option is neccessary. When -fno-[pic/PIC] is used witout -mno-abicalls,
warning is reported. An error is reported when -fno-pic or -fno-PIC is
used in combination with -mabicalls.

In this commit, test case is added.

Depends on D44381.

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

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

6 years agoRevert "[mips] Improve handling of -fno-[pic/PIC] option"
Aleksandar Beserminji [Mon, 7 May 2018 14:28:42 +0000 (14:28 +0000)]
Revert "[mips] Improve handling of -fno-[pic/PIC] option"

This reverts commit r331636. Forgot to add the test case.

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

6 years ago[mips] Improve handling of -fno-[pic/PIC] option
Aleksandar Beserminji [Mon, 7 May 2018 14:19:54 +0000 (14:19 +0000)]
[mips] Improve handling of -fno-[pic/PIC] option

In order to disable PIC and to match GCC behaviour, -mno-abicalls
option is neccessary. When -fno-[pic/PIC] is used witout -mno-abicalls,
warning is reported. An error is reported when -fno-pic or -fno-PIC is
used in combination with -mabicalls.

Depends on D44381.

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

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

6 years ago[ASTImporter] Support importing UnresolvedMemberExpr, DependentNameType, DependentSco...
Peter Szecsi [Mon, 7 May 2018 12:08:27 +0000 (12:08 +0000)]
[ASTImporter] Support importing UnresolvedMemberExpr, DependentNameType, DependentScopeDeclRefExpr

The visit callback implementations for the 3 C++ AST Node added to the ASTImporter.

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

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

6 years agoRemove now-unnecessary check for non-zero nvsize in addition to
Richard Smith [Mon, 7 May 2018 06:43:31 +0000 (06:43 +0000)]
Remove now-unnecessary check for non-zero nvsize in addition to
emptyness in MS record layout.

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

6 years agoNon-zero-length bit-fields make a class non-empty.
Richard Smith [Mon, 7 May 2018 06:43:30 +0000 (06:43 +0000)]
Non-zero-length bit-fields make a class non-empty.

This implements the rule intended by the standard (see LWG 2358)
and the rule intended by the Itanium C++ ABI (see
https://github.com/itanium-cxx-abi/cxx-abi/pull/51), and makes
Clang match the behavior of GCC, ICC, and MSVC.

A pedantic reading of both the standard and the ABI indicate that Clang
is currently technically correct, but that's not worth much when it's
clear that the wording is wrong in both those places.

This is an ABI break for classes that derive from a class that is empty
other than one or more unnamed non-zero-length bit-fields. Such cases
are expected to be rare, but -fclang-abi-compat=6 restores the old
behavior just in case.

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

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

6 years agoDisallow pointers to const in __sync_fetch_and_xxx.
Aaron Ballman [Sat, 5 May 2018 17:38:42 +0000 (17:38 +0000)]
Disallow pointers to const in __sync_fetch_and_xxx.

Diagnoses code like:

void f(const int *ptr) {
  __sync_fetch_and_add(ptr, 1);
}

which matches the behavior of GCC and ICC.

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

6 years agoAdd -target to address errors in test from r331592
Teresa Johnson [Sat, 5 May 2018 16:37:31 +0000 (16:37 +0000)]
Add -target to address errors in test from r331592

The error turns out to be:
Assertion failed: (Target.isCompatibleDataLayout(getDataLayout()) && "Can't create a MachineFunction using a Module with a " "Target-incompatible DataLayout attached\n"), function init, file /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm/lib/CodeGen/MachineFunction.cpp, line 180.

Add -target to address this. Also re-enable the test I had temporarily
commented, and move it further down in case there is still a failure
(since it pipes stderr to FileCheck).

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

6 years agoSkip part of test added in r331592 to help debug bot failures
Teresa Johnson [Sat, 5 May 2018 15:54:57 +0000 (15:54 +0000)]
Skip part of test added in r331592 to help debug bot failures

Trying to debug why/where a few bots getting exit code 256 e.g.
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/48471/testReport/Clang/CodeGen/thinlto_diagnostic_handler_remarks_with_hotness_ll/

and a few windows bots getting no output from that RUN line e.g.
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/11865/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Athinlto-diagnostic-handler-remarks-with-hotness.ll

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

6 years agoAdd required target to address bot failures from r331592
Teresa Johnson [Sat, 5 May 2018 15:15:04 +0000 (15:15 +0000)]
Add required target to address bot failures from r331592

Failing on non-x86 bots, needs x86 target for code gen.

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

6 years ago[ThinLTO] Support opt remarks options with distributed ThinLTO backends
Teresa Johnson [Sat, 5 May 2018 14:37:29 +0000 (14:37 +0000)]
[ThinLTO] Support opt remarks options with distributed ThinLTO backends

Summary:
Passes down the necessary code ge options to the LTO Config to enable
-fdiagnostics-show-hotness and -fsave-optimization-record in the ThinLTO
backend for a distributed build.

Also, remove warning about not having PGO when the input is IR.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

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

6 years agoFix a couple places that immediately called operator-> on the result of dyn_cast.
Craig Topper [Sat, 5 May 2018 01:58:26 +0000 (01:58 +0000)]
Fix a couple places that immediately called operator-> on the result of dyn_cast.

It looks like it safe to just use cast for both cases.

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

6 years agoAdd warning flag -Wordered-compare-function-pointers.
Eli Friedman [Sat, 5 May 2018 00:09:51 +0000 (00:09 +0000)]
Add warning flag -Wordered-compare-function-pointers.

The C standard doesn't allow comparisons like "f1 < f2" (where f1 and f2
are function pointers), but we allow them as an extension.  Add a
warning flag to control this warning.

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

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

6 years ago[analyzer] Remove untested code in evalLoad.
Artem Dergachev [Fri, 4 May 2018 23:01:10 +0000 (23:01 +0000)]
[analyzer] Remove untested code in evalLoad.

No functional change intended.

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

6 years ago[analyzer] Invalidate union regions properly. Don't hesitate to load later.
Artem Dergachev [Fri, 4 May 2018 22:19:32 +0000 (22:19 +0000)]
[analyzer] Invalidate union regions properly. Don't hesitate to load later.

We weren't invalidating our unions correctly. The previous behavior in
invalidateRegionsWorker::VisitCluster() was to direct-bind an UnknownVal
to the union (at offset 0).

For that reason we were never actually loading default bindings from our unions,
because there never was any default binding to load, and the value
that is presumed when there's no default binding to load
is usually completely incorrect (eg. UndefinedVal for stack unions).

The new behavior is to default-bind a conjured symbol (of irrelevant type)
to the union that's being invalidated, similarly to what we do for structures
and classes. Then it becomes safe to load the value properly.

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

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

6 years ago[analyzer] pr36458: Fix retrieved value cast for symbolic void pointers.
Artem Dergachev [Fri, 4 May 2018 22:11:12 +0000 (22:11 +0000)]
[analyzer] pr36458: Fix retrieved value cast for symbolic void pointers.

C allows us to write any bytes into any memory region. When loading weird bytes
from memory regions of known types, the analyzer is required to make sure that
the loaded value makes sense by casting it to an appropriate type.

Fix such cast for loading values that represent void pointers from non-void
pointer type places.

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

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

6 years ago[analyzer] pr18953: Split C++ zero-initialization from default initialization.
Artem Dergachev [Fri, 4 May 2018 21:56:51 +0000 (21:56 +0000)]
[analyzer] pr18953: Split C++ zero-initialization from default initialization.

The bindDefault() API of the ProgramState allows setting a default value
for reads from memory regions that were not preceded by writes.

It was used for implementing C++ zeroing constructors (i.e. default constructors
that boil down to setting all fields of the object to 0).

Because differences between zeroing consturctors and other forms of default
initialization have been piling up (in particular, zeroing constructors can be
called multiple times over the same object, probably even at the same offset,
requiring a careful and potentially slow cleanup of previous bindings in the
RegionStore), we split the API in two: bindDefaultInitial() for modeling
initial values and bindDefaultZero() for modeling zeroing constructors.

This fixes a few assertion failures from which the investigation originated.

The imperfect protection from both inability of the RegionStore to support
binding extents and lack of information in ASTRecordLayout has been loosened
because it's, well, imperfect, and it is unclear if it fixing more than it
was breaking.

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

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

6 years ago[X86] Correct the attributes on the incssp and rdssp builtins to only have 'nothrow'
Craig Topper [Fri, 4 May 2018 21:56:43 +0000 (21:56 +0000)]
[X86] Correct the attributes on the incssp and rdssp builtins to only have 'nothrow'

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

6 years ago[X86] Fix some inconsistent formatting in the first line of our intrinsics headers.
Craig Topper [Fri, 4 May 2018 21:45:25 +0000 (21:45 +0000)]
[X86] Fix some inconsistent formatting in the first line of our intrinsics headers.

Some were too long and some were too short.

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

6 years ago[analyzer] pr37209: Fix casts of glvalues to references.
Artem Dergachev [Fri, 4 May 2018 21:39:25 +0000 (21:39 +0000)]
[analyzer] pr37209: Fix casts of glvalues to references.

Many glvalue expressions aren't of their respective reference type -
they are simply glvalues of their value type.

This was causing problems when we were trying to obtain type of the original
expression while evaluating certain glvalue bit-casts.

Fixed by artificially forging a reference type to provide to the casting
procedure.

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

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

6 years ago[analyzer] Treat more const variables and fields as known contants.
Artem Dergachev [Fri, 4 May 2018 20:52:39 +0000 (20:52 +0000)]
[analyzer] Treat more const variables and fields as known contants.

When loading from a variable or a field that is declared as constant,
the analyzer will try to inspect its initializer and constant-fold it.
Upon success, the analyzer would skip normal load and return the respective
constant.

The new behavior also applies to fields/elements of brace-initialized structures
and arrays.

Patch by Rafael Stahl!

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

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

6 years agoAllow modifying the PrintingPolicy for fully qualified names.
Sterling Augustine [Fri, 4 May 2018 20:12:39 +0000 (20:12 +0000)]
Allow modifying the PrintingPolicy for fully qualified names.

Author: mikhail.ramalho@gmail.com

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

6 years ago[clang-format] Refactor #include insertion/deletion functionality into a class.
Eric Liu [Fri, 4 May 2018 17:55:13 +0000 (17:55 +0000)]
[clang-format] Refactor #include insertion/deletion functionality into a class.

Summary:
The class will be moved into libToolingCore as followup.

The new behaviors in this patch:
- New #include is inserted in the right position in a #include block to
preserver sorted #includes. This is best effort - only works when the
block is already sorted.
- When inserting multiple #includes to the end of a file which doesn't
end with a "\n" character, a "\n" will be prepended to each #include.
This is a special and rare case that was previously handled. This is now
relaxed to avoid complexity as it's rare in practice.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, cfe-commits, djasper

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

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

6 years ago[NFC]Convert Class to use member initialization instead of inline.
Erich Keane [Fri, 4 May 2018 16:19:53 +0000 (16:19 +0000)]
[NFC]Convert Class to use member initialization instead of inline.

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

6 years ago[clang-cl] Print /showIncludes to stderr, if used in combination with /E, /EP or /P
Erich Keane [Fri, 4 May 2018 15:58:31 +0000 (15:58 +0000)]
[clang-cl] Print /showIncludes to stderr, if used in combination with /E, /EP or /P

This replicates 'cl.exe' behavior and allows for both preprocessor output and
dependency information to be extraced with a single compiler invocation.

This is especially useful for compiler caching with tools like Mozilla's sccache.

See: https://github.com/mozilla/sccache/issues/246

Patch By: fxb

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

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

6 years agoRemove explicit cfg-temporary-dtors=true
Alexander Kornienko [Fri, 4 May 2018 14:13:14 +0000 (14:13 +0000)]
Remove explicit cfg-temporary-dtors=true

Summary:
Remove explicit -analyzer-config cfg-temporary-dtors=true in analyzer tests,
since this option defaults to true since r326461.

Reviewers: NoQ

Reviewed By: NoQ

Subscribers: cfe-commits

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

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

6 years ago[Coroutines] Catch exceptions in await_resume
Brian Gesiak [Fri, 4 May 2018 14:02:37 +0000 (14:02 +0000)]
[Coroutines] Catch exceptions in await_resume

Summary:
http://wg21.link/P0664r2 section "Evolution/Core Issues 24" describes a
proposed change to Coroutines TS that would have any exceptions thrown
after the initial suspend point of a coroutine be caught by the handler
specified by the promise type's 'unhandled_exception' member function.
This commit provides a sample implementation of the specified behavior.

Test Plan: `check-clang`

Reviewers: GorNishanov, EricWF

Reviewed By: GorNishanov

Subscribers: cfe-commits, lewissbaker, eric_niebler

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

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

6 years ago[Driver] Don't warn about unused inputs in config files
Martin Storsjo [Fri, 4 May 2018 06:05:58 +0000 (06:05 +0000)]
[Driver] Don't warn about unused inputs in config files

This avoids warnings about unused linker parameters, just like
other flags are ignored if they're from config files.

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

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

6 years ago[analyzer] NFC: Remove unused parameteer of StoreManager::CastRetrievedVal().
Artem Dergachev [Fri, 4 May 2018 00:53:41 +0000 (00:53 +0000)]
[analyzer] NFC: Remove unused parameteer of StoreManager::CastRetrievedVal().

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

6 years ago[X86] Make __builtin_ia32_directstore_u32 and __builtin_ia32_movdir64b 'nothrow'
Craig Topper [Thu, 3 May 2018 21:01:35 +0000 (21:01 +0000)]
[X86] Make __builtin_ia32_directstore_u32 and __builtin_ia32_movdir64b 'nothrow'

These builtins snuck in while I was in the middle of adding nothrow to the other builtins in my local clone and I guess I missed them.

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

6 years ago[CodeGenFunction] Use the StringRef::split function that takes a char separator inste...
Craig Topper [Thu, 3 May 2018 21:01:33 +0000 (21:01 +0000)]
[CodeGenFunction] Use the StringRef::split function that takes a char separator instead of StringRef separator. NFC

The char separator version should be a little better optimized.

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

6 years ago[OPENMP] Fix test typos: CHECK-DAG-N -> CHECK-N-DAG
Joel E. Denny [Thu, 3 May 2018 17:22:04 +0000 (17:22 +0000)]
[OPENMP] Fix test typos: CHECK-DAG-N -> CHECK-N-DAG

Reviewed by: ABataev

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

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

6 years agoRevert r331466: [OPENMP] Fix test typos: CHECK-DAG-N -> CHECK-N-DAG"
Joel E. Denny [Thu, 3 May 2018 17:22:01 +0000 (17:22 +0000)]
Revert r331466: [OPENMP] Fix test typos: CHECK-DAG-N -> CHECK-N-DAG"

Sorry, forgot to add commit log attributes.

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

6 years ago[OPENMP] Fix test typos: CHECK-DAG-N -> CHECK-N-DAG
Joel E. Denny [Thu, 3 May 2018 17:15:44 +0000 (17:15 +0000)]
[OPENMP] Fix test typos: CHECK-DAG-N -> CHECK-N-DAG

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

6 years agoAllow writing calling convention attributes on function types.
Aaron Ballman [Thu, 3 May 2018 15:33:50 +0000 (15:33 +0000)]
Allow writing calling convention attributes on function types.

Calling convention attributes notionally appertain to the function type -- they modify the mangling of the function, change the behavior of assignment operations, etc. This commit allows the calling convention attributes to be written in the type position as well as the declaration position.

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

6 years agoRename invariant.group.barrier to launder.invariant.group
Piotr Padlewski [Thu, 3 May 2018 11:03:01 +0000 (11:03 +0000)]
Rename invariant.group.barrier to launder.invariant.group

Summary:
This is one of the initial commit of "RFC: Devirtualization v2" proposal:
https://docs.google.com/document/d/16GVtCpzK8sIHNc2qZz6RN8amICNBtvjWUod2SujZVEo/edit?usp=sharing

Reviewers: rsmith, amharc, kuhar, sanjoy

Subscribers: arsenm, nhaehnle, javed.absar, hiraditya, llvm-commits

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

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

6 years agoEnable -fsanitize=function on FreeBSD.
Fangrui Song [Thu, 3 May 2018 06:37:47 +0000 (06:37 +0000)]
Enable -fsanitize=function on FreeBSD.

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

6 years agoFix -Wunused-variable warning in Clang.cpp
Karl-Johan Karlsson [Thu, 3 May 2018 05:53:29 +0000 (05:53 +0000)]
Fix -Wunused-variable warning in Clang.cpp

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

6 years agoTrack the result of evaluating a computed noexcept specification on the
Richard Smith [Thu, 3 May 2018 03:58:32 +0000 (03:58 +0000)]
Track the result of evaluating a computed noexcept specification on the
FunctionProtoType.

We previously re-evaluated the expression each time we wanted to know whether
the type is noexcept or not. We now evaluate the expression exactly once.

This is not quite "no functional change": it fixes a crasher bug during AST
deserialization where we would try to evaluate the noexcept specification in a
situation where we have not deserialized sufficient portions of the AST to
permit such evaluation.

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

6 years ago[CMake][Cache] Stop pretending that Fuchsia is UNIX
Petr Hosek [Thu, 3 May 2018 01:44:03 +0000 (01:44 +0000)]
[CMake][Cache] Stop pretending that Fuchsia is UNIX

This changes some aspects of the build that are not relevant or useful
for Fuchsia like setting the RPATH/RUNPATH.

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

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

6 years ago[Sema] Do not match function type with const T in template argument deduction
Lei Liu [Thu, 3 May 2018 01:43:23 +0000 (01:43 +0000)]
[Sema] Do not match function type with const T in template argument deduction

From http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1584,
function type should not match cv-qualified type in template argument
deduction. This also matches what GCC and EDG do in template argument
deduction.

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

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

6 years ago[ObjC] Supress the 'implementing unavailable method' warning when
Alex Lorenz [Thu, 3 May 2018 01:12:06 +0000 (01:12 +0000)]
[ObjC] Supress the 'implementing unavailable method' warning when
the method declaration is unavailable for an app extension platform

Rationale:
Classes are often shared between an app extension code and
non-app extension code. There's no way to remove the implementation
using preprocessor when building the app extension, so we should not warn here.

rdar://38150617

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

6 years ago[gcov] Make the CLang side coverage test work with the new
Chandler Carruth [Wed, 2 May 2018 22:57:20 +0000 (22:57 +0000)]
[gcov] Make the CLang side coverage test work with the new
instrumentation codegeneration strategy of using a data structure and
a loop. Required some finesse to get the critical things being tested to
surface in a nice way for FileCheck but I think this preserves the
original intent of the test.

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

6 years ago[ObjC] The absence of ownership qualifiers on an ambiguous property leads
Alex Lorenz [Wed, 2 May 2018 22:40:19 +0000 (22:40 +0000)]
[ObjC] The absence of ownership qualifiers on an ambiguous property leads
to synthesis of a valid property even when the selected protocol property
has ownership qualifiers

rdar://39024725

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

6 years ago[analyzer] Revert r331096 "CStringChecker: Add support for BSD strlcpy()...".
Artem Dergachev [Wed, 2 May 2018 20:33:17 +0000 (20:33 +0000)]
[analyzer] Revert r331096 "CStringChecker: Add support for BSD strlcpy()...".

The return values of the newly supported functions were not handled correctly:
strlcpy()/strlcat() return string sizes rather than pointers.

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

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

6 years ago[X86] Mark all x86 specific builtins as nothrow.
Craig Topper [Wed, 2 May 2018 20:18:57 +0000 (20:18 +0000)]
[X86] Mark all x86 specific builtins as nothrow.

I believe all of the x86 builtins should be considered nothrow.

I've left the incssp builtins alone because I think its current attributes are wrong and I'm following up with the contributor for that.

I plan to start adding const as well, but that requires more careful auditing.

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

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

6 years ago[OPENMP] Add support for reductions on simd directives in target
Alexey Bataev [Wed, 2 May 2018 20:03:27 +0000 (20:03 +0000)]
[OPENMP] Add support for reductions on simd directives in target
regions.

Added codegen for `simd reduction()` constructs in target directives.

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

6 years agoRevert "Emit an error when mixing <stdatomic.h> and <atomic>"
Volodymyr Sapsai [Wed, 2 May 2018 19:52:07 +0000 (19:52 +0000)]
Revert "Emit an error when mixing <stdatomic.h> and <atomic>"

It reverts r331378 as it caused test failures

    ThreadSanitizer-x86_64 :: Darwin/gcd-groups-destructor.mm
    ThreadSanitizer-x86_64 :: Darwin/libcxx-shared-ptr-stress.mm
    ThreadSanitizer-x86_64 :: Darwin/xpc-race.mm

Only clang part of the change is reverted, libc++ part remains as is because it
emits error less aggressively.

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

6 years ago[Driver] Infer Android sysroot location.
Dan Albert [Wed, 2 May 2018 19:38:37 +0000 (19:38 +0000)]
[Driver] Infer Android sysroot location.

Summary:
Android toolchains include their headers and libraries in a
self-contained directory within the toolchain.

Reviewers: srhines

Reviewed By: srhines

Subscribers: cfe-commits

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

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

6 years ago[Driver] Obey computed sysroot when finding libc++ headers.
Dan Albert [Wed, 2 May 2018 19:31:01 +0000 (19:31 +0000)]
[Driver] Obey computed sysroot when finding libc++ headers.

Summary:
A handful of targets will try some default paths if --sysroot is not provided.
If that is the case, it should be used for the libc++ header paths.

Reviewers: srhines, EricWF

Reviewed By: srhines

Subscribers: cfe-commits

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

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

6 years ago[OPENMP] Analyze the type of the mapped entity instead of its base.
Alexey Bataev [Wed, 2 May 2018 18:44:10 +0000 (18:44 +0000)]
[OPENMP] Analyze the type of the mapped entity instead of its base.

If the mapped entity is a data member, we erroneously checked the type
of its base rather than the type of the mapped entity itself.

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

6 years agoEmit an error when mixing <stdatomic.h> and <atomic>
Volodymyr Sapsai [Wed, 2 May 2018 17:50:43 +0000 (17:50 +0000)]
Emit an error when mixing <stdatomic.h> and <atomic>

Atomics in C and C++ are incompatible at the moment and mixing the
headers can result in confusing error messages.

Emit an error explicitly telling about the incompatibility. Introduce
the macro `__ALLOW_STDC_ATOMICS_IN_CXX__` that allows to choose in C++
between C atomics and C++ atomics.

rdar://problem/27435938

Reviewers: rsmith, EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: jkorous-apple, christof, bumblebritches57, JonChesterfield, smeenai, cfe-commits

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

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

6 years ago[OPENMP] Do not emit warning for implicitly declared target functions.
Alexey Bataev [Wed, 2 May 2018 17:39:00 +0000 (17:39 +0000)]
[OPENMP] Do not emit warning for implicitly declared target functions.

Since upcoming OpenMP 5.0 functions can be mapped implicitly as declare
target and we should not emit warnings for such functions.

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

6 years ago[OPENMP] Enable c++ exceptions outside of the target constructs iff they are
Alexey Bataev [Wed, 2 May 2018 16:52:07 +0000 (16:52 +0000)]
[OPENMP] Enable c++ exceptions outside of the target constructs iff they are
enabled for the host.

If the compilation for the host enables C++ exceptions, but they are not
supported by the device, we still need to allow the code with the
exception handling constructs outside of the target regions.

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

6 years agoAdd -foutline option to enable the MachineOutliner in AArch64
Jessica Paquette [Wed, 2 May 2018 16:42:51 +0000 (16:42 +0000)]
Add -foutline option to enable the MachineOutliner in AArch64

Since we've been working on productizing the MachineOutliner in AArch64, it
makes sense to provide a more user-friendly way to enable it.

This allows users of AArch64 to enable the outliner using -foutline instead
of -mllvm -enable-machine-outliner. Other, less mature implementations (e.g,
x86-64) can still enable the pass using the -mllvm option.

Also add a test to make sure it works.

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

6 years ago[OPENMP] Support C++ member functions in the device constructs.
Alexey Bataev [Wed, 2 May 2018 15:45:28 +0000 (15:45 +0000)]
[OPENMP] Support C++ member functions in the device constructs.

Added correct emission of the C++ member functions for the device
function when they are used in the device constructs.

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

6 years ago[analyzer] Fix filename in cross-file HTML report
Malcolm Parsons [Wed, 2 May 2018 14:26:12 +0000 (14:26 +0000)]
[analyzer] Fix filename in cross-file HTML report

Summary:
The filename is currently taken from the start of the path, while the
line and column are taken from the end of the path.
This didn't matter until cross-file path reporting was added.

Reviewers: george.karpenkov, dcoughlin, vlad.tsyrklevich

Reviewed By: george.karpenkov, vlad.tsyrklevich

Subscribers: xazax.hun, szepet, a.sidorin, cfe-commits

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

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

6 years ago[OPENMP] Emit names of the globals depending on target.
Alexey Bataev [Wed, 2 May 2018 14:20:50 +0000 (14:20 +0000)]
[OPENMP] Emit names of the globals depending on target.

Some symbols are not allowed to be used as names on some targets. Patch
ries to unify the emission of the names of LLVM globals so they could be
used on different targets.

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

6 years ago[analyzer] Add `TaintBugVisitor` to the ArrayBoundV2, DivideZero and VLASize.
Henry Wong [Wed, 2 May 2018 12:11:22 +0000 (12:11 +0000)]
[analyzer] Add `TaintBugVisitor` to the ArrayBoundV2, DivideZero and VLASize.

Summary: Add `TaintBugVisitor` to the ArrayBoundV2, DivideZero, VLASize to be able to indicate where the taint information originated from.

Reviewers: NoQ, george.karpenkov, xazax.hun, a.sidorin

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, cfe-commits, MTC

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

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

6 years ago[ASTImporter] Fix isa cast assert
Peter Szecsi [Wed, 2 May 2018 11:52:54 +0000 (11:52 +0000)]
[ASTImporter] Fix isa cast assert

Do early return if we can't import the found decl for a member expr.
This follows the pre-existing scheme, e.g with E->getMemberDecl().
E->getFoundDecl().getDecl() can be null when a member expression does
not involve lookup. It may involve a lookup in case of a using directive
which refers to a member function in a base class template.

We faced this assert during the CTU analysis of google::protobuf v3.5.2.
We tried hard to synthesize a minimal test example both by hand and by
executing creduce on multiple files. Unfortunately, we were unable to reduce
to such a minimal example, yet. Nevertheless, this fix solved the problem in
protobuf.

To reproduce the error one must execute the analyzer with
-Xclang -analyzer-config -Xclang experimental-enable-naive-ctu-analysis=true -Xclang -analyzer-config -Xclang ctu-dir=/path/to/ctu_dir

Patch by Gabor Marton!

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

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

6 years ago[Modules] Allow @import to reach submodules in private module maps
Bruno Cardoso Lopes [Wed, 2 May 2018 02:25:03 +0000 (02:25 +0000)]
[Modules] Allow @import to reach submodules in private module maps

A @import targeting a top level module from a private module map file
(@import Foo_Private), would fail if there's any submodule declaration
around (module Foo.SomeSub) in the same private module map.

This happens because compileModuleImpl, when building Foo_Private, will
start with the private module map and will not parse the public one,
which leads to unsuccessful parsing of Foo.SomeSub, since top level Foo
was never parsed.

Declaring other submodules in the private module map is not common and
should usually be avoided, but it shouldn't fail to build. Canonicalize
compileModuleImpl to always look at the public module first, so that all
necessary information is available when parsing the private one.

rdar://problem/39822328

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

6 years agoTrack skipped files in dependency scanning.
Volodymyr Sapsai [Tue, 1 May 2018 23:59:33 +0000 (23:59 +0000)]
Track skipped files in dependency scanning.

It's possible for a header to be a symlink to another header. In this
case both will be represented by clang::FileEntry with the same UID and
they'll use the same clang::HeaderFileInfo.

If you include both headers and use some single-inclusion mechanism
like a header guard or #import, one header will get a FileChanged
callback, and another FileSkipped.

So that we get an accurate dependency file, we therefore need to also
implement the FileSkipped callback in dependency scanning.

Patch by Pete Cooper.

Reviewers: bruno, pete

Reviewed By: bruno

Subscribers: cfe-commits, jkorous, vsapsai

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

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

6 years agoThis test fails if there is no integrated assembler, so change the -c option to ...
Douglas Yung [Tue, 1 May 2018 23:32:09 +0000 (23:32 +0000)]
This test fails if there is no integrated assembler, so change the -c option to -S as it is not important to the test and allows it to pass when there is no integrated assembler.

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

6 years ago[libclang] Fix the type of 'int (Foo);'
Shoaib Meenai [Tue, 1 May 2018 20:45:25 +0000 (20:45 +0000)]
[libclang] Fix the type of 'int (Foo);'

libclang exposes the type of 'int (Foo);' (a global variable of type int
called Foo) as CXType_Unexposed. This is because Clang represents Foo's
type as ParenType{BuiltinType{Int}}, and libclang does not handle
ParenType.

Make libclang return CXType_Int as the type of 'int (Foo);' by
unwrapping ParenType transparently.

Patch by Matt Glazar.

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

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

6 years ago[ARM] Remove redundant #if in test. NFC
Shoaib Meenai [Tue, 1 May 2018 20:38:05 +0000 (20:38 +0000)]
[ARM] Remove redundant #if in test. NFC

Both sides of this #if #include the same file. Drop the #if, leaving only the #include.

Patch by Matt Glazar.

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

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

6 years agoFix bogus MSVC char8_t mangling.
Richard Smith [Tue, 1 May 2018 18:50:15 +0000 (18:50 +0000)]
Fix bogus MSVC char8_t mangling.

This appears to have been caused by a bad automatic svn merge with r330225
attaching the 'case' label to the wrong block of code. :(

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

6 years agoDriver: fix an assertion with `-print-prog-name=`
Saleem Abdulrasool [Tue, 1 May 2018 18:40:42 +0000 (18:40 +0000)]
Driver: fix an assertion with `-print-prog-name=`

Fix an assertion when -print-prog-name= is invoked without parameter.
Returns an empty string.

Patch by Christian Bruel!

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

6 years agoUpdate existed CodeGen TBAA tests
Danil Malyshev [Tue, 1 May 2018 18:14:36 +0000 (18:14 +0000)]
Update existed CodeGen TBAA tests

Reviewers: hfinkel, kosarev, rjmccall

Reviewed By: rjmccall

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

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

6 years agoAdd Microsoft Mangling for OpenCL Half Type
Erich Keane [Tue, 1 May 2018 14:16:15 +0000 (14:16 +0000)]
Add Microsoft Mangling for OpenCL Half Type

Half-type mangling is accomplished following the method introduced by Erich
Keane for mangling _Float16. Updated the half.cl LIT test to cover this
particular case.

Patch By: vbridgers

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

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

6 years ago[OPENMP] Emit template instatiation|specialization functions for
Alexey Bataev [Tue, 1 May 2018 14:09:46 +0000 (14:09 +0000)]
[OPENMP] Emit template instatiation|specialization functions for
devices.

If the function is an instantiation|specialization of the template and
is used in the device code, the definitions of such functions should be
emitted for the device.

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

6 years ago[X86] directstore and movdir64b intrinsics
Gabor Buella [Tue, 1 May 2018 10:05:42 +0000 (10:05 +0000)]
[X86] directstore and movdir64b intrinsics

Reviewers: spatel, craig.topper, RKSimon

Reviewed By: craig.topper

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

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

6 years agoFix up r331244 - the emitted definition is weak_odr linkage. Should get
Chandler Carruth [Tue, 1 May 2018 06:48:30 +0000 (06:48 +0000)]
Fix up r331244 - the emitted definition is weak_odr linkage. Should get
the build bots to healthy again without a full revert. As the
functionality added has nothing to do with linkage this seems unlikely
to represent a deep or interesting bug in the patch.

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

6 years agoImplement P0482R2, support for char8_t type.
Richard Smith [Tue, 1 May 2018 05:02:45 +0000 (05:02 +0000)]
Implement P0482R2, support for char8_t type.

This is not yet part of any C++ working draft, and so is controlled by the flag
-fchar8_t rather than a -std= flag. (The GCC implementation is controlled by a
flag with the same name.)

This implementation is experimental, and will be removed or revised
substantially to match the proposal as it makes its way through the C++
committee.

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

6 years ago[ShadowCallStack] fix the docs
Kostya Serebryany [Tue, 1 May 2018 00:15:56 +0000 (00:15 +0000)]
[ShadowCallStack] fix the docs

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

6 years ago[Modules] Fix testcases from r331232
Bruno Cardoso Lopes [Mon, 30 Apr 2018 22:57:02 +0000 (22:57 +0000)]
[Modules] Fix testcases from r331232

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