Commit Graph

63618 Commits

Author SHA1 Message Date
Etienne Bergeron 3588be7fa1 Add an AST matcher for string-literal length
Summary:
This patch is adding support for a matcher to check string literal length.

This matcher is used in clang-tidy checkers and is part of this refactoring:
  see: http://reviews.llvm.org/D19841

Reviewers: sbenza, klimek, aaron.ballman

Subscribers: alexfh, klimek, cfe-commits

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

llvm-svn: 269274
2016-05-12 04:20:04 +00:00
David Majnemer 7f980d842c [MS ABI] Don't crash when zero-initializing a vbase which contains a vbase
Bases can be zero-initialized: the storage is zero-initialized before
the base constructor is run.
The MS ABI has a quirk where base VBPtrs are not installed by the
base constructor but by the most derived class.  In particular, they are
installed before the base constructor is run.
The derived constructor must be careful to zero-initialize only the bits
of the class which haven't already been populated by virtual base
pointers.

While we correctly avoided this scenario, we didn't handle the case
where the base class has virtual bases which have virtual bases.

llvm-svn: 269271
2016-05-12 03:51:52 +00:00
Bruno Cardoso Lopes ab83dc646d [VFS] Reapply r269100: Reconstruct the VFS overlay tree for more accurate lookup
The way we currently build the internal VFS overlay representation leads
to inefficient path search and might yield wrong answers when asked for
recursive or regular directory iteration.

Currently, when reading an YAML file, each YAML root entry is placed
inside a new root in the filesystem overlay. In the crash reproducer, a
simple "@import Foundation" currently maps to 43 roots, and when looking
up paths, we traverse a directory tree for each of these different
roots, until we find a match (or don't). This has two consequences:

- It's slow.
- Directory iteration gives incomplete results since it only return
results within one root - since contents of the same directory can be
declared inside different roots, the result isn't accurate.

This is in part fault of the way we currently write out the YAML file
when emitting the crash reproducer - we could generate only one root and
that would make it fast and correct again. However, we should not rely
on how the client writes the YAML, but provide a good internal
representation regardless.

This patch builds a proper virtual directory tree out of the YAML
representation, allowing faster search and proper iteration. Besides the
crash reproducer, this potentially benefits other VFS clients.

llvm-svn: 269270
2016-05-12 03:23:36 +00:00
Etienne Bergeron 394dfff1ed [tooling] Remove redundant inline keyword
Summary:
The inline keywords are redundant.
Introduce by this commit to try to fix broken build bots:
  http://reviews.llvm.org/D20180

Tested on Debug and Release build [linux].
Tested on Release + Shared (-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON) [linux]
Tested on Release [windows]

Reviewers: alexfh

Subscribers: cfe-commits, klimek

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

llvm-svn: 269257
2016-05-12 00:22:28 +00:00
Simon Pilgrim bff9dae3ff Fixed msvc warnings
llvm-svn: 269242
2016-05-11 21:55:37 +00:00
Bruno Cardoso Lopes 29ebd4979a [VFS][Unittests] Make dir iteration tests depend only on content
Do not rely on any specific order while comparing the results of
directory iteration.

llvm-svn: 269234
2016-05-11 20:58:47 +00:00
Richard Smith c2bebe9aca Preserve the FoundDecl when performing overload resolution for constructors.
This is in preparation for C++ P0136R1, which switches the model for inheriting
constructors over from synthesizing a constructor to finding base class
constructors (via using shadow decls) when looking for derived class
constructors.

llvm-svn: 269231
2016-05-11 20:37:46 +00:00
Devin Coughlin c1bfafd309 [analyzer] Fix crash in ObjCGenericsChecker
Fix a crash in the generics checker where DynamicTypePropagation tries
to get the superclass of a root class.

This is a spot-fix for a deeper issue where the checker makes assumptions
that may not hold about subtyping between the symbolically-tracked type of
a value and the compile-time types of a cast on that value.

I've added a TODO to address the underlying issue.

rdar://problem/26086914

llvm-svn: 269227
2016-05-11 20:28:41 +00:00
Etienne Bergeron 3cb7504d30 [tooling] Fix missing inline keyworkd, breaking build bot.
Summary:
The missing keyword "inline" is causing some buildbot to fail.
The symbol is not available.

see: http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/2281/

Reviewers: rnk

Subscribers: cfe-commits, klimek

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

llvm-svn: 269224
2016-05-11 20:09:17 +00:00
Andrey Bokhanko 45d413260e [MSVC] Implementation of __unaligned as a proper type qualifier
This patch implements __unaligned (MS extension) as a proper type qualifier
(before that, it was implemented as an ignored attribute).

It also fixes PR27367 and PR27666.

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

llvm-svn: 269220
2016-05-11 18:38:21 +00:00
Reid Kleckner 43be52a59f Relax -Wcalling-convention-cast when casting to the default convention (cdecl)
llvm-svn: 269214
2016-05-11 17:43:13 +00:00
Steven Wu 27fb5227ec Embed bitcode in object file (clang cc1 part)
Summary:
Teach clang to embed bitcode inside bitcode. When -fembed-bitcode cc1
option is used, clang will embed both the input bitcode and cc1
commandline into the bitcode in special sections before compiling to
the object file.  Using -fembed-bitcode-marker will only introduce a
marker in both sections.

Depends on D17390

Reviewers: rsmith

Subscribers: yaron.keren, vsk, cfe-commits

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

llvm-svn: 269202
2016-05-11 16:26:03 +00:00
Reid Kleckner 330fb175d4 Update clang support on recent Haiku
[ Copied from https://llvm.org/bugs/show_bug.cgi?id=26404 ]

clang support on Haiku is lagging a bit, and missing on x86_64.

This patch updates support for x86 and add support for x86_64. It should
apply directly to trunk and it's harmless in the sense that it only
affects Haiku.

Reviewers: rnk, rsmith

Patch by Jérôme Duval

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

llvm-svn: 269201
2016-05-11 16:19:05 +00:00
Krzysztof Parzyszek 338b98fc88 [Hexagon] Avoid spurious failures in test/Driver/hexagon-toolchain-elf.c
llvm-svn: 269200
2016-05-11 16:11:22 +00:00
Etienne Bergeron 53276d1221 [tooling] FixItHint Tooling refactoring
Summary:
This is the refactoring to lift some FixItHint into tooling.
used by: http://reviews.llvm.org/D19807

Reviewers: klimek, alexfh

Subscribers: cfe-commits

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

llvm-svn: 269188
2016-05-11 14:31:39 +00:00
Michael Zuckerman 13d3c002df [clang][AVX512] completing missing set intrinsics
Differential Revision: http://reviews.llvm.org/D20099

llvm-svn: 269172
2016-05-11 11:41:29 +00:00
Michael Zuckerman 5e2c6b6200 [clang][AVX512] completing missing intrinsics for [vpermt2d|vptestm] instruction set.
Differential Revision: http://reviews.llvm.org/D20096

llvm-svn: 269170
2016-05-11 11:21:18 +00:00
Sean Silva 7e61e1509a Hopefully bring llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast back to life
Bruno made a couple valiant attempts but the bot is still red.

This reverts r269100 (primary commit), r269108 (fix attempt), r269133
(fix attempt).

llvm-svn: 269160
2016-05-11 04:04:59 +00:00
George Burgess IV e8f10cc0b9 [Sema] Fix value-dependent enable_if bug.
This patch fixes a bug where we would assume all value-dependent
enable_if conditions give successful results.

Instead, we consider value-dependent enable_if conditions to always
fail. While this isn't ideal, this is the best we can realistically do
without changing both enable_if's semantics and large parts of Sema
(specifically, all of the parts that don't expect type dependence to
come out of nowhere, and that may interact with overload resolution).

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

llvm-svn: 269154
2016-05-11 01:38:27 +00:00
Hans Wennborg 68e3aa7f30 Disable -Wcast-calling-convention by default (follow-up to r269116)
llvm-svn: 269148
2016-05-11 00:49:20 +00:00
Bruno Cardoso Lopes 14e89e022a [VFS] One more unittest change to fix win10 buildbot
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/5110
Follow up from r269100.

llvm-svn: 269133
2016-05-10 22:30:01 +00:00
Reid Kleckner 0ff6e1bc26 Wildcard away paths in fixit CHECKs in my last testcase
Oops. :(

llvm-svn: 269118
2016-05-10 21:10:25 +00:00
Reid Kleckner 9f49733c65 Add -Wcast-calling-convention to warn when casting away calling conventions
Summary:
This only warns on casts of the address of a function defined in the
current TU. In this case, the fix is likely to be local and the warning
useful.

Here are some things we could experiment with in the future:
- Fire on declarations as well as definitions
- Limit the warning to non-void function prototypes
- Limit the warning to mismatches of caller and callee cleanup CCs

This warning is currently off by default while we study its usefulness.

Reviewers: thakis, rtrieu

Subscribers: cfe-commits

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

llvm-svn: 269116
2016-05-10 21:00:03 +00:00
Peter Collingbourne 7d6e81d179 Update clang for LLVM API change.
llvm-svn: 269111
2016-05-10 20:23:29 +00:00
Bruno Cardoso Lopes 7347fce4c3 [VFS] Change unittest to try appeasing win10 buildbot
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/5103
Follow up from r269100.

llvm-svn: 269108
2016-05-10 20:20:55 +00:00
Bruno Cardoso Lopes ecf7d15d49 [VFS] Reconstruct the VFS overlay tree for more accurate lookup
The way we currently build the internal VFS overlay representation leads
to inefficient path search and might yield wrong answers when asked for
recursive or regular directory iteration.

Currently, when reading an YAML file, each YAML root entry is placed
inside a new root in the filesystem overlay. In the crash reproducer, a
simple "@import Foundation" currently maps to 43 roots, and when looking
up paths, we traverse a directory tree for each of these different
roots, until we find a match (or don't). This has two consequences:

- It's slow.
- Directory iteration gives incomplete results since it only return
results within one root - since contents of the same directory can be
declared inside different roots, the result isn't accurate.

This is in part fault of the way we currently write out the YAML file
when emitting the crash reproducer - we could generate only one root and
that would make it fast and correct again. However, we should not rely
on how the client writes the YAML, but provide a good internal
representation regardless.

This patch builds a proper virtual directory tree out of the YAML
representation, allowing faster search and proper iteration. Besides the
crash reproducer, this potentially benefits other VFS clients.

llvm-svn: 269100
2016-05-10 18:43:00 +00:00
Derek Schuff ef508f34a6 [WebAssembly] Reduce strictness of static destructor test
It didn't work on non-asserts builds

llvm-svn: 269099
2016-05-10 18:35:31 +00:00
Derek Schuff 8179be4897 Introduce CGCXXABI::canCallMismatchedFunctionType
llvm-svn: 269089
2016-05-10 17:44:55 +00:00
Derek Schuff 09b2492387 more cleanup
llvm-svn: 269088
2016-05-10 17:44:52 +00:00
Derek Schuff 2136eed869 Clarify condition, remove redundant check
llvm-svn: 269087
2016-05-10 17:44:50 +00:00
Derek Schuff 060fd22093 Clean up condition, add ARM to test
llvm-svn: 269086
2016-05-10 17:44:48 +00:00
Derek Schuff cc42df4a30 Do not register incompatible C++ destructors with __cxa_atexit
Summary:
For a static object with a nontrivial destructor, clang generates an
initializer function (__cxx_global_var_init) which registers that
object's destructor using __cxa_atexit. However some ABIs (ARM,
WebAssembly) use destructors that return 'this' instead of having void
return (which does not match the signature of function pointers passed
to __cxa_atexit). This results in undefined behavior when the destructors are
called. All the calling conventions I know of on ARM can tolerate this,
but WebAssembly requires the signatures of indirect calls to match the
called function.

This patch disables that direct registration of destructors for ABIs
that have this-returning destructors.

Subscribers: aemerson, jfb, cfe-commits, dschuff

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

llvm-svn: 269085
2016-05-10 17:44:46 +00:00
NAKAMURA Takumi d4fbaef2b0 clang/test/CodeGen/avx512f-builtins.c: Fix for -Asserts.
llvm-svn: 269079
2016-05-10 17:16:12 +00:00
Chris Bieneman 129fba7fb6 [CMake] Pass LLVM_LIBDIR_SUFFIX into Compiler-RT
Not passing this causes Compiler-RT to fail to configure on multi-lib systems.

llvm-svn: 269069
2016-05-10 16:10:22 +00:00
Benjamin Kramer a31994b7b0 Remove unused diagnostic. NFC.
llvm-svn: 269063
2016-05-10 14:04:34 +00:00
Michael Zuckerman e9e8e573e3 [Clang][AVX512] completing missing intrinsics [load/store]
Differential Revision: http://reviews.llvm.org/D20063

llvm-svn: 269056
2016-05-10 13:13:54 +00:00
Alexey Bataev 1e1e286a6b [OPENMP 4.5] Initial codegen for 'priority' clause in task-based
directives.

OpenMP 4.5 supports clause 'priority' in task-based directives. Patch
adds initial codegen support for this clause in codegen.

llvm-svn: 269050
2016-05-10 12:21:02 +00:00
Michael Zuckerman de860e5585 [Clang][AVX512] completing missing intrinsics [vmin/vmax]{sd|sq|uq|ud}.
Differential Revision: http://reviews.llvm.org/D20064

llvm-svn: 269042
2016-05-10 11:34:19 +00:00
Alexey Bataev 8a83159731 [OPENMP 4.0] Fixed codegen for destructors in task-based directives.
If private variables require destructors call at the deletion of the
task, additional flag in task flags must be set. Patch fixes this
problem.

llvm-svn: 269039
2016-05-10 10:36:51 +00:00
Michael Zuckerman 2564d2f5fe [Clang][AVX512] completing missing intrinsics [vextractf].
Differential Revision: http://reviews.llvm.org/D20061

llvm-svn: 269037
2016-05-10 10:14:50 +00:00
Alexey Bataev 9ebd742748 [OPENMP 4.5] Add codegen support in runtime for '[non]monotonic'
schedule modifiers.

Runtime library expects some additional data in schedule argument for
loop-based directives, that have additional schedule modifiers
'monotonic|nonmonotonic'.

llvm-svn: 269035
2016-05-10 09:57:36 +00:00
Michael Zuckerman 7360d8a9cc [Clang][AVX512] completing missing intrinsics [roundscale, ceil, floor]
Differential Revision: http://reviews.llvm.org/D20070

llvm-svn: 269022
2016-05-10 07:30:58 +00:00
George Burgess IV 3dc1669133 [Sema] Fix an overload resolution bug with enable_if.
Currently, if clang::isBetterOverloadCandidate encounters an enable_if
attribute on either candidate that it's inspecting, it will ignore all
lower priority attributes (e.g. pass_object_size). This is problematic
in cases like:

```
void foo(char *c) __attribute__((enable_if(1, "")));
void foo(char *c __attribute__((pass_object_size(0))))
    __attribute__((enable_if(1, "")));
```

...Because we would ignore the pass_object_size attribute in the second
`foo`, and consider any call to `foo` to be ambiguous.

This patch makes overload resolution consult further tiebreakers (e.g.
pass_object_size) if two candidates have equally good enable_if
attributes.

llvm-svn: 269005
2016-05-10 01:59:34 +00:00
Justin Lebar 3b30b7eef6 [CUDA] Fix flush-denormals.cu test so that it checks what it intends to CHECK.
FileCheck does not evaluate plain CHECKs if you pass -check-prefix; you
have to ask for it explicitly.

llvm-svn: 269000
2016-05-10 00:34:50 +00:00
Richard Smith 57443fce3f When forming a fully-qualified type name, put any qualifiers outside/before the
nested-name-specifier. Patch by Sterling Augustine!

llvm-svn: 268988
2016-05-09 23:06:14 +00:00
Artem Belevich 4d430badeb [CUDA] Restrict init of local __shared__ variables to empty constructors only.
Allow only empty constructors for local __shared__ variables in a way
identical to restrictions imposed on dynamic initializers for global
variables on device.

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

llvm-svn: 268982
2016-05-09 22:09:56 +00:00
Artem Belevich 0c0ada01b6 [CUDA] Only __shared__ variables can be static local on device side.
According to CUDA programming guide (v7.5):
> E.2.9.4: Within the body of a device or global function, only
> shared variables may be declared with static storage class.

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

llvm-svn: 268962
2016-05-09 19:36:08 +00:00
Douglas Katzman 5eddc2395b [Myriad] Use Generic_ELF::addClangTargetOptions()
llvm-svn: 268956
2016-05-09 19:09:59 +00:00
Nemanja Ivanovic d99f21b0e6 [Power9] Enable -mcpu=pwr9 (-mcpu=power9) in the front end
This patch corresponds to review:
http://reviews.llvm.org/D19684

It simply adds the handling for the option and the corresponding macros.

llvm-svn: 268951
2016-05-09 18:58:02 +00:00
Vedant Kumar 400a3f66e2 [cmake] Enable zlib support for Apple stage2 builds
This allows llvm-profdata to interact with profiles containing
compressed name data.

rdar://problem/26122944

llvm-svn: 268947
2016-05-09 18:40:09 +00:00