]> granicus.if.org Git - clang/log
clang
9 years agoSet the type of ptrdiff_t to signed on NVPTX targets
Eli Bendersky [Wed, 1 Apr 2015 20:29:18 +0000 (20:29 +0000)]
Set the type of ptrdiff_t to signed on NVPTX targets

It was unsigned before, which is unlike any other target and also doesn't make
much sense.

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

9 years agoRe-land "MS ABI: lambda call operators are instance methods and should use thiscall"
Reid Kleckner [Wed, 1 Apr 2015 20:22:13 +0000 (20:22 +0000)]
Re-land "MS ABI: lambda call operators are instance methods and should use thiscall"

Update the test cases to pass when lambda call operators use thiscall.

Update the lambda-to-block conversion operator to use the default free
function calling convention instead of the call operator's convention.

This reverts commit r233082 and re-instates r233023.

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

9 years agoRun dos2unix on test/PCH/cxx1y-lambdas.mm
Reid Kleckner [Wed, 1 Apr 2015 20:21:34 +0000 (20:21 +0000)]
Run dos2unix on test/PCH/cxx1y-lambdas.mm

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

9 years agoMinor simplification: do typo-correction before handling inheriting
Richard Smith [Wed, 1 Apr 2015 19:31:06 +0000 (19:31 +0000)]
Minor simplification: do typo-correction before handling inheriting
constructors, instead of having the typo-correction code also dispatch to the
inheriting constructor special case.

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

9 years agoSet NVPTX64 target's size_t to match other 64-bit targets
Eli Bendersky [Wed, 1 Apr 2015 18:29:27 +0000 (18:29 +0000)]
Set NVPTX64 target's size_t to match other 64-bit targets

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

9 years agoFix inlinehint.cpp with an explicit triple to avoid x86_thiscallcc problems
Reid Kleckner [Wed, 1 Apr 2015 16:48:54 +0000 (16:48 +0000)]
Fix inlinehint.cpp with an explicit triple to avoid x86_thiscallcc problems

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

9 years agoRemove comdats from inlinehint.cpp to pass test on Darwin
Reid Kleckner [Wed, 1 Apr 2015 16:45:17 +0000 (16:45 +0000)]
Remove comdats from inlinehint.cpp to pass test on Darwin

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

9 years agoFix data layout mismatch between LLVM and Clang for i686-pc-windows-msvc-elf
Reid Kleckner [Wed, 1 Apr 2015 16:45:06 +0000 (16:45 +0000)]
Fix data layout mismatch between LLVM and Clang for i686-pc-windows-msvc-elf

Do the same thing as win64. If we're not using COFF, use the ELF
manglings. Maybe if we are targetting *-windows-msvc-macho, we should
use darwin manglings, but I don't need to stir that pot today.

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

9 years agoTry to fix nacl-direct.c driver test in Cygwin environment
Reid Kleckner [Wed, 1 Apr 2015 16:27:07 +0000 (16:27 +0000)]
Try to fix nacl-direct.c driver test in Cygwin environment

Why is NaCl not using the integrated assembler, by the way?

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

9 years agoMark instantiated function decls as inline specified if any pattern is
Reid Kleckner [Wed, 1 Apr 2015 16:23:44 +0000 (16:23 +0000)]
Mark instantiated function decls as inline specified if any pattern is

A function template pattern can be declared without the 'inline'
specifier and defined later with the 'inline' specifier. However, during
instantiation, we were only looking at the canonical decl to see if we
should mark the instantiated decl as inline specified. Since the
instantiated decl actually represents many pattern declarations, put the
inline specifier on the instantiation decl if any of the pattern decls
have it.

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

9 years ago[SystemZ] Add BuiltinsSystemZ.def to Clang_Basic modulemap
Ulrich Weigand [Wed, 1 Apr 2015 15:34:53 +0000 (15:34 +0000)]
[SystemZ] Add BuiltinsSystemZ.def to Clang_Basic modulemap

This should fix the last remaining build bot failures
resulting from the r233804 commit.

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

9 years ago[SystemZ] Add header files to Makefile / module.modulemap
Ulrich Weigand [Wed, 1 Apr 2015 14:15:35 +0000 (14:15 +0000)]
[SystemZ] Add header files to Makefile / module.modulemap

This should fix build-bot failures after r233804.

The patch also adds a "systemz" feature, and renames the
"transactional-execution" feature to "htm", since it turns
out "-" is not a legal character in module feature names.

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

9 years ago[SystemZ] Support transactional execution on zEC12
Ulrich Weigand [Wed, 1 Apr 2015 12:54:25 +0000 (12:54 +0000)]
[SystemZ] Support transactional execution on zEC12

The zEC12 provides the transactional-execution facility.  This is exposed
to users via a set of builtin routines on other compilers.  This patch
adds clang support to enable those builtins.  In partciular, the patch:

- enables the transactional-execution feature by default on zEC12
- allows to override presence of that feature via the -mhtm/-mno-htm options
- adds a predefined macro __HTM__ if the feature is enabled
- adds support for the transactional-execution GCC builtins
- adds Sema checking to verify the __builtin_tabort abort code
- adds the s390intrin.h header file (for GCC compatibility)
- adds s390 sections to the htmintrin.h and htmxlintrin.h header files

Since this is first use of target-specific intrinsics on the platform,
the patch creates the include/clang/Basic/BuiltinsSystemZ.def file and
hooks it up in TargetBuiltins.h and lib/Basic/Targets.cpp.

An associated LLVM patch adds the required LLVM IR intrinsics.

For reference, the transactional-execution instructions are documented
in the z/Architecture Principles of Operation for the zEC12:
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/download/DZ9ZR009.pdf
The associated builtins are documented in the GCC manual:
http://gcc.gnu.org/onlinedocs/gcc/S_002f390-System-z-Built-in-Functions.html
The htmxlintrin.h intrinsics provided for compatibility with the IBM XL
compiler are documented in the "z/OS XL C/C++ Programming Guide".

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

9 years agoAVX-512: added clang intrinsics for logical and, or xor for 512 bits
Elena Demikhovsky [Wed, 1 Apr 2015 06:54:16 +0000 (06:54 +0000)]
AVX-512: added clang intrinsics for logical and, or xor for 512 bits
by Asaf Badouh (asaf.badouh@intel.com)

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

9 years ago[MS ABI] Disregard restrictive exception specifications
David Majnemer [Wed, 1 Apr 2015 04:45:52 +0000 (04:45 +0000)]
[MS ABI] Disregard restrictive exception specifications

MSVC treats all non-empty exception specifications the same way: all
exceptions are permitted.  The .xdata tables provide a way to
efficiently lower exception specifications *but* this probably has to be
implemented as a catch-all/rethrow mechanism instead of the Itanium way.

This fixes PR23092.

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

9 years ago[OPENMP] Sema analysis for 'atomic capture' construct.
Alexey Bataev [Wed, 1 Apr 2015 03:33:17 +0000 (03:33 +0000)]
[OPENMP] Sema analysis for 'atomic capture' construct.

Added sema checks for forms of expressions/statements allowed under control of 'atomic capture' directive + generation of helper objects for future codegen.

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

9 years ago[Objective-C metadata patch]. Patch to allocate one more space for
Fariborz Jahanian [Tue, 31 Mar 2015 22:22:40 +0000 (22:22 +0000)]
[Objective-C metadata patch]. Patch to allocate one more space for
Protocol objects in OBJC2. rdar://20286356

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

9 years agoFix nacl's clang driver tests to tolerate libdir suffixes and Windows paths.
Derek Schuff [Tue, 31 Mar 2015 21:43:52 +0000 (21:43 +0000)]
Fix nacl's clang driver tests to tolerate libdir suffixes and Windows paths.

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

9 years ago[lex] Bitfieldize some booleans.
Benjamin Kramer [Tue, 31 Mar 2015 18:47:05 +0000 (18:47 +0000)]
[lex] Bitfieldize some booleans.

Lets us fuse some branches into bit tests downstream. NFC.

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

9 years agoAdd sm_37 target to Clang for NVPTX
Eli Bendersky [Tue, 31 Mar 2015 17:03:16 +0000 (17:03 +0000)]
Add sm_37 target to Clang for NVPTX

Support for this target was added in LLVM r233575 and r233583

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

9 years agoSema: Accept pointers to any address space for builtin functions
Tom Stellard [Tue, 31 Mar 2015 16:39:02 +0000 (16:39 +0000)]
Sema: Accept pointers to any address space for builtin functions

As long as they don't have an address space explicitly defined.

This allows builtins with pointer arguments to be used with OpenCL.

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

9 years agoclang-format: [JS] Support getters, setters and methods in object literals.
Daniel Jasper [Tue, 31 Mar 2015 14:34:15 +0000 (14:34 +0000)]
clang-format: [JS] Support getters, setters and methods in object literals.

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

9 years agoMake new test slightly more generic to allow running it under
Daniel Jasper [Tue, 31 Mar 2015 09:08:16 +0000 (09:08 +0000)]
Make new test slightly more generic to allow running it under
non-standard test runners.

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

9 years ago[X86] Use getHostCPUFeatures when 'native' is specified for cpu.
Craig Topper [Tue, 31 Mar 2015 05:45:00 +0000 (05:45 +0000)]
[X86] Use getHostCPUFeatures when 'native' is specified for cpu.

This is necessary because not aall Sandybridge, Ivybrige, Haswell, and Broadwell CPUs support AVX. Currently we modify the CPU name back to Nehalem for this case, but that turns off additional features for these CPUs.

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

9 years agoUpdate for llvm commit r233648.
Eric Christopher [Tue, 31 Mar 2015 00:10:23 +0000 (00:10 +0000)]
Update for llvm commit r233648.

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

9 years ago[Objective-C patch]. Amend TransformObjCMessageExpr to handle call
Fariborz Jahanian [Mon, 30 Mar 2015 23:30:24 +0000 (23:30 +0000)]
[Objective-C patch]. Amend TransformObjCMessageExpr to handle call
to 'super' of instance/class methods and not assert.
rdar://20350364

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

9 years agoAdd driver support for Native Client SDK
Derek Schuff [Mon, 30 Mar 2015 20:31:33 +0000 (20:31 +0000)]
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

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

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