Commit Graph

67755 Commits

Author SHA1 Message Date
Martin Probst 20371c30ef clang-format: [JS] whitespace after async in arrow functions.
Summary:
Async arrow functions should be marked with a whitespace after the async keyword, before the parameter list:
    x = async () => foo();

Before:
    x = async() => foo();

This makes it easier to tell apart an async arrow function from a call to a function called async.

Reviewers: bkramer

Subscribers: cfe-commits, klimek

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

llvm-svn: 296330
2017-02-27 11:15:53 +00:00
Daniel Marjamaki e97838f49e [analyzer] clarify 'result is garbage value' when it is out of bounds
Differential Revision: https://reviews.llvm.org/D28278

llvm-svn: 296326
2017-02-27 10:44:24 +00:00
Argyrios Kyrtzidis cf486b24ba [GeneratePCHAction] If preprocessor option 'AllowPCHWithCompilerErrors' is enabled, don't delete the produced PCH file if error diagnostics occurred.
llvm-svn: 296320
2017-02-27 03:52:36 +00:00
Dominic Chen 8589e10c30 Revert "[analyzer] NFC: Update test infrastructure to support multiple constraint managers"
This reverts commit 8e7780b9e59ddaad1800baf533058d2c064d4787.

llvm-svn: 296317
2017-02-27 03:29:25 +00:00
Dominic Chen 02064a3076 [analyzer] NFC: Update test infrastructure to support multiple constraint managers
Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952.

Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin

Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits

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

llvm-svn: 296312
2017-02-27 02:36:15 +00:00
Argyrios Kyrtzidis 7b5d910c66 Add a cc1 flag for setting the existing Preprocessor option 'AllowPCHWithCompilerErrors'.
llvm-svn: 296306
2017-02-27 02:06:18 +00:00
Oren Ben Simhon 259b091669 [X86] DAZ Macros Relocation
The DAZ feature introduces the denormal zero support for x86.
Currently the definitions are located under SSE3 header, however there are some SSE2 targets that support the feature as well.

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

llvm-svn: 296296
2017-02-26 11:58:15 +00:00
Argyrios Kyrtzidis 6d1a15b2d4 [index] Add 'Parameter' symbol kind and 'Local' symbol property to distinguish function-local symbols
Parameters have a 'child' relation to their function/method.
Also add an option '-include-locals' to 'c-index-test core' to enable indexing of function-local symbols.

Original patch from Nathan Hawes with some changes by me.
https://reviews.llvm.org/D30304

llvm-svn: 296282
2017-02-26 05:37:56 +00:00
Richard Smith c46fe0d629 Update cxx_dr_status page.
llvm-svn: 296276
2017-02-25 23:54:18 +00:00
Richard Smith df054d3d22 C++ DR1611, 1658, 2180: implement "potentially constructed subobject" rules for special member functions.
Essentially, as a base class constructor does not construct virtual bases, such
a constructor for an abstract class does not need the corresponding base class
construction to be valid, and likewise for destructors.

This creates an awkward situation: clang will sometimes generate references to
the complete object and deleting destructors for an abstract class (it puts
them in the construction vtable for a derived class). But we can't generate a
"correct" version of these because we can't generate references to base class
constructors any more (if they're template specializations, say, we might not
have instantiated them and can't assume any other TU will emit a copy).
Fortunately, we don't need to, since no correct program can ever invoke them,
so instead emit symbols that just trap.

We should stop emitting references to these symbols, but still need to emit
definitions for compatibility.

llvm-svn: 296275
2017-02-25 23:53:05 +00:00
Argyrios Kyrtzidis f70ab5bf6b [test] Disable test/Index/pch-from-libclang.c for non-darwin systems.
llvm-svn: 296267
2017-02-25 19:17:11 +00:00
Argyrios Kyrtzidis 30844025e9 [test] Use cc1 -triple for test/Index/pch-from-libclang.c.
Note quite sure why driver -target has no effect.

llvm-svn: 296265
2017-02-25 18:55:32 +00:00
Argyrios Kyrtzidis df3e14a168 [test] Add target to test/Index/pch-from-libclang.c.
Attempt to fix the failing bots.

llvm-svn: 296263
2017-02-25 18:35:53 +00:00
Argyrios Kyrtzidis bcae047dc9 [driver] Pass a resource dir without the '/../' part.
This get the resource dir string to match with the one from libclang (which is not adding '/../'),
and allows clang to accept a modules-enabled PCH that was created by libclang.

llvm-svn: 296262
2017-02-25 18:14:35 +00:00
Argyrios Kyrtzidis bdff27dbea [modules] For -module-file-info, print out the resource dir path, since it is included in the module hash.
llvm-svn: 296261
2017-02-25 18:14:31 +00:00
Brad Smith 9cb3b3bf60 Also test OpenBSD/powerpc here for the various types expected to be the same across archs.
llvm-svn: 296256
2017-02-25 16:35:18 +00:00
Vedant Kumar dcfe34e667 Weaken test/Profile/c-ternary.c
There is a bot which doesn't use '%1' as the IR name of the first
argument to a function:

http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/2050/steps/test-stage1-compiler/logs/stdio

llvm-svn: 296248
2017-02-25 07:21:23 +00:00
Vedant Kumar 3ec213e05c Suppress uninteresting warnings in test/CoverageMapping, NFC.
llvm-svn: 296247
2017-02-25 07:05:41 +00:00
Vedant Kumar 66c00cc439 Fix -Wparentheses warning
llvm-svn: 296246
2017-02-25 06:47:00 +00:00
Vedant Kumar 502bbfafca Retry: [profiling] Fix profile counter increment when emitting selects (PR32019)
2nd attempt: the first was in r296231, but it had a use after lifetime
bug.

Clang has logic to lower certain conditional expressions directly into llvm
select instructions. However, it does not emit the correct profile counter
increment as it does this: it emits an unconditional increment of the counter
for the 'then branch', even if the value selected is from the 'else branch'
(this is PR32019).

That means, given the following snippet, we would report that "0" is selected
twice, and that "1" is never selected:

  int f1(int x) {
    return x ? 0 : 1;
               ^2  ^0
  }

  f1(0);
  f1(1);

Fix the problem by using the instrprof_increment_step intrinsic to do the
proper increment.

llvm-svn: 296245
2017-02-25 06:35:45 +00:00
Dominic Chen 9bc02cee8d [analyzer] Refactor and simplify SimpleConstraintManager
Summary: SimpleConstraintManager is difficult to use, and makes assumptions about capabilities of the constraint manager. This patch refactors out those portions into a new RangedConstraintManager, and also fixes some issues with camel case, formatting, and confusing naming.

Reviewers: zaks.anna, dcoughlin

Subscribers: mgorny, xazax.hun, NoQ, rgov, cfe-commits

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

llvm-svn: 296242
2017-02-25 04:51:31 +00:00
Jan Vesely 9488560bb8 AMDGPU: export s_sendmsg{halt} instrinsics
Differential Revision: https://reviews.llvm.org/D30366

llvm-svn: 296241
2017-02-25 04:20:24 +00:00
Jan Vesely c255097517 AMDGPU: export l1 cache invalidation intrinsics
Differential Revision: https://reviews.llvm.org/D30360

llvm-svn: 296240
2017-02-25 04:20:22 +00:00
Jan Vesely d26dbb389f AMDGPU: export s_waitcnt builtin
Differential Revision: https://reviews.llvm.org/D30359

llvm-svn: 296239
2017-02-25 04:20:20 +00:00
NAKAMURA Takumi d274dc3896 Revert r296166, "clang-format: Don't leave behind temp files in -i mode on Windows, PR26125", and r296171.
(MemoryBuffer)Code.reset() was too early.

  ==26912== Invalid read of size 1
  ==26912==    at 0x437E1D: llvm::MemoryBuffer::init(char const*, char const*, bool) (MemoryBuffer.cpp:47)
  ==26912==    by 0x438013: (anonymous namespace)::MemoryBufferMem::MemoryBufferMem(llvm::StringRef, bool) (MemoryBuffer.cpp:86)
  ==26912==    by 0x438128: llvm::MemoryBuffer::getMemBuffer(llvm::StringRef, llvm::StringRef, bool) (MemoryBuffer.cpp:112)
  ==26912==    by 0x4E189D: clang::vfs::detail::(anonymous namespace)::InMemoryFileAdaptor::getBuffer(llvm::Twine const&, long, bool, bool) (VirtualFileSystem.cpp:443)
  ==26912==    by 0x4DF5BA: clang::vfs::FileSystem::getBufferForFile(llvm::Twine const&, long, bool, bool) (VirtualFileSystem.cpp:94)
  ==26912==    by 0x4B72EC: clang::FileManager::getBufferForFile(clang::FileEntry const*, bool, bool) (FileManager.cpp:443)
  ==26912==    by 0x4C1F81: clang::SrcMgr::ContentCache::getBuffer(clang::DiagnosticsEngine&, clang::SourceManager const&, clang::SourceLocation, bool*) const (SourceManager.cpp:98)
  ==26912==    by 0x4C50E5: clang::SourceManager::getBufferData(clang::FileID, bool*) const (SourceManager.cpp:689)
  ==26912==    by 0x58E794: clang::Rewriter::getEditBuffer(clang::FileID) (Rewriter.cpp:230)
  ==26912==    by 0x407297: clang::format::format(llvm::StringRef) (ClangFormat.cpp:311)
  ==26912==    by 0x4078D7: main (ClangFormat.cpp:363)

llvm-svn: 296237
2017-02-25 03:45:49 +00:00
Vedant Kumar a45f315e2f Revert "[profiling] Fix profile counter increment when emitting selects (PR32019)"
This reverts commit r296231. It causes an assertion failure on 32-bit
machines

clang: /export/users/atombot/llvm/clang-atom-d525-fedora-rel/llvm/lib/IR/Instructions.cpp:263: void llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, const llvm::Twine&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.
llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/export/users/atombot/llvm/clang-atom-d525-fedora-rel/stage1/./bin/clang+0x1c5fbfa)
llvm::sys::RunSignalHandlers() (/export/users/atombot/llvm/clang-atom-d525-fedora-rel/stage1/./bin/clang+0x1c5dc7e)
SignalHandler(int) (/export/users/atombot/llvm/clang-atom-d525-fedora-rel/stage1/./bin/clang+0x1c5dde2)
__restore_rt (/lib64/libpthread.so.0+0x3f1d00efa0)
__GI_raise /home/glibctest/rpmbuild/BUILD/glibc-2.17-c758a686/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
__GI_abort /home/glibctest/rpmbuild/BUILD/glibc-2.17-c758a686/stdlib/abort.c:92:0
__assert_fail_base /home/glibctest/rpmbuild/BUILD/glibc-2.17-c758a686/assert/assert.c:92:0
(/lib64/libc.so.6+0x3f1c82e622)
llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&) (/export/users/atombot/llvm/clang-atom-d525-fedora-rel/stage1/./bin/clang+0x1804e3a)
clang::CodeGen::CodeGenPGO::emitCounterIncrement(clang::CodeGen::CGBuilderTy&, clang::Stmt const*, llvm::Value*) (/export/users/atombot/llvm/clang-atom-d525-fedora-rel/stage1/./bin/clang+0x1ec7891)

llvm-svn: 296234
2017-02-25 02:59:47 +00:00
Vedant Kumar c416e99d42 [profiling] Fix profile counter increment when emitting selects (PR32019)
Clang has logic to lower certain conditional expressions directly into
llvm select instructions. However, it does not emit the correct profile
counter increment as it does this: it emits an unconditional increment
of the counter for the 'then branch', even if the value selected is from
the 'else branch' (this is PR32019).

That means, given the following snippet, we would report that "0" is
selected twice, and that "1" is never selected:

  int f1(int x) {
    return x ? 0 : 1;
               ^2  ^0
  }

  f1(0);
  f1(1);

Fix the problem by using the instrprof_increment_step intrinsic to do
the proper increment.

llvm-svn: 296231
2017-02-25 02:30:03 +00:00
Richard Trieu ff60e0f898 [ODRHash] Move inherited visitor call to end of function.
llvm-svn: 296221
2017-02-25 01:29:34 +00:00
Paul Robinson 4032785206 Revert r296209, still one more test to go.
llvm-svn: 296216
2017-02-25 00:50:34 +00:00
Vedant Kumar 42de380765 [ubsan] Detect signed overflow UB in remainder operations
Teach ubsan to diagnose remainder operations which have undefined
behavior due to signed overflow (e.g INT_MIN % -1).

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

llvm-svn: 296214
2017-02-25 00:43:39 +00:00
Vedant Kumar 82ee16beb8 [ubsan] Omit superflous overflow checks for promoted arithmetic (PR20193)
C requires the operands of arithmetic expressions to be promoted if
their types are smaller than an int. Ubsan emits overflow checks when
this sort of type promotion occurs, even if there is no way to actually
get an overflow with the promoted type.

This patch teaches clang how to omit the superflous overflow checks
(addressing PR20193).

Testing: check-clang and check-ubsan.

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

llvm-svn: 296213
2017-02-25 00:43:36 +00:00
Paul Robinson 7c344cf2b7 [PS4] Set our default dialect to C++11. NFC for other targets.
llvm-svn: 296209
2017-02-25 00:15:45 +00:00
Richard Trieu 8d543e2741 [ODRHash] Finish FieldDecl support by handling mutable and initializers.
https://reviews.llvm.org/rL296170

llvm-svn: 296198
2017-02-24 23:35:37 +00:00
Charles Li 6de8aca1d0 [Test] Make Lit tests C++11 compatible #10
Differential Revision: https://reviews.llvm.org/D21626

llvm-svn: 296193
2017-02-24 23:23:53 +00:00
Charles Li 9ea0817c5a [Test] Make Lit tests C++11 compatible #9
[Test] Make Lit tests C++11 compatible #9

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

llvm-svn: 296184
2017-02-24 22:22:05 +00:00
Richard Smith 6f0e63eab3 Factor out more commonality between handling of deletion and exception specifications for special member functions.
llvm-svn: 296173
2017-02-24 21:18:47 +00:00
Nico Weber 0760360dcc Try to unbreak tests after r296166
Looks like %T isn't per-test but per-test-directory, and
the rm was deleting temp files written by other tests in
test/Format.  Limit the rm's scope a bit.

llvm-svn: 296171
2017-02-24 21:01:43 +00:00
Richard Trieu 93772fcfc7 [ODRHash] Add handling of bitfields
Differential Revision: https://reviews.llvm.org/D21675

llvm-svn: 296170
2017-02-24 20:59:28 +00:00
Nico Weber cc0573b03f clang-format: Don't leave behind temp files in -i mode on Windows, PR26125
Fix and analysis by Wei Mao <weimao1@gmail.com> (see bug), test by me.

llvm-svn: 296166
2017-02-24 20:49:00 +00:00
Nico Weber 004d5245c0 clang-format: Enable include sorting for style=Chromium
llvm-svn: 296161
2017-02-24 19:13:59 +00:00
Nico Weber d96ae86735 clang-format: Fix many Objective-C formatting regressions from r289428
r289428 added a separate language kind for Objective-C, but kept many
"Language == LK_Cpp" checks untouched.  This introduced a "IsCpp()"
method that returns true for both C++ and Objective-C++, and replaces
all comparisons of Language with LK_Cpp with calls to this new method.

Also add a lot more test coverge for formatting things in LK_ObjC mode,
by having FormatTest's verifyFormat() test for LK_ObjC everything that's
being tested for LK_Cpp at the moment.

Fixes PR32060 and many other things.

llvm-svn: 296160
2017-02-24 19:10:12 +00:00
Alex Lorenz 24a1bedf76 [Preprocessor] Fix incorrect token caching that occurs when lexing _Pragma
in macro argument pre-expansion mode when skipping a function body

This commit fixes a token caching problem that currently occurs when clang is
skipping a function body (e.g. when looking for a code completion token) and at
the same time caching the tokens for _Pragma when lexing it in macro argument
pre-expansion mode.

When _Pragma is being lexed in macro argument pre-expansion mode, it caches the
tokens so that it can avoid interpreting the pragma immediately (as the macro
argument may not be used in the macro body), and then either backtracks over or
commits these tokens. The problem is that, when we're backtracking/committing in
such a scenario, there's already a previous backtracking position stored in
BacktrackPositions (as we're skipping the function body), and this leads to a
situation where the cached tokens from the pragma (like '(' 'string_literal'
and ')') will remain in the cached tokens array incorrectly even after they're
consumed (in the case of backtracking) or just ignored (in the case when they're
committed). Furthermore, what makes it even worse, is that because of a previous
backtracking position, the logic that deals with when should we call
ExitCachingLexMode in CachingLex no longer works for us in this situation, and
more tokens in the macro argument get cached, to the point where the EOF token
that corresponds to the macro argument EOF is cached. This problem leads to all
sorts of issues in code completion mode, where incorrect errors get presented
and code completion completely fails to produce completion results.

rdar://28523863

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

llvm-svn: 296140
2017-02-24 17:45:16 +00:00
Serge Pavlov 8ed8374057 Made test more target agnostic
Recommits r295975 (Added regression tests), reverted in r295975,
because it did not work on non-X86 targets.

llvm-svn: 296116
2017-02-24 13:15:08 +00:00
Roger Ferrer Ibanez d93add34b7 Fix crash when an incorrect redeclaration only differs in __unaligned type-qualifier
Fix an assertion that is hit when a redeclaration with differing types only
differs in the unaligned type-qualifier.

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

llvm-svn: 296099
2017-02-24 08:41:09 +00:00
Kevin Funk 83143a8e3e Add clazy to external Clang examples page
Reviewers: silvas, rizsotto.mailinglist, sergio.martins

Reviewed By: rizsotto.mailinglist

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

llvm-svn: 296098
2017-02-24 08:29:46 +00:00
Petr Hosek 162540ec1d [Driver] Enable SafeStack for Fuchsia targets
The runtime support is provided directly by the Fuchsia system C
library.

Patch by Roland McGrath

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

llvm-svn: 296082
2017-02-24 03:17:41 +00:00
Richard Trieu 8459ddf12a [ODRHash] Add handling of TypedefType and DeclarationName
Differential Revision: https://reviews.llvm.org/D21675

llvm-svn: 296078
2017-02-24 02:59:12 +00:00
George Burgess IV b7760210d3 Represent pass_object_size attrs in ExtParameterInfo
The goal of this is to fix a bug in modules where we'd merge
FunctionDecls that differed in their pass_object_size attributes. Since
we can overload on the presence of pass_object_size attributes, this
behavior is incorrect.

We don't represent `N` in `pass_object_size(N)` as part of
ExtParameterInfo, since it's an error to overload solely on the value of
N. This means that we have a bug if we have two modules that declare
functions that differ only in their pass_object_size attrs, like so:

// In module A, from a.h
void foo(char *__attribute__((pass_object_size(0))));

// In module B, from b.h
void foo(char *__attribute__((pass_object_size(1))));

// In module C, in main.c
#include "a.h"
#include "b.h"

At the moment, we'll merge the foo decls, when we should instead emit a
diagnostic about an invalid overload. We seem to have similar (silent)
behavior if we overload only on the return type of `foo` instead; I'll
try to find a good place to put a FIXME (or I'll just file a bug) soon.

This patch also fixes a bug where we'd not output the proper extended
parameter info for declarations with pass_object_size attrs.

llvm-svn: 296076
2017-02-24 02:49:47 +00:00
Richard Smith 8bae1be0fa Factor out some common code between SpecialMemberExceptionSpecInfo and SpecialMemberDeletionInfo.
To simplify this, convert SpecialMemberOverloadResult to a value type.

llvm-svn: 296073
2017-02-24 02:07:20 +00:00
Richard Smith 5511800bb0 Simplify and pass a more useful source location when computing an exception
specification for an implicit special member.

llvm-svn: 296068
2017-02-24 01:36:58 +00:00
Richard Smith 2246c83369 Refactor computation of exception specification for special members to remove
some of the repetition.

llvm-svn: 296067
2017-02-24 01:29:42 +00:00
Douglas Yung 1db609f882 Recently a change was made to this test in r294639 which fails when the
compiler is run in a mode where the default C++ standard is newer than C++03.
The reason is because one of the warnings checked is only produced when the
compiler is using C++03 or lower.

This change fixes this problem as well as adds explicit run lines to run the
test in C++03 and C++11 modes.

llvm-svn: 296066
2017-02-24 01:25:02 +00:00
Hans Wennborg 260c6d4555 Revert r291477 "[Frontend] Correct values of ATOMIC_*_LOCK_FREE to match builtin"
It caused PR31864. There is a patch in progress to fix that, but let's
revert in the meantime.

llvm-svn: 296063
2017-02-24 01:16:34 +00:00
Vedant Kumar 7f809b2fbd [profiling] PR31992: Don't skip interesting non-base constructors
Fix the fact that we don't assign profile counters to constructors in
classes with virtual bases, or constructors with variadic parameters.

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

llvm-svn: 296062
2017-02-24 01:15:19 +00:00
David L. Jones ecc6de35fb [Driver] Move architecture-specific free helper functions to their own files.
This patch moves helper functions that are CPU-specific out of Driver.cpp and to
separate implementation files. The new files are named for the architecture,
e.g. ARMArch.cpp.

The next step after this will be to move OS-specific code, which I expect will
include many of the tool implementations, to similarly separate files.

Some CPU-specific functions are not being moved just yet. In cases where the
only caller is the platform-specific tools, I plan to move them together. An
example is Hexagon, where the only caller of the architecture-specific functions
are the tools themselves. (I'm happy to revise this choice, it just seems like
less churn to me.)

This does mean that some functions which were previously static are now exposed
through the library header Driver.h.

Reviewers: rsmith, javed.absar

Subscribers: aemerson, danalbert, srhines, dschuff, jyknight, nemanjai, mgorny, cfe-commits

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

llvm-svn: 296056
2017-02-24 00:28:01 +00:00
Alex Lorenz 8da15b501a NFC, Remove commented out block of code from CGBlocks.cpp
This is a preparation clean-up commit around the code that emits
block copy/dispose routines.

llvm-svn: 296054
2017-02-24 00:21:20 +00:00
Alex Lorenz 95cb2fbd89 NFC, Add a test that ensures that we don't emit helper code in copy/dispose
routines for objects that are captured with the __unsafe_unretained
ownership qualifier

This is a preparation commit that improves code-coverage in code that emits
block copy/dispose routines.

llvm-svn: 296048
2017-02-24 00:09:30 +00:00
Alex Lorenz e3e8131460 NFC, Add a test that ensure that we don't emit helper code in copy/dispose
routines for variables that are const-captured

This is a preparation commit that improves code-coverage in code that emits
block copy/dispose routines.

llvm-svn: 296040
2017-02-23 23:41:50 +00:00
Benjamin Kramer d12317ef90 [CodeGen] Silence unused variable warning in Release builds.
llvm-svn: 296034
2017-02-23 22:47:56 +00:00
Richard Smith 382bc51fdd PR32044: Fix some cases where we would confuse a transparent init-list expression with an aggregate init.
llvm-svn: 296033
2017-02-23 22:41:47 +00:00
George Burgess IV 635a7369b7 Tighten up a regex in a test
...If we're trying to match "this function has only two arguments", `.*`
probably isn't the best thing to use. :)

llvm-svn: 296027
2017-02-23 22:14:55 +00:00
George Burgess IV d0a9e807f3 [CodeGen] Fix ExtParameterInfo bugs in C++ CodeGen code.
This patch makes use of the prefix/suffix ABI argument distinction that
was introduced in r295870, so that we now emit ExtParameterInfo at the
correct offset for member calls that have added ABI arguments. I don't
see a good way to test the generated param info, since we don't actually
seem to use it in CGFunctionInfo outside of Swift. Any
suggestions/thoughts for how to better test this are welcome. :)

This patch also fixes a small bug with inheriting constructors: if we
decide not to pass args into an base class ctor, we would still
generate ExtParameterInfo as though we did. The added test-case is for
that behavior.

llvm-svn: 296024
2017-02-23 22:07:35 +00:00
Richard Smith 1338122b25 Add context note to diagnostics that occur while declaring an implicit special member function.
llvm-svn: 296020
2017-02-23 21:43:43 +00:00
Erik Pilkington 9c42a8d43e [ObjC][CodeGen] CodeGen support for @available.
CodeGens uses of @available into calls to the compiler-rt function
__isOSVersionAtLeast.

This commit is part of a feature that I proposed here:
http://lists.llvm.org/pipermail/cfe-dev/2016-July/049851.html

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

llvm-svn: 296015
2017-02-23 21:08:08 +00:00
Serge Pavlov 418e0fb9aa Reverted r295975
llvm-svn: 295982
2017-02-23 15:10:45 +00:00
Serge Pavlov 6485a994db Added regression tests
llvm-svn: 295975
2017-02-23 14:34:04 +00:00
George Burgess IV 0d6592a899 [CodeGen] Don't reemit expressions for pass_object_size params.
This fixes an assertion failure in cases where we had expression
statements that declared variables nested inside of pass_object_size
args. Since we were emitting the same ExprStmt twice (once for the arg,
once for the @llvm.objectsize call), we were getting issues with
redefining locals.

This also means that we can be more lax about when we emit
@llvm.objectsize for pass_object_size args: since we're reusing the
arg's value itself, we don't have to care so much about side-effects.

llvm-svn: 295935
2017-02-23 05:59:56 +00:00
Argyrios Kyrtzidis 0af90586e7 [c-index-test] For the 'core' invocation, avoid running it under a new thread.
It's unnecessary.

llvm-svn: 295934
2017-02-23 05:51:47 +00:00
Richard Trieu bcaaf96674 [ODRHash] Handle types in ODR hashing.
Fields will now have their types added to the hash, allowing for detection of
mismatched field types.  This detection allows the existing ODR checking to
produce the correct message.

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

llvm-svn: 295931
2017-02-23 03:25:57 +00:00
Richard Smith 73c3c21fae Fix tracking of whether the previous template instantiation stack matches the current one.
Rather than attempting to compare whether the previous and current top of
context stack are "equal" (which fails for a number of reasons, such as the
context stack entries containing pointers to objects on the stack, or reaching
the same "top of stack" entry through two different paths), track the depth of
context stack at which we last emitted a note and invalidate it when we pop the
context stack to less than that depth.

This causes us to emit some missing "in instantiation of" notes and to stop
emitting redundant "in instantiation of" stacks matching the previous stack in
rare cases.

llvm-svn: 295921
2017-02-23 02:09:03 +00:00
Richard Smith 696e31271b Rename ActiveTemplateInstantiation to CodeSynthesisContext in preparation for
using it for other kinds of context (where we currently produce context notes
in a highly ad-hoc manner).

llvm-svn: 295919
2017-02-23 01:43:54 +00:00
Vedant Kumar e550d11d34 Rename a helper function, NFC.
llvm-svn: 295918
2017-02-23 01:22:38 +00:00
Richard Trieu d0786099b1 [ODRHash] Add IdentiferInfo and FieldDecl support.
IdentifierInfo is hashed based on the stored string.  FieldDecl versus other
Decl is now detected, as well as differently named fields.

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

llvm-svn: 295911
2017-02-23 00:23:01 +00:00
Alex Lorenz f9a28a287c [ObjC][Modules] Don't perform property lookup in hidden class extensions
rdar://30603803

llvm-svn: 295903
2017-02-22 23:18:49 +00:00
George Burgess IV 75b34a9610 [CodeGen] Add param info for ctors with ABI args.
This fixes a few assertion failures. Please see the added test case.

llvm-svn: 295894
2017-02-22 22:38:25 +00:00
Richard Trieu 639d7b68d6 [ODRHash] static_cast and Stmt hashing.
Add support for static_cast in classes.  Add pointer-independent profiling for
Stmt's, sharing most of the logic with Stmt::Profile.  This is the first of the
deep sub-Decl diffing for error messages.

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

llvm-svn: 295890
2017-02-22 22:22:42 +00:00
Richard Smith 64cb9ca456 PR32034: Evaluate _Atomic(T) in-place when T is a class or array type.
This is necessary in order for the evaluation of an _Atomic initializer for
those types to have an associated object, which an initializer for class or
array type needs.

llvm-svn: 295886
2017-02-22 22:09:50 +00:00
Matt Arsenault a0c6dca15b AMDGPU: Add fmed3 half builtin
llvm-svn: 295874
2017-02-22 20:55:59 +00:00
Bob Haarman 4f5a98570f stop using associative comdats for SEH filter functions
Summary: We implement structured exception handling (SEH) by generating filter functions for functions that use exceptions. Currently, we use associative comdats to ensure that the filter functions are preserved if and only if the functions we generated them for are preserved. This can lead to problems when generating COFF objects - LLVM may decide to inline a function that uses SEH and remove its body, at which point we will end up with a comdat that COFF cannot represent. To avoid running into that situation, this change makes us not use associative comdats for SEH filter functions. We can still get the benefits we used the associative comdats for: we will always preserve filter functions we use, and dead stripping can eliminate the ones we don't use.

Reviewers: rnk, pcc, ruiu

Reviewed By: rnk

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

llvm-svn: 295872
2017-02-22 20:29:39 +00:00
George Burgess IV f203dbfba9 [CodeGen] Note where we add ABI-specific args in ctors. NFC.
Meta: The ultimate goal is to teach ExtParameterInfo about
pass_object_size attributes. This is necessary for that, since our
ExtParameterInfo is a bit buggy in C++. I plan to actually make use of
this Prefix/Suffix info in the near future, but I like small
single-purpose changes. Especially when those changes are hard to
actually test...

At the moment, some of our C++-specific CodeGen pretends that ABIs can
only add arguments to the beginning of a function call. This isn't quite
correct: args can be appended to the end, as well. It hasn't mattered
much until now, since we seem to only use this "number of arguments
added" data when calculating the ExtParameterInfo to use when making a
CGFunctionInfo. Said ExtParameterInfo is currently only used for
ParameterABIs (Swift) and ns_consumed (ObjC).

So, this patch allows ABIs to indicate whether args they added were at
the beginning or end of an argument list. We can use this information to
emit ExtParameterInfos more correctly, though like said, that bit is
coming soon.

No tests since this is theoretically a nop.

llvm-svn: 295870
2017-02-22 20:28:02 +00:00
Richard Smith 4ae5ec8268 Improve support for 'decltype(auto)' in template template parameter matching.
A 'decltype(auto)' parameter can match any other kind of non-type template
parameter, so should be usable in place of any other parameter in a template
template argument. The standard is sadly extremely unclear on how this is
supposed to work, but this seems like the obviously-correct result.

It's less clear whether an 'auto' parameter should be able to match
'decltype(auto)', since the former cannot be used if the latter turns out to be
used for a reference type, but if we disallow that then consistency suggests we
should also disallow 'auto' matching 'T' for the same reason, defeating
intended use cases of the feature.

llvm-svn: 295866
2017-02-22 20:01:55 +00:00
Jan Vesely a6f369c727 [OpenCL] r600 needs OpenCL kernel calling convention
Differential Revision: https://reviews.llvm.org/D30236

llvm-svn: 295843
2017-02-22 15:01:42 +00:00
Yaron Keren 4cd211b5de Remove superfluous initializer.
The following fully-covered switch either sets value to External or exits the function.

llvm-svn: 295839
2017-02-22 14:32:39 +00:00
Simon Pilgrim eeb1b30627 Fix 'control reaches end of non-void function' warning
llvm-svn: 295829
2017-02-22 13:21:24 +00:00
Simon Pilgrim 732d6eb166 Fix -Wunused-private-field warning by removing unused ODRHash reference field from ODRDeclVisitor
llvm-svn: 295828
2017-02-22 13:19:24 +00:00
Benjamin Kramer 6f224d2bc0 [ODRHash] Avoid dereferencing end() of a SmallVector.
Found by MSAN.

llvm-svn: 295820
2017-02-22 10:19:45 +00:00
Jonas Hahnfeld 64a9e3c530 [OpenMP] Generate better diagnostics for cancel and cancellation point
checkNestingOfRegions uses CancelRegion to determine whether cancel and
cancellation point are valid in the given nesting. This leads to unuseful
diagnostics if CancelRegion is invalid. The given test case has produced:
  region cannot be closely nested inside 'parallel' region

As a solution, introduce checkCancelRegion and call it first to get the
expected error:
  one of 'for', 'parallel', 'sections' or 'taskgroup' is expected

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

llvm-svn: 295808
2017-02-22 06:49:10 +00:00
George Burgess IV 8856aa9a54 Call the correct @llvm.objectsize.
The following code would crash clang:

void foo(unsigned *const __attribute__((pass_object_size(0))));
void bar(unsigned *i) { foo(i); }

This is because we were always selecting the version of
`@llvm.objectsize` that takes an i8* in CodeGen. Passing an i32* as an
i8* makes LLVM very unhappy.

(Yes, I'm surprised that this remained uncaught for so long, too. :) )

As an added bonus, we'll now also use the appropriate address space when
emitting @llvm.objectsize calls.

llvm-svn: 295805
2017-02-22 02:35:51 +00:00
Richard Trieu e7f7ed2be7 Add more ODR checking.
Add the basics for the ODRHash class, which will only process Decl's from
a whitelist, which currently only has AccessSpecDecl.  Different access
specifiers in merged classes can now be detected.

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

llvm-svn: 295800
2017-02-22 01:11:25 +00:00
Richard Smith a0abc42911 Fix assertion failure when generating debug information for a variable
declaration declared using class template argument deduction.

Patch by Eric Fiselier (who is busy and asked me to commit this on his behalf)!

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

llvm-svn: 295794
2017-02-22 00:13:14 +00:00
Richard Smith b80bbca254 [c++1z] Mark constexpr lambdas as done on status page and start advertising
them via feature test macro __cpp_constexpr.

Thanks to Faisal for implementing this feature!

llvm-svn: 295791
2017-02-21 23:58:29 +00:00
Richard Smith 130cc445e4 Fix deduction of type of pack-expanded non-type template parameter.
We need to look through the PackExpansionType in the parameter type when
deducing, and we need to consider the possibility of deducing arguments for
packs that are not lexically mentioned in the pattern (but are nonetheless
deducible) when figuring out which packs are covered by a pack deduction scope.

llvm-svn: 295790
2017-02-21 23:49:18 +00:00
Brad Smith 9aa2bf209b Hook up OpenBSD AArch64 support
llvm-svn: 295786
2017-02-21 23:13:09 +00:00
Jacob Gravelle 40aefb5fe0 Declare lgamma library builtins as never being const
Summary:
POSIX requires lgamma writes to an external global variable, signgam.
This prevents annotating lgamma with readnone, which is incorrect on
targets that write to signgam.

Reviewers: efriedma, rsmith

Subscribers: cfe-commits

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

llvm-svn: 295781
2017-02-21 22:37:27 +00:00
Taewook Oh cc89bacabe Fix for pr31836 - pp_nonportable_path on absolute paths: broken delimiters
Summary: This is a patch for PR31836. As the bug replaces the path separators in the included file name with the characters following them, the test script makes sure that there's no "Ccase-insensitive-include-pr31836.h" in the warning message.

Reviewers: rsmith, eric_niebler

Reviewed By: eric_niebler

Subscribers: karies, cfe-commits

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

llvm-svn: 295779
2017-02-21 22:30:55 +00:00
Tim Shen d4ba2f2336 [XRay] Merge xray clang flag tests, and add powerpc64le.
Summary: I'm not sure why they were in different files, but it's kind of harder to maintain. I create this patch partially for initiate a discussion.

Reviewers: dberris

Subscribers: nemanjai, cfe-commits

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

llvm-svn: 295778
2017-02-21 22:30:00 +00:00
Dehao Chen 7810d4fbd0 Only enable AddDiscriminator pass when -fdebug-info-for-profiling is true
Summary: AddDiscriminator pass is only useful for sample pgo. This patch restricts AddDiscriminator to -fdebug-info-for-profiling so that it does not introduce unecessary debug size increases for non-sample-pgo builds.

Reviewers: dblaikie, aprantl

Reviewed By: dblaikie

Subscribers: cfe-commits

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

llvm-svn: 295764
2017-02-21 20:36:21 +00:00
Erik Pilkington 9227e108eb Fix copy and paste mistake in header comment, NFC.
llvm-svn: 295763
2017-02-21 20:31:01 +00:00
Simon Dardis df827a7165 [mips] Define macros related to -mabicalls in the preprocessor
Summary:
Historically, NetBSD, FreeBSD and OpenBSD have defined the macro ABICALLS in
the preprocessor when -mabicalls is in effect.

Mainline GCC later defined __mips_abicalls when -mabicalls is in effect.

This patch teaches the preprocessor to define these macros when appropriate.

NetBSD does not require the ABICALLS macro.

This resolves PR/31694.

Thanks to Sean Bruno for highlighting this issue!

Reviewers: slthakur, seanbruno

Reviewed By: seanbruno

Subscribers: joerg, brad, emaste, seanbruno, cfe-commits

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

llvm-svn: 295728
2017-02-21 16:01:00 +00:00
Krasimir Georgiev 4b15922838 [clang-format] Remove unused member variables from BreakableToken
llvm-svn: 295714
2017-02-21 10:54:50 +00:00