]> granicus.if.org Git - clang/log
clang
9 years ago[analyzer] Add test for previous commit.
Jordan Rose [Mon, 30 Mar 2015 20:18:04 +0000 (20:18 +0000)]
[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

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

9 years ago[analyzer] Disable all retain count diagnostics on values that come from ivars.
Jordan Rose [Mon, 30 Mar 2015 20:18:00 +0000 (20:18 +0000)]
[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

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

9 years ago[analyzer] Don't special-case ivars backing +0 properties.
Jordan Rose [Mon, 30 Mar 2015 20:17:47 +0000 (20:17 +0000)]
[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

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

9 years agoDebugInfo: Use new LLVM API for DebugLoc
Duncan P. N. Exon Smith [Mon, 30 Mar 2015 20:01:41 +0000 (20:01 +0000)]
DebugInfo: Use new LLVM API for DebugLoc

Use the new API for `DebugLoc` added in r233573 before the old one
disappears.

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

9 years agoUpdating code owners file per discussion with Doug at the 2014-10 dev meeting.
Richard Smith [Mon, 30 Mar 2015 19:52:53 +0000 (19:52 +0000)]
Updating code owners file per discussion with Doug at the 2014-10 dev meeting.

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

9 years ago[PPC] Move argument range checks for HTM and crypto builtins to Sema
Kit Barton [Mon, 30 Mar 2015 19:40:59 +0000 (19:40 +0000)]
[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

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

9 years ago[SystemZ] Fix fallout from r233543 on no-assert builds
Ulrich Weigand [Mon, 30 Mar 2015 18:08:50 +0000 (18:08 +0000)]
[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.

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

9 years ago[SystemZ] Fix definition of IntMaxType / Int64Type
Ulrich Weigand [Mon, 30 Mar 2015 13:50:21 +0000 (13:50 +0000)]
[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).

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

9 years ago[SystemZ] Fix some ABI corner cases
Ulrich Weigand [Mon, 30 Mar 2015 13:49:01 +0000 (13:49 +0000)]
[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.

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

9 years ago[mips] Add support for 'ZC' inline assembly memory constraint.
Daniel Sanders [Mon, 30 Mar 2015 13:47:23 +0000 (13:47 +0000)]
[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

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

9 years agoclang-format: [JS] Fix comment formatting in goog.scopes.
Daniel Jasper [Mon, 30 Mar 2015 09:56:50 +0000 (09:56 +0000)]
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
  });

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

9 years ago[OPENMP] Codegen for 'atomic update' construct.
Alexey Bataev [Mon, 30 Mar 2015 05:20:59 +0000 (05:20 +0000)]
[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

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

9 years ago[OPENMP] Improved codegen for implicit/explicit 'barrier' constructs.
Alexey Bataev [Mon, 30 Mar 2015 04:30:22 +0000 (04:30 +0000)]
[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

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

9 years agoAdd check for kind of UnqualifiedId in Declarator::isStaticMember()
Petar Jovanovic [Mon, 30 Mar 2015 00:43:56 +0000 (00:43 +0000)]
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

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

9 years ago[MS ABI] Rework .xdata HandlerType emission
David Majnemer [Sun, 29 Mar 2015 21:55:10 +0000 (21:55 +0000)]
[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'

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

9 years ago[parse] Don't crash on alternative operator spellings from macros in c++11 attributes.
Benjamin Kramer [Sun, 29 Mar 2015 19:25:07 +0000 (19:25 +0000)]
[parse] Don't crash on alternative operator spellings from macros in c++11 attributes.

Found by afl-fuzz.

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

9 years ago[lex] Provide a valid token when __has_include is found outside of a pp directive
Benjamin Kramer [Sun, 29 Mar 2015 19:05:27 +0000 (19:05 +0000)]
[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.

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

9 years ago[edit] Don't hit an assert when trying to delete a trailing space at EOF
Benjamin Kramer [Sun, 29 Mar 2015 18:07:29 +0000 (18:07 +0000)]
[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.

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

9 years ago[parser] Push _Atomic locs through DeclaratorChunk.
Benjamin Kramer [Sun, 29 Mar 2015 16:42:06 +0000 (16:42 +0000)]
[parser] Push _Atomic locs through DeclaratorChunk.

Otherwise it stays uninitialized with potentially catastrophic results.
Found by afl-fuzz.

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

9 years ago[lex] Don't create a garbage token if parsing of __has_include fails.
Benjamin Kramer [Sun, 29 Mar 2015 15:33:29 +0000 (15:33 +0000)]
[lex] Don't create a garbage token if parsing of __has_include fails.

It will crash downstream somewhere. Found by afl-fuzz.

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

9 years ago[Parse] Don't crash on ~A::{
Benjamin Kramer [Sun, 29 Mar 2015 14:35:39 +0000 (14:35 +0000)]
[Parse] Don't crash on ~A::{

Found by clang-fuzz.

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

9 years ago[lex] Don't read past the end of the buffer
Benjamin Kramer [Sun, 29 Mar 2015 14:11:37 +0000 (14:11 +0000)]
[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.

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

9 years ago[lex] Turn range checks into asserts.
Benjamin Kramer [Sun, 29 Mar 2015 14:11:22 +0000 (14:11 +0000)]
[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.

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

9 years ago[scan-build] Be friendly to "" in the argument list.
Anna Zaks [Sat, 28 Mar 2015 02:17:21 +0000 (02:17 +0000)]
[scan-build] Be friendly to "" in the argument list.

Do not fail when "" is one of the compilation arguments.

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

9 years ago[Modules] Don't compute a modules cache path if we're not using modules!
Chandler Carruth [Sat, 28 Mar 2015 01:10:44 +0000 (01:10 +0000)]
[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.

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

9 years agoMake the clang-fuzzer use the CompilerInstance directly.
Manuel Klimek [Sat, 28 Mar 2015 00:42:36 +0000 (00:42 +0000)]
Make the clang-fuzzer use the CompilerInstance directly.

Going through the driver is too slow.

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

9 years agoA conversion from a scoped enumeration bitfield to an integral type is an
Richard Smith [Sat, 28 Mar 2015 00:31:40 +0000 (00:31 +0000)]
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.

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

9 years agoAdd initial version of a clang-fuzzer.
Manuel Klimek [Sat, 28 Mar 2015 00:07:39 +0000 (00:07 +0000)]
Add initial version of a clang-fuzzer.

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

9 years agoDebugInfo: Don't call DIBuilder::retainType(nullptr)
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 22:58:05 +0000 (22:58 +0000)]
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.

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

9 years ago[modules] Allow a function template definition if we have a pre-existing but not...
Richard Smith [Fri, 27 Mar 2015 21:57:41 +0000 (21:57 +0000)]
[modules] Allow a function template definition if we have a pre-existing but not visible definition of the same template.

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

9 years ago[Modules] Work around PR23030 again, in a different code path, where
Chandler Carruth [Fri, 27 Mar 2015 21:40:58 +0000 (21:40 +0000)]
[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.

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

9 years agoAdd file forgotten from r233420.
Richard Smith [Fri, 27 Mar 2015 21:40:57 +0000 (21:40 +0000)]
Add file forgotten from r233420.

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

9 years ago[modules] When merging class definitions, make the retained definition visible
Richard Smith [Fri, 27 Mar 2015 21:16:39 +0000 (21:16 +0000)]
[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.

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

9 years ago[modules] Allow a function to be redefined if the old definition is not visible.
Richard Smith [Fri, 27 Mar 2015 20:16:58 +0000 (20:16 +0000)]
[modules] Allow a function to be redefined if the old definition is not visible.

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

9 years agoRevert "Don't use unique section names by default if using the integrated as."
Rafael Espindola [Fri, 27 Mar 2015 19:01:14 +0000 (19:01 +0000)]
Revert "Don't use unique section names by default if using the integrated as."

This reverts commit r233393 while a debug a bot failure.

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

9 years agoDon't use unique section names by default if using the integrated as.
Rafael Espindola [Fri, 27 Mar 2015 17:55:23 +0000 (17:55 +0000)]
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.

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

9 years agoMark DR777 only as fixed in clang SVN.
Benjamin Kramer [Fri, 27 Mar 2015 17:38:35 +0000 (17:38 +0000)]
Mark DR777 only as fixed in clang SVN.

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

9 years ago[Sema] Factor diags with %plural. No functionality change intended.
Benjamin Kramer [Fri, 27 Mar 2015 17:23:14 +0000 (17:23 +0000)]
[Sema] Factor diags with %plural. No functionality change intended.

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

9 years agoMake -fsanitize-coverage flag a core option so it's available via the clang-cl driver too
Timur Iskhodzhanov [Fri, 27 Mar 2015 16:32:10 +0000 (16:32 +0000)]
Make -fsanitize-coverage flag a core option so it's available via the clang-cl driver too

Reviewed at http://reviews.llvm.org/D8663

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

9 years agoRemove test for PR12917 for now. I'm relatively sure this is ill-formed per [dcl...
Benjamin Kramer [Fri, 27 Mar 2015 14:12:44 +0000 (14:12 +0000)]
Remove test for PR12917 for now. I'm relatively sure this is ill-formed per [dcl.fct.default]p3.

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

9 years ago[Sema] Implement DR777
Benjamin Kramer [Fri, 27 Mar 2015 13:58:41 +0000 (13:58 +0000)]
[Sema] Implement DR777

A parameter pack after a default argument is now valid.

PR23029.

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

9 years ago[Sema] Diagnose default argument on a parameter pack.
Benjamin Kramer [Fri, 27 Mar 2015 13:58:31 +0000 (13:58 +0000)]
[Sema] Diagnose default argument on a parameter pack.

This is ill-formed (and cannot be used anyways).

PR23028.

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

9 years ago[Modules] When walking the lookup results in a namespace, sort them by
Chandler Carruth [Fri, 27 Mar 2015 01:48:11 +0000 (01:48 +0000)]
[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.

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

9 years agoDiagnose delayed typos in an expr list that is in an invalid expression.
Kaelyn Takata [Fri, 27 Mar 2015 01:44:47 +0000 (01:44 +0000)]
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.

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

9 years ago[modules] Handle defining a tag with a typedef name for linkage purposes on top of...
Richard Smith [Fri, 27 Mar 2015 01:37:43 +0000 (01:37 +0000)]
[modules] Handle defining a tag with a typedef name for linkage purposes on top of an existing imported-but-not-visible definition.

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

9 years ago[Modules] Make Sema's map of referenced selectors have a deterministic
Chandler Carruth [Fri, 27 Mar 2015 00:55:05 +0000 (00:55 +0000)]
[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.

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

9 years ago[Modules] Make our on-disk hash table of selector IDs be built in
Chandler Carruth [Fri, 27 Mar 2015 00:47:43 +0000 (00:47 +0000)]
[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.

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

9 years ago[modules] Handle defining a class template on top of an existing imported-but-not...
Richard Smith [Fri, 27 Mar 2015 00:41:57 +0000 (00:41 +0000)]
[modules] Handle defining a class template on top of an existing imported-but-not-visible definition.

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

9 years ago[Modules] Sort the file IDs prior to building the flattened array of
Chandler Carruth [Fri, 27 Mar 2015 00:31:20 +0000 (00:31 +0000)]
[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.

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

9 years ago[Modules] Fix another pointer keyed set that we iterate over while
Chandler Carruth [Fri, 27 Mar 2015 00:01:44 +0000 (00:01 +0000)]
[Modules] Fix another pointer keyed set that we iterate over while
writing a module to be a set-vector to preserve insertion order.

No test case, found by inspection.

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

9 years ago[Modules] Clean up some code that was manually replicating what
Chandler Carruth [Thu, 26 Mar 2015 23:59:47 +0000 (23:59 +0000)]
[Modules] Clean up some code that was manually replicating what
SmallSetVector provides directly.

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

9 years ago[Modules] Fix an obvious lack of deterministic ordering when processing
Chandler Carruth [Thu, 26 Mar 2015 23:58:11 +0000 (23:58 +0000)]
[Modules] Fix an obvious lack of deterministic ordering when processing
rewritten decls for Objective-C modules.

Found by inspection and completely obvious, so no test case. Many of the
remaining determinism fixes won't have precise test cases at this point,
but these are the kinds of things we wouldn't ask for a specific test of
during code review but ask authors to fix. The functionality isn't
changing, and should (he he!) already be tested.

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

9 years ago[Modules] Make the AST serialization always use lexicographic order when
Chandler Carruth [Thu, 26 Mar 2015 23:54:15 +0000 (23:54 +0000)]
[Modules] Make the AST serialization always use lexicographic order when
traversing the identifier table.

No easy test case as this table is somewhere between hard and impossible
to observe as non-deterministically ordered. The table is a hash table
but we hash the string contents and never remove entries from the table
so the growth pattern, etc, is all completely fixed. However, relying on
the hash function being deterministic is specifically against the
long-term direction of LLVM's hashing datastructures, which are intended
to provide *no* ordering guarantees. As such, this defends against these
things by sorting the identifiers. Sorting identifiers right before we
emit them to a serialized form seems a low cost for predictability here.

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

9 years ago[Modules] Delete stale, pointless code. All tests still pass with this
Chandler Carruth [Thu, 26 Mar 2015 23:45:40 +0000 (23:45 +0000)]
[Modules] Delete stale, pointless code. All tests still pass with this
logic removed.

This logic was both inserting all builtins into the identifier table and
ensuring they would get serialized. The first happens unconditionally
now, and we always write out the entire identifier table. This code can
simply go away.

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

9 years ago[Modules] Fix a sneaky bug in r233249 where we would look for implicit
Chandler Carruth [Thu, 26 Mar 2015 22:27:09 +0000 (22:27 +0000)]
[Modules] Fix a sneaky bug in r233249 where we would look for implicit
constructors in the current lexical context even though name lookup
found them via some other context merged into the redecl chain.

This can only happen for implicit constructors which can only have the
name of the type of the current context, so we can fix this by simply
*always* merging those names first. This also has the advantage of
removing the walk of the current lexical context from the common case
when this is the only constructor name we need to deal with (implicit or
otherwise).

I've enhanced the tests to cover this case (and uncovered an unrelated
bug which I fixed in r233325).

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

9 years ago[Modules] Fix tiny bug where we failed to get the canonical decl when
Chandler Carruth [Thu, 26 Mar 2015 22:22:22 +0000 (22:22 +0000)]
[Modules] Fix tiny bug where we failed to get the canonical decl when
deserializing an inherited constructor.

This is the exact same logic we use when deserializing method overrides
for the same reason: the canonical decl may end up pinned to a different
decl when we are improting modules, we need to re-pin to the canonical
one during reading.

My test case for this will come in a subsequent commit. I was trying to
test a more tricky bug fix and the test case happened to tickle this bug
as well.

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

9 years ago[modules] Restrict the module use-declaration to only appear in top-level
Richard Smith [Thu, 26 Mar 2015 22:10:01 +0000 (22:10 +0000)]
[modules] Restrict the module use-declaration to only appear in top-level
modules, and allow sub-modules of a module with a use-declaration to make use
of the nominated modules.

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

9 years agoFix -Wshift-count-negative. It didn't work if the right hand side
Davide Italiano [Thu, 26 Mar 2015 21:37:49 +0000 (21:37 +0000)]
Fix -Wshift-count-negative. It didn't work if the right hand side
of the shift wasn't a constant integer expression, now it (hopefully)
does.

PR: 22059

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

9 years ago[PowerPC] Remove assembly testing from test/CodeGen/ppc64-elf-abi.c
Bill Schmidt [Thu, 26 Mar 2015 20:16:52 +0000 (20:16 +0000)]
[PowerPC] Remove assembly testing from test/CodeGen/ppc64-elf-abi.c

Eric Christopher pointed out that we have a check for assembly code
generation in a clang test, which isn't cool.  We already have Driver
and back-end CodeGen tests for the .abiversion handling, so this
testing is unnecessary anyway.  Make it go away.

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

9 years agoclang-format: Force line break in trailing calls after multline exprs.
Daniel Jasper [Thu, 26 Mar 2015 18:46:28 +0000 (18:46 +0000)]
clang-format: Force line break in trailing calls after multline exprs.

Before:
  aaaaaaaa(aaaaaaaaaa,
           bbbbbbbbbb).a();

After:
  aaaaaaaa(aaaaaaaaaa,
           bbbbbbbbbb)
      .a();

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

9 years agoEnable -ffunction-sections and -fdata-sections for CloudABI by default.
Ed Schouten [Thu, 26 Mar 2015 17:50:28 +0000 (17:50 +0000)]
Enable -ffunction-sections and -fdata-sections for CloudABI by default.

Unlike most of the other platforms supported by Clang, CloudABI only
supports static linkage, for the reason that global filesystem access is
prohibited. Functions provided by dlfcn.h are not present. As we know
that applications will not try to do any symbol lookups at run-time, we
can garbage collect unused code quite aggressively. Because of this, it
makes sense to enable -ffunction-sections and -fdata-sections by
default.

Object files will be a bit larger than usual, but the resulting binary
will not be affected, as the sections are merged again. However, when
--gc-sections is used, the linker is able to remove unused code far more
more aggressively. It also has the advantage that transitive library
dependencies only need to be provided to the linker in case that
functionality is actually used.

Differential Revision: http://reviews.llvm.org/D8635
Reviewed by: echristo

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

9 years agoclang-format: Fix merging of _T macros.
Daniel Jasper [Thu, 26 Mar 2015 14:47:35 +0000 (14:47 +0000)]
clang-format: Fix merging of _T macros.

NewlinesBefore and HasUnescapedNewline were not properly propagated
leading to llvm.org/PR23032.

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

9 years agoLet Clang invoke CloudABI's linker.
Ed Schouten [Thu, 26 Mar 2015 11:13:44 +0000 (11:13 +0000)]
Let Clang invoke CloudABI's linker.

Now that CloudABI's target information and header search logic for Clang
has been submitted, the only thing that remains to be done is adding
support for CloudABI's linker.

CloudABI uses Binutils ld, although there is some work to use lld
instead. This means that this code is largely based on what we use on
FreeBSD. There are some exceptions, however:

- Only static linking is performed. CloudABI does not support any
  dynamically linked executables.
- CloudABI uses compiler-rt, libc++ and libc++abi unconditionally. Link
  in these libraries instead of using libgcc_s, libstdc++, etc.
- We must ensure that the .eh_frame_hdr is present to make C++
  exceptions work properly.

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

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

9 years ago[Modules] Preserve source order for the map of late parsed templates.
Chandler Carruth [Thu, 26 Mar 2015 09:08:15 +0000 (09:08 +0000)]
[Modules] Preserve source order for the map of late parsed templates.

Clang was inserting these into a dense map. While it never iterated the
dense map during normal compilation, it did when emitting a module. Fix
this by using a standard MapVector to preserve the order in which we
encounter the late parsed templates.

I suspect this still isn't ideal, as we don't seem to remove things from
this map even when we mark the templates as no longer late parsed. But
I don't know enough about this particular extension to craft a nice,
subtle test case covering this. I've managed to get the stress test to
at least do some late parsing and demonstrate the core problem here.
This patch fixes the test and provides deterministic behavior which is
a strict improvement over the prior state.

I've cleaned up some of the code here as well to be explicit about
inserting when that is what is actually going on.

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

9 years ago[Modules] Add some more fun code to my modules stress test, this time
Chandler Carruth [Thu, 26 Mar 2015 08:49:55 +0000 (08:49 +0000)]
[Modules] Add some more fun code to my modules stress test, this time
templates. Turns out all of this works correctly (so far). But it should
cover more code paths and will let me test some things that don't
actually work next.

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

9 years ago[Modules] Make "#pragma weak" undeclared identifiers be tracked
Chandler Carruth [Thu, 26 Mar 2015 08:32:49 +0000 (08:32 +0000)]
[Modules] Make "#pragma weak" undeclared identifiers be tracked
deterministically.

This fixes a latent issue where even Clang's Sema (and diagnostics) were
non-deterministic in the face of this pragma. The fix is super simple --
just use a MapVector so we track the order in which these are parsed (or
imported). Especially considering how rare they are, this seems like the
perfect tradeoff. I've also simplified the client code with judicious
use of auto and range based for loops.

I've added some pretty hilarious code to my stress test which now
survives the binary diff without issue.

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

9 years ago[Modules] Delete a bunch of complex code for ensuring visible decls in
Chandler Carruth [Thu, 26 Mar 2015 04:27:10 +0000 (04:27 +0000)]
[Modules] Delete a bunch of complex code for ensuring visible decls in
updated decl contexts get emitted.

Since this code was added, we have newer vastly simpler code for
handling this. The code I'm removing was very expensive and also
generated unstable order of declarations which made module outputs
non-deterministic.

All of the tests continue to pass for me and I'm able to check the
difference between the .pcm files after merging modules together.

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

9 years ago[modules] If we reach a definition of a class for which we already have a
Richard Smith [Thu, 26 Mar 2015 04:09:53 +0000 (04:09 +0000)]
[modules] If we reach a definition of a class for which we already have a
non-visible definition, skip the new definition and make the old one visible
instead of trying to parse it again and failing horribly. C++'s ODR allows
us to assume that the two definitions are identical.

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

9 years ago[Modules] A second attempt at writing out on-disk hash tables for the
Chandler Carruth [Thu, 26 Mar 2015 03:11:40 +0000 (03:11 +0000)]
[Modules] A second attempt at writing out on-disk hash tables for the
decl context lookup tables.

The first attepmt at this caused problems. We had significantly more
sources of non-determinism that I realized at first, and my change
essentially turned them from non-deterministic output into
use-after-free. Except that they weren't necessarily caught by tools
because the data wasn't really freed.

The new approach is much simpler. The first big simplification is to
inline the "visit" code and handle this directly. That works much
better, and I'll try to go and clean up the other caller of the visit
logic similarly.

The second key to the entire approach is that we need to *only* collect
names into a stable order at first. We then need to issue all of the
actual 'lookup()' calls in the stable order of the names so that we load
external results in a stable order. Once we have loaded all the results,
the table of results will stop being invalidated and we can walk all of
the names again and use the cheap 'noload_lookup()' method to quickly
get the results and serialize them.

To handle constructors and conversion functions (whose names can't be
stably ordered) in this approach, what we do is record only the visible
constructor and conversion function names at first. Then, if we have
any, we walk the decls of the class and add those names in the order
they occur in the AST. The rest falls out naturally.

This actually ends up simpler than the previous approach and seems much
more robust.

It uncovered a latent issue where we were building on-disk hash tables
for lookup results when the context was a linkage spec! This happened to
dodge all of the assert by some miracle. Instead, add a proper predicate
to the DeclContext class and use that which tests both for function
contexts and linkage specs.

It also uncovered PR23030 where we are forming somewhat bizarre negative
lookup results. I've just worked around this with a FIXME in place
because fixing this particular Clang bug seems quite hard.

I've flipped the first part of the test case I added for stability back
on in this commit. I'm taking it gradually to try and make sure the
build bots are happy this time.

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

9 years agoAdd an explanatory comment as to why we're turning on and off
Eric Christopher [Thu, 26 Mar 2015 00:50:13 +0000 (00:50 +0000)]
Add an explanatory comment as to why we're turning on and off
certain other options as aliases. There be dragons here.

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

9 years agoReformatting, NFC
Richard Smith [Thu, 26 Mar 2015 00:16:07 +0000 (00:16 +0000)]
Reformatting, NFC

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

9 years agoKeep track of canonical decls in Redeclarable.
Manuel Klimek [Wed, 25 Mar 2015 23:18:30 +0000 (23:18 +0000)]
Keep track of canonical decls in Redeclarable.

More than 2x speedup on modules builds with large redecl chains.
Roughly 15-20% speedup on non-modules builds for very large TUs.
Between 2-3% cost in memory on large TUs.

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

9 years agoReapply r232888 after applying a fix for -msse4 code generation.
Eric Christopher [Wed, 25 Mar 2015 23:14:47 +0000 (23:14 +0000)]
Reapply r232888 after applying a fix for -msse4 code generation.

As a note, any target that uses fake target features via command
line options will have similar problems.

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

9 years agoMake the msse4/mno-sse4 flags aliases of the maximum sse values
Eric Christopher [Wed, 25 Mar 2015 22:09:26 +0000 (22:09 +0000)]
Make the msse4/mno-sse4 flags aliases of the maximum sse values
they enable/disable.

This fixes two things:

a) sse4 isn't actually a target feature, don't treat it as one.
b) we weren't correctly disabling sse4.1 when we'd pass -mno-sse4
   after enabling it, thus passing preprocessor directives and
   (soon) passing the function attribute as well when we shouldn't.

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

9 years agoFix coverage-ld.c on systems with an Android linker in $PATH
Ehsan Akhgari [Wed, 25 Mar 2015 20:17:20 +0000 (20:17 +0000)]
Fix coverage-ld.c on systems with an Android linker in $PATH

Summary:
On my system, clang tries to invoke /path/to/arm-linux-androideabi-ld
as the linker for Android, and the regex inside the test file considers
this as unacceptable.

Reviewers: samsonov

Subscribers: tberghammer, aemerson, cfe-commits

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

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

9 years agoDisable this test for PS4 target because PS4 issues different diagnostics.
Yunzhong Gao [Wed, 25 Mar 2015 20:16:29 +0000 (20:16 +0000)]
Disable this test for PS4 target because PS4 issues different diagnostics.

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

9 years agoFix addrspace when emitting constructors of static local variables
Jingyue Wu [Wed, 25 Mar 2015 20:06:28 +0000 (20:06 +0000)]
Fix addrspace when emitting constructors of static local variables

Summary:
Due to CUDA's implicit address space casting, the type of a static local
variable may be more specific (i.e. with address space qualifiers) than
the type expected by the constructor. Emit an addrspacecast in that
case.

Test Plan: Clang used to crash on the added test.

Reviewers: nlewycky, pcc, eliben, rsmith

Reviewed By: eliben, rsmith

Subscribers: llvm-commits

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

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

9 years agoAdd Hardware Transactional Memory (HTM) Support
Kit Barton [Wed, 25 Mar 2015 19:41:41 +0000 (19:41 +0000)]
Add Hardware Transactional Memory (HTM) Support

This patch adds Hardware Transaction Memory (HTM) support supported by ISA 2.07
(POWER8). The intrinsic support is based on GCC one [1], with both 'PowerPC HTM
Low Level Built-in Functions' and 'PowerPC HTM High Level Inline Functions'
implemented.

Along with builtins a new driver switch is added to enable/disable HTM
instruction support (-mhtm) and a header with common definitions (mostly to
parse the TFHAR register value). The HTM switch also sets a preprocessor builtin
HTM.

The HTM usage requires a recently newer kernel with PPC HTM enabled. Tested on
powerpc64 and powerpc64le.

This is send along a llvm patch to enabled the builtins and option switch.

[1]
https://gcc.gnu.org/onlinedocs/gcc/PowerPC-Hardware-Transactional-Memory-Built-in-Functions.html

Phabricator Review: http://reviews.llvm.org/D8248

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

9 years agoCreate android x86_32 and x86_64 target info
Tamas Berghammer [Wed, 25 Mar 2015 10:38:50 +0000 (10:38 +0000)]
Create android x86_32 and x86_64 target info

On android x86_32 the long double is only 64 bits (compared to 80 bits
on linux x86_32) and on android x86_64 the long double is IEEEquad
(compared to x87DoubleExtended on linux x86_64). This CL creates new
TargetInfo classes for this targets to represent these differences.

Differential revision: http://reviews.llvm.org/D8357

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

9 years agoTemporarily disable one more non-determinism flag.
Daniel Jasper [Wed, 25 Mar 2015 06:59:19 +0000 (06:59 +0000)]
Temporarily disable one more non-determinism flag.

This turned the bots to red after r233172 which reverted r233156.

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

9 years agoRevert "[Modules] When writing out the on-disk hash table for the decl context lookup...
Rafael Espindola [Wed, 25 Mar 2015 04:43:15 +0000 (04:43 +0000)]
Revert "[Modules] When writing out the on-disk hash table for the decl context lookup tables, we need to establish a stable ordering for constructing the hash table. This is trickier than it might seem."

This reverts commit r233156. It broke the bots.

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

9 years agoInstrProf: Handle whitespace and comments at the ends of macros
Justin Bogner [Wed, 25 Mar 2015 04:13:49 +0000 (04:13 +0000)]
InstrProf: Handle whitespace and comments at the ends of macros

When we try to find the end loc for a token, we have to re-lex the
token. This was running into a problem when we'd store the end loc of
a macro's coverage region, since we wouldn't actually be at the
beginning of a token when we tried to re-lex it, leading us to do
silly things (and eventually assert) when whitespace or comments
followed.

This pushes our use of getPreciseTokenLocEnd earlier, so that we won't
call it when it doesn't make sense to. It also removes an unnecessary
adjustment by 1 that was working around this problem in some cases.

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

9 years ago[Modules] Disable the diff of the merged module, there is still some
Chandler Carruth [Wed, 25 Mar 2015 01:30:02 +0000 (01:30 +0000)]
[Modules] Disable the diff of the merged module, there is still some
non-determinism here, I just got lucky a bunch of times on my system.

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

9 years ago[Modules] Make the DeclUpdates map be processed in insertion order.
Chandler Carruth [Wed, 25 Mar 2015 01:02:12 +0000 (01:02 +0000)]
[Modules] Make the DeclUpdates map be processed in insertion order.

This fixes my stress tests non-determinism so far. However, I've not
started playing with templates, friends, or terrible macros. I've found
at least two more seeming instabilities and am just waiting for a test
case to actually trigger them.

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

9 years agoDiagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit hints
Ehsan Akhgari [Wed, 25 Mar 2015 00:53:33 +0000 (00:53 +0000)]
Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit hints

Summary: Follow-up to the fix of PR22075.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

9 years agoDiagnose declspecs occuring after virt-specifier-seq and generate fixit hints
Ehsan Akhgari [Wed, 25 Mar 2015 00:53:27 +0000 (00:53 +0000)]
Diagnose declspecs occuring after virt-specifier-seq and generate fixit hints

Summary: This fixes PR22075.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

9 years ago[Modules] When writing out the on-disk hash table for the decl context
Chandler Carruth [Wed, 25 Mar 2015 00:34:51 +0000 (00:34 +0000)]
[Modules] When writing out the on-disk hash table for the decl context
lookup tables, we need to establish a stable ordering for constructing
the hash table. This is trickier than it might seem.

Most of these cases are easily handled by sorting the lookup results
associated with a specific name that has an identifier. However for
constructors and conversion functions, the story is more complicated.
Here we need to merge all of the constructors or conversion functions
together and this merge needs to be stable. We don't have any stable
ordering for either constructors or conversion functions as both would
require a stable ordering across types.

Instead, when we have constructors or conversion functions in the
results, we reconstruct a stable order by walking the decl context in
lexical order and merging them in the order their particular declaration
names are encountered. This doesn't generalize as there might be found
declaration names which don't actually occur within the lexical context,
but for constructors and conversion functions it is safe. It does
require loading the entire decl context if necessary to establish the
ordering but there doesn't seem to be a meaningful way around that.

Many thanks to Richard for talking through all of the design choices
here. While I wrote the code, he guided all the actual decisions about
how to establish the order of things.

No test case yet because the test case I have doesn't pass yet -- there
are still more sources of non-determinism. However, this is complex
enough that I wanted it to go into its own commit in case it causes some
unforseen issue or needs to be reverted.

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

9 years agoFix obviously broken assertion, NFC
Reid Kleckner [Tue, 24 Mar 2015 23:46:25 +0000 (23:46 +0000)]
Fix obviously broken assertion, NFC

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

9 years ago[CodeGen] Support native half inc/dec amounts.
Ahmed Bougacha [Tue, 24 Mar 2015 23:44:42 +0000 (23:44 +0000)]
[CodeGen] Support native half inc/dec amounts.

We previously defaulted to long double, but it's also possible to have
a half inc/dec amount, when LangOpts NativeHalfType is set.
Currently, that's only true for OpenCL.

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

9 years ago[Modules] Stop creating timestamps for the modules cache and trying to
Chandler Carruth [Tue, 24 Mar 2015 21:44:25 +0000 (21:44 +0000)]
[Modules] Stop creating timestamps for the modules cache and trying to
prune it when we have disabled implicit module generation and thus are
not using any cached modules.

Also update a test of explicitly generated modules to pass this CC1 flag
correctly.

This fixes an issue where Clang was dropping files into the source tree
while running its tests.

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

9 years ago[Modules] Start making explicit modules produce deterministic output.
Chandler Carruth [Tue, 24 Mar 2015 21:18:10 +0000 (21:18 +0000)]
[Modules] Start making explicit modules produce deterministic output.

There are two aspects of non-determinism fixed here, which was the
minimum required to cause at least an empty module to be deterministic.

First, the random number signature is only inserted into the module when
we are building modules implicitly. The use case for these random
signatures is to work around the very fact that modules are not
deterministic in their output when working with the implicitly built and
populated module cache. Eventually this should go away entirely when
we're confident that Clang is producing deterministic output.

Second, the on-disk hash table is populated based on the order of
iteration over a DenseMap. Instead, use a MapVector so that we can walk
it in insertion order.

I've added a test that an empty module, when built twice, produces the
same binary PCM file.

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

9 years agoAdding back a CHECK that works with r233110
Sanjay Patel [Tue, 24 Mar 2015 20:42:20 +0000 (20:42 +0000)]
Adding back a CHECK that works with r233110

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

9 years agoRemoving a CHECK that is about to go wrong.
Sanjay Patel [Tue, 24 Mar 2015 20:35:24 +0000 (20:35 +0000)]
Removing a CHECK that is about to go wrong.

I'm about to commit a patch for:
http://reviews.llvm.org/D8567

That patch will break this one existing test case in Clang.
I'm not sure if this file is intending to create a Clang
dependency on the LLVM IR optimizer, but that's the
consequence of specifying -O3 on this test file.

My hope is to avoid buildbot rage by removing this check,
committing the LLVM patch, and then fixing this check.
I don't know how to make a simultaneous commit to Clang
and LLVM.

I will commit the correct CHECK line fix for this test
shortly.

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

9 years ago[Objective-C diagnostic PATCH] Accept and ignore -Wreceiver-is-weak
Fariborz Jahanian [Tue, 24 Mar 2015 17:14:20 +0000 (17:14 +0000)]
[Objective-C diagnostic PATCH] Accept and ignore -Wreceiver-is-weak
warning until Xcode removes the warning setting.
rdar://20262140

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

9 years agoTrack the source location of the dot or arrow operator in a MemberExpr.
Aaron Ballman [Tue, 24 Mar 2015 15:07:53 +0000 (15:07 +0000)]
Track the source location of the dot or arrow operator in a MemberExpr.

Patch by Joe Ranieri!

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

9 years agoReverting r233023 -- it caused test failures on Windows with MSVC x86.
Aaron Ballman [Tue, 24 Mar 2015 13:51:13 +0000 (13:51 +0000)]
Reverting r233023 -- it caused test failures on Windows with MSVC x86.

http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/572

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

9 years agoRevert "Diagnose declspecs occuring after virt-specifier-seq and generate fixit hints"
Ehsan Akhgari [Tue, 24 Mar 2015 13:25:26 +0000 (13:25 +0000)]
Revert "Diagnose declspecs occuring after virt-specifier-seq and generate fixit hints"

This reverts commit 2131e63e2fdff7c831ab3bfe31facf2e3ebab03d.

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

9 years agoRevert "Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit...
Ehsan Akhgari [Tue, 24 Mar 2015 13:25:23 +0000 (13:25 +0000)]
Revert "Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit hints"

This reverts commit 49079d45966a3f57cd82edb35bde2e8e88fccf40.

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

9 years agoDiagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit hints
Ehsan Akhgari [Tue, 24 Mar 2015 13:02:50 +0000 (13:02 +0000)]
Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit hints

Summary: Follow-up to the fix of PR22075.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

9 years agoDiagnose declspecs occuring after virt-specifier-seq and generate fixit hints
Ehsan Akhgari [Tue, 24 Mar 2015 13:02:47 +0000 (13:02 +0000)]
Diagnose declspecs occuring after virt-specifier-seq and generate fixit hints

Summary: This fixes PR22075.

Reviewers: rsmith

Subscribers: cfe-commits

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

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