Commit Graph

57533 Commits

Author SHA1 Message Date
Derek Schuff 6ab52fabcf Add driver support for Native Client SDK
Add Tool and ToolChain support for clang to target the NaCl OS using the NaCl
SDK for x86-32, x86-64 and ARM.

Includes nacltools::Assemble and Link which are derived from gnutools. They
are similar to Linux but different enought that they warrant their own class.
Also includes a NaCl_TC in ToolChains derived from Generic_ELF with library
and include paths suitable for an SDK and independent of the system tools.

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

llvm-svn: 233594
2015-03-30 20:31:33 +00:00
Jordan Rose ad176b5e10 [analyzer] Add test for previous commit.
Again, this is being applied in a separate commit so that the previous commit
can be reverted while leaving the test in place.

rdar://problem/20335433

llvm-svn: 233593
2015-03-30 20:18:04 +00:00
Jordan Rose 3da3f8e045 [analyzer] Disable all retain count diagnostics on values that come from ivars.
This is imitating a pre-r228174 state where ivars are not considered tracked by
default, but with the addition that even ivars /with/ retain count information
(e.g. "[_ivar retain]; [ivar _release];") are not being tracked as well. This is
to ensure that we don't regress on values accessed through both properties and
ivars, which is what r228174 was trying to fix.

The issue occurs in code like this:

  [_contentView retain];
  [_contentView removeFromSuperview];
  [self addSubview:_contentView]; // invalidates 'self'
  [_contentView release];

In this case, the call to -addSubview: may change the value of self->_contentView,
and so the analyzer can't be sure that we didn't leak the original _contentView.
This is a correct conservative view of the world, but not a useful one. Until we
have a heuristic that allows us to not consider this a leak, not emitting a
diagnostic is our best bet.

This commit disables all of the ivar-related retain count tests, but does not
remove them to ensure that we don't crash trying to evaluate either valid or
erroneous code. The next commit will add a new test for the example above so
that this commit (and the previous one) can be reverted wholesale when a better
solution is implemented.

Rest of rdar://problem/20335433

llvm-svn: 233592
2015-03-30 20:18:00 +00:00
Jordan Rose 218772f87e [analyzer] Don't special-case ivars backing +0 properties.
Give up this checking in order to continue tracking that these values came from
direct ivar access, which will be important in the next commit.

Part of rdar://problem/20335433

llvm-svn: 233591
2015-03-30 20:17:47 +00:00
Duncan P. N. Exon Smith 2809cc7493 DebugInfo: Use new LLVM API for DebugLoc
Use the new API for `DebugLoc` added in r233573 before the old one
disappears.

llvm-svn: 233589
2015-03-30 20:01:41 +00:00
Richard Smith d7eef87e65 Updating code owners file per discussion with Doug at the 2014-10 dev meeting.
llvm-svn: 233588
2015-03-30 19:52:53 +00:00
Kit Barton e50adcb6b1 [PPC] Move argument range checks for HTM and crypto builtins to Sema
The argument range checks for the HTM and Crypto builtins were implemented in
CGBuiltin.cpp, not in Sema. This change moves them to the appropriate location
in SemaChecking.cpp. It requires the creation of a new method in the Sema class
to do checks for PPC-specific builtins.

http://reviews.llvm.org/D8672

llvm-svn: 233586
2015-03-30 19:40:59 +00:00
Ulrich Weigand 283ad7d6b4 [SystemZ] Fix fallout from r233543 on no-assert builds
Test cases must not check for symbolic variable names that are not
present in IR generated by no-assert builds.

Fixed by testing a more complete subset of the va_arg dataflow,
without relying on variable names.

llvm-svn: 233574
2015-03-30 18:08:50 +00:00
Ulrich Weigand 881497ac29 [SystemZ] Fix definition of IntMaxType / Int64Type
Like on other 64-bit platforms, Int64Type should be SignedLong
on SystemZ, not SignedLongLong as per default.  This could cause
ABI incompatibilities in certain cases (e.g. name mangling).

llvm-svn: 233544
2015-03-30 13:50:21 +00:00
Ulrich Weigand 759449c76a [SystemZ] Fix some ABI corner cases
Running the GCC's inter-compiler ABI compatibility test suite uncovered
a couple of errors in clang's SystemZ ABI implementation.  These all
affect only rare corner cases:

- Short vector types

GCC synthetic vector types defined with __attribute__ ((vector_size ...))
are always passed and returned by reference.  (This is not documented in
the official ABI document, but is the de-facto ABI implemented by GCC.)
clang would do that only for vector sizes >= 16 bytes, but not for shorter
vector types.

- Float-like aggregates and empty bitfields

clang would consider any aggregate containing an empty bitfield as
first element to be a float-like aggregate.  That's obviously wrong.
According to the ABI doc, the presence of an empty bitfield makes
an aggregate to be *not* float-like.  However, due to a bug in GCC,
empty bitfields are ignored in C++; this patch changes clang to be
compatible with this "feature" of GCC.

- Float-like aggregates and va_arg

The va_arg implementation would mis-detect some aggregates as float-like
that aren't actually passed as such.  This applies to aggregates that
have only a single element of type float or double, but using an aligned
attribute that increases the total struct size to more than 8 bytes.

This error occurred because the va_arg implement used to have an copy
of the float-like aggregate detection logic (i.e. it would call the
isFPArgumentType routine, but not perform the size check).

To simplify the logic, this patch removes the duplicated logic and
instead simply checks the (possibly coerced) LLVM argument type as
already determined by classifyArgumentType.

llvm-svn: 233543
2015-03-30 13:49:01 +00:00
Daniel Sanders 48fa39e4a1 [mips] Add support for 'ZC' inline assembly memory constraint.
Summary: Also add tests for 'R' and 'm'.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits

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

llvm-svn: 233542
2015-03-30 13:47:23 +00:00
Daniel Jasper 02c7bca5d1 clang-format: [JS] Fix comment formatting in goog.scopes.
Before:
  goog.scope(function() {
  // test
  var x = 0;
  // test
  });

After:
  goog.scope(function() {
  // test
  var x = 0;
    // test
  });

llvm-svn: 233530
2015-03-30 09:56:50 +00:00
Alexey Bataev b4505a7229 [OPENMP] Codegen for 'atomic update' construct.
Adds atomic update codegen for the following forms of expressions:

x binop= expr;
x++;
++x;
x--;
--x;
x = x binop expr;
x = expr binop x;
If x and expr are integer and binop is associative or x is a LHS in a RHS of the assignment expression, and atomics are allowed for type of x on the target platform atomicrmw instruction is emitted.
Otherwise compare-and-swap sequence is emitted:

bb:
...
atomic load <x>
cont:
<expected> = phi [ <x>, label %bb ], [ <new_failed>, %cont ]
<desired> = <expected> binop <expr>
<res> = cmpxchg atomic &<x>, desired, expected
<new_failed> = <res>.field1;
br <res>field2, label %exit, label %cont
exit:
...

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

llvm-svn: 233513
2015-03-30 05:20:59 +00:00
Alexey Bataev f268568447 [OPENMP] Improved codegen for implicit/explicit 'barrier' constructs.
Replace boolean IsExplicit parameter of OpenMPRuntime::emitBarrierCall() method by OpenMPDirectiveKind Kind for better compatibility with the runtime library. Also add processing of 'nowait' clause on worksharing directives.
Differential Revision: http://reviews.llvm.org/D8659

llvm-svn: 233511
2015-03-30 04:30:22 +00:00
Petar Jovanovic e886cfb612 Add check for kind of UnqualifiedId in Declarator::isStaticMember()
Method CXXMethodDecl::isStaticOverloadedOperator expects Operator field
from the struct OperatorFunctionId, which is a member of the union in
the class UnqualifiedId. If the kind of UnqualifiedId is not checked,
there is no guarantee that the value that this method receives will be
correct, because it can be the value of another union member and not
OperatorFunctionId.

This bug manifests itself when running make check-all on mips64 BE. 

This fix resolves the following regression tests: 
Clang :: CXX/special/class.dtor/p9.cpp
Clang :: CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp
Clang :: CodeGenCXX/ctor-dtor-alias.cpp
Clang :: CodeGenCXX/debug-info-windows-dtor.cpp
Clang :: CodeGenCXX/dllexport-members.cpp
Clang :: CodeGenCXX/dllexport.cpp

Patch by Violeta Vukobrat.

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

llvm-svn: 233508
2015-03-30 00:43:56 +00:00
David Majnemer 37b417f1ed [MS ABI] Rework .xdata HandlerType emission
Utilizing IMAGEREL relocations for synthetic IR constructs isn't
valuable, just clutter.  While we are here, simplify HandlerType names
by making the numeric value for the 'adjective' part of the mangled name
instead of appending '.const', etc.  The old scheme made for very long
global names and leads to wordy things like '.std_bad_alloc'

llvm-svn: 233503
2015-03-29 21:55:10 +00:00
Benjamin Kramer 60be563f3d [parse] Don't crash on alternative operator spellings from macros in c++11 attributes.
Found by afl-fuzz.

llvm-svn: 233499
2015-03-29 19:25:07 +00:00
Benjamin Kramer 0a126adc68 [lex] Provide a valid token when __has_include is found outside of a pp directive
ExpandBuiltinMacro would strip the identifier and downstream users crash
when they encounter an identifier token with nullptr identifier info.

Found by afl-fuzz.

llvm-svn: 233497
2015-03-29 19:05:27 +00:00
Benjamin Kramer 851f310cec [edit] Don't hit an assert when trying to delete a trailing space at EOF
The buffer is guaranteed to be zero-terminated so we can just
circumvent the check. Found by afl-fuzz.

llvm-svn: 233496
2015-03-29 18:07:29 +00:00
Benjamin Kramer d0028dcb86 [parser] Push _Atomic locs through DeclaratorChunk.
Otherwise it stays uninitialized with potentially catastrophic results.
Found by afl-fuzz.

llvm-svn: 233494
2015-03-29 16:42:06 +00:00
Benjamin Kramer 18ff02dd51 [lex] Don't create a garbage token if parsing of __has_include fails.
It will crash downstream somewhere. Found by afl-fuzz.

llvm-svn: 233493
2015-03-29 15:33:29 +00:00
Benjamin Kramer 3012e59bc7 [Parse] Don't crash on ~A::{
Found by clang-fuzz.

llvm-svn: 233492
2015-03-29 14:35:39 +00:00
Benjamin Kramer 8671028e95 [lex] Don't read past the end of the buffer
While dereferencing ThisTokEnd is fine and we know that it's not in
[a-zA-Z0-9_.], ThisTokEnd[1] is really past the end.

Found by asan and with a little help from clang-fuzz.

llvm-svn: 233491
2015-03-29 14:11:37 +00:00
Benjamin Kramer 7fd88386b0 [lex] Turn range checks into asserts.
We know that the last accessible char is not in [a-zA-Z0-9_.] so we can
happily scan on as long as it is. No functionality change.

llvm-svn: 233490
2015-03-29 14:11:22 +00:00
Anna Zaks 50b0956754 [scan-build] Be friendly to "" in the argument list.
Do not fail when "" is one of the compilation arguments.

llvm-svn: 233465
2015-03-28 02:17:21 +00:00
Chandler Carruth ff8d943cb8 [Modules] Don't compute a modules cache path if we're not using modules!
Notably, this prevents us from doing *tons* of work to compute the
modules hash, including trying to read a darwin specific plist file off
of the system. There is a lot that needs cleaning up below this layer
too.

llvm-svn: 233462
2015-03-28 01:10:44 +00:00
Manuel Klimek bea7dfbc5e Make the clang-fuzzer use the CompilerInstance directly.
Going through the driver is too slow.

llvm-svn: 233459
2015-03-28 00:42:36 +00:00
Richard Smith ac8c17533f A conversion from a scoped enumeration bitfield to an integral type is an
integral promotion only if it converts to the underlying type or its promoted
type, not if it converts to the promoted type that the bitfield would have it
if were of the underlying type.

llvm-svn: 233457
2015-03-28 00:31:40 +00:00
Manuel Klimek 667c152bce Add initial version of a clang-fuzzer.
llvm-svn: 233455
2015-03-28 00:07:39 +00:00
Duncan P. N. Exon Smith 5043f91657 DebugInfo: Don't call DIBuilder::retainType(nullptr)
An upcoming LLVM commit will make calling
`DIBuilder::retainType(nullptr)` illegal (actually, it already was, but
it wasn't verified).  Check for null before calling.

This triggered in test/CodeGenObjC/debug-info-block-helper.m.

llvm-svn: 233443
2015-03-27 22:58:05 +00:00
Richard Smith d6aab59ad1 [modules] Allow a function template definition if we have a pre-existing but not visible definition of the same template.
llvm-svn: 233430
2015-03-27 21:57:41 +00:00
Chandler Carruth f089372c5c [Modules] Work around PR23030 again, in a different code path, where
I again added the "reasonable" assertions and they again fired during
a modules self-host.

This hopefully will un-break the self-host build bot. No test case handy
and adding one seems to have little or no value really.

llvm-svn: 233426
2015-03-27 21:40:58 +00:00
Richard Smith df5bf99d0b Add file forgotten from r233420.
llvm-svn: 233425
2015-03-27 21:40:57 +00:00
Richard Smith 0279375836 [modules] When merging class definitions, make the retained definition visible
if the merged definition is visible, and perform lookups into all merged copies
of the definition (not just for special members) so that we can complete the
redecl chains for members of the class.

llvm-svn: 233420
2015-03-27 21:16:39 +00:00
Richard Smith 9a71c99844 [modules] Allow a function to be redefined if the old definition is not visible.
llvm-svn: 233407
2015-03-27 20:16:58 +00:00
Rafael Espindola d053d20d0d Revert "Don't use unique section names by default if using the integrated as."
This reverts commit r233393 while a debug a bot failure.

llvm-svn: 233398
2015-03-27 19:01:14 +00:00
Rafael Espindola 463a0afe15 Don't use unique section names by default if using the integrated as.
This saves some IO and ccache space by not creating long section names. It
should work with every ELF linker.

llvm-svn: 233393
2015-03-27 17:55:23 +00:00
Benjamin Kramer 6dcddc21f8 Mark DR777 only as fixed in clang SVN.
llvm-svn: 233391
2015-03-27 17:38:35 +00:00
Benjamin Kramer 3a8650af77 [Sema] Factor diags with %plural. No functionality change intended.
llvm-svn: 233387
2015-03-27 17:23:14 +00:00
Timur Iskhodzhanov 3082d0e984 Make -fsanitize-coverage flag a core option so it's available via the clang-cl driver too
Reviewed at http://reviews.llvm.org/D8663

llvm-svn: 233384
2015-03-27 16:32:10 +00:00
Benjamin Kramer 52bd867399 Remove test for PR12917 for now. I'm relatively sure this is ill-formed per [dcl.fct.default]p3.
llvm-svn: 233379
2015-03-27 14:12:44 +00:00
Benjamin Kramer fe25759022 [Sema] Implement DR777
A parameter pack after a default argument is now valid.

PR23029.

llvm-svn: 233377
2015-03-27 13:58:41 +00:00
Benjamin Kramer 3b8044c02d [Sema] Diagnose default argument on a parameter pack.
This is ill-formed (and cannot be used anyways).

PR23028.

llvm-svn: 233376
2015-03-27 13:58:31 +00:00
Chandler Carruth 74e0585949 [Modules] When walking the lookup results in a namespace, sort them by
declaration name so that we mark declarations for emission in
a deterministic order (and in turn give them deterministic IDs).

This is the last for loop or data structure I can find by inspection of
the AST writer which doesn't use a deterministic order.

Found by inspection, no test case.

llvm-svn: 233348
2015-03-27 01:48:11 +00:00
Kaelyn Takata 92565b51aa Diagnose delayed typos in an expr list that is in an invalid expression.
Previously, if the expr list parsed fine but the expr to the left of the
open parenthesis was invalid (when parsing the suffix of a
postfix-expression), the parsed expr list was just ignored.

Fixes PR23005.

llvm-svn: 233347
2015-03-27 01:44:47 +00:00
Richard Smith a523022b53 [modules] Handle defining a tag with a typedef name for linkage purposes on top of an existing imported-but-not-visible definition.
llvm-svn: 233345
2015-03-27 01:37:43 +00:00
Chandler Carruth 12c8f65408 [Modules] Make Sema's map of referenced selectors have a deterministic
order based on order of insertion.

This should cause both our warnings about these and the modules
serialization to be deterministic as a consequence.

Found by inspection.

llvm-svn: 233343
2015-03-27 00:55:05 +00:00
Chandler Carruth acbbeb9782 [Modules] Make our on-disk hash table of selector IDs be built in
a deterministic order.

This uses a MapVector to track the insertion order of selectors.

Found by inspection.

llvm-svn: 233342
2015-03-27 00:47:43 +00:00
Richard Smith be3980b73c [modules] Handle defining a class template on top of an existing imported-but-not-visible definition.
llvm-svn: 233341
2015-03-27 00:41:57 +00:00
Chandler Carruth b306d73a2d [Modules] Sort the file IDs prior to building the flattened array of
DeclIDs so that in addition to be grouped by file, the order of these
groups is stable.

Found by inspection, no test case. Not sure this can be observed without
a randomized seed for the hash table, but we shouldn't be relying on the
hash table layout under any circumstances.

llvm-svn: 233339
2015-03-27 00:31:20 +00:00