Florian Hahn [Wed, 20 Dec 2017 15:50:52 +0000 (15:50 +0000)]
[Complex] Don't use __div?c3 when building with fast-math.
Summary: Plant an inline version of "((ac+bd)/(cc+dd)) + i((bc-ad)/(cc+dd))" instead.
Patch by Paul Walker.
Reviewed By: hfinkel
Differential Revision: https://reviews.llvm.org/D40299
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321183
91177308-0d34-0410-b5e6-
96231b3b80d8
Ilya Biryukov [Wed, 20 Dec 2017 14:32:38 +0000 (14:32 +0000)]
[Frontend] Handle skipped bodies in template instantiations
Summary:
- Fixed an assert in Sema::InstantiateFunctionDefinition and added
support for instantiating a function template with skipped body.
- Properly call setHasSkippedBody for FunctionTemplateDecl passed to
Sema::ActOnSkippedFunctionBody.
Reviewers: sepavloff, bkramer
Reviewed By: sepavloff
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D41237
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321174
91177308-0d34-0410-b5e6-
96231b3b80d8
Pavel Labath [Wed, 20 Dec 2017 11:34:38 +0000 (11:34 +0000)]
Remove llvm::MemoryBuffer const_casts
Summary:
llvm has grown a WritableMemoryBuffer class, which is convertible
(inherits from) a MemoryBuffer. We can use it to avoid conts_casting the
buffer contents when we want to write to it.
Reviewers: dblaikie, rsmith
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D41387
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321167
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Wed, 20 Dec 2017 02:31:30 +0000 (02:31 +0000)]
[darwin][driver] Warn about mismatching -<os>-version-min rather than
superfluous -<os>-version-min compiler option
rdar://
35813850
Differential Revision: https://reviews.llvm.org/D41425
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321145
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Wed, 20 Dec 2017 01:47:08 +0000 (01:47 +0000)]
Revert r320942, "[ASTImporter] Support importing FunctionTemplateDecl and CXXDependentScopeMemberExpr"
Caused a test failure on Windows:
[ RUN ] ImportExpr.ImportCXXDependentScopeMemberExpr
C:\b\rr\tmppzcp4w\w\src\third_party\llvm\tools\clang\unittests\AST\ASTImporterTest.cpp(526): error: Value of: testImport("template <typename T> class C { T t; };" "template <typename T> void declToImport() {" " C<T> d;" " d.t;" "}", Lang_CXX, "", Lang_CXX, Verifier, functionTemplateDecl(has(functionDecl(has(compoundStmt( has(cxxDependentScopeMemberExpr())))))))
Actual: false (Could not find match)
Expected: true
C:\b\rr\tmppzcp4w\w\src\third_party\llvm\tools\clang\unittests\AST\ASTImporterTest.cpp(534): error: Value of: testImport("template <typename T> class C { T t; };" "template <typename T> void declToImport() {" " C<T> d;" " (&d)->t;" "}", Lang_CXX, "", Lang_CXX, Verifier, functionTemplateDecl(has(functionDecl(has(compoundStmt( has(cxxDependentScopeMemberExpr())))))))
Actual: false (Could not find match)
Expected: true
[ FAILED ] ImportExpr.ImportCXXDependentScopeMemberExpr (37 ms)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321139
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Wed, 20 Dec 2017 01:17:53 +0000 (01:17 +0000)]
[analyzer] De-duplicate path diagnostics for each exploded graph node.
The bugreporter::trackNullOrUndefValue() mechanism contains a system of bug
reporter visitors that recursively call each other in order to track where a
null or undefined value came from, where each visitor represents a particular
tracking mechanism (track how the value was stored, track how the value was
returned from a function, track how the value was constrained to null, etc.).
Each visitor is only added once per value it needs to track. Almost. One
exception from this rule would be FindLastStoreBRVisitor that has two operation
modes: it contains a flag that indicates whether null stored values should be
suppressed. Two instances of FindLastStoreBRVisitor with different values of
this flag are considered to be different visitors, so they can be added twice
and produce the same diagnostic twice. This was indeed the case in the affected
test.
With the current logic of this whole machinery, such duplication seems
unavoidable. We should be able to safely add visitors with different flag
values without constructing duplicate diagnostic pieces. Hence the effort
in this commit to de-duplicate diagnostics regardless of what visitors
have produced them.
Differential Revision: https://reviews.llvm.org/D41258
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321135
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Wed, 20 Dec 2017 01:03:22 +0000 (01:03 +0000)]
[analyzer] trackNullOrUndefValue: always track through parentheses and casts.
When trying to figure out where a null or undefined value came from,
parentheses and cast expressions are either completely irrelevant, or,
in the case of lvalue-to-rvale cast, straightforwardly lead us in the right
direction when we remove them.
There is a regression that causes a certain diagnostic to appear twice in the
path-notes.cpp test (changed to FIXME). It would be addressed in the next
commit.
Differential revision: https://reviews.llvm.org/D41254
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321133
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Wed, 20 Dec 2017 00:47:17 +0000 (00:47 +0000)]
[analyzer] trackNullOrUndefValue: track last store to non-variables.
When reporting certain kinds of analyzer warnings, we use the
bugreporter::trackNullOrUndefValue mechanism, which is part of public checker
API, to understand where a zero, null-pointer, or garbage value came from,
which would highlight important events with respect to that value in the
diagnostic path notes, and help us suppress various false positives that result
from values appearing from particular sources.
Previously, we've lost track of the value when it was written into a memory
region that is not a plain variable. Now try to resume tracking in this
situation by finding where the last write to this region has occured.
Differential revision: https://reviews.llvm.org/D41253
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321130
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Wed, 20 Dec 2017 00:46:09 +0000 (00:46 +0000)]
[X86] Add more CPUID bits to cpuid.h to match gcc and support icelake features.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321129
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Wed, 20 Dec 2017 00:40:38 +0000 (00:40 +0000)]
[analyzer] Fix a crash during C++17 aggregate construction of base objects.
Since C++17, classes that have base classes can potentially be initialized as
aggregates. Trying to construct such objects through brace initialization was
causing the analyzer to crash when the base class has a non-trivial constructor,
while figuring target region for the base class constructor, because the parent
stack frame didn't contain the constructor of the subclass, because there is
no constructor for subclass, merely aggregate initialization.
This patch avoids the crash, but doesn't provide the actually correct region
for the constructor, which still remains to be fixed. Instead, construction
goes into a fake temporary region which would be immediately discarded. Similar
extremely conservative approach is used for other cases in which the logic for
finding the target region is not yet implemented, including aggregate
initialization with fields instead of base-regions (which is not C++17-specific
but also never worked, just didn't crash).
Differential revision: https://reviews.llvm.org/D40841
rdar://problem/
35441058
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321128
91177308-0d34-0410-b5e6-
96231b3b80d8
Adrian Prantl [Tue, 19 Dec 2017 22:21:48 +0000 (22:21 +0000)]
Add explicit break (PR35700).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321116
91177308-0d34-0410-b5e6-
96231b3b80d8
Adrian Prantl [Tue, 19 Dec 2017 22:06:11 +0000 (22:06 +0000)]
Silence a bunch of implicit fallthrough warnings
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321115
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Tue, 19 Dec 2017 19:56:14 +0000 (19:56 +0000)]
[driver][darwin] Set the 'simulator' environment when it's specified
in '-target'
rdar://
35742458
Differential Revision: https://reviews.llvm.org/D41076
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321102
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Tue, 19 Dec 2017 19:05:04 +0000 (19:05 +0000)]
[driver][darwin] Take the OS version specified in "-target" as the target
OS instead of inferring it from SDK / environment
The OS version is specified in -target should be used instead of the one in an
environment variable / SDK name.
rdar://
35813850
Differential Revision: https://reviews.llvm.org/D40998
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321099
91177308-0d34-0410-b5e6-
96231b3b80d8
Jonas Devlieghere [Tue, 19 Dec 2017 17:16:45 +0000 (17:16 +0000)]
[clang] -foptimization-record-file= should imply -fsave-optimization-record
The Clang option -foptimization-record-file= controls which file an
optimization record is output to. Optimization records are output if you
use the Clang option -fsave-optimization-record. If you specify the
first option without the second, you get a warning that the command line
argument was unused. Passing -foptimization-record-file= should imply
-fsave-optimization-record.
This fixes PR33670
Patch by: Dmitry Venikov <venikov@phystech.edu>
Differential revision: https://reviews.llvm.org/D39834
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321090
91177308-0d34-0410-b5e6-
96231b3b80d8
Walter Lee [Tue, 19 Dec 2017 16:34:13 +0000 (16:34 +0000)]
Add renamed .o files that were omitted by "git llvm push" command
Original commit is at: https://reviews.llvm.org/D41295.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321082
91177308-0d34-0410-b5e6-
96231b3b80d8
Walter Lee [Tue, 19 Dec 2017 16:19:11 +0000 (16:19 +0000)]
Rename sparc-myriad-elf triplet to sparc-myriad-rtems
Summary: This is to be consistent with latest Movidius MDK releases.
Also, don't inherit any gcc paths for shave triple.
Reviewers: jyknight
Subscribers: emaste, fedor.sergeev
Differential Revision: https://reviews.llvm.org/D41295
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321080
91177308-0d34-0410-b5e6-
96231b3b80d8
Kamil Rytarowski [Tue, 19 Dec 2017 07:10:33 +0000 (07:10 +0000)]
Teach clang/NetBSD about additional dependencies for sanitizers
Summary:
Sanitizers on NetBSD require additional linkage:
- libutil for forkpty(3)
- libexecinfo for backtrace(3)
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, eugenis, vitalybuka, kcc
Reviewed By: eugenis
Subscribers: #sanitizers, cfe-commits
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D41054
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321060
91177308-0d34-0410-b5e6-
96231b3b80d8
Eli Friedman [Tue, 19 Dec 2017 01:54:09 +0000 (01:54 +0000)]
[Coverage] Fix use-after free in coverage emission
Fixes regression from r320533.
This fixes the undefined behavior, but I'm not sure it's really right...
I think we end up with missing coverage for code in modules.
Differential Revision: https://reviews.llvm.org/D41374
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321052
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Mon, 18 Dec 2017 21:40:07 +0000 (21:40 +0000)]
[hwasan] update the design doc
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321027
91177308-0d34-0410-b5e6-
96231b3b80d8
Dimitry Andric [Mon, 18 Dec 2017 19:46:56 +0000 (19:46 +0000)]
Fix more inconsistent line endings. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321016
91177308-0d34-0410-b5e6-
96231b3b80d8
Ivan A. Kosarev [Mon, 18 Dec 2017 16:50:11 +0000 (16:50 +0000)]
Fix the reference to the now renamed member of TBAAStructField
See https://reviews.llvm.org/D39956 for details.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320994
91177308-0d34-0410-b5e6-
96231b3b80d8
Stephan Bergmann [Mon, 18 Dec 2017 13:51:48 +0000 (13:51 +0000)]
Revert r320978 "No -fsanitize=function warning when calling noexcept function through non-noexcept pointer in C++17"
At least <http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/
builds/6013/steps/annotate/logs/stdio> complains about
__ubsan::__ubsan_handle_function_type_mismatch_abort (compiler-rt
lib/ubsan/ubsan_handlers.cc) returning now despite being declared 'noreturn', so
looks like a different approach is needed for the function_type_mismatch check
to be called also in cases that may ultimately succeed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320982
91177308-0d34-0410-b5e6-
96231b3b80d8
Stephan Bergmann [Mon, 18 Dec 2017 13:05:42 +0000 (13:05 +0000)]
No -fsanitize=function warning when calling noexcept function through non-noexcept pointer in C++17
As discussed in the mail thread <https://groups.google.com/a/isocpp.org/forum/
#!topic/std-discussion/T64_dW3WKUk> "Calling noexcept function throug non-
noexcept pointer is undefined behavior?", such a call should not be UB.
However, Clang currently warns about it.
There is no cheap check whether two function type_infos only differ in noexcept,
so pass those two type_infos as additional data to the function_type_mismatch
handler (with the optimization of passing a null "static callee type" info when
that is already noexcept, so the additional check can be avoided anyway). For
the Itanium ABI (which appears to be the only one that happens to be used on
platforms that support -fsanitize=function, and which appears to only record
noexcept information for pointer-to-function type_infos, not for function
type_infos themselves), we then need to check the mangled names for occurrence
of "Do" representing "noexcept".
This is the cfe part of a patch covering both cfe and compiler-rt.
Differential Revision: https://reviews.llvm.org/D40720
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320978
91177308-0d34-0410-b5e6-
96231b3b80d8
Martin Bohme [Mon, 18 Dec 2017 11:29:21 +0000 (11:29 +0000)]
[X86] Use {{.*}} instead of hardcoded %1 in knot test.
This makes the test more resilient and consistent with the other tests
introduced in r320919.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320971
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sun, 17 Dec 2017 23:52:45 +0000 (23:52 +0000)]
Refactor overridden methods iteration to avoid double lookups.
Convert most uses to range-for loops. No functionality change intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320954
91177308-0d34-0410-b5e6-
96231b3b80d8
Aleksei Sidorin [Sun, 17 Dec 2017 14:16:17 +0000 (14:16 +0000)]
[ASTImporter] Support importing FunctionTemplateDecl and CXXDependentScopeMemberExpr
* Also introduces ImportTemplateArgumentListInfo facility (A. Sidorin)
Patch by Peter Szecsi!
Differential Revision: https://reviews.llvm.org/D38692
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320942
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Sat, 16 Dec 2017 16:11:17 +0000 (16:11 +0000)]
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320920
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 16 Dec 2017 08:26:22 +0000 (08:26 +0000)]
[X86] Implement kand/kandn/kor/kxor/kxnor/knot intrinsics using native IR.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320919
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 16 Dec 2017 06:10:24 +0000 (06:10 +0000)]
[X86] Add the two files I forgot to commit in r320915.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320916
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 16 Dec 2017 06:02:31 +0000 (06:02 +0000)]
[X86] Add builtins and tests for 128 and 256 bit vpopcntdq.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320915
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Sat, 16 Dec 2017 02:23:22 +0000 (02:23 +0000)]
[VerifyDiagnosticConsumer] support -verify=<prefixes>
This mimics FileCheck's --check-prefixes option.
The default prefix is "expected". That is, "-verify" is equivalent to
"-verify=expected".
The goal is to permit exercising a single test suite source file with different
compiler options producing different sets of diagnostics. While cpp can be
combined with the existing -verify to accomplish the same goal, source is often
easier to maintain when it's not cluttered with preprocessor directives or
duplicate passages of code. For example, this patch also rewrites some existing
clang tests to demonstrate the benefit of this feature.
Patch by Joel E. Denny, thanks!
Differential Revision: https://reviews.llvm.org/D39694
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320908
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Sat, 16 Dec 2017 01:40:19 +0000 (01:40 +0000)]
[TextDiagnosticBuffer] Fix diagnostic note emission order
The frontend currently groups diagnostics from the command line according to
diagnostic level, but that places all notes last. Fix that by emitting such
diagnostics in the order they were generated.
Patch by Joel E. Denny, thanks!
Differential Revision: https://reviews.llvm.org/D40995
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320904
91177308-0d34-0410-b5e6-
96231b3b80d8
Vedant Kumar [Sat, 16 Dec 2017 01:28:25 +0000 (01:28 +0000)]
[CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)
This patch introduces a specialized way to lower overflow-checked
multiplications with mixed-sign operands. This fixes link failures and
ICEs on code like this:
void mul(int64_t a, uint64_t b) {
int64_t res;
__builtin_mul_overflow(a, b, &res);
}
The generic checked-binop irgen would use a 65-bit multiplication
intrinsic here, which requires runtime support for _muloti4 (128-bit
multiplication), and therefore fails to link on i386. To get an ICE
on x86_64, change the example to use __int128_t / __uint128_t.
Adding runtime and backend support for 65-bit or 129-bit checked
multiplication on all of our supported targets is infeasible.
This patch solves the problem by using simpler, specialized irgen for
the mixed-sign case.
llvm.org/PR34920, rdar://
34963321
Testing: Apart from check-clang, I compared the output from this fairly
comprehensive test driver using unpatched & patched clangs:
https://gist.github.com/vedantk/
3eb9c88f82e5c32f2e590555b4af5081
Differential Revision: https://reviews.llvm.org/D41149
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320902
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Fri, 15 Dec 2017 20:07:53 +0000 (20:07 +0000)]
__is_target_environment: Check the environment after parsing it
This ensures that target triples with environment versions can still work with
__is_target_environment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320854
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Fri, 15 Dec 2017 19:58:38 +0000 (19:58 +0000)]
__is_target_arch: Check the arch and subarch instead of the arch name
This ensures that when compiling for "arm64" __is_target_arch will succeed for
both "arm64" and "aarch64".
Thanks to Bob Wilson who pointed this out!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320853
91177308-0d34-0410-b5e6-
96231b3b80d8
Erich Keane [Fri, 15 Dec 2017 16:37:14 +0000 (16:37 +0000)]
Remove "FunctionName -" from docs on FunctionDecl(NFC)
Removed the repetative usage of the operator name on the
documentation for FunctionDecl. Also reflowed some of the
comments since this changes the 80 character rule.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320829
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Fri, 15 Dec 2017 16:28:31 +0000 (16:28 +0000)]
[OPENMP] Codegen `declare simd` for function declarations.
Previously the attributes were emitted only for function definitions.
Patch adds emission of the attributes for function declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320826
91177308-0d34-0410-b5e6-
96231b3b80d8
Ilya Biryukov [Fri, 15 Dec 2017 11:27:51 +0000 (11:27 +0000)]
[clang] Add PPCallbacks list to preprocessor when building a preacompiled preamble.
Summary:
Revision D38639 needs this commit in order to properly make open
definition calls on include statements work.
Patch by William Enright.
Reviewers: malaperle, krasimir, bkramer, ilya-biryukov
Reviewed By: malaperle, ilya-biryukov
Subscribers: cfe-commits, arphaman, ilya-biryukov
Differential Revision: https://reviews.llvm.org/D39375
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320804
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Thu, 14 Dec 2017 23:40:42 +0000 (23:40 +0000)]
Remove duplicate python libclang changes from r320748
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320766
91177308-0d34-0410-b5e6-
96231b3b80d8
Erich Keane [Thu, 14 Dec 2017 23:37:08 +0000 (23:37 +0000)]
Correct UnaryTransformTypeLoc to properly initialize.
The initializeLocal function of UnaryTransformTypeLoc missed
the UnderlyingTInfo member. This caused a null-dereference
issue, as reported in PR23421. This patch correctly initializss
the UnderlyingTInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320765
91177308-0d34-0410-b5e6-
96231b3b80d8
Vassil Vassilev [Thu, 14 Dec 2017 23:30:18 +0000 (23:30 +0000)]
D40901: Refactor lazy loading of template specializations. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320763
91177308-0d34-0410-b5e6-
96231b3b80d8
Dimitry Andric [Thu, 14 Dec 2017 22:32:24 +0000 (22:32 +0000)]
Don't trigger -Wuser-defined-literals for system headers
Summary:
In D41064, I proposed adding `#pragma clang diagnostic ignored
"-Wuser-defined-literals"` to some of libc++'s headers, since these
warnings are now triggered by clang's new `-std=gnu++14` default:
```
$ cat test.cpp
#include <string>
$ clang -std=c++14 -Wsystem-headers -Wall -Wextra -c test.cpp
In file included from test.cpp:1:
In file included from /usr/include/c++/v1/string:470:
/usr/include/c++/v1/string_view:763:29: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
basic_string_view<char> operator "" sv(const char *__str, size_t __len)
^
/usr/include/c++/v1/string_view:769:32: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
basic_string_view<wchar_t> operator "" sv(const wchar_t *__str, size_t __len)
^
/usr/include/c++/v1/string_view:775:33: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
basic_string_view<char16_t> operator "" sv(const char16_t *__str, size_t __len)
^
/usr/include/c++/v1/string_view:781:33: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
basic_string_view<char32_t> operator "" sv(const char32_t *__str, size_t __len)
^
In file included from test.cpp:1:
/usr/include/c++/v1/string:4012:24: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
basic_string<char> operator "" s( const char *__str, size_t __len )
^
/usr/include/c++/v1/string:4018:27: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
basic_string<wchar_t> operator "" s( const wchar_t *__str, size_t __len )
^
/usr/include/c++/v1/string:4024:28: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
basic_string<char16_t> operator "" s( const char16_t *__str, size_t __len )
^
/usr/include/c++/v1/string:4030:28: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals]
basic_string<char32_t> operator "" s( const char32_t *__str, size_t __len )
^
8 warnings generated.
```
Both @aaron.ballman and @mclow.lists felt that adding this workaround to
the libc++ headers was the wrong way, and it should be fixed in clang
instead.
Here is a proposal to do just that. I verified that this suppresses the
warning, even when -Wsystem-headers is used, and that the warning is
still emitted for a declaration outside of system headers.
Reviewers: aaron.ballman, mclow.lists, rsmith
Reviewed By: aaron.ballman
Subscribers: mclow.lists, aaron.ballman, andrew, emaste, cfe-commits
Differential Revision: https://reviews.llvm.org/D41080
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320755
91177308-0d34-0410-b5e6-
96231b3b80d8
Yi Kong [Thu, 14 Dec 2017 22:24:45 +0000 (22:24 +0000)]
[ThreadSafetyAnalysis] Fix isCapabilityExpr
There are many more expr types that can be a capability expr, like
CXXThisExpr, CallExpr, MemberExpr. Instead of enumerating all of them,
just check typeHasCapability for any type given.
Also add & and * operators to allowed unary operators.
Differential Revision: https://reviews.llvm.org/D41224
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320753
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Thu, 14 Dec 2017 22:17:09 +0000 (22:17 +0000)]
Harmonize GNU- and C++-style attribute spellings.
Most attributes will now use the Clang<"name"> construct to provide both __attribute__((name)) and [[clang::name]] syntaxes for the attribute. Attributes deviating from this should be marked with a comment explaining why they are not supported under both spellings. Common reasons are: the attribute is provided by some other specification that controls the syntax or the attribute cannot be exposed under a particular spelling for some given reason.
Because this is a mechanical change that only introduces new spellings, there are no test cases for the commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320752
91177308-0d34-0410-b5e6-
96231b3b80d8
Don Hinton [Thu, 14 Dec 2017 22:12:46 +0000 (22:12 +0000)]
[debuginfo] Remove temporary FIXME.
Summary:
Now that r320495, "[debuginfo-tests] Support moving
debuginfo-tests to llvm/projects," has landed, remove temporary FIXME
that supported the old mechanism.
Reviewers: zturner, aprantl
Reviewed By: aprantl
Subscribers: JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D41259
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320751
91177308-0d34-0410-b5e6-
96231b3b80d8
Zachary Turner [Thu, 14 Dec 2017 22:07:03 +0000 (22:07 +0000)]
Fix many -Wsign-compare and -Wtautological-constant-compare warnings.
Most of the -Wsign-compare warnings are due to the fact that
enums are signed by default in the MS ABI, while the
tautological comparison warnings trigger on x86 builds where
sizeof(size_t) is 4 bytes, so N > numeric_limits<unsigned>::max()
is always false.
Differential Revision: https://reviews.llvm.org/D41256
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320750
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Thu, 14 Dec 2017 22:01:50 +0000 (22:01 +0000)]
[libclang] Add support for checking abstractness of records
This patch allows checking whether a C++ record declaration is abstract through
libclang and clang.cindex (Python).
Patch by Johann Klähn!
Differential Revision: https://reviews.llvm.org/D36952
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320748
91177308-0d34-0410-b5e6-
96231b3b80d8
Ben Hamilton [Thu, 14 Dec 2017 21:44:11 +0000 (21:44 +0000)]
Revert "[ClangFormat] IndentWrappedFunctionNames should be true in the google ObjC style"
This reverts commit
37e69667f748e1458b46483b7c1b8f9ba33eec44.
We're going to discuss its ramifications further before making a
conclusion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320747
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Thu, 14 Dec 2017 19:22:41 +0000 (19:22 +0000)]
Commit missing tests for r320734
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320735
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Thu, 14 Dec 2017 19:22:02 +0000 (19:22 +0000)]
[Preprocessor] Implement __is_target_{arch|vendor|os|environment} function-like
builtin macros
This patch implements the __is_target_arch, __is_target_vendor, __is_target_os,
and __is_target_environment Clang preprocessor extensions that were proposed by
@compnerd in Bob's cfe-dev post:
http://lists.llvm.org/pipermail/cfe-dev/2017-November/056166.html.
These macros can be used to examine the components of the target triple at
compile time. A has_builtin(is_target_???) preprocessor check can be used to
check for their availability.
__is_target_arch allows you to check if an arch is specified without worring
about a specific subarch, e.g.
__is_target_arch(arm) returns 1 for the target arch "armv7"
__is_target_arch(armv7) returns 1 for the target arch "armv7"
__is_target_arch(armv6) returns 0 for the target arch "armv7"
__is_target_vendor and __is_target_environment match the specific vendor
or environment. __is_target_os matches the specific OS, but
__is_target_os(darwin) will match any Darwin-based OS. "Unknown" can be used
to test if the triple's component is specified.
rdar://
35753116
Differential Revision: https://reviews.llvm.org/D41087
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320734
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Thu, 14 Dec 2017 19:00:21 +0000 (19:00 +0000)]
[CodeGen][X86] Implement _InterlockedCompareExchange128 intrinsic
Summary:
InterlockedCompareExchange128 is a bit more complicated than the other
InterlockedCompareExchange functions, so it requires a bit more work. It
doesn't directly refer to 128bit ints, instead it takes pointers to
64bit ints for Destination and ComparandResult, and exchange is taken as
two 64bit ints (high & low). The previous value is written to
ComparandResult, and success is returned. This implementation does the
following in order to produce a cmpxchg instruction:
1. Cast everything to 128bit ints or int pointers, and glues together
the Exchange values
2. Reads from CompareandResult to get the comparand
3. Calls cmpxchg volatile (on X86 this will produce a lock cmpxchg16b
instruction)
1. Result 0 (previous value) is written back to ComparandResult
2. Result 1 (success bool) is zext'ed to a uchar and returned
Resolves bug https://llvm.org/PR35251
Patch by Colden Cullen!
Reviewers: rnk, agutowski
Reviewed By: rnk
Subscribers: majnemer, cfe-commits
Differential Revision: https://reviews.llvm.org/D41032
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320730
91177308-0d34-0410-b5e6-
96231b3b80d8
John McCall [Thu, 14 Dec 2017 18:21:14 +0000 (18:21 +0000)]
In an ARC lambda-to-block conversion thunk, reclaim the return value of
the lambda so that we don't over-release it.
Patch by Dan Zimmerman!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320721
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Thu, 14 Dec 2017 17:00:17 +0000 (17:00 +0000)]
[OPENMP] Add codegen for target data constructs with `nowait` clause.
Added codegen for the `nowait` clause in target data constructs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320717
91177308-0d34-0410-b5e6-
96231b3b80d8
Ben Hamilton [Thu, 14 Dec 2017 16:17:38 +0000 (16:17 +0000)]
[ClangFormat] IndentWrappedFunctionNames should be true in the google ObjC style
Summary:
If we write the following code, it goes over 100 columns, so we need to wrap it:
```
- (VeryLongReturnTypeName)veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName
longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;
```
Currently, clang-format with the google style aligns the method parameter names on the first column:
```
- (VeryLongReturnTypeName)
veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName
longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;
```
We'd like clang-format in the google style to align these to column 4 for Objective-C:
```
- (VeryLongReturnTypeName)
veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName
longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;
```
Test Plan: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests
Reviewers: krasimir, djasper, klimek
Reviewed By: djasper
Subscribers: cfe-commits, thakis
Differential Revision: https://reviews.llvm.org/D41195
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320714
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Thu, 14 Dec 2017 15:40:16 +0000 (15:40 +0000)]
When attempting to complete an incomplete array bound type in an expression,
update the type from the definition even if we didn't instantiate a definition.
We may have instantiated the definition in an earlier stage of semantic
analysis, after creating the DeclRefExpr but before we reach a point where a
complete expression type is required.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320709
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Thu, 14 Dec 2017 15:16:18 +0000 (15:16 +0000)]
[c++20] P0515R3: Parsing support and basic AST construction for operator <=>.
Adding the new enumerator forced a bunch more changes into this patch than I
would have liked. The -Wtautological-compare warning was extended to properly
check the new comparison operator, clang-format needed updating because it uses
precedence levels as weights for determining where to break lines (and several
operators increased their precedence levels with this change), thread-safety
analysis needed changes to build its own IL properly for the new operator.
All "real" semantic checking for this operator has been deferred to a future
patch. For now, we use the relational comparison rules and arbitrarily give
the builtin form of the operator a return type of 'void'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320707
91177308-0d34-0410-b5e6-
96231b3b80d8
Ilya Biryukov [Thu, 14 Dec 2017 14:51:17 +0000 (14:51 +0000)]
Renamed test file to use proper naming convention
Also changed the order of CHECK statements.
CHEKC-NOT must come before CHECK in skipped-function-bodies.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320702
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Thu, 14 Dec 2017 13:15:08 +0000 (13:15 +0000)]
Warn if we find a Unicode homoglyph for a symbol in an identifier.
Specifically, warn if:
* we find a character that the language standard says we must treat as an
identifier, and
* that character is not reasonably an identifier character (it's a punctuation
character or similar), and
* it renders identically to a valid non-identifier character in common
fixed-width fonts.
Some tools "helpfully" substitute the surprising characters for the expected
characters, and replacing semicolons with Greek question marks is a common
"prank".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320697
91177308-0d34-0410-b5e6-
96231b3b80d8
Ilya Biryukov [Thu, 14 Dec 2017 13:00:33 +0000 (13:00 +0000)]
[Frontend] Treat function with skipped body as definition
Summary:
This fixes an invalid warning about missing definition of a function when
parsing with SkipFunctionBodies=true
Reviewers: bkramer, sepavloff
Reviewed By: sepavloff
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D41189
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320696
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Wed, 13 Dec 2017 21:53:04 +0000 (21:53 +0000)]
IRGen: When performing CFI checks, load vtable pointer from vbase when necessary.
Under the Microsoft ABI, it is possible for an object not to have
a virtual table pointer of its own if all of its virtual functions
were introduced by virtual bases. In that case, we need to load the
vtable pointer from one of the virtual bases and perform the type
check using its type.
Differential Revision: https://reviews.llvm.org/D41036
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320638
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Wed, 13 Dec 2017 21:04:20 +0000 (21:04 +0000)]
[OPENMP] Add codegen for `nowait` clause in target directives.
Added basic codegen for `nowait` clauses in target-based directives.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320613
91177308-0d34-0410-b5e6-
96231b3b80d8
Krzysztof Parzyszek [Wed, 13 Dec 2017 19:56:03 +0000 (19:56 +0000)]
[Hexagon] Intrinsic support for V62 and V65
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320609
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Wed, 13 Dec 2017 19:45:06 +0000 (19:45 +0000)]
[OPENMP] Initial codegen for `target teams distribute simd` directive.
Host + generic device codegen for `target teams distribute simd`
directive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320608
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Wed, 13 Dec 2017 17:31:39 +0000 (17:31 +0000)]
[OPENMP] Support `reduction` clause on target-based directives.
OpenMP 5.0 added support for `reduction` clause in target-based
directives. Patch adds this support to clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320596
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Wed, 13 Dec 2017 15:28:44 +0000 (15:28 +0000)]
[OPENMP] Fix handling of clauses in clause parsing mode.
The compiler may generate incorrect code if we try to capture the
variable in clause parsing mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320590
91177308-0d34-0410-b5e6-
96231b3b80d8
Krzysztof Parzyszek [Wed, 13 Dec 2017 13:48:07 +0000 (13:48 +0000)]
[Hexagon] Add front-end support for Hexagon V65
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320579
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Liu [Wed, 13 Dec 2017 10:26:49 +0000 (10:26 +0000)]
[Sema] Ignore decls in namespaces when global decls are not wanted.
Summary: ... in qualified code completion and decl lookup.
Reviewers: ilya-biryukov, arphaman
Reviewed By: ilya-biryukov
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D40562
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320563
91177308-0d34-0410-b5e6-
96231b3b80d8
Eli Friedman [Wed, 13 Dec 2017 00:14:17 +0000 (00:14 +0000)]
[Coverage] Always emit unused coverage mappings in the same order.
Non-determinism is confusing at best.
Differential Revision: https://reviews.llvm.org/D41140
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320533
91177308-0d34-0410-b5e6-
96231b3b80d8
Gheorghe-Teodor Bercea [Tue, 12 Dec 2017 21:38:43 +0000 (21:38 +0000)]
[OpenMP] Add function attribute for triggering data sharing.
Summary:
The backend should only emit data sharing code for the cases where it is needed.
A new function attribute is used by Clang to enable data sharing only for the cases where OpenMP semantics require it and there are variables that need to be shared.
Reviewers: hfinkel, Hahnfeld, ABataev, carlo.bertolli, caomhin
Reviewed By: ABataev
Subscribers: cfe-commits, jholewinski
Differential Revision: https://reviews.llvm.org/D41123
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320527
91177308-0d34-0410-b5e6-
96231b3b80d8
Kelvin Li [Tue, 12 Dec 2017 20:08:12 +0000 (20:08 +0000)]
[OpenMP] Diagnose function name on the link clause
This patch is to add diagnose when a function name is
specified on the link clause. According to the OpenMP
spec, only the list items that exclude the function
name are allowed on the link clause.
Differential Revision: https://reviews.llvm.org/D40968
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320521
91177308-0d34-0410-b5e6-
96231b3b80d8
Don Hinton [Tue, 12 Dec 2017 19:47:40 +0000 (19:47 +0000)]
[cmake] Follow-up to rL320494.
EXISTS requires full paths.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320519
91177308-0d34-0410-b5e6-
96231b3b80d8
Kelvin Li [Tue, 12 Dec 2017 18:33:39 +0000 (18:33 +0000)]
Add --cuda-path to mock a CUDA Toolkit installation to avoid
unexpected error messages for incompatibility between the
default SM level and the support in the installed toolkit.
Differential Revision: https://reviews.llvm.org/D40996
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320506
91177308-0d34-0410-b5e6-
96231b3b80d8
Don Hinton [Tue, 12 Dec 2017 16:48:35 +0000 (16:48 +0000)]
[debuginfo-tests] Add support for moving debuginfo-tests from clang/test to llvm/projects or monorepo.
Summary:
The new version of debuginfo-tests will have it's own
lit.cfg.py file which is incompatible with the one in clang/test.
This change supports both the old and new versions, and can be used
until the bots actually move debuginfo-tests to either clang/test or
the monorepo.
This is a prerequisite for D40971.
Reviewers: zturner, aprantl
Subscribers: mgorny, JDevlieghere, llvm-commits, cfe-commits
Differential Revision: https://reviews.llvm.org/D41055
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320494
91177308-0d34-0410-b5e6-
96231b3b80d8
Erich Keane [Tue, 12 Dec 2017 16:22:31 +0000 (16:22 +0000)]
Revert a part of 320489 that was submitted unintentionally.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320493
91177308-0d34-0410-b5e6-
96231b3b80d8
Erich Keane [Tue, 12 Dec 2017 16:02:06 +0000 (16:02 +0000)]
Fix ICE when __has_unqiue_object_representations called with invalid decl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320489
91177308-0d34-0410-b5e6-
96231b3b80d8
Krasimir Georgiev [Tue, 12 Dec 2017 13:43:59 +0000 (13:43 +0000)]
[clang-format] Improve ObjC headers detection.
This patch improves detection of ObjC header files.
Right now many ObjC headers, especially short ones, are categorized as C/C++.
Way of filtering still isn't the best, as most likely it should be token-based.
Contributed by jolesiak!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320479
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Liu [Tue, 12 Dec 2017 11:35:46 +0000 (11:35 +0000)]
[SemaCodeComplete] Allow passing out scope specifiers in qualified-id completions via completion context.
Reviewers: ilya-biryukov, arphaman
Reviewed By: arphaman
Subscribers: nik, cfe-commits
Differential Revision: https://reviews.llvm.org/D40563
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320471
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Tue, 12 Dec 2017 02:59:09 +0000 (02:59 +0000)]
[analyzer] StackAddrEscape: For now, disable the new async escape checks.
The new check introduced in r318705 is useful, but suffers from a particular
class of false positives, namely, it does not account for
dispatch_barrier_sync() API which allows one to ensure that the asyncronously
executed block that captures a pointer to a local variable does not actually
outlive that variable.
The new check is split into a separate checker, under the name of
alpha.core.StackAddressAsyncEscape, which is likely to get enabled by default
again once these positives are fixed. The rest of the StackAddressEscapeChecker
is still enabled by default.
Differential Revision: https://reviews.llvm.org/D41042
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320455
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Tue, 12 Dec 2017 02:27:55 +0000 (02:27 +0000)]
[analyzer] In getSVal() API, disable auto-detection of void type as char type.
This is a follow-up from r314910. When a checker developer attempts to
dereference a location in memory through ProgramState::getSVal(Loc) or
ProgramState::getSVal(const MemRegion *), without specifying the second
optional QualType parameter for the type of the value he tries to find at this
location, the type is auto-detected from location type. If the location
represents a value beyond a void pointer, we thought that auto-detecting the
type as 'char' is a good idea. However, in most practical cases, the correct
behavior would be to specify the type explicitly, as it is available from other
sources, and the few cases where we actually need to take a 'char' are
workarounds rather than an intended behavior. Therefore, try to fail with an
easy-to-understand assertion when asked to read from a void pointer location.
Differential Revision: https://reviews.llvm.org/D38801
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320451
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 11 Dec 2017 21:09:19 +0000 (21:09 +0000)]
[Driver][CodeGen] Add -mprefer-vector-width driver option and attribute during CodeGen.
This adds a new command line option -mprefer-vector-width to specify a preferred vector width for the vectorizers. Valid values are 'none' and unsigned integers. The driver will check that it meets those constraints. Specific supported integers will be managed by the targets in the backend.
Clang will take the value and add it as a new function attribute during CodeGen.
This represents the alternate direction proposed by Sanjay in this RFC: http://lists.llvm.org/pipermail/llvm-dev/2017-November/118734.html
The syntax here matches gcc, though gcc treats it as an x86 specific command line argument. gcc only allows values of 128, 256, and 512. I'm not having clang check any values.
Differential Revision: https://reviews.llvm.org/D40230
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320419
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 11 Dec 2017 21:09:16 +0000 (21:09 +0000)]
[Docs] Regenerate command line documentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320418
91177308-0d34-0410-b5e6-
96231b3b80d8
Erich Keane [Mon, 11 Dec 2017 19:44:28 +0000 (19:44 +0000)]
PR35586: Relax two asserts that are overly restrictive
The two asserts are too aggressive. In C++ mode, an
enum is NOT considered an integral type, but an enum value
is allowed to be an enum. This patch relaxes the two asserts
to allow the enum value as well (as typechecking does).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320411
91177308-0d34-0410-b5e6-
96231b3b80d8
Krzysztof Parzyszek [Mon, 11 Dec 2017 19:29:56 +0000 (19:29 +0000)]
[Hexagon] Remove unsupported vlut intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320410
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Mon, 11 Dec 2017 18:58:18 +0000 (18:58 +0000)]
Fix warn-enum-compare.cpp on Windows
It's been failing since r319875.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320405
91177308-0d34-0410-b5e6-
96231b3b80d8
Zhihao Yuan [Mon, 11 Dec 2017 18:29:54 +0000 (18:29 +0000)]
P0620 follow-up: deducing `auto` from braced-init-list in new expr
Summary:
This is a side-effect brought in by p0620r0, which allows other placeholder types (derived from `auto` and `decltype(auto)`) to be usable in a `new` expression with a single-clause //braced-init-list// as its initializer (8.3.4 [expr.new]/2). N3922 defined its semantics.
References:
http://wg21.link/p0620r0
http://wg21.link/n3922
Reviewers: rsmith, aaron.ballman
Reviewed By: rsmith
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D39451
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320401
91177308-0d34-0410-b5e6-
96231b3b80d8
Erich Keane [Mon, 11 Dec 2017 18:14:51 +0000 (18:14 +0000)]
Revert 320391: Certain targets are failing, pulling back to diagnose.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320398
91177308-0d34-0410-b5e6-
96231b3b80d8
Malcolm Parsons [Mon, 11 Dec 2017 18:00:36 +0000 (18:00 +0000)]
[Sema] Fix crash in unused-lambda-capture warning for VLAs
Summary:
Clang was crashing when diagnosing an unused-lambda-capture for a VLA because
From.getVariable() is null for the capture of a VLA bound.
Warning about the VLA bound capture is not helpful, so only warn for the VLA
itself.
Fixes: PR35555
Reviewers: aaron.ballman, dim, rsmith
Reviewed By: aaron.ballman, dim
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D41016
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320396
91177308-0d34-0410-b5e6-
96231b3b80d8
Erich Keane [Mon, 11 Dec 2017 17:36:42 +0000 (17:36 +0000)]
For Linux/gnu compatibility, preinclude <stdc-predef.h> if the file is available
As reported in llvm bugzilla 32377.
Here’s a patch to add preinclude of stdc-predef.h.
The gcc documentation says “On GNU/Linux, <stdc-predef.h> is pre-included.” See https://gcc.gnu.org/gcc-4.8/porting_to.html;
The preinclude is inhibited with –ffreestanding.
Basically I fixed the failing test cases by adding –ffreestanding which inhibits this behavior.
I fixed all the failing tests, including some in extra/test, there's a separate patch for that which is linked here
Note: this is a recommit after a test failure took down the original (r318669)
Patch By: mibintc
Differential Revision: https://reviews.llvm.org/D34158
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320391
91177308-0d34-0410-b5e6-
96231b3b80d8
Aleksandar Beserminji [Mon, 11 Dec 2017 12:12:16 +0000 (12:12 +0000)]
[mips] Minor update to the comment (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320354
91177308-0d34-0410-b5e6-
96231b3b80d8
Aleksandar Beserminji [Mon, 11 Dec 2017 11:29:17 +0000 (11:29 +0000)]
[mips] Removal of microMIPS64R6
microMIPS64R6 is removed from backend, and therefore frontend
will show an error when target is microMIPS64R6.
This is Clang part of patch.
Differential Revision: https://reviews.llvm.org/D35624
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320351
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sun, 10 Dec 2017 11:05:14 +0000 (11:05 +0000)]
Fix MSVC 'not all control paths return a value' warning
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320297
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan P. N. Exon Smith [Sat, 9 Dec 2017 23:44:42 +0000 (23:44 +0000)]
Update Clang CMake cache to use cxx-headers, NFC
Apparently libcxx-headers is going away. Fixes PR35584.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320271
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Sat, 9 Dec 2017 12:09:54 +0000 (12:09 +0000)]
Switch to gnu++14 as the default dialect.
This is C++14 with conforming GNU extensions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320250
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Trieu [Sat, 9 Dec 2017 03:02:21 +0000 (03:02 +0000)]
Revert r320230 to fix buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320239
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Sat, 9 Dec 2017 02:56:48 +0000 (02:56 +0000)]
Fix Driver/darwin-version.c test
A target argument should be provided to avoid failures on non-Darwin
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320238
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Sat, 9 Dec 2017 02:27:11 +0000 (02:27 +0000)]
[driver][darwin] Refactor the target selection code, NFC
The simulator variant of Darwin's platforms is removed in favor of a new
environment field.
The code that selects the platform and the version is split into 4 different
functions instead of being all in one function.
This is an NFC commit, although it slightly improves the
"invalid version number" diagnostic by displaying the environment variable
instead of -m<os>-version-min if the OS version was derived from the
environment.
rdar://
35813850
Differential Revision: https://reviews.llvm.org/D41035
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320235
91177308-0d34-0410-b5e6-
96231b3b80d8
Evgeniy Stepanov [Sat, 9 Dec 2017 02:15:42 +0000 (02:15 +0000)]
Fix fsanitize-blacklist test on Windows.
Broken in r320232.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320233
91177308-0d34-0410-b5e6-
96231b3b80d8
Evgeniy Stepanov [Sat, 9 Dec 2017 01:32:07 +0000 (01:32 +0000)]
Hardware-assisted AddressSanitizer (clang part).
Summary:
Driver, frontend and LLVM codegen for HWASan.
A clone of ASan, basically.
Reviewers: kcc, pcc, alekseyshl
Subscribers: srhines, javed.absar, cfe-commits
Differential Revision: https://reviews.llvm.org/D40936
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320232
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Trieu [Sat, 9 Dec 2017 01:29:40 +0000 (01:29 +0000)]
[ODRHash] Support ODR violation detection in functions.
Extend the hashing to functions, which allows detection of function definition
mismatches across modules.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320230
91177308-0d34-0410-b5e6-
96231b3b80d8