Commit Graph

36762 Commits

Author SHA1 Message Date
Richard Smith c6abd96bff PR20445: Properly transform the initializer in a CXXNewExpr rather than running
it through the normal TreeTransform logic for Exprs (which will strip off
implicit parts of the initialization and never re-create them).

llvm-svn: 213913
2014-07-25 01:12:44 +00:00
Richard Trieu d86c901f29 Pass the PrintingPolicy when converting types to strings in template type
diffing.  This removes extra "struct"/"class" in the type names and gives
"bool" instead of "_Bool" for booleans.

llvm-svn: 213912
2014-07-25 00:24:02 +00:00
Richard Trieu 116083159c Print "(default)" for default template template arguments to match the
printing of other types.

llvm-svn: 213902
2014-07-24 23:14:16 +00:00
Mark Heffernan c888e41c0c Add support for #pragma nounroll.
llvm-svn: 213885
2014-07-24 18:09:38 +00:00
Aaron Ballman 31f42318d8 Improving the "integer constant too large" diagnostics based on post-commit feedback from Richard Smith. Amends r213657.
llvm-svn: 213865
2014-07-24 14:51:23 +00:00
Tim Northover 02a979fd1e MachO: use "arm64" as the triple name in modules.
Current versions of ld64 can't cope with "aarch64" being stored. I'm fixing
that, but in the transitionary period we'll need to still emit "arm64".

rdar://problem/17783765

llvm-svn: 213852
2014-07-24 10:25:34 +00:00
Alexey Bataev 82bad8b026 [OPENMP] Initial parsing and sema analysis for clause 'seq_cst' of 'atomic' directive.
llvm-svn: 213846
2014-07-24 08:55:34 +00:00
Alexey Bataev 459dec0ca2 [OPENMP] Initial parsing and sema analysis for clause 'capture' in 'atomic' directive.
llvm-svn: 213842
2014-07-24 06:46:57 +00:00
David Majnemer 65f8732c14 MS ABI: -fno-rtti-data wasn't data-free enough
While -fno-rtti-data would correctly avoid referencing the RTTI complete
object locator in the VFTable itself, it would emit them anyway.

llvm-svn: 213841
2014-07-24 06:09:19 +00:00
Richard Trieu 3880089fc7 Add support for nullptr template arguments to template type diffing.
llvm-svn: 213840
2014-07-24 04:24:50 +00:00
Richard Smith 73a29662b9 Simplify MacroInfo lifetime management. We don't need three different functions
to destroy one of these.

llvm-svn: 213837
2014-07-24 03:25:00 +00:00
Alexey Bataev 8b9cb9833f [OPENMP] Fixed DSA detecting for function parameters: by default they must be private.
llvm-svn: 213835
2014-07-24 02:33:58 +00:00
Richard Smith 78bb36f159 Take the canonical type when forming a canonical template argument with
'nullptr' value. Fixes profiling of such template arguments to always give the
same value.

llvm-svn: 213834
2014-07-24 02:27:39 +00:00
Richard Smith ee0c4c1673 Remove unused Prev pointer from MacroInfo chain.
Remove pointless MICache: it only ever contained up to 1 object, and was only
non-empty when recovering from an error. There's no performance or memory win
from maintaining this cache.

llvm-svn: 213825
2014-07-24 01:13:23 +00:00
Richard Smith 33b44ab2b7 Replace r213816's fix with a different one. It's not meaningful to call
isOnePastTheEnd on an invalid designator, so assert and push the check into the
one caller that wasn't already checking.

llvm-svn: 213820
2014-07-23 23:50:25 +00:00
Reid Kleckner 142dd46c2a Add a missing Invalid check to SubobjectDesignator::isOnePastEnd()
The class seems to have an invariant that Entries is non-empty if
Invalid is false.  It appears this method was previously private, and
all internal uses checked Invalid.  Now there is an external caller, so
check Invalid to avoid array OOB underflow.

Fixes PR20420.

llvm-svn: 213816
2014-07-23 23:24:25 +00:00
Richard Smith a507bfc6b9 PR20228: don't retain a pointer to a vector element after the container has been resized.
llvm-svn: 213790
2014-07-23 20:07:08 +00:00
Mark Heffernan 450c23843e In unroll pragma syntax and loop hint metadata, change "enable" forms to a new form using the string "full".
llvm-svn: 213771
2014-07-23 17:31:31 +00:00
Ben Langmuir b537a3a651 Add stopgap option -fmodule-implementation-of <name>
This flag specifies that we are building an implementation file of the
module <name>, preventing importing <name> as a module. This does not
consider this to be the 'current module' for the purposes of doing
modular checks like decluse or non-modular-include warnings, unlike
-fmodule-name.

This is needed as a stopgap until:
1) we can resolve relative includes to a VFS-mapped module (or can
   safely import a header textually and as part of a module)

and ideally
2) we can safely do incremental rebuilding when implementation files
   import submodules.

llvm-svn: 213767
2014-07-23 15:30:23 +00:00
Daniel Jasper 3dfa09bbbc Prevent assert in ASTMatchFinder.
If nodes without memoization data (e.g. TypeLocs) are bound to specific
names, that effectively prevents memoization as those elements cannot be
compared effectively. If it is tried anyway, this can lead to an assert
as demonstrated in the new test.

In the long term, the better solution will be to enable DynTypedNodes
without memoization data. For now, simply skip memoization instead.

llvm-svn: 213751
2014-07-23 13:17:47 +00:00
Tim Northover 40956e64f2 AArch64: update Clang for merged arm64/aarch64 triples.
The main subtlety here is that the Darwin tools still need to be given "-arch
arm64" rather than "-arch aarch64". Fortunately this already goes via a custom
function to handle weird edge-cases in other architectures, and it tested.

I removed a few arm64_be tests because that really isn't an interesting thing
to worry about. No-one using big-endian is also referring to the target as
arm64 (at least as far as toolchains go). Mostly they date from when arm64 was
a separate target and we *did* need a parallel name simply to test it at all.
Now aarch64_be is sufficient.

llvm-svn: 213744
2014-07-23 12:32:58 +00:00
Daniel Sanders 54d8ee6d7b [mips] -mno-shared should only be given to the assembler when -fPIC/-fpic/-fPIE/-fpie is not in effect.
This fixes compiler recursion on MIPS32r2.

llvm-svn: 213741
2014-07-23 12:06:13 +00:00
Alexey Bataev 67a4f22f12 [OPENMP] Initial parsing and sema analysis for 'update' clause of 'atomic' directive.
llvm-svn: 213735
2014-07-23 10:25:33 +00:00
Simon Atanasyan c92717f2f6 [Driver][Mips] Restore FIXME comment was removed accidentally.
llvm-svn: 213734
2014-07-23 09:27:10 +00:00
Yi Kong cd08139865 Add module map entry for ARM ACLE header file
llvm-svn: 213731
2014-07-23 09:00:21 +00:00
Alexey Bataev dea4761c06 [OPENMP] Initial parsing an sema analysis for 'write' clause of 'atomic' directive.
llvm-svn: 213728
2014-07-23 07:46:59 +00:00
Nico Weber 9386c82d56 Improve diagnostic on default-initializing const variables (PR20208).
This tweaks the diagnostic wording slighly, and adds a fixit on a note.
An alternative would be to add the fixit directly on the diagnostic, see
the review thread linked to from the bug for a few notes on that approach.

llvm-svn: 213725
2014-07-23 05:16:10 +00:00
Richard Smith a593419593 AST printer: fix double space before base class with no access specifier.
llvm-svn: 213719
2014-07-23 03:22:10 +00:00
Richard Smith a4bb292095 When pretty-printing a declaration of a pack, put the ellipsis before the name
being declared, not at the end. When pretty-printing a non-type template
parameter, put the name of the parameter in the middle of the type, not at the
end.

llvm-svn: 213718
2014-07-23 03:17:06 +00:00
Alexey Bataev f98b00c33e [OPENMP] Initial parsing and sema analysis for 'read' clause in 'atomic' directive.
llvm-svn: 213717
2014-07-23 02:27:21 +00:00
Ehsan Akhgari c3ad3bab61 Use the correct from type in a SCS
Summary:
If during constructing a standard conversion sequence, we resolve an
overload, we need to adjust the from type in the SCS according to the
resolved operator.

I found this bug when debugging PR20218.  This doesn't seem to be
observable, so there is no good way of testing it.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 213680
2014-07-22 20:20:14 +00:00
Aaron Ballman adfdde5ba6 Improve the checkUInt32Argument() helper function so that it diagnoses integer constants larger than 32-bits.
llvm-svn: 213658
2014-07-22 14:09:34 +00:00
Aaron Ballman 446867ee4e Provide extra information in the "integer constant is too large" diagnostic. This will be used to improve other diagnostics.
llvm-svn: 213657
2014-07-22 14:08:09 +00:00
Aaron Ballman 08b065909f Disallowing GNU-style attributes in new expressions, since they are prohibited by GCC as well.
llvm-svn: 213650
2014-07-22 12:44:22 +00:00
Elena Demikhovsky bd1a49bf81 AVX-512: I added new headers to makefiles. It should resolve tests fail.
If it will not, I'm reverting the both commits.

llvm-svn: 213645
2014-07-22 12:08:25 +00:00
Elena Demikhovsky fcc6df310d AVX-512: Added intrinsics to clang.
The set is small, that what I have right now.
Everybody is welcome to add more.

llvm-svn: 213641
2014-07-22 11:31:39 +00:00
Alexey Bataev 0162e459ef [OPENMP] Initial parsing and sema analysis for 'atomic' directive.
llvm-svn: 213639
2014-07-22 10:10:35 +00:00
Alexey Bataev 9fb6e647e7 [OPENMP] Initial parsing and sema analysis for 'ordered' directive.
llvm-svn: 213616
2014-07-22 06:45:04 +00:00
Richard Trieu d53def22ef Fix '&' printing for template arguments in parentheses in template diffing.
llvm-svn: 213613
2014-07-22 04:42:15 +00:00
Richard Trieu 63056c3918 More gracefully handle parentheses in templare arguments in template diffing.
llvm-svn: 213611
2014-07-22 04:06:54 +00:00
Richard Trieu 965cfa1d5b Fix a template diffing problem were an '&' is unexpectedly printed in
a template argument.

llvm-svn: 213609
2014-07-22 03:33:01 +00:00
Saleem Abdulrasool 202aac174a Sema: correct handling for __va_start for WoA
Windows ARM indicates __va_start as a variadic function.  However, the function
itself is treated as having 4 formal arguments:
  - (out) pointer to the va_list
  - (in) address of the last named argument
  - (in) slot size for the type of the last argument
  - address of the last named argument

The last argument does not seem to have any bearing on codegen, and thus is not
explicitly type checked at this point.

Unlike the previous handling for __va_start, it does not currently validate if
the parameter is the last named parameter (it seems that MSVC currently accepts
this).

llvm-svn: 213595
2014-07-22 02:01:04 +00:00
Serge Pavlov b4b3578af7 Avoid crash if default argument parsed with errors.
If function parameters have default values, and that of the second
parameter is parsed with errors, function declaration would have
a parameter without default value that follows a parameter with
that. Such declaration breaks logic of selecting overloaded
function. As a solution, put opaque object as default value in such case.

This patch fixes PR20055.

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

llvm-svn: 213594
2014-07-22 01:54:49 +00:00
Reid Kleckner 1a711b1696 -fms-extensions: Implement half of #pragma init_seg
Summary:
This pragma is very rare.  We could *hypothetically* lower some uses of
it down to @llvm.global_ctors, but given that GlobalOpt isn't able to
optimize prioritized global ctors today, there's really no point.

If we wanted to do this in the future, I would check if the section used
in the pragma started with ".CRT$XC" and had up to two characters after
it.  Those two characters could form the 16-bit initialization priority
that we support in @llvm.global_ctors.  We would have to teach LLVM to
lower prioritized global ctors on COFF as well.

This should let us compile some silly uses of this pragma in WebKit /
Blink.

Reviewers: rsmith, majnemer

Subscribers: cfe-commits

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

llvm-svn: 213593
2014-07-22 00:53:05 +00:00
Hans Wennborg 8858a03e2f clang-cl: ignore /showIncludes when combined with /E (PR20336)
Both /showIncludes and /E write to stdout. Allowing both results
in interleaved output and an error when double-closing the file
descriptor, intended to catch issues like this.

llvm-svn: 213589
2014-07-21 23:42:07 +00:00
Mark Heffernan 34735af3cb Rename metadata llvm.loop.vectorize.unroll to llvm.loop.vectorize.interleave.
llvm-svn: 213587
2014-07-21 23:10:56 +00:00
Arnaud A. de Grandmaison 6e24a46572 Revert "Emit lifetime.start / lifetime.end markers for unnamed temporary objects."
This commit did break the sanitizer-x86 bot. Revert it while
investigating.

llvm-svn: 213579
2014-07-21 19:47:02 +00:00
Arnaud A. de Grandmaison 17a83cf4b6 Emit lifetime.start / lifetime.end markers for unnamed temporary objects.
This will give more information to the optimizers so that they can reuse stack slots.

llvm-svn: 213576
2014-07-21 18:54:21 +00:00
Mark Heffernan bd26f5ea4d Add support for '#pragma unroll'.
llvm-svn: 213574
2014-07-21 18:08:34 +00:00
Justin Bogner 4f42fc4e1d Sema: Handle C11 atomics when diagnosing out of range comparisons
This fixes a couple of asserts when analyzing comparisons involving
C11 atomics that were uncovered by r205608 when we extended the
applicability of -Wtautological-constant-out-of-range-compare.

llvm-svn: 213573
2014-07-21 18:01:53 +00:00
Alexey Bataev 6125da9258 [OPENMP] Initial parsing and sema analysis for 'flush' directive.
llvm-svn: 213512
2014-07-21 11:26:11 +00:00
Alexander Musman d9ed09f7a5 [OPENMP] Parsing/Sema of the OpenMP directive 'critical'.
llvm-svn: 213510
2014-07-21 09:42:05 +00:00
Richard Smith 22fdae9bd5 Add missing initialization found due to a valgrind false positive.
This field is never inspected in the object state initialized by this
constructor; however, initializing it seems reasonable, since it has
a meaningful value.

llvm-svn: 213499
2014-07-21 05:27:31 +00:00
Richard Smith 57721ac591 [modules] Fix some of the confusion when computing the override set for a macro
introduced by finalization. This is still not entirely correct; more fixes to
follow.

llvm-svn: 213498
2014-07-21 04:10:40 +00:00
Ulrich Weigand 601957fa23 [PowerPC] Optimize passing certain aggregates by value
In addition to enabling ELFv2 homogeneous aggregate handling,
LLVM support to pass array types directly also enables a performance
enhancement.  We can now pass (non-homogeneous) aggregates that fit
fully in registers as direct integer arrays, using an element type
to encode the alignment requirement (that would otherwise go to the
"byval align" field).

This is preferable since "byval" forces the back-end to write the
aggregate out to the stack, even if it could be passed fully in
registers.  This is particularly annoying on ELFv2, if there is
no parameter save area available, since we then need to allocate
space on the callee's stack just to hold those aggregates.

Note that to implement this optimization, this patch does not attempt
to fully anticipate register allocation rules as (defined in the
ABI and) implemented in the back-end.  Instead, the patch is simply
passing *any* aggregate passed by value using the array mechanism
if its size is up to 64 bytes.   This means that some of those will
end up being passed in stack slots anyway, but the generated code
shouldn't be any worse either.  (*Large* aggregates remain passed
using "byval" to enable optimized copying via memcpy etc.)

llvm-svn: 213495
2014-07-21 00:56:36 +00:00
Ulrich Weigand b712237da6 [PowerPC] Support the ELFv2 ABI
This patch implements clang support for the PowerPC ELFv2 ABI.
Together with a series of companion patches in LLVM, this makes
clang/LLVM fully usable on powerpc64le-linux.

Most of the ELFv2 ABI changes are fully implemented on the LLVM side.
On the clang side, we only need to implement some changes in how
aggregate types are passed by value.   Specifically, we need to:
- pass (and return) "homogeneous" floating-point or vector aggregates in
  FPRs and VRs (this is similar to the ARM homogeneous aggregate ABI)
- return aggregates of up to 16 bytes in one or two GPRs

The second piece is trivial to implement in any case.  To implement
the first piece, this patch makes use of infrastructure recently
enabled in the LLVM PowerPC back-end to support passing array types
directly, where the array element type encodes properties needed to
handle homogeneous aggregates correctly.

Specifically, the array element type encodes:
- whether the parameter should be passed in FPRs, VRs, or just
  GPRs/stack slots  (for float / vector / integer element types,
  respectively)
- what the alignment requirements of the parameter are when passed in
  GPRs/stack slots  (8 for float / 16 for vector / the element type
  size for integer element types) -- this corresponds to the
  "byval align" field

With this support in place, the clang part simply needs to *detect*
whether an aggregate type implements a float / vector homogeneous
aggregate as defined by the ELFv2 ABI, and if so, pass/return it
as array type using the appropriate float / vector element type.

llvm-svn: 213494
2014-07-21 00:48:09 +00:00
Ben Langmuir b797d59f03 If a module build reports errors, don't try to load it
... just to find out that it didn't build.

llvm-svn: 213454
2014-07-19 16:29:28 +00:00
Viktor Kutuzov 99400a5a34 Revert D3908 due to issues on Mac platforms
llvm-svn: 213450
2014-07-19 05:58:38 +00:00
Hal Finkel 16e394a36c Cleanup comparisons to VariableArrayType::Static for non-VLAs
The enum is part of ArrayType, so there is no functional change, but comparing
to ArrayType::Static for non-VLAs makes more sense.

llvm-svn: 213446
2014-07-19 02:13:40 +00:00
Hal Finkel bfe2d3c0f9 TypePrinter should not ignore IndexTypeCVRQualifiers on constant-sized arrays
C99 array parameters can have index-type CVR qualifiers, and the TypePrinter
should print them when present (and we were not for constant-sized arrays).
Otherwise, we'd drop the restrict in:

  int foo(int a[restrict static 3]) { ... }

llvm-svn: 213445
2014-07-19 02:01:03 +00:00
Hal Finkel 48d53e2c4c Use the dereferenceable attribute on C99 array parameters with static
In C99, an array parameter declarator might have the form:
  direct-declarator '[' 'static' type-qual-list[opt] assign-expr ']'

where the static keyword indicates that the caller will always provide a
pointer to the beginning of an array with at least the number of elements
specified by the assignment expression. For constant sizes, we can use the
new dereferenceable attribute to pass this information to the optimizer. For
VLAs, we don't know the size, but (for addrspace(0)) do know that the pointer
must be nonnull (and so we can use the nonnull attribute).

llvm-svn: 213444
2014-07-19 01:41:07 +00:00
Richard Smith 1b98ccc4e9 PR20356: Fix all Sema warnings with mismatched ext_/warn_ versus
ExtWarn/Warnings. Mostly the name of the warning was changed to match the
semantics, but in the PR20356 cases, the warning was about valid code, so the
diagnostic was changed from ExtWarn to Warning instead.

llvm-svn: 213443
2014-07-19 01:39:17 +00:00
David Blaikie 3875a82d42 Remove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ".reset()"
It's also possible to just write "= nullptr", but there's some question
of whether that's as readable, so I leave it up to authors to pick which
they prefer for now. If we want to discuss standardizing on one or the
other, we can do that at some point in the future.

llvm-svn: 213439
2014-07-19 01:06:45 +00:00
Warren Hunt b530bc0242 [MS-ABI] Assign SEH handler indices to __try blocks
Assigns indices to try blocks. These indices will used in constructing 
tables that the mscrt function __except_handler3 reads during SEH.
Testing will occur once we actually emit the tables, in a subsequent 
patch.

llvm-svn: 213437
2014-07-19 00:45:07 +00:00
David Majnemer 1c3d95ebc5 CodeGen: Properly null-check typeid expressions
Thoroughly check for a pointer dereference which yields a glvalue.  Look
through casts, comma operators, conditional operators, paren
expressions, etc.

This was originally D4416.

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

llvm-svn: 213434
2014-07-19 00:17:06 +00:00
NAKAMURA Takumi 215f3b7f02 Revert r213415, "Merge two lines". It broke tests in -Asserts builds.
CGBuilder doesn't name instructions with Name. We should use Inst::setName() to name an instruction explicitly here.

llvm-svn: 213431
2014-07-18 23:46:16 +00:00
Akira Hatanaka 88ef728f2e [X86 inline-asm] Error out on inline-asm constraint "=f".
<rdar://problem/17476689>

llvm-svn: 213428
2014-07-18 23:30:30 +00:00
Hal Finkel f3e0265ea0 TypePrinter should not omit the static keyword in array parameter declarators
In C99, an array parameter declarator might have the form: direct-declarator
'[' 'static' type-qual-list[opt] assign-expr ']'

and when the size of the array is a constant, don't omit the static keyword
when printing the type. Also, in the VLA case, put a space after the static
keyword (some assignment expression must follow it).

llvm-svn: 213424
2014-07-18 23:19:20 +00:00
Fariborz Jahanian ac6b4efaab Objective-C. Patch to warn if the result of calling a property getter
is unused (this is match behavior when property-dot syntax is used to
use same getter). rdar://17514245
Patch by Anders Carlsson with minor refactoring by me.

llvm-svn: 213423
2014-07-18 22:59:10 +00:00
Richard Smith e657bbdcbc Reinstate r213348, reverted in r213395, with an additional bug fix and more
thorough tests.

Original commit message:

[modules] Fix macro hiding bug exposed if:

 * A submodule of module A is imported into module B
 * Another submodule of module A that is not imported into B exports a macro
 * Some submodule of module B also exports a definition of the macro, and
   happens to be the first submodule of B that imports module A.

In this case, we would incorrectly determine that A's macro redefines B's
macro, and so we don't need to re-export B's macro at all.

This happens with the 'assert' macro in an LLVM self-host. =(

llvm-svn: 213416
2014-07-18 22:13:40 +00:00
Alexey Samsonov ad2e0352f0 Merge two lines
llvm-svn: 213415
2014-07-18 21:29:55 +00:00
David Majnemer 9edaf7c822 Revert "CodeGen: Properly null-check typeid expressions"
This reverts commit r213401, r213402, r213403, and r213404.

I accidently committed these changes instead of updating the
differential.

llvm-svn: 213405
2014-07-18 20:00:13 +00:00
David Majnemer 5dd5ea422a Address Richard's latest feedback.
llvm-svn: 213404
2014-07-18 19:53:25 +00:00
David Majnemer e04c470afa Address Richard's comments
llvm-svn: 213403
2014-07-18 19:53:23 +00:00
David Majnemer 18a9ac9129 Address Richard's comments.
llvm-svn: 213402
2014-07-18 19:53:21 +00:00
David Majnemer 4fbb1b9f98 CodeGen: Properly null-check typeid expressions
Summary:
Thoroughly check for a pointer dereference which yields a glvalue.  Look
through casts, comma operators, conditional operators, paren
expressions, etc.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 213401
2014-07-18 19:53:17 +00:00
Tyler Nowicki f8a767df67 Recommit: Handle diagnostic warnings in Frontend diagnostic handler.
Clang uses a diagnostic handler to grab diagnostic messages so it can print them
with the line of source code they refer to. This patch extends this to handle
optimization failures that were added to llvm to produce a warning when
loop vectorization is explicitly specified (using a pragma clang loop directive)
but fails.

Update renames warning flag name to avoid indicating the flag's severity and
adds a test.

Reviewed by Alp Toker

llvm-svn: 213400
2014-07-18 19:40:19 +00:00
Ben Langmuir ebaf14bdd0 Revert "[modules] Fix macro hiding bug exposed if:"
This is breaking the system modules on Darwin, because something that
was defined and re-exported no longer is.  Might be this patch, or might
just be a really poor interaction with an existing visibility bug.

This reverts commit r213348.

llvm-svn: 213395
2014-07-18 18:38:24 +00:00
Alexey Samsonov 32f59d8e1e [UBsan] Skip -fsanitize=vptr instrumentations when the pointer value is null.
Otherwise -fsanitize=vptr causes the program to crash when it downcasts
a null pointer.

Reviewed in http://reviews.llvm.org/D4412.
Patch by Byoungyoung Lee!

llvm-svn: 213393
2014-07-18 18:15:39 +00:00
Alexey Samsonov 6c12414358 Make sure globals created by UBSan are not instrumented by ASan.
Summary:
This change adds description of globals created by UBSan
instrumentation (UBSan handlers, type descriptors, filenames) to
llvm.asan.globals metadata, effectively "blacklisting" them. This can
dramatically decrease the data section in binaries built with UBSan+ASan,
as UBSan tends to create a lot of handlers, and ASan instrumentation
increases the global size to at least 64 bytes.

Test Plan: clang regression test suite

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, byoungyoung, kcc

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

llvm-svn: 213392
2014-07-18 17:50:06 +00:00
Sylvestre Ledru e939235b24 For i386, gcc 4.9 under Debian (at least) updated its paths to i586-linux-gnu
(i486-linux-gnu previously). Adding this triple to the list of search.
Also impacts clang 3.4.2

Reported on the Debian bug tracking system here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=754963
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=755183

llvm-svn: 213388
2014-07-18 16:24:57 +00:00
Hal Finkel a2347baaec Mark C++ reference parameters as dereferenceable
Because references must be initialized using some evaluated expression, they
must point to something, and a callee can assume the reference parameter is
dereferenceable. Taking advantage of a new attribute just added to LLVM, mark
them as such.

Because dereferenceability in addrspace(0) implies nonnull in the backend, we
don't need both attributes. However, we need to know the size of the object to
use the dereferenceable attribute, so for incomplete types we still emit only
nonnull.

llvm-svn: 213386
2014-07-18 15:52:10 +00:00
Daniel Sanders 492beb1ad3 [mips] Use Triple::getVendor() instead of Triple::getVendorName() to identify 'mti' vendor triples.
llvm-svn: 213383
2014-07-18 15:05:38 +00:00
Arnaud A. de Grandmaison 18bc4fff48 Revert "Emit lifetime.start / lifetime.end markers for unnamed temporary objects."
This reverts commit dbf785a6432f78a8ec229665876647c4cc610d3d, while I qm
investigating a buildbot failure.

llvm-svn: 213380
2014-07-18 14:23:58 +00:00
Arnaud A. de Grandmaison 1be89f4977 Emit lifetime.start / lifetime.end markers for unnamed temporary objects.
This will give more information to the optimizers so that they can reuse stack slots.

llvm-svn: 213379
2014-07-18 13:36:33 +00:00
Alexey Bataev 2df347ad96 [OPENMP] Initial parsing and sema analysis for 'taskwait' directive.
llvm-svn: 213363
2014-07-18 10:17:07 +00:00
Alexey Bataev 4d1dfeabc9 [OPENMP] Initial parsing and sema analysis for 'barrier' directive.
llvm-svn: 213360
2014-07-18 09:11:51 +00:00
Oliver Stannard e022851f3b [ARM] Fix AAPCS regression caused by r211898
r211898 introduced a regression where a large struct, which would
normally be passed ByVal, was causing padding to be inserted to
prevent the backend from using some GPRs, in order to follow the
AAPCS. However, the type of the argument was not being set correctly,
so the backend cannot align 8-byte aligned struct types on the stack.

The fix is to not insert the padding arguments when the argument is
being passed ByVal.

llvm-svn: 213359
2014-07-18 09:09:31 +00:00
Alexey Bataev 68446b7253 [OPENMP] Initial parsing and sema analysis of 'taskyield' directive.
llvm-svn: 213355
2014-07-18 07:47:19 +00:00
Kevin Qin 110db6f2ad [AArch64] Implement Clang CLI interface proposal about "-march".
1. Revert "Add default feature for CPUs on AArch64 target in Clang"
at r210625. Then, all enabled feature will by passed explicitly by
-target-feature in -cc1 option.

2. Get "-mfpu" deprecated.

3. Implement support of "-march". Usage is:
    -march=armv8-a+[no]feature
  For instance, "-march=armv8-a+neon+crc+nocrypto". Here "armv8-a" is
  necessary, and CPU names are not acceptable. Candidate features are
  fp, neon, crc and crypto. Where conflicting feature modifiers are
  specified, the right-most feature is used.

4. Implement support of "-mtune". Usage is:
    -march=CPU_NAME
  For instance, "-march=cortex-a57". This option will ONLY get
  micro-architectural feature enabled specifying to target CPU,
  like "+zcm" and "+zcz" for cyclone. Any architectural features
  WON'T be modified.

5. Change usage of "-mcpu" to "-mcpu=CPU_NAME+[no]feature", which is
  an alias to "-march={feature of CPU_NAME}+[no]feature" and
  "-mtune=CPU_NAME" together. Where this option is used in conjunction
  with -march or -mtune, those options take precedence over the
  appropriate part of this option.

llvm-svn: 213353
2014-07-18 07:03:22 +00:00
David Majnemer 2e49830b3d Parse: Diagnose malformed 'message' arguments for 'availability' attr
The parsing code for 'availability' wasn't prepared for string literals
like "a" L"b" showing up.  Error if this occurs.

llvm-svn: 213350
2014-07-18 05:43:12 +00:00
Richard Smith a5d2a49c34 Add dump() for MacroDirective and MacroInfo.
llvm-svn: 213349
2014-07-18 04:54:02 +00:00
Richard Smith 3965412f08 [modules] Fix macro hiding bug exposed if:
* A submodule of module A is imported into module B
 * Another submodule of module A that is not imported into B exports a macro
 * Some submodule of module B also exports a definition of the macro, and
   happens to be the first submodule of B that imports module A.

In this case, we would incorrectly determine that A's macro redefines B's
macro, and so we don't need to re-export B's macro at all.

This happens with the 'assert' macro in an LLVM self-host. =(

llvm-svn: 213348
2014-07-18 04:53:37 +00:00
Richard Smith c4158e862f Cleanup: remove essentially unused variable.
llvm-svn: 213347
2014-07-18 04:47:25 +00:00
Reid Kleckner 3be586fec2 Mark the vtable used when defining implicit copy and move ctors
I don't think other implicit members like copy assignment and move
assignment require this treatment, because they should already be
operating on a constructed object.

Fixes PR20351.

llvm-svn: 213346
2014-07-18 01:48:10 +00:00
NAKAMURA Takumi c1551a10ed SemaInit.cpp: Fix a warning with -Asserts. [-Wunused-variable]
llvm-svn: 213345
2014-07-18 01:26:35 +00:00
Reid Kleckner 722b1df869 Fix parsing certain kinds of strings in the MS section pragmas
We were crashing on the relevant test case inputs.  Also, refactor this
code a bit so we can report failure and slurp the pragma tokens without
returning a diagnostic id.  This is more consistent with the rest of the
parser and sema code.

llvm-svn: 213337
2014-07-18 00:13:16 +00:00
Richard Smith 8aa561ba32 PR20346: fix aggregate initialization / template instantiation bug:
If, during the initial parse of a template, we perform aggregate initialization
and form an implicit value initialization for an array type, then when we come
to instantiate the template and redo the initialization step, we would try to
match the implicit value initialization up against an array *element*, not to
the complete array.

Remarkably, we've had this bug since ~the dawn of time, but only noticed it
recently.

llvm-svn: 213332
2014-07-17 23:12:06 +00:00
David Blaikie 62a56f39b7 Revert "unique_ptr-ify ownership of ASTConsumers"
This reverts commit r213307.

Reverting to have some on-list discussion/confirmation about the ongoing
direction of smart pointer usage in the LLVM project.

llvm-svn: 213325
2014-07-17 22:34:12 +00:00
David Blaikie a51666a4d6 unique_ptr-ify ownership of ASTConsumers
(after fixing a bug in MultiplexConsumer I noticed the ownership of the
nested consumers was implemented with raw pointers - so this fixes
that... and follows the source back to its origin pushing unique_ptr
ownership up through there too)

llvm-svn: 213307
2014-07-17 20:40:36 +00:00
Hans Wennborg 56fc62bf01 MS compatibility: always emit dllexported in-class initialized static data members (PR20140)
This makes us emit dllexported in-class initialized static data members (which
are treated as definitions in MSVC), even when they're not referenced.

It also makes their special linkage reflected in the GVA linkage instead of
getting massaged in CodeGen.

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

llvm-svn: 213304
2014-07-17 20:25:23 +00:00
Joerg Sonnenberger 587deea875 If char/short are shorter than int, do not use U as suffix for
constants. Comparing int against a constant of the given type like
UINT8_MAX will otherwise force a promotion to unsigned int, which is
typically not expected.

llvm-svn: 213301
2014-07-17 20:12:32 +00:00
Joerg Sonnenberger 3042f7e7a1 Always set the C suffix macro, even if it is empty.
llvm-svn: 213299
2014-07-17 19:47:34 +00:00
Ehsan Akhgari bd927b6457 clang-cl: Flush stdout after writing the /showIncludes output
Summary:
Before this patch, you could get lines in the output such as:
Note: including file:   ../../dist/include/js/Tc:/path/to/foo.cpp(1,1) :  error(clang): static_assert failed...

This patch ensures that the stdout output from showIncludes won't be garbled
in the terminal like this, and it also helps applications that use the output
to generate dependency information if they happen to capture both stdout and
stderr.

Test Plan:
Tested locally, it's hard to write an automated test for this as
the behavior depends on the buffering of the ostreams.

Reviewers: nico

Subscribers: cfe-commits

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

llvm-svn: 213297
2014-07-17 19:08:19 +00:00
Alexey Samsonov 24cad99307 [UBSan] Add !nosanitize metadata to the code generated by UBSan.
This is used to mark the instructions emitted by Clang to implement
variety of UBSan checks. Generally, we don't want to instrument these
instructions with another sanitizers (like ASan).

Reviewed in http://reviews.llvm.org/D4544

llvm-svn: 213291
2014-07-17 18:46:27 +00:00
Joerg Sonnenberger b3a4969b70 Provide __SIG_ATOMIC_MAX__ next to __SIG_ATOMIC_WIDTH__.
llvm-svn: 213289
2014-07-17 18:31:20 +00:00
Nico Weber 022e507042 Wrap a comment to 80 columns, no code change.
llvm-svn: 213288
2014-07-17 18:19:30 +00:00
Fariborz Jahanian b93355e9b1 Objective-C. deprecated attribute is not inherited on methods
overriden in interfaces and protocols (this is already the case
for properties). rdar://16068470

llvm-svn: 213282
2014-07-17 17:05:04 +00:00
Hal Finkel a8443c36ae Handle __assume in the VoidExprEvaluator
This is a follow-up to an IRC conversation with Richard last night; __assume
does not evaluate its argument, and so the argument should not contribute to
whether (__assume(e), constant) can be used where a constant is required.

llvm-svn: 213267
2014-07-17 14:49:58 +00:00
Hal Finkel f041733585 Add an __assume side-effects warning
In MS-compatibility mode, we support the __assume builtin. The __assume builtin
does not evaluate its arguments, and we should issue a warning if __assume is
provided with an argument with side effects (because these effects will be
discarded).

This is similar in spirit to the warnings issued by other compilers (Intel
Diagnostic 2261, MS Compiler Warning C4557).

llvm-svn: 213266
2014-07-17 14:25:55 +00:00
Aaron Ballman 9eef742308 Using a std::string instead of a StringRef because the Default case synthesizes a temporary std::string from a Twine. Assigning that into a StringRef causes the StringRef to refer to a temporary, and bad things happen.
This fixes a failing test case on Windows.

llvm-svn: 213265
2014-07-17 13:28:50 +00:00
Alexey Bataev 74ba3a5880 [OPENMP] Initial parsing and sema analysis of 'mergeable' clause.
llvm-svn: 213262
2014-07-17 12:47:03 +00:00
Yi Kong 28d7b02687 ARM: Add ACLE memory barrier intrinsic mapping
llvm-svn: 213261
2014-07-17 12:45:17 +00:00
Alp Toker 5c37d70e9e Revert "Handle diagnostic warnings in Frontend diagnostic handler."
This commit is missing tests and there are a few points that need to be
addressed before a new user-facing option can be added:

  http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140714/110198.html

This reverts commit r213112.

llvm-svn: 213260
2014-07-17 12:29:08 +00:00
Daniel Jasper fc3861ac48 clang-format: Fix parsing of conditional expressions.
Before:
  aaaaaa = aaaaaaaaaaaa ? aaaaaaaaaa ? aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      : aaaaaaaaaaaaaaaaaaaaaa
      : aaaaaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  aaaaaa = aaaaaaaaaaaa
               ? aaaaaaaaaa ? aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                            : aaaaaaaaaaaaaaaaaaaaaa
               : aaaaaaaaaaaaaaaaaaaaaaaaaaaa;

llvm-svn: 213258
2014-07-17 12:22:04 +00:00
Alexey Bataev 7aea99a310 [OPENMP] Initial support for parsing and sema analysis of 'untied' clause.
llvm-svn: 213257
2014-07-17 12:19:31 +00:00
Yi Kong 19a29ac0d0 Port memory barriers intrinsics to AArch64
Memory barrier __builtin_arm_[dmb, dsb, isb] intrinsics are required to
implement their corresponding ACLE and MSVC intrinsics.

This patch ports ARM dmb, dsb, isb intrinsic to AArch64.

Requires LLVM r213247.

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

llvm-svn: 213250
2014-07-17 10:52:06 +00:00
Tim Northover 6dbcbac98b IR: update Clang to use polymorphic __fp16 conversion intrinsics.
There should be no change in semantics at this stage.

llvm-svn: 213249
2014-07-17 10:51:31 +00:00
Daniel Sanders 4dcbe810d4 [mips] Pass the ABI to the integrated assembler and add tests the existing arguments.
Summary:
With this patch (and a corresponding LLVM patch), assembling an empty file with
GCC and Clang -fintegrated-as produce near identical objects. The remaining
differences are:
* GCC/GAS produce objects have a .pdr section
* GCC/GAS produce objects have a .gnu.attributes section
Other differences are insignificant such as precise file offsets and the order
of strings in the string table.

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

llvm-svn: 213241
2014-07-17 09:46:40 +00:00
Alexander Musman 80c2289a03 [OPENMP] Parsing/Sema analysis of directive 'master'
llvm-svn: 213237
2014-07-17 08:54:58 +00:00
Alexey Bataev 3778b60176 [OPENMP] Initial parsing and sema analysis for 'final' clause.
llvm-svn: 213232
2014-07-17 07:32:53 +00:00
Richard Smith f8adcdc436 Track the difference between
-- a constructor list initialization that unpacked an initializer list into
    constructor arguments and
 -- a list initialization that created as std::initializer_list and passed it
    as the first argument to a constructor

in the AST. Use this flag while instantiating templates to provide the right
semantics for the resulting initialization.

llvm-svn: 213224
2014-07-17 05:12:35 +00:00
Nikola Smiljanic 4fc91538e9 Fix FriendDecl source location and range for class templates and function declarations that don't start with 'friend' keyword. Add more unittests.
llvm-svn: 213220
2014-07-17 01:59:34 +00:00
David Majnemer a246468f58 MS ABI: Padding injected between empty vbases doesn't up required align
Only alignment is changed, not required alignment.

llvm-svn: 213217
2014-07-17 00:55:19 +00:00
David Blaikie 1326975496 DebugInfo: Forward HandleTagDeclRequiredDefinition through MultiplexConsumer to fix debug info emission in the presence of plugins.
When plugins are used the Multiplex(AST)Consumer is employed to dispatch
to both the plugin ASTConsumers and the IRGen ASTConsumer. It wasn't
dispatching a critical call for debug info, resulting in plugin users
having a negative debugging experience.

While I'm here, forward a bunch of other missing calls through the
consumer that seem like they should be there.

To test this, use the example plugin (requires plugins and examples) and
split the test case up so that the plugin testing can be done under that
requirement while the non-plugin testing will execute even in builds
that don't include plugin support or examples.

llvm-svn: 213213
2014-07-16 23:52:46 +00:00
Hal Finkel 3e49fda0d4 Add basic (noop) CodeGen support for __assume
Clang supports __assume, at least at the semantic level, when MS extensions are
enabled. Unfortunately, trying to actually compile code using __assume would
result in this error:

  error: cannot compile this builtin function yet

__assume is an optimizer hint, and can be ignored at the IR level. Until LLVM
supports assumptions at the IR level, a noop lowering is valid, and that is
what is done here.

llvm-svn: 213206
2014-07-16 22:44:54 +00:00
Richard Smith 5332411cd7 When list-initializing an object of class type, if we pick an initializer list
constructor (and pass it an implicitly-generated std::initializer_list object),
be sure to mark the resulting construction as list-initialization. This fixes
an assert in template instantiation where we previously thought we'd got direct
non-list initialization without any parentheses.

llvm-svn: 213201
2014-07-16 21:33:43 +00:00
Arthur Marble 31fb6f4730 Typically linker options are protected with -Xlinker or -Wl,
however certain sloppy Makefiles pass -z options directly to
the compiler. This patch enables clang to recognize these
options (because -z is not used by clang itself).

llvm-svn: 213198
2014-07-16 21:16:16 +00:00
Aaron Ballman 80f1529c6d Removing a FIXME from the attribute parsing code by now passing along the scope and syntax information for attributes with custom parsing. It turns out not to matter too much because the FIXME wasn't quite true -- none of these attributes have a C++11 spelling. However, it's still a good change (for instance, we may add an attribute with a type arg in the future for which this code now behaves properly).
llvm-svn: 213191
2014-07-16 20:21:50 +00:00
Fariborz Jahanian a2e5deb86d Objective-C. Changes per A. Ballman's comment
for my last patch. // rdar://17631257

llvm-svn: 213185
2014-07-16 19:44:34 +00:00
Serge Pavlov 9f81d6a482 Simplify memory management in NestedNameSpecifierLocBuilder.
With this change the memory of buffer in NestedNameSpecifierLocBuilder
is allocated in one place. It also prevents from allocation of tiny blocks.

llvm-svn: 213178
2014-07-16 18:18:13 +00:00
Simon Atanasyan 9988e3afcc [Driver][Mips] If CPU name is not provided to the driver explicitly use
multilibs from the FSFS toolchain corresponding to the mips32r2/mips64r2 CPUs.

llvm-svn: 213175
2014-07-16 17:34:54 +00:00
Alp Toker 0621cb2e7d Make clang's rewrite engine a core feature
The rewrite facility's footprint is small so it's not worth going to these
lengths to support disabling at configure time, particularly since key compiler
features now depend on it.

Meanwhile the Objective-C rewriters have been moved under the
ENABLE_CLANG_ARCMT umbrella for now as they're comparatively heavy and still
potentially worth excluding from lightweight builds.

Tests are now passing with any combination of feature flags. The flags
historically haven't been tested by LLVM's build servers so caveat emptor.

llvm-svn: 213171
2014-07-16 16:48:33 +00:00
Fariborz Jahanian 451b92ab6a Objective-C. Introducing __attribute__((objc_runtime_name("runtimename"))
to be applied to class or protocols. This will direct IRGen
for Objective-C metadata to use the new name in various places
where class and protocol names are needed.
rdar:// 17631257

llvm-svn: 213167
2014-07-16 16:16:04 +00:00
Simon Atanasyan 7018e1dbb5 [Driver][Mips] Reduce code duplication - use existing function
getMipsCPUAndABI() to get MIPS ABI name during multi-library selection.

No functional changes.

llvm-svn: 213143
2014-07-16 12:29:22 +00:00
Simon Atanasyan 18d6ad2705 [Driver][Mips] Remove flags which is not used in multi-library selection.
No functional changes.

llvm-svn: 213142
2014-07-16 12:29:05 +00:00
Simon Atanasyan ab6db9ff2a [Driver][Mips] Reduce code duplication. Remove static isMipsNan2008() function.
Use the tools::mips::isNaN2008() routine instead.

llvm-svn: 213141
2014-07-16 12:24:48 +00:00
Daniel Sanders 379d44bfdf [mips] Correct the invocation of GAS in several cases.
Summary:
As a result of this patch, assembling an empty file with GCC and Clang (using
GAS as the assembler) now produces identical objects.

-mfp32/-mfpxx/-mfp64 now form a trinity of options. -mfpxx is the default
when the triple vendor is 'img' or 'mti', the ABI is O32, and the CPU is
between mips2 and mips32r2/mips64r2 (inclusive).

-mno-shared is always given to the assembler to match the effect of
-mabicalls (currently unimplemented but Clang acts as if it is given).
Similarly, -call_nonpic is always given to match the effect of -mplt (also
unimplemented and acts as if given) except when the ABI is 64 in which case
-mplt has no effect so -KPIC is given instead.

-mhard-float/-msoft-float are now passed on.

-modd-spreg/-mno-odd-spreg are now passed on.

-mno-mips16 is correctly passed on. The assembler option is -no-mips16 not
-mno-mips16

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

llvm-svn: 213138
2014-07-16 11:52:23 +00:00
Daniel Sanders 2e9427a175 [mips] Add support for -mfpxx and -mno-fpxx.
Differential Revision: http://reviews.llvm.org/D4464

llvm-svn: 213132
2014-07-16 09:57:54 +00:00
Evgeniy Stepanov a333117852 Don't add -Bsymbolic by default on Android.
-Bsymbolic is not a platform requirement and should not
be added unconditionally.

llvm-svn: 213126
2014-07-16 08:46:35 +00:00
David Majnemer bf3d430163 MS ABI: Up the required alignment after inserting padding between vbases
We would correctly insert sufficiently aligned padding between vbases
when our leading base was empty, however we would neglect to increase
the required alignment of the most derived class.

This fixes PR20315.

llvm-svn: 213123
2014-07-16 07:16:58 +00:00
David Majnemer 1272764b18 AST: Convert a SmallPtrSet to a SmallPtrSetImpl in RecordLayoutBuilder
No functionality changed, it just makes the code a little less brittle.

llvm-svn: 213122
2014-07-16 06:30:31 +00:00
David Majnemer c964b4b4d0 AST: Cleanup RecordLayoutBuilder
No functionality changed, just some cleanups:
- Switch some loops to range-based for.
- Name some iterators with a more creative name than "I".
- Reduce dependence on auto. Does RD->bases() give you a list of
  CXXBaseSpecifiers or CXXRecordDecls? It's more clear to just say which
  upfront.

llvm-svn: 213121
2014-07-16 06:04:00 +00:00
Serge Pavlov 458ea76041 Improve error recovery around colon.
Recognize additional cases, when '::' is mistyped as ':'.
This is a fix to RP18587 - colons have too much protection in member-declarations
Review is tracked by http://reviews.llvm.org/D3653.

This is an attempt to recommit the fix, initially committed as r212957 but then
reverted in r212965 as it broke self-build. In the updated patch ParseDirectDeclarator
turns on colon protection in for context as well.

llvm-svn: 213120
2014-07-16 05:16:52 +00:00
Saleem Abdulrasool c68237bc2c Driver: bifurcate extended and basic MSC versioning
This restores the original behaviour of -fmsc-version. The older option
remains as a mechanism for specifying the basic version information. A
secondary option, -fms-compatibility-version permits the user to specify an
extended version to the driver.

The new version takes the value as a dot-separated value rather than the
major * 100 + minor format that -fmsc-version format. This makes it easier to
specify the value as well as a more flexible manner for specifying the value.

Specifying both values is considered an error.

The older parameter is left solely as a driver option, which is normalised into
the newer parameter. This allows us to retain a single code path in the
compiler itself whilst preserving the semantics of the old parameter as well as
avoid having to determine which of two formats are being used by the invocation.

The test changes are due to the fact that the compiler no longer supports the
old option, and is a direct conversion to the new option.

llvm-svn: 213119
2014-07-16 03:13:50 +00:00
Tyler Nowicki e470771b3a Handle diagnostic warnings in Frontend diagnostic handler.
Clang uses a diagnostic handler to grab diagnostic messages so it can print them
with the line of source code they refer to. This patch extends this to handle
diagnostic warnings that were added to llvm to produce a warning when
loop vectorization is explicitly specified (using a pragma clang loop directive)
but fails.

Reviewed by: Aaron Ballman

llvm-svn: 213112
2014-07-16 00:40:42 +00:00
Reid Kleckner 4e32604f60 Avoid referencing the vtable when calling the ctor without emitting it
This fixes compilation errors about incomplete types used with WebKit's
RefPtr template.  Simply calling an out of line constructor should not
instantiate all inline and defaulted virtual methods.

Tested by building and testing several big piles of code on Linux.

Reviewers: rsmith

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

llvm-svn: 213109
2014-07-16 00:30:59 +00:00
Brad Smith 873d467bb6 Use the integrated assembler by default on OpenBSD/sparc.
llvm-svn: 213105
2014-07-15 23:07:10 +00:00
Aaron Ballman 1e606f4d46 Switching some iterator-based for loops to use range-based for loops. No functional changes intended.
llvm-svn: 213098
2014-07-15 22:03:49 +00:00
Joerg Sonnenberger f6432d83c3 Add __INTMAX_C_SUFFIX__ and __UINTMAX_C_SUFFIX__.
llvm-svn: 213097
2014-07-15 21:58:11 +00:00
Aaron Ballman 2a89e8526a Added the pack_elements range accessor. Refactoring some for loops to use range-based for loops instead. No functional changes intended.
llvm-svn: 213095
2014-07-15 21:32:31 +00:00
Ehsan Akhgari eeb7e65c5f clang-cl: Implement the -arch flag
Summary:
This implements the -arch flag for both x86 and x86-64 by letting
them affect the default target features we pass to cc1.  -m machine
flags will override the features set by -arch.

Reviewers: hansw

Subscribers: cfe-commits

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

llvm-svn: 213083
2014-07-15 18:27:51 +00:00
Matt Arsenault 8587711164 Add codegen for more R600 builtins
llvm-svn: 213079
2014-07-15 17:23:46 +00:00
Fariborz Jahanian bc94c94be4 Objective-C IRGen. Fixes an inconsistant linkage of
ObC's metaclass metadata with its class metadata which
results in an assert. rdar://17633301

llvm-svn: 213076
2014-07-15 17:14:34 +00:00
Joerg Sonnenberger cc43c85855 Don't create non-temporary twines.
llvm-svn: 213066
2014-07-15 12:18:40 +00:00
Joerg Sonnenberger 62277b37db Make sure int64_t and uint64_t are consistent.
llvm-svn: 213065
2014-07-15 11:51:38 +00:00
NAKAMURA Takumi 04b8b37f56 Prune Redundant libdeps in CMake's target_link_libraries and LLVMBuild.txt.
I checked this with Release+Asserts on x86_64-mingw32. Please restore partially if this were overkill.

llvm-svn: 213064
2014-07-15 11:37:03 +00:00
Joerg Sonnenberger be324f9832 Provide builtin macros as template for PRIab and SCNab, matching the
underlaying types.

llvm-svn: 213063
2014-07-15 11:30:00 +00:00
Daniel Jasper fcfac10c8a clang-format: Improve heuristic around avoiding bad line breaks.
Now, this can be properly formatted:
  static_cast<A< //
      B> *>(     //
      );

Before, clang-format could end up, not formatting the code at all.

llvm-svn: 213055
2014-07-15 09:00:34 +00:00
David Majnemer 6d4766535f AST: Don't walk all redeclarations when looking for a uuid attr
No funcionality changed, just a simplification of the existing code.

llvm-svn: 213044
2014-07-15 04:30:17 +00:00
Richard Smith 5e9e56a0a1 [modules] Rearrange and unify the way we determine if we need to pull in
redeclaration chains when pulling in a declaration. We need the redecl chain
unless we know some other declaration will trigger it to be pulled in; that
happens if our originally-canonical declaration had all the knowledge that
we have (and isn't us).

llvm-svn: 213043
2014-07-15 03:37:06 +00:00
Alexey Bataev 74a05c9445 [OPENMP] Several cosmetic fixes in comments, tests and the code for '#pragma omp single'.
llvm-svn: 213040
2014-07-15 02:55:09 +00:00
Ehsan Akhgari 833ed943d6 Don't get confused on the number of braces when braces start after the first __asm
Summary:
Without this, we would not consume the closing brace which would cause
the parser to start consuming C++ and bad things would happen.

Reviewers: majnemer

Subscribers: cfe-commits

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

llvm-svn: 213032
2014-07-15 02:21:41 +00:00
Justin Bogner 73466400b2 VirtualFileSystem: Correctly generate the mapping for an empty VFS
In r209332 I accidentally broke generation of empty VFS maps. This
fixes the issue and adds a test.

llvm-svn: 213028
2014-07-15 01:24:35 +00:00
Richard Smith 5a477c5e37 PR19751: (T())++ is not a cast-expression.
llvm-svn: 213022
2014-07-15 00:11:48 +00:00
David Majnemer 37de611c0f AST: Fix __uuidof for template specializations
While we previously supported __uuidof applied to a template
specialization, we would only find the uuid attribute if it was applied
to the template argument.  We would erroneously ignore the uuid
attribute on the specialization itself.

This is required to parse Windows Runtime C++ Template Library headers.

llvm-svn: 213016
2014-07-14 23:40:24 +00:00
Richard Smith 9ef089dc97 Remove dead code.
llvm-svn: 213013
2014-07-14 23:25:30 +00:00
David Majnemer 48b0863f52 AST: Cleanup __uuidof related code
Switch some things to use range-based for loops.
Change CXXUuidofExpr::GetUuidAttrOfType's return type to be const.
No functionality changed.

llvm-svn: 213009
2014-07-14 23:12:54 +00:00
Kaelyn Takata 22101f9689 Continue parsing an expression list even after an error is encountered.
Otherwise, multiple errors such as having unknown identifiers for two
arguments won't be diagnosed properly (e.g. only the first one would
have a diagnostic message if typo correction fails even though both
would be diagnosed if typo correction suggests a replacement).

llvm-svn: 213003
2014-07-14 22:48:10 +00:00
Alp Toker ccb9aa3586 Fix build with various feature flag combinations
llvm-svn: 212996
2014-07-14 22:17:22 +00:00
Joerg Sonnenberger 9b7060e218 Drop separate UIntMaxType and just derive it from IntMaxType.
llvm-svn: 212987
2014-07-14 21:00:38 +00:00
Joerg Sonnenberger 3809a7a9f6 Introduce getCorrespondingUnsignedType() in TargetInfo to work like the
corresponding AST context function, only restricted to basic integer
types. Use this to ensure getUIntPtrType() gives types consistent with
getIntPtrType(). Fix NVPTX backend to give signed intptr_t.

llvm-svn: 212982
2014-07-14 20:40:56 +00:00
Richard Smith b94afe1dd6 In C++98, if an rvalue reference binds to a function lvalue (or an xvalue or an
array prvalue), treat that as a direct binding. Only the class prvalue case
needs to be excluded here; the rest are extensions anyway, so we can treat them
as we would in C++11.

llvm-svn: 212978
2014-07-14 19:54:05 +00:00
Ben Langmuir 6b7f73451f Fix case-sensitivity of inferred framework modules
Just because we can open a directory named "COcoa.framework" doesn't
mean we should provide a "COcoa" module on a case-insensitive filesystem.

llvm-svn: 212975
2014-07-14 19:45:12 +00:00
Alp Toker 958027b698 Fix typos
Also consolidate 'backward compatibility'

llvm-svn: 212974
2014-07-14 19:42:55 +00:00
Reid Kleckner c582f0137e Revert "Improve error recovery around colon."
This reverts commit r212957.  It broke the self-host on code like this
from LLVM's option library:
  for (auto Arg: filtered(Id0, Id1, Id2))

llvm-svn: 212965
2014-07-14 18:19:58 +00:00
Serge Pavlov a88f27897a Improve error recovery around colon.
Recognize additional cases, when '::' is mistyped as ':'.
This is a fix to RP18587 - colons have too much protection in member-declarations.

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

llvm-svn: 212957
2014-07-14 16:42:20 +00:00
David Majnemer ade4bee761 CodeGen: Let arrays be inputs to inline asm
An array showing up in an inline assembly input is accepted in ICC and
GCC 4.8

This fixes PR20201.

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

llvm-svn: 212954
2014-07-14 16:27:53 +00:00
Yi Kong 472e521cec ARM: Add NOP intrinsic mapping in arm_acle.h
llvm-svn: 212950
2014-07-14 15:32:29 +00:00
Yi Kong 4d5e23f53a ARM: Implement __builtin_arm_nop intrinsic
This patch implements __builtin_arm_nop intrinsic for AArch32 and AArch64,
which generates hint 0x0, the alias of NOP instruction.

This intrinsic is necessary to implement ACLE __nop intrinsic.

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

llvm-svn: 212947
2014-07-14 15:20:09 +00:00
Daniel Jasper 3064620d0d clang-format: Improve cast detection (fix false positive).
Before:
  fn(a)(b)+1;

After:
  fn(a)(b) + 1;

llvm-svn: 212935
2014-07-14 12:38:38 +00:00
Pavel Chupin 3362c5fb0f [x32] Add __ILP32__ macro for ILP32 platforms
Summary:
Add __ILP32__ and _ILP32 macro for corresponding platforms.
Cover x86_64-*-*-gnux32 with test.

Test Plan: test added

Reviewers: chandlerc, atanasyan

Subscribers: cfe-commits, dschuff, zinovy.nis

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

llvm-svn: 212931
2014-07-14 09:58:10 +00:00
NAKAMURA Takumi 23b702c8de [CMake] Update libdeps.
llvm-svn: 212920
2014-07-14 05:01:53 +00:00
NAKAMURA Takumi 4a070dc428 [CMake] Reorder libdeps by alphabetical order.
llvm-svn: 212919
2014-07-14 04:59:27 +00:00
Richard Smith 19172c4f70 Superficial fix for PR20218: binding a function lvalue to a const reference to
a function pointer is neither better nor worse than binding a function lvalue
to a function rvalue reference. Don't get confused and think that both bindings
are binding to a function lvalue (which would make the lvalue form win); the
const reference is binding to an rvalue.

The "real" bug in PR20218 is still present: we're getting the wrong answer from
template argument deduction, and that's what leads us to this weird overload
set.

llvm-svn: 212916
2014-07-14 02:28:44 +00:00
David Majnemer b2615aa44d MS ABI: Stick internal vftables in a comdat if they have RTTI data
Previously, we would have a private backing variable and an internal
alias pointing at it.

However, -fdata-sections only fires if a global variable has non-private
linkage.  This means that an unreferenced vftable wouldn't get
discarded, bloating the object file.

Instead, stick the backing variable in a comdat even if the alias has
internal linkage.  This will allow the linker to drop the vftable if it
is unused.

llvm-svn: 212901
2014-07-13 05:19:56 +00:00
Saleem Abdulrasool 07257fe14e Headers: add hint intrinsics to arm_acle.h
This adds the ARM ACLE hint intrinsic wrappers to arm_acle.h.  These need to be
protected with a !defined(_MSC_VER) since MSVC (and thus clang in compatibility
mode) provide these wrappers as proper builtin intrinsics.

llvm-svn: 212891
2014-07-12 23:27:26 +00:00
Saleem Abdulrasool 572250d60a CodeGen: support hint intrinsics from ACLE on AArch64
This adds support for the ACLE hint intrinsics on AArch64 similar to ARM.  This
is required to properly support ACLE on AArch64.

llvm-svn: 212890
2014-07-12 23:27:22 +00:00
Yi Kong 4e00ce7d0c Improve comments of ARM ACLE header file and tests
Include section number in ARM ACLE specification for easier navigation.

llvm-svn: 212887
2014-07-12 22:48:13 +00:00
Hal Finkel d8442b1b21 Add nonnull in CodeGen for __attribute__((returns_nonnull))
As a follow-up to r212835, also add the LLVM nonnull function attribute when
__attribute__((returns_nonnull)) is provided.

llvm-svn: 212874
2014-07-12 04:51:04 +00:00
Alexey Samsonov 15c9669615 [ASan] Collect unmangled names of global variables in Clang to print them in error reports.
Currently ASan instrumentation pass creates a string with global name
for each instrumented global (to include global names in the error report). Global
name is already mangled at this point, and we may not be able to demangle it
at runtime (e.g. there is no __cxa_demangle on Android).

Instead, create a string with fully qualified global name in Clang, and pass it
to ASan instrumentation pass in llvm.asan.globals metadata. If there is no metadata
for some global, ASan will use the original algorithm.

This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=264.

llvm-svn: 212872
2014-07-12 00:42:52 +00:00
Reid Kleckner f392ec6ecc Form a CallExpr from __noop without parens
MSVC accepts __noop without any trailing parens and treats it like a
literal zero.  We don't treat __noop as an integer literal, but now at
least we can parse a naked __noop expression.

Reviewers: rsmith

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

llvm-svn: 212860
2014-07-11 23:54:29 +00:00
Argyrios Kyrtzidis baa97663c2 [Driver] clang::driver::getARMCPUForMArch() moved to llvm::Triple::getARMCPUForArch().
Depends on llvm r212846.
Suggested by Eric Christopher.

llvm-svn: 212858
2014-07-11 23:47:48 +00:00
Alp Toker 5d96e0a3a7 Consolidate header inclusion diagnostics
Make argument orders match, unify diagnostic IDs and reword the message to be a
little less saccharine.

llvm-svn: 212845
2014-07-11 20:53:51 +00:00
David Majnemer 9b21c33da4 CodeGen: Don't emit a thread-wrapper if we can't touch the backing variable
OS X TLS has all accesses going through the thread-wrapper function and
gives the backing thread-local variable internal linkage.  This means
that thread-wrappers must have WeakAnyLinkage so that references to the
internal thread-local variables do not get propagated to other code.

It also means that translation units which do not provide a definition
for the thread-local variable cannot attempt to emit a thread-wrapper
because the thread wrapper will attempt to reference the backing
variable.

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

llvm-svn: 212841
2014-07-11 20:28:10 +00:00
Reid Kleckner ed5d4adb36 MS extension: Make __noop be the integer zero, not void
We still don't accept '__noop;', and we don't consider __noop to be the
integer literal zero.  More work is needed.

llvm-svn: 212839
2014-07-11 20:22:55 +00:00
Brad Smith 10cd0f457a Handle SPARC float command line parameters for SPARCv9.
llvm-svn: 212838
2014-07-11 20:12:08 +00:00
Richard Smith 547864d26a [modules] When merging a class template, also merge the definition of its pattern.
llvm-svn: 212836
2014-07-11 18:22:58 +00:00
Hal Finkel 82504f03ce Add nonnull in CodeGen for __attribute__((nonnull))
We now have an LLVM-level nonnull attribute that can be applied to function
parameters, and we emit it for reference types (as of r209723), but did not
emit it when an __attribute__((nonnull)) was provided. Now we will.

llvm-svn: 212835
2014-07-11 17:35:21 +00:00
Aaron Ballman 6288d0648a The returns_nonnull attribute does not require a function prototype because it affects only the return value, not any arguments. In turn, asking for a function or method result type should not require a function prototype either, so getFunctionOrMethodResultType has been relaxed.
llvm-svn: 212827
2014-07-11 16:31:29 +00:00