]> granicus.if.org Git - clang/log
clang
7 years agoAdd clazy to external Clang examples page
Kevin Funk [Fri, 24 Feb 2017 08:29:46 +0000 (08:29 +0000)]
Add clazy to external Clang examples page

Reviewers: silvas, rizsotto.mailinglist, sergio.martins

Reviewed By: rizsotto.mailinglist

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

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

7 years ago[Driver] Enable SafeStack for Fuchsia targets
Petr Hosek [Fri, 24 Feb 2017 03:17:41 +0000 (03:17 +0000)]
[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

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

7 years ago[ODRHash] Add handling of TypedefType and DeclarationName
Richard Trieu [Fri, 24 Feb 2017 02:59:12 +0000 (02:59 +0000)]
[ODRHash] Add handling of TypedefType and DeclarationName

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

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

7 years agoRepresent pass_object_size attrs in ExtParameterInfo
George Burgess IV [Fri, 24 Feb 2017 02:49:47 +0000 (02:49 +0000)]
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.

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

7 years agoFactor out some common code between SpecialMemberExceptionSpecInfo and SpecialMemberD...
Richard Smith [Fri, 24 Feb 2017 02:07:20 +0000 (02:07 +0000)]
Factor out some common code between SpecialMemberExceptionSpecInfo and SpecialMemberDeletionInfo.

To simplify this, convert SpecialMemberOverloadResult to a value type.

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

7 years agoSimplify and pass a more useful source location when computing an exception
Richard Smith [Fri, 24 Feb 2017 01:36:58 +0000 (01:36 +0000)]
Simplify and pass a more useful source location when computing an exception
specification for an implicit special member.

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

7 years agoRefactor computation of exception specification for special members to remove
Richard Smith [Fri, 24 Feb 2017 01:29:42 +0000 (01:29 +0000)]
Refactor computation of exception specification for special members to remove
some of the repetition.

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

7 years agoRecently a change was made to this test in r294639 which fails when the
Douglas Yung [Fri, 24 Feb 2017 01:25:02 +0000 (01:25 +0000)]
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.

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

7 years agoRevert r291477 "[Frontend] Correct values of ATOMIC_*_LOCK_FREE to match builtin"
Hans Wennborg [Fri, 24 Feb 2017 01:16:34 +0000 (01:16 +0000)]
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.

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

7 years ago[profiling] PR31992: Don't skip interesting non-base constructors
Vedant Kumar [Fri, 24 Feb 2017 01:15:19 +0000 (01:15 +0000)]
[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

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

7 years ago[Driver] Move architecture-specific free helper functions to their own files.
David L. Jones [Fri, 24 Feb 2017 00:28:01 +0000 (00:28 +0000)]
[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

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

7 years agoNFC, Remove commented out block of code from CGBlocks.cpp
Alex Lorenz [Fri, 24 Feb 2017 00:21:20 +0000 (00:21 +0000)]
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.

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

7 years agoNFC, Add a test that ensures that we don't emit helper code in copy/dispose
Alex Lorenz [Fri, 24 Feb 2017 00:09:30 +0000 (00:09 +0000)]
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.

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

7 years agoNFC, Add a test that ensure that we don't emit helper code in copy/dispose
Alex Lorenz [Thu, 23 Feb 2017 23:41:50 +0000 (23:41 +0000)]
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.

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

7 years ago[CodeGen] Silence unused variable warning in Release builds.
Benjamin Kramer [Thu, 23 Feb 2017 22:47:56 +0000 (22:47 +0000)]
[CodeGen] Silence unused variable warning in Release builds.

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

7 years agoPR32044: Fix some cases where we would confuse a transparent init-list expression...
Richard Smith [Thu, 23 Feb 2017 22:41:47 +0000 (22:41 +0000)]
PR32044: Fix some cases where we would confuse a transparent init-list expression with an aggregate init.

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

7 years agoTighten up a regex in a test
George Burgess IV [Thu, 23 Feb 2017 22:14:55 +0000 (22:14 +0000)]
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. :)

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

7 years ago[CodeGen] Fix ExtParameterInfo bugs in C++ CodeGen code.
George Burgess IV [Thu, 23 Feb 2017 22:07:35 +0000 (22:07 +0000)]
[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.

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

7 years agoAdd context note to diagnostics that occur while declaring an implicit special member...
Richard Smith [Thu, 23 Feb 2017 21:43:43 +0000 (21:43 +0000)]
Add context note to diagnostics that occur while declaring an implicit special member function.

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

7 years ago[ObjC][CodeGen] CodeGen support for @available.
Erik Pilkington [Thu, 23 Feb 2017 21:08:08 +0000 (21:08 +0000)]
[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

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

7 years agoReverted r295975
Serge Pavlov [Thu, 23 Feb 2017 15:10:45 +0000 (15:10 +0000)]
Reverted r295975

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

7 years agoAdded regression tests
Serge Pavlov [Thu, 23 Feb 2017 14:34:04 +0000 (14:34 +0000)]
Added regression tests

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

7 years ago[CodeGen] Don't reemit expressions for pass_object_size params.
George Burgess IV [Thu, 23 Feb 2017 05:59:56 +0000 (05:59 +0000)]
[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.

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

7 years ago[c-index-test] For the 'core' invocation, avoid running it under a new thread.
Argyrios Kyrtzidis [Thu, 23 Feb 2017 05:51:47 +0000 (05:51 +0000)]
[c-index-test] For the 'core' invocation, avoid running it under a new thread.

It's unnecessary.

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

7 years ago[ODRHash] Handle types in ODR hashing.
Richard Trieu [Thu, 23 Feb 2017 03:25:57 +0000 (03:25 +0000)]
[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

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

7 years agoFix tracking of whether the previous template instantiation stack matches the current...
Richard Smith [Thu, 23 Feb 2017 02:09:03 +0000 (02:09 +0000)]
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.

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

7 years agoRename ActiveTemplateInstantiation to CodeSynthesisContext in preparation for
Richard Smith [Thu, 23 Feb 2017 01:43:54 +0000 (01:43 +0000)]
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).

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

7 years agoRename a helper function, NFC.
Vedant Kumar [Thu, 23 Feb 2017 01:22:38 +0000 (01:22 +0000)]
Rename a helper function, NFC.

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

7 years ago[ODRHash] Add IdentiferInfo and FieldDecl support.
Richard Trieu [Thu, 23 Feb 2017 00:23:01 +0000 (00:23 +0000)]
[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

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

7 years ago[ObjC][Modules] Don't perform property lookup in hidden class extensions
Alex Lorenz [Wed, 22 Feb 2017 23:18:49 +0000 (23:18 +0000)]
[ObjC][Modules] Don't perform property lookup in hidden class extensions

rdar://30603803

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

7 years ago[CodeGen] Add param info for ctors with ABI args.
George Burgess IV [Wed, 22 Feb 2017 22:38:25 +0000 (22:38 +0000)]
[CodeGen] Add param info for ctors with ABI args.

This fixes a few assertion failures. Please see the added test case.

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

7 years ago[ODRHash] static_cast and Stmt hashing.
Richard Trieu [Wed, 22 Feb 2017 22:22:42 +0000 (22:22 +0000)]
[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

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

7 years agoPR32034: Evaluate _Atomic(T) in-place when T is a class or array type.
Richard Smith [Wed, 22 Feb 2017 22:09:50 +0000 (22:09 +0000)]
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.

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

7 years agoAMDGPU: Add fmed3 half builtin
Matt Arsenault [Wed, 22 Feb 2017 20:55:59 +0000 (20:55 +0000)]
AMDGPU: Add fmed3 half builtin

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

7 years agostop using associative comdats for SEH filter functions
Bob Haarman [Wed, 22 Feb 2017 20:29:39 +0000 (20:29 +0000)]
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

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

7 years ago[CodeGen] Note where we add ABI-specific args in ctors. NFC.
George Burgess IV [Wed, 22 Feb 2017 20:28:02 +0000 (20:28 +0000)]
[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.

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

7 years agoImprove support for 'decltype(auto)' in template template parameter matching.
Richard Smith [Wed, 22 Feb 2017 20:01:55 +0000 (20:01 +0000)]
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.

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

7 years ago[OpenCL] r600 needs OpenCL kernel calling convention
Jan Vesely [Wed, 22 Feb 2017 15:01:42 +0000 (15:01 +0000)]
[OpenCL] r600 needs OpenCL kernel calling convention

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

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

7 years agoRemove superfluous initializer.
Yaron Keren [Wed, 22 Feb 2017 14:32:39 +0000 (14:32 +0000)]
Remove superfluous initializer.
The following fully-covered switch either sets value to External or exits the function.

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

7 years agoFix 'control reaches end of non-void function' warning
Simon Pilgrim [Wed, 22 Feb 2017 13:21:24 +0000 (13:21 +0000)]
Fix 'control reaches end of non-void function' warning

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

7 years agoFix -Wunused-private-field warning by removing unused ODRHash reference field from...
Simon Pilgrim [Wed, 22 Feb 2017 13:19:24 +0000 (13:19 +0000)]
Fix -Wunused-private-field warning by removing unused ODRHash reference field from ODRDeclVisitor

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

7 years ago[ODRHash] Avoid dereferencing end() of a SmallVector.
Benjamin Kramer [Wed, 22 Feb 2017 10:19:45 +0000 (10:19 +0000)]
[ODRHash] Avoid dereferencing end() of a SmallVector.

Found by MSAN.

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

7 years ago[OpenMP] Generate better diagnostics for cancel and cancellation point
Jonas Hahnfeld [Wed, 22 Feb 2017 06:49:10 +0000 (06:49 +0000)]
[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

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

7 years agoCall the correct @llvm.objectsize.
George Burgess IV [Wed, 22 Feb 2017 02:35:51 +0000 (02:35 +0000)]
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.

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

7 years agoAdd more ODR checking.
Richard Trieu [Wed, 22 Feb 2017 01:11:25 +0000 (01:11 +0000)]
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

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

7 years agoFix assertion failure when generating debug information for a variable
Richard Smith [Wed, 22 Feb 2017 00:13:14 +0000 (00:13 +0000)]
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

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

7 years ago[c++1z] Mark constexpr lambdas as done on status page and start advertising
Richard Smith [Tue, 21 Feb 2017 23:58:29 +0000 (23:58 +0000)]
[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!

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

7 years agoFix deduction of type of pack-expanded non-type template parameter.
Richard Smith [Tue, 21 Feb 2017 23:49:18 +0000 (23:49 +0000)]
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.

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

7 years agoHook up OpenBSD AArch64 support
Brad Smith [Tue, 21 Feb 2017 23:13:09 +0000 (23:13 +0000)]
Hook up OpenBSD AArch64 support

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

7 years agoDeclare lgamma library builtins as never being const
Jacob Gravelle [Tue, 21 Feb 2017 22:37:27 +0000 (22:37 +0000)]
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

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

7 years agoFix for pr31836 - pp_nonportable_path on absolute paths: broken delimiters
Taewook Oh [Tue, 21 Feb 2017 22:30:55 +0000 (22:30 +0000)]
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

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

7 years ago[XRay] Merge xray clang flag tests, and add powerpc64le.
Tim Shen [Tue, 21 Feb 2017 22:30:00 +0000 (22:30 +0000)]
[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

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

7 years agoOnly enable AddDiscriminator pass when -fdebug-info-for-profiling is true
Dehao Chen [Tue, 21 Feb 2017 20:36:21 +0000 (20:36 +0000)]
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

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

7 years agoFix copy and paste mistake in header comment, NFC.
Erik Pilkington [Tue, 21 Feb 2017 20:31:01 +0000 (20:31 +0000)]
Fix copy and paste mistake in header comment, NFC.

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

7 years ago[mips] Define macros related to -mabicalls in the preprocessor
Simon Dardis [Tue, 21 Feb 2017 16:01:00 +0000 (16:01 +0000)]
[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

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

7 years ago[clang-format] Remove unused member variables from BreakableToken
Krasimir Georgiev [Tue, 21 Feb 2017 10:54:50 +0000 (10:54 +0000)]
[clang-format] Remove unused member variables from BreakableToken

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

7 years agoFix lookup through injected-class-names in implicit deduction guides in the
Richard Smith [Tue, 21 Feb 2017 08:42:39 +0000 (08:42 +0000)]
Fix lookup through injected-class-names in implicit deduction guides in the
case where the class template has a parameter pack.

Checking of the template arguments expects an "as-written" template argument
list, which in particular does not have any parameter packs. So flatten the
packs into separate arguments before passing them in.

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

7 years agoWhen deducing an array bound from the length of an initializer list, don't
Richard Smith [Tue, 21 Feb 2017 07:22:31 +0000 (07:22 +0000)]
When deducing an array bound from the length of an initializer list, don't
assume the bound has a non-dependent integral type.

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

7 years agoPR32010: Fix template argument depth mixup when forming implicit constructor
Richard Smith [Tue, 21 Feb 2017 06:30:38 +0000 (06:30 +0000)]
PR32010: Fix template argument depth mixup when forming implicit constructor
template deduction guides for class template argument deduction.

Ensure that we have a local instantiation scope for tracking the instantiated
parameters. Additionally, unusually, we're substituting at depth 1 and leaving
depth 0 alone; make sure that we don't reduce template parameter depth by 2 for
inner parameters in the process. (This is probably also broken for alias
templates in the case where they're expanded within a dependent context, but
this patch doesn't fix that.)

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

7 years agoAdd template parameter depth and index to -ast-dump output.
Richard Smith [Tue, 21 Feb 2017 02:04:03 +0000 (02:04 +0000)]
Add template parameter depth and index to -ast-dump output.

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

7 years agoFactor out function to determine whether we're performing a template
Richard Smith [Tue, 21 Feb 2017 01:17:38 +0000 (01:17 +0000)]
Factor out function to determine whether we're performing a template
instantiation.

In preparation for converting the template stack to a more general context
stack (so we can include context notes for other kinds of context).

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

7 years agoSema: use PropertyDecl for property selector
Saleem Abdulrasool [Mon, 20 Feb 2017 23:45:49 +0000 (23:45 +0000)]
Sema: use PropertyDecl for property selector

Using the constructed name for the class properties with dot syntax may
yield an inappropriate selector (i.e. if it is specified via property
attributes).  Prefer the declaration for the selector, falling back to
the constructed name otherwise.

Patch by David Herzka!

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

7 years ago[Sema][ObjC] perform-selector ARC check should see @selector in parens
Alex Lorenz [Mon, 20 Feb 2017 17:55:15 +0000 (17:55 +0000)]
[Sema][ObjC] perform-selector ARC check should see @selector in parens

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

7 years agoclang-format: [JS] Improve line-wrapping behavior of template strings.
Daniel Jasper [Mon, 20 Feb 2017 14:51:16 +0000 (14:51 +0000)]
clang-format: [JS] Improve line-wrapping behavior of template strings.

Specifically, similar to other blocks, clang-format now wraps both
after "${" and before the corresponding "}", if the contained
expression spans multiple lines.

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

7 years agoclang-format: Prevent weird line-wraps in complex lambda introducers
Daniel Jasper [Mon, 20 Feb 2017 12:43:48 +0000 (12:43 +0000)]
clang-format: Prevent weird line-wraps in complex lambda introducers

Before:
  aaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      [aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]() -> ::std::
  unordered_set<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> {
    //
  });

After:
  aaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      [aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]()
  -> ::std::unordered_set<
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> {
//
      });

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

7 years agoclang-format: [JS/TS] Improve detection for array subscripts in types.
Daniel Jasper [Mon, 20 Feb 2017 12:43:41 +0000 (12:43 +0000)]
clang-format: [JS/TS] Improve detection for array subscripts in types.

Before:
  var someValue = (v as aaaaaaaaaaaaaaaaaaaa<T>[
                  ]).someFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
  var someValue = (v as aaaaaaaaaaaaaaaaaaaa<T>[])
                      .someFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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

7 years ago[ASTImporter] Support default argument initialization of ParmVarDecls
Aleksei Sidorin [Mon, 20 Feb 2017 11:57:12 +0000 (11:57 +0000)]
[ASTImporter] Support default argument initialization of ParmVarDecls

Patch by Peter Szecsi!

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

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

7 years ago[ARM] Add regression tests for Cortex-M23 and Cortex-M33
Sanne Wouda [Mon, 20 Feb 2017 10:37:01 +0000 (10:37 +0000)]
[ARM] Add regression tests for Cortex-M23 and Cortex-M33

Reviewers: rengolin, t.p.northover

Reviewed By: t.p.northover

Subscribers: aemerson, llvm-commits

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

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

7 years ago[analyzer] Do not duplicate call graph nodes for functions that have definition and...
Aleksei Sidorin [Mon, 20 Feb 2017 09:16:48 +0000 (09:16 +0000)]
[analyzer] Do not duplicate call graph nodes for functions that have definition and forward declaration

Patch by Ivan Sidorenko!

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

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

7 years agoEnable support for __float128 in Clang on OpenBSD/X86
Brad Smith [Mon, 20 Feb 2017 03:18:15 +0000 (03:18 +0000)]
Enable support for __float128 in Clang on OpenBSD/X86

/usr/local/include/c++/4.9.4/type_traits:279:39: error: __float128 is not
supported on this target

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

7 years agoDriver: inline a single caller of a function (NFC)
Saleem Abdulrasool [Sun, 19 Feb 2017 21:50:40 +0000 (21:50 +0000)]
Driver: inline a single caller of a function (NFC)

Inline the addCompilerRT call to the single caller.  NFC.

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

7 years agoAlways use --eh-frame-hdr on OpenBSD, even for -static
Brad Smith [Sun, 19 Feb 2017 20:11:48 +0000 (20:11 +0000)]
Always use --eh-frame-hdr on OpenBSD, even for -static

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

7 years agoLink static PIE programs against rcrt0.o on OpenBSD
Brad Smith [Sun, 19 Feb 2017 19:33:26 +0000 (19:33 +0000)]
Link static PIE programs against rcrt0.o on OpenBSD

Patch by Stefan Kempf.

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

7 years ago[CUDA] Don't pass -stack-protector to NVPTX compilations.
Justin Lebar [Sun, 19 Feb 2017 19:05:32 +0000 (19:05 +0000)]
[CUDA] Don't pass -stack-protector to NVPTX compilations.

We can't support stack-protector on NVPTX because NVPTX doesn't expose a
stack to the compiler!

Fixes PR32009.

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

7 years agoclang/CMakeLists.txt: Rework r294954 -- use file(TO_CMAKE_PATH).
NAKAMURA Takumi [Sun, 19 Feb 2017 03:17:31 +0000 (03:17 +0000)]
clang/CMakeLists.txt: Rework r294954 -- use file(TO_CMAKE_PATH).

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

7 years ago[X86][XOP] Fix type conversion warning in vpcmov generic implementations.
Simon Pilgrim [Sat, 18 Feb 2017 23:47:34 +0000 (23:47 +0000)]
[X86][XOP] Fix type conversion warning in vpcmov generic implementations.

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

7 years ago[X86] Replace XOP vpcmov builtins with native vector logical operations.
Craig Topper [Sat, 18 Feb 2017 21:15:30 +0000 (21:15 +0000)]
[X86] Replace XOP vpcmov builtins with native vector logical operations.

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

7 years agoAMDGPU: Add gfx900 and gfx901 processors
Matt Arsenault [Sat, 18 Feb 2017 19:02:41 +0000 (19:02 +0000)]
AMDGPU: Add gfx900 and gfx901 processors

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

7 years ago[analyzer] Revert 295545. There are buildbot failures.
Daniel Marjamaki [Sat, 18 Feb 2017 16:31:35 +0000 (16:31 +0000)]
[analyzer] Revert 295545. There are buildbot failures.

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

7 years ago[analyzer] Fix crash in CastToStruct when there is no record definition
Daniel Marjamaki [Sat, 18 Feb 2017 11:18:57 +0000 (11:18 +0000)]
[analyzer] Fix crash in CastToStruct when there is no record definition

This crash was reported in https://bugs.llvm.org//show_bug.cgi?id=31173

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

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

7 years agoProcess attributes 'ifunc' and 'alias' when checking for redefinition
Serge Pavlov [Sat, 18 Feb 2017 06:04:15 +0000 (06:04 +0000)]
Process attributes 'ifunc' and 'alias' when checking for redefinition

These attributes effectively turn a non-defining declaration into a
definition, so the case when the declaration already has a body must
be diagnosed properly.

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

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

7 years ago[AVR] Move definition of IsIntegratedAssemblerDefault
Dylan McKay [Sat, 18 Feb 2017 02:42:36 +0000 (02:42 +0000)]
[AVR] Move definition of IsIntegratedAssemblerDefault

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

7 years agoPart of adding an improved ODR checker.
Richard Trieu [Sat, 18 Feb 2017 02:09:28 +0000 (02:09 +0000)]
Part of adding an improved ODR checker.

Reserve a spot for ODR hash in CXXRecordDecl and in its modules storage.
Default the hash value to 0 for all classes.

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

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

7 years ago[profiling] Make a test more explicit. NFC.
Vedant Kumar [Sat, 18 Feb 2017 02:02:55 +0000 (02:02 +0000)]
[profiling] Make a test more explicit. NFC.

The cxx-structors.cpp test checks that some instrumentation doesn't
appear, but it should be more explicit about which instrumentation it
actually expects to appear.

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

7 years ago[profiling] Tighten test cases which refer to "profn" vars. NFC.
Vedant Kumar [Sat, 18 Feb 2017 01:50:14 +0000 (01:50 +0000)]
[profiling] Tighten test cases which refer to "profn" vars. NFC.

The frontend can't see "__profn" profile name variables after IRGen
because llvm throws these away now. Tighten up some test cases which
checked for the non-existence of those variables.

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

7 years agoReuse a local variable. NFC.
Vedant Kumar [Sat, 18 Feb 2017 01:50:11 +0000 (01:50 +0000)]
Reuse a local variable. NFC.

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

7 years agoCleanup: use range-based for rather than separate calls to begin and end.
Richard Smith [Sat, 18 Feb 2017 01:14:43 +0000 (01:14 +0000)]
Cleanup: use range-based for rather than separate calls to begin and end.

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

7 years agoHandle deduction guides better in -ast-print.
Richard Smith [Sat, 18 Feb 2017 01:01:48 +0000 (01:01 +0000)]
Handle deduction guides better in -ast-print.

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

7 years ago[modules] Load the ModuleOffsetMap from the module header lazily.
Richard Smith [Sat, 18 Feb 2017 00:32:02 +0000 (00:32 +0000)]
[modules] Load the ModuleOffsetMap from the module header lazily.

If we never need to map any ID within the module to its global ID, we don't
need the module offset map. If a compilation transitively depends on lots of
unused module files, this can result in a modest performance improvement.

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

7 years agoRetry^2: [ubsan] Reduce null checking of C++ object pointers (PR27581)
Vedant Kumar [Fri, 17 Feb 2017 23:22:59 +0000 (23:22 +0000)]
Retry^2: [ubsan] Reduce null checking of C++ object pointers (PR27581)

This patch teaches ubsan to insert exactly one null check for the 'this'
pointer per method/lambda.

Previously, given a load of a member variable from an instance method
('this->x'), ubsan would insert a null check for 'this', and another
null check for '&this->x', before allowing the load to occur.

Similarly, given a call to a method from another method bound to the
same instance ('this->foo()'), ubsan would a redundant null check for
'this'. There is also a redundant null check in the case where the
object pointer is a reference ('Ref.foo()').

This patch teaches ubsan to remove the redundant null checks identified
above.

Testing: check-clang, check-ubsan, and a stage2 ubsan build.

I also compiled X86FastISel.cpp with -fsanitize=null using
patched/unpatched clangs based on r293572. Here are the number of null
checks emitted:

  -------------------------------------
  | Setup          | # of null checks |
  -------------------------------------
  | unpatched, -O0 |            21767 |
  | patched, -O0   |            10758 |
  -------------------------------------

Changes since the initial commit:
- Don't introduce any unintentional object-size or alignment checks.
- Don't rely on IRGen of C labels in the test.

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

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

7 years ago[ubsan] Pass a set of checks to skip to EmitTypeCheck() (NFC)
Vedant Kumar [Fri, 17 Feb 2017 23:22:55 +0000 (23:22 +0000)]
[ubsan] Pass a set of checks to skip to EmitTypeCheck() (NFC)

CodeGenFunction::EmitTypeCheck accepts a bool flag which controls
whether or not null checks are emitted. Make this a bit more flexible by
changing the bool to a SanitizerSet.

Needed for an upcoming change which deals with a scenario in which we
only want to emit null checks.

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

7 years ago[OpenMP] Prepare Sema for initial implementation for pragma 'distribute parallel...
Carlo Bertolli [Fri, 17 Feb 2017 21:29:13 +0000 (21:29 +0000)]
[OpenMP] Prepare Sema for initial implementation for pragma 'distribute parallel for'

https://reviews.llvm.org/D29922

This patch adds two fields for use in the implementation of 'distribute parallel for':

The increment expression for the distribute loop. As the chunk assigned to a team is executed by multiple threads within the 'parallel for' region, the increment expression has to correspond to the value returned by the related runtime call (for_static_init).
The upper bound of the innermost loop ('for' in 'distribute parallel for') is not the globalUB expression normally used for pragma 'for' when found in isolation. It is instead the upper bound of the chunk assigned to the team ('distribute' loop). In this way, we prevent teams from executing chunks assigned to other teams.
The use of these two fields can be see in a related explanatory patch:
https://reviews.llvm.org/D29508

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

7 years agoRevert "Retry: [ubsan] Reduce null checking of C++ object pointers (PR27581)"
Vedant Kumar [Fri, 17 Feb 2017 20:59:40 +0000 (20:59 +0000)]
Revert "Retry: [ubsan] Reduce null checking of C++ object pointers (PR27581)"

This reverts commit r295401. It breaks the ubsan self-host. It inserts
object size checks once per C++ method which fire when the structure is
empty.

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

7 years agoAdd an explicit derived class of FunctionDecl to model deduction guides rather
Richard Smith [Fri, 17 Feb 2017 20:05:37 +0000 (20:05 +0000)]
Add an explicit derived class of FunctionDecl to model deduction guides rather
than just treating them as FunctionDecls with a funny name.

No functionality change intended.

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

7 years ago[Test] Make Lit tests C++11 compatible - misc
Charles Li [Fri, 17 Feb 2017 19:36:19 +0000 (19:36 +0000)]
[Test] Make Lit tests C++11 compatible - misc

Updated 5 tests.

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

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

7 years ago[CMake] Add Fuchsia toolchain CMake cache files
Petr Hosek [Fri, 17 Feb 2017 19:28:54 +0000 (19:28 +0000)]
[CMake] Add Fuchsia toolchain CMake cache files

These cache files can be used to build Fuchsia toolchain. They also
demonstrate the use of multi-target builtins build.

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

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

7 years ago[OpenMP] Fix cancellation point in task with no cancel
Jonas Hahnfeld [Fri, 17 Feb 2017 18:32:58 +0000 (18:32 +0000)]
[OpenMP] Fix cancellation point in task with no cancel

With tasks, the cancel may happen in another task. This has a different
region info which means that we can't find it here.

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

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

7 years ago[OpenMP] Remove barriers at cancel and cancellation point
Jonas Hahnfeld [Fri, 17 Feb 2017 18:32:51 +0000 (18:32 +0000)]
[OpenMP] Remove barriers at cancel and cancellation point

This resolves a deadlock with the cancel directive when there is no explicit
cancellation point. In that case, the implicit barrier acts as cancellation
point. After removing the barrier after cancel, the now unmatched barrier for
the explicit cancellation point has to go as well.

This has probably worked before rL255992: With the calls for the explicit
barrier, it was sure that all threads passed a barrier before exiting.

Reported by Simon Convent and Joachim Protze!

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

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

7 years agoRename DiagnosticInfoWithDebugLoc to WithLocation to match LLVM
Justin Bogner [Fri, 17 Feb 2017 17:34:49 +0000 (17:34 +0000)]
Rename DiagnosticInfoWithDebugLoc to WithLocation to match LLVM

Updates for llvm r295465.

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

7 years agoclang-format: Don't remove existing spaces between identifier and ::.
Daniel Jasper [Fri, 17 Feb 2017 10:44:07 +0000 (10:44 +0000)]
clang-format: Don't remove existing spaces between identifier and ::.

This can lead to bad behavior with macros that are used to annotate
functions (e.g. ALWAYS_INLINE).

Before, this:
  ALWAYS_INLINE ::std::string getName() ...

was turned into:
  ALWAYS_INLINE::std::string getName() ...

If it turns out that clang-format is failing to clean up a lot of the
existing spaces now, we can add more analyses of the identifier. It
should not currently. Cases where clang-format breaks nested name
specifiers should be fine as clang-format wraps after the "::". Thus, a
line getting longer and then shorter again should lead to the same
original code.

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