Commit Graph

57922 Commits

Author SHA1 Message Date
Nico Weber 6e0ebaea1f Revert r236060, it caused PR23375.
llvm-svn: 236159
2015-04-29 21:16:40 +00:00
Richard Smith 0ae6b2b839 Stop assuming a 64-bit target here.
llvm-svn: 236155
2015-04-29 20:49:22 +00:00
Richard Smith 419bd09415 PR23373: A defaulted union copy constructor that is not trivial must still be
emitted as a memcpy.

llvm-svn: 236142
2015-04-29 19:26:57 +00:00
Richard Smith 6282b215cc Revert r236063 due to regression with -fdelayed-template-parsing.
llvm-svn: 236134
2015-04-29 17:48:08 +00:00
Reid Kleckner 0bb12a8981 Re-land r236052, the linker errors were fixed by LLVM r236123
Basic __finally blocks don't cause linker errors anymore (although they
are miscompiled).

llvm-svn: 236128
2015-04-29 17:17:17 +00:00
Adrian Prantl 00820abf02 Debug Info: Represent local anonymous unions as anonymous unions
and as artificial local variables in the debug info.

This is a follow-up to r236059. We can't get rid of the local variables
entirely because the gdb buildbot depends on them, but we can mark them
as artificial while still emitting the correct debug info. As I learned
from review comments other compilers also follow this model.

A paired commit in LLVM temporarily relaxes the debug info verifier to
not check the integrity of DW_OP_bit_pieces of artificial variables.

rdar://problem/20730771

llvm-svn: 236125
2015-04-29 16:52:31 +00:00
Duncan P. N. Exon Smith 9dd4e4e63a DebugInfo: Metadata constructs now start with DI*
LLVM r236120 renamed debug info IR constructs to use a `DI` prefix, now
that the `DIDescriptor` hierarchy has been gone for about a week.  This
commit was generated using the rename-md-di-nodes.sh upgrade script
attached to PR23080, followed by running clang-format-diff.py on the
`lib/` portion of the patch.

llvm-svn: 236121
2015-04-29 16:40:08 +00:00
Adrian Prantl 0d82089233 Revert "Debug Info: Represent local anonymous unions as anonymous unions"
This reverts commit r236059 as it breaks the gdb buildbot.

llvm-svn: 236110
2015-04-29 15:05:50 +00:00
Bradley Smith dfddebcfb9 Revert code changes made under r235976.
This issue was fixed elsewhere in r235396 in a more general way, hence these
changes no longer do anything. Keep the testcase however, to ensure that we
don't regress this for ARM.

llvm-svn: 236104
2015-04-29 14:32:06 +00:00
Daniel Jasper a4499133b1 clang-format: Add ability to align assignment operators.
In Objective-C some style guides use a style where assignment operators are
aligned, in an effort to increase code readability. This patch adds an option
to the format library which allows this functionality. It is disabled by
default for all the included styles, so it must be explicitly enabled.

The option will change code such as:
  - (void)method {
      NSNumber *one = @1;
      NSNumber *twentyFive = @25;
  }

to:
  - (void)method {
      NSNumber *one        = @1;
      NSNumber *twentyFive = @25;
  }

Patch by Matt Oakes. Thank you!

Accidentally reformatted all the tests...

llvm-svn: 236100
2015-04-29 13:06:49 +00:00
Daniel Jasper eb45cb7cf9 clang-format: Fix selective indentaiton in nested blocks.
Buggy case:
  someFunction(
      [] {
        // comment
        int i; // invoke formatting here.
      },       // force line break
      aaa);

llvm-svn: 236091
2015-04-29 08:29:26 +00:00
Alexey Bataev 19fa2c3b66 [OPENMP] Fix crash on reductions codegen for short circuit reduction operations.
llvm-svn: 236084
2015-04-29 05:21:03 +00:00
Nico Weber ea721b64df Revert r236052, it caused linker errors when building 32-bit applications.
llvm-svn: 236082
2015-04-29 03:08:32 +00:00
Richard Trieu ac3eca536d Add -Wpessimizing-move and -Wredundant-move warnings.
-Wpessimizing-move warns when a call to std::move would prevent copy elision
if the argument was not wrapped in a call.  This happens when moving a local
variable in a return statement when the variable is the same type as the
return type or using a move to create a new object from a temporary object.

-Wredundant-move warns when an implicit move would already be made, so the
std::move call is not needed, such as when moving a local variable in a return
that is different from the return type.

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

llvm-svn: 236075
2015-04-29 01:52:17 +00:00
Richard Smith 180b92168d PR20625: Instantiate static constexpr member function of a local struct in a function template earlier.
This is necessary in order to allow the use of a constexpr member function, or
a member function with deduced return type, of a local class within a
surrounding instantiated function template specialization.

Patch by Michael Park!

llvm-svn: 236063
2015-04-29 00:07:09 +00:00
Eric Christopher 52fa24172f Stop emitting the soft-float and soft-float-abi target features
for ARM while the backend will only ignore them. No functional
change intended.

llvm-svn: 236060
2015-04-28 23:18:33 +00:00
Adrian Prantl 0a4ddc180b Debug Info: Represent local anonymous unions as anonymous unions
in the debug info. This patch deletes a hack that emits the members
of local anonymous unions as local variables.

Besides being morally wrong, the existing representation using local
variables breaks internal assumptions about the local variables' storage
size.

Compiling

```
   void fn1() {
     union {
       int i;
       char c;
     };
     i = c;
   }

```

with -g -O3 -verify will cause the verifier to fail after SROA splits
the 32-bit storage for the "local variable" c into two pieces because the
second piece is clearly outside the 8-bit range that is expected for a
variable of type char. Given the choice I'd rather fix the debug
representation than weaken the verifier.

Debuggers generally already know how to deal with anonymous unions when
they are members of C++ record types, but they may have problems finding
the local anonymous struct members in the expression evaluator.

rdar://problem/20730771

llvm-svn: 236059
2015-04-28 23:01:24 +00:00
Reid Kleckner de57c2af61 Fix Sema tests using __try by adding triple
llvm-svn: 236057
2015-04-28 22:58:25 +00:00
Reid Kleckner ddd40964f0 [SEH] Add 32-bit lowering code for __try
This is just the clang-side of 32-bit SEH. LLVM still needs work, and it
will determinstically fail to compile until it's feature complete.

On x86, all outlined handlers have no parameters, but they do implicitly
take the EBP value passed in and use it to address locals of the parent
frame. We model this with llvm.frameaddress(1).

This works (mostly), but __finally block inlining can break it. For now,
we apply the 'noinline' attribute. If we really want to inline __finally
blocks on 32-bit x86, we should teach the inliner how to untangle
frameescape and framerecover.

Promote the error diagnostic from codegen to sema. It now rejects SEH on
non-Windows platforms. LLVM doesn't implement SEH on non-x86 Windows
platforms, but there's nothing preventing it.

llvm-svn: 236052
2015-04-28 22:19:32 +00:00
Steven Wu b49febeaee Fix the typo in r236044. NFC.
llvm-svn: 236051
2015-04-28 22:07:05 +00:00
Steven Wu 2baa53ace9 Fix -fno-gnu-inline-asm doesn't catch file scope asm
Summary:
FileScopeAsm should be treated the same as funcion level inline asm.
-fno-gnu-inline-asm should trigger an error if file scope asm is used.
I missed this case from r226340. This should not affect ms-extension
because it is not allowed in the file scope.

Reviewers: bob.wilson, rnk

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 236044
2015-04-28 21:49:09 +00:00
Richard Smith 6d69e8c00b Fix assertion failure if a lambda array-capture is followed by a this capture.
llvm-svn: 236043
2015-04-28 21:41:14 +00:00
Sean Callanan 9a89d6a185 Attempt to fix the MSVC build by making ExprIterator
inherit correctly.

llvm-svn: 236035
2015-04-28 21:18:01 +00:00
Richard Smith 9a99aa75d7 Work around a suspected MSVC miscompile to try to bring the MSVC2013 buildbot back.
llvm-svn: 236034
2015-04-28 21:09:27 +00:00
Richard Smith 1e1728536a Refactor to make MacroState ownership and lifetime clearer.
llvm-svn: 236032
2015-04-28 21:05:07 +00:00
Artem Belevich a0473a5479 [cuda] Preserve TLS storage class of host variable even if it's a
device-side compilation.

llvm-svn: 236029
2015-04-28 20:31:49 +00:00
Sean Callanan 59721b3d3f Implemented ASTImporter support for Stmts and fixed
some bugs in the ASTImporter that this exposed:

- When importing functions, the body (if any) was
  previously ignored.  This patch ensures that the
  body is imported also.

- When a function-local Decl is imported, the first
  thing the ASTImporter does is import its context
  (via ImportDeclParts()).  This can trigger 
  importing the Decl again as part of the body of
  the function (but only once, since the function's
  Decl has been added to ImportedDecls).  This patch
  fixes that problem by extending ImportDeclParts()
  to return the imported Decl if it was imported as
  part of importing its context, and the patch adds
  ASTImporter::GetAlreadyImportedOrNull() to support
  this query.  All callers of ImportDeclParts return
  the imported version of the Decl if ImportDeclParts()
  returns it.

- When creating functions, InnerLocStart of the source
  function was re-used without importing.  This is a
  straight up bug, and this patch makes ASTImporter
  import the InnerLocStart and use the imported version.

- When importing FileIDs, the ASTImporter previously
  always tried to re-load the file for the corresponding
  CacheEntry from disk.  This doesn't work if the 
  CacheEntry corresponds to a named memory buffer.  This
  patch changes the code so that if the UniqueID for the
  cache entry is invalid (i.e., it is not a disk file)
  the whole entry is treated as if it were invalid, which
  forces an in-memory copy of the buffer.

Also added test cases, using the new support committed in
236011.

llvm-svn: 236012
2015-04-28 18:41:46 +00:00
Sean Callanan 61ea0571ac Implemented support for testing the ASTImporter's
ability to generate code that CodeGen likes.  Test
cases can use this functionality by calling

// RUN: %clang_cc1 -emit-obj -o /dev/null -ast-merge %t.1.ast -ast-merge %t.2.ast %s

llvm-svn: 236011
2015-04-28 18:24:12 +00:00
Nico Weber 20b0ce3abd Fix typo in comment.
llvm-svn: 236010
2015-04-28 18:19:18 +00:00
Jonathan Roelofs 7441136d2a Fix PR22047: ObjC: Method unavailability attribute doesn't work with overloaded methods
http://reviews.llvm.org/D9261

llvm-svn: 236006
2015-04-28 18:04:44 +00:00
Serge Pavlov 907233fd99 Combine instantiation context of field initializer with context of class.
Inclass initializer is instantiated in its own LocalInstantiationScope. It
causes problems when instantiating local classes - when instantiation scope
is searched for DeclContext of the field, the search fails. As a solution,
the instantiation scope of field initializer is combined with its outer
scope.

This patch fixes PR23194.

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

llvm-svn: 236005
2015-04-28 17:58:47 +00:00
Aaron Ballman e918faadd2 Silencing a -Wuninitialized warning in a different way. This replaces r235981, but is still NFC.
llvm-svn: 236002
2015-04-28 17:34:38 +00:00
Elena Demikhovsky 35dc8c0944 AVX-512: added intrinsics for KNL and SKX
by Asaf Badouh (asaf.badouh@intel.com)

llvm-svn: 235986
2015-04-28 13:28:01 +00:00
Alexey Bataev 6111469a4a [OPENMP] Fix crash on loop control vars explicitly marked as private.
It is allowed to mark loop control vars as private in 'private' or 'lastprivate' clause, so no need to assert here.

llvm-svn: 235985
2015-04-28 13:20:05 +00:00
Aaron Ballman d1c6916327 Silencing a spurious -Wuninitialized warning with this local; NFC.
llvm-svn: 235981
2015-04-28 12:36:54 +00:00
Bradley Smith ba945626b0 [ARM/AArch64] Enforce alignment for bitfielded structs
When creating a global variable with a type of a struct with bitfields, we must
forcibly set the alignment of the global from the RecordDecl. We must do this so
that the proper bitfield alignment makes its way down to LLVM, since clang will
mangle the bitfields into one large type.

llvm-svn: 235976
2015-04-28 11:24:54 +00:00
Justin Bogner 097f1bf4b2 InstrProf: Match a bit less strictly - some targets may add signext
Notably, this bot didn't like it:

  http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/5117

llvm-svn: 235968
2015-04-28 06:55:23 +00:00
Justin Bogner f959febf7a InstrProf: Mark code regions after throw expressions as unreachable
We weren't setting regions as being unreachable after C++ throw
expressions, leading to incorrect count propagations.

llvm-svn: 235967
2015-04-28 06:31:55 +00:00
Richard Smith 66f5ab26e3 Fix memory leak found by asan buildbot.
llvm-svn: 235957
2015-04-28 01:11:23 +00:00
Duncan P. N. Exon Smith 374934cb8a DebugInfo: Add a clang test for LLVM fix for PR23332
Add a clang test for LLVM r235955, which added support for up to 2^16
arguments.

llvm-svn: 235956
2015-04-28 01:09:20 +00:00
Alexey Samsonov d60832eade Allow UBSan+MSan and UBSan+TSan combinations (Clang part).
Embed UBSan runtime into TSan and MSan runtimes in the same as we do
in ASan. Extend UBSan test suite to also run tests for these
combinations.

llvm-svn: 235953
2015-04-28 00:56:36 +00:00
John McCall f3e86a7a55 ms_struct does not imply the MS base-layout ABI; separate these
conditions in the IRGen struct layout code.

rdar://20636558

llvm-svn: 235949
2015-04-28 00:17:18 +00:00
Richard Smith cc2236f777 Refactor: put these function declarations somewhere more appropriate.
llvm-svn: 235946
2015-04-27 23:52:41 +00:00
Richard Smith 753e007091 [modules] Incrementally compute the list of overridden module macros based on
the active module macros at the point of definition, rather than reconstructing
it from the macro history. No functionality change intended.

llvm-svn: 235941
2015-04-27 23:21:38 +00:00
Reid Kleckner e0bca755d8 Remove stale FIXMEs from test case
llvm-svn: 235937
2015-04-27 23:14:24 +00:00
Eric Christopher f37ab1ca73 Always add the target-cpu and target-features sets if they're non-null.
This makes sure that the front end is specific about what they're expecting
the backend to produce. Update a FIXME with the idea that the target-features
could be more precise using backend knowledge.

llvm-svn: 235936
2015-04-27 23:11:34 +00:00
Aaron Ballman edc8084751 Check whether the operand to a noexcept expression is valid or not. Fixes PR15842.
llvm-svn: 235931
2015-04-27 22:31:12 +00:00
Alexey Samsonov 381845d54f Introduce tsan_cxx and msan_cxx libraries (Clang part).
For now tsan_cxx and msan_cxx contain only operator new/delete
replacements. In the future, when we add support for running UBSan+TSan
and UBSan+MSan, they will also contain bits ubsan_cxx runtime.

llvm-svn: 235924
2015-04-27 22:07:50 +00:00
Richard Smith c38498f046 PR23334: Perform semantic checking of lambda capture initialization in the right context.
Previously we'd try to perform checks on the captures from the middle of
parsing the lambda's body, at the point where we detected that a variable
needed to be captured. This was wrong in a number of subtle ways. In
PR23334, we couldn't correctly handle the list of potential odr-uses
resulting from the capture, and our attempt to recover from that resulted
in a use-after-free.

We now defer building the initialization expression until we leave the lambda
body and return to the enclosing context, where the initialization does the
right thing. This patch only covers lambda-expressions, but we should apply
the same change to blocks and captured statements too.

llvm-svn: 235921
2015-04-27 21:27:54 +00:00
Artem Belevich c3e2fd7bea Revert "PR21000: pass -I options to assembler" as the test was failing on hexagon.
llvm-svn: 235919
2015-04-27 21:11:08 +00:00