Commit Graph

24427 Commits

Author SHA1 Message Date
David Blaikie 20937be183 DebugInfo: Suppress the location of instructions in complex default arguments.
llvm-svn: 228589
2015-02-09 18:55:57 +00:00
David Blaikie 2221aba85b DebugInfo: Suppress the location of instructions in aggregate default arguments.
Matches the existing code for scalar default arguments. Complex default
arguments probably need the same handling too (test/fix to that coming
next).

llvm-svn: 228588
2015-02-09 18:47:14 +00:00
David Majnemer e9624ed67a Sema: Don't give attribute alias vars with struct type an init expr
We'd give the VarDecl a CXXConstructExpr even though it is annotated
with an alias attribute.  This would make us trip over sanity checking
asserts.

This fixes PR22493.

llvm-svn: 228523
2015-02-08 10:55:14 +00:00
Richard Smith 2b56057517 [modules] Treat friend declarations that are lexically within a dependent
context as anonymous for merging purposes. They can't be found by their names,
so we merge them based on their position within the surrounding context.

llvm-svn: 228485
2015-02-07 03:11:11 +00:00
Filipe Cabecinhas 2177fc1732 Make the byte-shift SSE intrinsics emit vector shuffles which we know the backend can handle.
Also removed unused builtins.

Original patch by Andrea Di Biagio!

Reviewers: craig.topper, nadav

Subscribers: cfe-commits

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

llvm-svn: 228481
2015-02-07 01:37:09 +00:00
Richard Smith a3271c1390 [modules] Don't accidentally trigger deserialization from DeclContext::noload_lookup.
llvm-svn: 228475
2015-02-07 00:45:52 +00:00
Richard Smith 72625c2cad PR22405: don't lose implicit-deleted-ness across AST write / read.
llvm-svn: 228464
2015-02-06 23:20:21 +00:00
Eric Christopher f5d9977600 Make this test a little less specific by removing the argument that
could change.

llvm-svn: 228438
2015-02-06 20:53:40 +00:00
Eric Christopher 79f5e4ede5 Inline asm IR input register constraints don't have early clobber
modifiers on them. If we have a matching output constraint with
an early clobber make sure we don't propagate that to the input
constraint.

llvm-svn: 228422
2015-02-06 18:44:18 +00:00
Steven Wu 3ffb61b4ae -iframework option should be forwarded to linker
Summary:
-iframework option is used to specified System framework path so the
path specified should be passed to linker as -F option
rdar://problem/18234544

Reviewers: bob.wilson

Subscribers: cfe-commits

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

llvm-svn: 228413
2015-02-06 18:08:29 +00:00
Tom Stellard 96d5dc77fa Revert "OpenCL: handle shift operator with vector operands"
This reverts commit r228382.

This breaks the following case:  Reported by Jeroen Ketema:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20150202/122961.html

typedef __attribute__((ext_vector_type(3))) char char3;

void foo() {
 char3 v = {1,1,1};
 char3 w = {1,2,3};

 w <<= v;
}

If I compile with:

 clang -x cl file.c

Then an error is produced:

file.c:10:5: error: expression is not assignable
 w <<= v;
 ~ ^
1 error generated.

llvm-svn: 228406
2015-02-06 17:30:04 +00:00
Bill Schmidt 12ba5fd491 [PowerPC] Re-disable linker optimizations for now
llvm-svn: 228402
2015-02-06 15:31:03 +00:00
Andrea Di Biagio b4f5d5cb35 Added a test to check that exception flags are not passed by default on PS4.
This patch adds an extra test case to clang-exception-flags.cpp.
No functional change intended.

Patch by Wolfgang Pieb!

Reviewers: filcab, alexr

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

llvm-svn: 228394
2015-02-06 13:02:39 +00:00
Sameer Sahasrabuddhe c65605d008 OpenCL: handle shift operator with vector operands
Introduce a number of checks:
1. If LHS is a scalar, then RHS cannot be a vector.
2. Operands must be of integer type.
3. If both are vectors, then the number of elements must match.

Relax the requirement for "usual arithmetic conversions":
When LHS is a vector, a scalar RHS can simply be expanded into a
vector; OpenCL does not require that its rank be lower than the LHS.
For example, the following code is not an error even if the implicit
type of the constant literal is "int".

  char2 foo(char2 v) { return v << 1; }

Consolidate existing tests under CodeGenOpenCL, and add more tests
under SemaOpenCL.

llvm-svn: 228382
2015-02-06 05:44:55 +00:00
Richard Smith 5a4737cd6a [modules] If a module declares an entity and then imports another declaration
of that entity, ensure that the redeclaration chain is reordered properly on
reload. Otherwise, the result of name lookup for that entity may point to an
entity that is too old; if that's an injected friend name or the like, that
can result in the name not being found at all.

llvm-svn: 228371
2015-02-06 02:42:59 +00:00
Tim Northover a6a19f1e38 Preprocessor: support __BIGGEST_ALIGNMENT__ macro
For compatibility with GCC (and because it's generally helpful information
otherwise inaccessible to the preprocessor). This appears to be canonically the
alignment of max_align_t (e.g. on i386, __BIGGEST_ALIGNMENT__ is 4 even though
vector types will be given greater alignment).

Patch mostly by Mats Petersson

llvm-svn: 228367
2015-02-06 01:25:07 +00:00
Filipe Cabecinhas 566e584bd4 Force an unknown target for the default case to make it work.
Summary:
This test was failing if LLVM_DEFAULT_TARGET_TRIPLE=x86_64-scei-ps4 due to
its behavior for exceptions.
Force an --unknown triple for the default case.

Reviewers: echristo, chandlerc

Subscribers: cfe-commits

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

llvm-svn: 228337
2015-02-05 19:48:48 +00:00
Reid Kleckner deeddeced3 Re-land r228258 and make clang-cl's /EHs- disable -fexceptions again
After r228258, Clang started emitting C++ EH IR that LLVM wasn't ready
to deal with, even when exceptions were disabled with /EHs-. This time,
make /EHs- turn off -fexceptions while still emitting exceptional
constructs in functions using __try.  Since Sema rejects C++ exception
handling constructs before CodeGen, landingpads should only appear in
such functions as the result of a __try.

llvm-svn: 228329
2015-02-05 18:56:03 +00:00
Richard Smith ed83ebd77e PR22465: when performing list-initialization for a class type C, if we see an
initializer of the form {x}, where x is of type C or a type derived from C,
perform *non-list* initialization of the entity from x, but create a
CXXConstructExpr that knows that we used list-initialization syntax.

Plus some fixes to ensure we mangle correctly in this and related cases.

llvm-svn: 228276
2015-02-05 07:02:11 +00:00
Alexey Bataev 6956e2e683 [OPENMP] Initial codegen for 'single' directive.
This patch emits the following code for the single directive:

#pragma omp single
<body>
<---->

if(__kmpc_single(...)) {
    <body>
      __kmpc_end_single(...);
}
Differential Revision: http://reviews.llvm.org/D7045

llvm-svn: 228275
2015-02-05 06:35:41 +00:00
Richard Smith 520449d55e Various fixes to mangling of list-initialization.
llvm-svn: 228274
2015-02-05 06:15:50 +00:00
Alexey Bataev 9f797f32e2 [OPENMP] Codegen for 'taskyield' directive
For 'taskyield' directive emit call to kmp_int32 __kmpc_omp_taskyield(ident_t *,
kmp_int32 global_tid, int end_part); runtime function call with end_part arg set
to 0 (it is ignored).
Differential Revision: http://reviews.llvm.org/D7047

llvm-svn: 228272
2015-02-05 05:57:51 +00:00
Nico Weber 94b2368c24 Revert r228258.
It caused a chromium base unittest that tests throwing and catching SEH
exceptions to fail (http://crbug.com/455488) and I suspect it might also
be the cause of the chromium clang win 64-bit shared release builder timing
out during compiles.  So revert to see if that's true.

llvm-svn: 228262
2015-02-05 02:08:50 +00:00
Bill Schmidt 0a9c061343 [PowerPC] Revert workaround for TLS linker bug
In r227480, Ulrich Weigand introduced a workaround for a linker
optimization bug that can create mis-optimized code for accesses to
general-dynamic or local-dynamic TLS variables.  The linker
optimization bug only occurred for Clang/LLVM because of some
inefficient code being generated for these TLS accesses.  I have
recently corrected LLVM to produce the efficient code sequence
expected by the linkers, so this workaround is no longer needed.
Therefore this patch reverts r227480.

I've tested that the previous bootstrap failure no longer occurs with
the workaround reverted.

llvm-svn: 228253
2015-02-05 01:12:24 +00:00
Anna Zaks f4c7ce8a37 [analyzer] Relax an assertion in VisitLvalArraySubscriptExpr
The analyzer thinks that ArraySubscriptExpr cannot be an r-value (ever).
However, it can be in some corner cases. Specifically, C forbids expressions
of unqualified void type from being l-values.

Note, the analyzer will keep modeling the subscript expr as an l-value. The
analyzer should be treating void* as a char array
(https://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Pointer-Arith.html).

llvm-svn: 228249
2015-02-05 01:02:59 +00:00
Anna Zaks 33f0632640 [analyzer] Do not crash in the KeychainAPI checker on user defined 'free()'.
llvm-svn: 228248
2015-02-05 01:02:56 +00:00
Anna Zaks 486a0ff4b7 [analyzer] Look for allocation site in the parent frames as well as the current one.
Instead of handling edge cases (mostly involving blocks), where we have difficulty finding
an allocation statement, allow the allocation site to be in a parent node.

Previously we assumed that the allocation site can always be found in the same frame
as allocation, but there are scenarios in which an element is leaked in a child
frame but is allocated in the parent.

llvm-svn: 228247
2015-02-05 01:02:53 +00:00
NAKAMURA Takumi b1980e63d7 Tweak clang/test/CodeGenCXX/debug-info-line.cpp for -Asserts.
CHECK: call {{.*}}src

matched

  %call = invoke dereferenceable(4) i32* @_Z3srcv()

I don't think it was intentional.

llvm-svn: 228245
2015-02-05 01:02:34 +00:00
Reid Kleckner 16f9a6b43d Fix crash on finally blocks that don't fall through
llvm-svn: 228243
2015-02-05 00:58:46 +00:00
Richard Smith 4eca9b9372 [modules] When using -E, we may try to merge decls despite having no Sema
object. In such a case, use the TU's DC for merging global decls rather than
giving up when we find there is no TU scope.

Ultimately, we should probably avoid all loading of decls when preprocessing,
but there are other reasonable use cases for loading an AST file with no Sema
object for which this is the right thing.

llvm-svn: 228234
2015-02-04 23:37:59 +00:00
Reid Kleckner aca01db706 Implement IRGen for SEH __finally and AbnormalTermination
Previously we would simply double-emit the body of the __finally block,
but that doesn't work when it contains any kind of Decl, which we can't
double emit.

This fixes that by emitting the block once and branching into a shared
code region and then branching back out.

llvm-svn: 228222
2015-02-04 22:37:07 +00:00
Josh Magee 4d1a79b8c0 Catch more cases when diagnosing integer-constant-expression overflows.
When visiting AssignmentOps, keep evaluating after a failure (when possible) in
order to identify overflow in subexpressions.

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

llvm-svn: 228202
2015-02-04 21:50:20 +00:00
DeLesley Hutchins 3c355aa24d Thread Safety Analysis: support adopting of locks, as implemented in
std::lock_guard.  If EXCLUSIVE_LOCKS_REQUIRED is placed on the constructor of
a SCOPED_LOCKABLE class, then that constructor is assumed to adopt the lock;
e.g. the lock must be held on construction, and will be released on destruction.

llvm-svn: 228194
2015-02-04 21:16:17 +00:00
David Blaikie 4d52443c0e DebugInfo: Attribute cleanup code to the end of the scope, not the end of the function.
Now if you break on a dtor and go 'up' in your debugger (or you get an
asan failure in a dtor) during an exception unwind, you'll have more
context. Instead of all dtors appearing to be called from the '}' of the
function, they'll be attributed to the end of the scope of the variable,
the same as the non-exceptional dtor call.

This doesn't /quite/ remove all uses of CurEHLocation (which might be
nice to remove, for a few reasons) - it's still used to choose the
location for some other work in the landing pad. It'd be nice to
attribute that code to the same location as the exception calls within
the block and to remove CurEHLocation.

llvm-svn: 228181
2015-02-04 19:47:54 +00:00
Jordan Rose cb5386cbfc [analyzer] RetainCountChecker: be forgiving when ivars are accessed directly.
A refinement of r204730, itself a refinement of r198953, to better handle
cases where an object is accessed both through a property getter and
through direct ivar access. An object accessed through a property should
always be treated as +0, i.e. not owned by the caller. However, an object
accessed through an ivar may be at +0 or at +1, depending on whether the
ivar is a strong reference. Outside of ARC, we don't always have that
information.

The previous attempt would clear out the +0 provided by a getter, but only
if that +0 hadn't already participated in other retain counting operations.
(That is, "self.foo" is okay, but "[[self.foo retain] autorelease]" is
problematic.) This turned out to not be good enough when our synthesized
getters get involved.

This commit drops the notion of "overridable" reference counting and instead
just tracks whether a value ever came from a (strong) ivar. If it has, we
allow one more release than we otherwise would. This has the added benefit
of being able to catch /some/ overreleases of instance variables, though
it's not likely to come up in practice.

We do still get some false negatives because we currently throw away
refcount state upon assigning a value into an ivar. We should probably
improve on that in the future, especially once we synthesize setters as
well as getters.

rdar://problem/18075108

llvm-svn: 228174
2015-02-04 19:24:52 +00:00
Ben Langmuir 1d9b36227a Port test/Driver/mg.c to use FileCheck instead of fgrep
Patch by İsmail Dönmez

llvm-svn: 228164
2015-02-04 18:34:26 +00:00
Steven Wu a74bbaf97c Update darwin-version tests
Summary:
Now that the darwin-version tests in Driver and Frontend are
testing different parts of the version encoding instead of doing
duplicated work

Reviewers: rnk

Reviewed By: rnk

Subscribers: rnk, cfe-commits

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

llvm-svn: 228159
2015-02-04 18:10:38 +00:00
Alexey Samsonov a511cdd247 Allow to specify multiple -fsanitize-blacklist= arguments.
Summary:
Allow user to provide multiple blacklists by passing several
-fsanitize-blacklist= options. These options now don't override
default blacklist from Clang resource directory, which is always
applied (which fixes PR22431).

-fno-sanitize-blacklist option now disables all blacklists that
were specified earlier in the command line (including the default
one).

This change depends on http://reviews.llvm.org/D7367.

Test Plan: regression test suite

Reviewers: timurrrr

Subscribers: cfe-commits, kcc, pcc

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

llvm-svn: 228156
2015-02-04 17:40:08 +00:00
NAKAMURA Takumi 2e4c20109a Tweak clang/test/CodeGenCXX/copy-constructor-elim.cpp to satisfy i686-linux.
llvm-svn: 228146
2015-02-04 14:51:30 +00:00
Daniel Sanders aa748a8db5 Preserve early clobber flag when using named registers in inline assembly.
Summary:
Named registers with the constraint "=&r" currently lose the early clobber flag
and turn into "=r" when converted to LLVM-IR. This patch correctly passes it on.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits

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

llvm-svn: 228143
2015-02-04 14:25:47 +00:00
Renato Golin 84545d7a5c Teaches the Clang driver to accept Cortex-A72
A previous commit added Cortex-A72 to LLVM, this teaches Clang to
accept it as well.

Patch by Ranjeet Singh.

llvm-svn: 228141
2015-02-04 13:31:56 +00:00
David Majnemer bda8632f9b Parse: Handle __declspec in a lambda definition
llvm-svn: 228121
2015-02-04 08:22:46 +00:00
David Majnemer 631a90b6bc Sema: Add support for __declspec(restrict)
__declspec(restrict) and __attribute(malloc) are both handled
identically by clang: they are allowed to the noalias LLVM attribute.

Seeing as how noalias models the C99 notion of 'restrict', rename the
internal clang attribute to Restrict from Malloc.

llvm-svn: 228120
2015-02-04 07:23:21 +00:00
Anna Zaks a3d9534248 Register parameters have local storage.
Fixes a regression introduced in r209149.

llvm-svn: 228119
2015-02-04 07:15:12 +00:00
Sameer Sahasrabuddhe e8d2aaf320 OpenCL: handle ternary operator when the condition is a vector
When the condition is a vector, OpenCL specifies additional
requirements on the operand types, and also the operations
required to determine the result type of the operator. This is a
combination of OpenCL v1.1 s6.3.i and s6.11.6, and the semantics
remain unchanged in later versions of OpenCL.

llvm-svn: 228118
2015-02-04 06:38:18 +00:00
Alexey Bataev 8f01bb983c [MSVC2012] Allow 'mutable' references
Some standard header files from MSVC2012 use 'mutable' on references, though it is directly prohibited by the standard.
Fix for http://llvm.org/PR22444
Differential Revision: http://reviews.llvm.org/D7370

llvm-svn: 228113
2015-02-04 04:45:32 +00:00
Rafael Espindola d94d25301c Make this test stricter. NFC.
llvm-svn: 228112
2015-02-04 04:23:48 +00:00
David Majnemer df1e1aee4c Fix ARM buildbot
llvm-svn: 228111
2015-02-04 03:30:00 +00:00
Larisse Voufo 5ecfede65c Fix typo in test case.
llvm-svn: 228110
2015-02-04 03:16:46 +00:00
Larisse Voufo eebe962eda Fix typo in test case.
llvm-svn: 228108
2015-02-04 02:46:33 +00:00