Commit Graph

219010 Commits

Author SHA1 Message Date
Ben Craig 90bee6354d [libcxx] Refactoring target_info.py
This patch makes it easier to support running the lit tests for new and
unusual platforms. It will break existing users that set
LIBCXX_TARGET_INFO to anything other than the default. I think this is
fine, because the old LIBCXX_TARGET_INFO wasn't terribly useful.

The old way of supporting the different test platforms was to have
conditional code scattered throughout config.py. New platforms would need
to add conditionals there. Alternatively, the new platform could set
no_default_flags to true, and reconstitue almost the entire compile and
link line, including things that don't vary across platforms.

The new way of supporting new platforms is to create a new target info
class, and have make_target_info return an instance of it. For platforms
supported in-tree, that will be done by modifying make_target_info. For
out-of-tree platforms, users can set LIBCXX_TARGET_INFO at cmake configure
time.

The target info sub-classes can provide fine-grained information back to
config.py. The hooks that will most commonly be provided will be
add_cxx_compile_flags and add_cxx_link_flags. These hooks can provide the
platform specific flags, while letting config.py handle all the invariant
flags.

Target info hooks were added for each area that the existing config.py had
platform specific behavior. config.py is now mostly free of platform
specific conditionals.

This patch was tested on Linux x86_64. I both targeted Linux x86_64, and
an out-of-tree platform with a custom target_info. In both cases I was
able to run libcxx and libcxxabi tests. I do not have access to FreeBSD,
Darwin, or Windows machines that are set up for lit testing.

llvm-svn: 256588
2015-12-29 22:21:38 +00:00
Richard Smith a4a3c185d7 Use consistent types for all bit-field members in the same bit-field so that MSVC's bit-field packing algorithm packs them properly.
llvm-svn: 256587
2015-12-29 22:19:20 +00:00
Manuel Jacob 67f1d3ac63 [RS4GC] Use DenseMap::count() instead of DenseMap::find()/DenseMap::end(). NFC.
llvm-svn: 256586
2015-12-29 22:16:41 +00:00
James Y Knight 967eb20ebe [TrailingObjects] Convert Decl* classes.
Also remove now-redundant explicit alignment specification on some of
the classes converted prior to TrailingObjects automatically ensuring
proper alignment.

llvm-svn: 256585
2015-12-29 22:13:13 +00:00
Sanjay Patel ac6e910c42 don't repeat function names in comments; NFC
llvm-svn: 256584
2015-12-29 22:11:50 +00:00
David Majnemer 0b996dd634 [MS ABI] Add a mangling for _Complex
MSVC doesn't implement a mangling for C99's _Complex so we must invent
our own.

For now, treating it like a class type called _Complex in the __clang
namespace.

This means that 'void f(__Complex int))'
will demangle as: 'void f(struct __clang::_Complex<int>)'

llvm-svn: 256583
2015-12-29 22:02:15 +00:00
David Majnemer 53b60a1d26 [MS ABI] Mark an unreachable path appropriately
No functional change is intended, just a small cleanup.

llvm-svn: 256582
2015-12-29 22:02:10 +00:00
Sanjay Patel d1d9db5889 use auto with dyn_casted values; NFC
llvm-svn: 256581
2015-12-29 22:00:37 +00:00
Manuel Jacob e3773d632e [PlaceSafepoints] Assert that the gc.safepoint_poll function is present in the module.
If running the PlaceSafepoints pass on a module which doesn't have the
gc.safepoint_poll function without disabling entry and backedge safepoints,
previously the pass crashed with an obscure error because of a null pointer.
Now it fails the assert instead.

llvm-svn: 256580
2015-12-29 21:57:55 +00:00
Sanjay Patel 7a7abc9a3b use auto with dyn_casted values; NFC
llvm-svn: 256579
2015-12-29 21:49:08 +00:00
Dimitry Andric 2d82f915c2 For the asan_symbolize.py script, use addr2line as the default system
symbolizer on FreeBSD too.  This allows the asan-symbolize-bad-path.cc
test to succeed.

llvm-svn: 256578
2015-12-29 21:36:34 +00:00
Simon Atanasyan 69b3cbef43 [ELF][MIPS] Rename test file. NFC
llvm-svn: 256577
2015-12-29 21:09:26 +00:00
Sanjay Patel 71fca736bc fix typos; NFC
llvm-svn: 256576
2015-12-29 20:09:37 +00:00
Richard Smith de6d6c4860 Teach typo correction to properly handle mapping declarations to their
underlying decls. Preserve the found declaration throughout, and only map to
the underlying declaration when we want to check whether it's the right kind.
This allows us to provide the right source location for the found declaration,
and prepares for the possibility of underlying decls with a different name
from the found decl.

llvm-svn: 256575
2015-12-29 19:43:10 +00:00
Sanjay Patel b120ae96d3 fix formatting; NFC
llvm-svn: 256574
2015-12-29 19:34:53 +00:00
Sanjay Patel 4104f78640 use range-based for-loops; NFCI
llvm-svn: 256573
2015-12-29 19:14:23 +00:00
Sanjay Patel faeee6f44d use range-based for-loop; NFCI
llvm-svn: 256572
2015-12-29 18:30:09 +00:00
Chad Rosier 6b4326367a Add command line options to force function/loop alignments.
These are being added for testing purposes.
http://reviews.llvm.org/D15648

llvm-svn: 256571
2015-12-29 18:18:07 +00:00
James Y Knight e7d82283cd [TrailingObjects] Convert AST classes that had a ASTTemplateKWAndArgsInfo.
So, also:

- Moved the TemplateArgumentLoc array out of the
  ASTTemplateKWAndArgsInfo class (making it a simple fixed-size object),
  to avoid needing to have a variable-length object as part of a
  variable-length object. Now the objects that have a
  ASTTemplateKWAndArgsInfo also have some TemplateArgumentLoc objects
  appended directly.

- Removed some internal-use accessors which became simply a wrapper on
  getTrailingObjects.

- Moved MemberNameQualifier out of the MemberExpr class, renamed it
  MemberExprNameQualifier, because the template can't
  refer to a class nested within the class it's defining.

llvm-svn: 256570
2015-12-29 18:15:14 +00:00
Sanjay Patel 59309cc090 don't repeat function names in comments; NFC
llvm-svn: 256569
2015-12-29 18:14:06 +00:00
Geoff Berry 43dc285915 [JumpThreading] Fix opcode bonus in getJumpThreadDuplicationCost()
The code that was meant to adjust the duplication cost based on the
terminator opcode was not being executed in cases where the initial
threshold was hit inside the loop.

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 256568
2015-12-29 18:10:16 +00:00
Devin Coughlin 755baa4050 [analyzer] Nullability: allow cast to _Nonnull to suppress warning about returning nil.
The nullability checker currently allows casts to suppress warnings when a nil
literal is passed as an argument to a parameter annotated as _Nonnull:

  foo((NSString * _Nonnull)nil); // no-warning

It does so by suppressing the diagnostic when the *type* of the argument expression
is _Nonnull -- even when the symbolic value returned is known to be nil.

This commit updates the nullability checker to similarly honor such casts in the analogous
scenario when nil is returned from a function with a _Nonnull return type:

  return (NSString * _Nonnull)nil; // no-warning

This commit also normalizes variable naming between the parameter and return cases and
adds several tests demonstrating the limitations of this suppression mechanism (such as
when nil is cast to _Nonnull and then stored into a local variable without a nullability
qualifier). These tests are marked with FIXMEs.

rdar://problem/23176782

llvm-svn: 256567
2015-12-29 17:40:49 +00:00
Sanjay Patel 7dd45697ca use range-based for-loops; NFCI
llvm-svn: 256566
2015-12-29 17:15:22 +00:00
Philip Reames 87a8677e3d [MemoryBuiltins] Delete dead code [NFC]
llvm-svn: 256565
2015-12-29 17:04:43 +00:00
James Y Knight 2cd14e93a9 [TrailingObjects] Use a different technique to determine if a getDecl
member function exists on a class.

The previous trick depended on inheriting from the class it was
checking, which will fail when I start marking things 'final'.

Attempt #2: now with a special #ifdef branch for MSVC.

Hopefully *this* actually builds with all supported compilers...

llvm-svn: 256564
2015-12-29 16:44:11 +00:00
George Rimar 4b5346fa49 Reformat of conditions for calculating r_offset in RelocationSection<ELFT>::writeTo(). NFC.
llvm-svn: 256563
2015-12-29 16:17:32 +00:00
Alexander Kornienko 254825a356 [clang-tidy] Fix a use-after-free bug found by asan
llvm-svn: 256562
2015-12-29 16:14:38 +00:00
Michael Zuckerman c2e4bb421a [AVX512] add PSRLW Intrinsic
Fixing tab/space indentation.
Differential Revision: http://reviews.llvm.org/D15751

llvm-svn: 256561
2015-12-29 14:34:58 +00:00
Davide Italiano ed9d95b290 [llvm-objdump] Mark noreturn function as such.
Match attribute in the header to make MSVC happy.

llvm-svn: 256560
2015-12-29 13:41:02 +00:00
Alexander Kornienko 1daf4cbc74 [clang-tidy] Fix capitalization of the message in the example
llvm-svn: 256559
2015-12-29 13:28:10 +00:00
Michael Zuckerman 80821ee77c [AVX512] add PSRLW Intrinsic
Differential Revision: http://reviews.llvm.org/D15751

llvm-svn: 256558
2015-12-29 13:04:35 +00:00
David Majnemer 3421fb69c6 [MS ABI] Implement a mangling for _Atomic types
MSVC doesn't implement a mangling for C11's _Atomic so we must invent
our own.

For now, treating it like a class type called _Atomic in the __clang
namespace.

This means that 'void f(__Atomic(int))'
will demangle as: 'void f(struct __clang::_Atomic<int>)'

llvm-svn: 256557
2015-12-29 11:46:00 +00:00
David Majnemer 0a29fed31f [MS ABI] Cleanup our mangling of vector types
We used to produce a type which demangled to:
union __clang_vec8_F

That 'F' is the mangling for 'short' but it is present in the mangled
name in an inappropriate place, leading to it not getting demangled.

Instead, create a synthetic class type in a synthetic namespace called
__clang. With this, it now demangles to:
union __clang::__vector<short,8>

llvm-svn: 256556
2015-12-29 11:45:58 +00:00
David Majnemer 3add70bf55 [MS ABI] Cleanup the mangling of artifical types
Hand-rolling the mangling results in us not correctly adding names to
the backreference map.

llvm-svn: 256555
2015-12-29 11:45:53 +00:00
Alexander Kornienko 5de730ef47 [clang-tidy] Don't generate duplicated blank line in add_new_check.py script.
Reviewers: alexfh

Subscribers: cfe-commits

Patch by Haojian Wu!

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

llvm-svn: 256554
2015-12-29 11:05:35 +00:00
Chandler Carruth 8db8e8b86f [ADT] Teach alignment helpers to work correctly for abstract classes.
This is necessary to use them as part of pointer traits and is generally
useful. I've added unit test coverage to isolate and ensure this works
correctly.

I'll watch the build bots to try to see if any compilers can't tolerate
this bit of magic (and much credit goes to Richard Smith for coming up
with this magical production!) but give a shout if you see issues.

llvm-svn: 256553
2015-12-29 09:52:41 +00:00
Chandler Carruth 5bd31b37ca [ptr-traits] Provide a real MCFragment address for the sentinel instead
of casting the integer '4' to such a pointer. There is no reason to
expect '4' to be a portable or reliable pointer of this form. The only
reason this ever worked is because the PointerIntPair that this actually
gets used with has an artificially *low* presumed alignment that allowed
it to work. When the alignment of PointerIntPair is derived from the
actual type's alignment, the asserts start firing on this pointer. I'm
amazed we never managed to do anything that triggered the alignment
sanitizer with it, as this is just flat out UB.

If folks dislike this approach to providing a sentinel fragment address,
there are a myriad of other alternatives, suggestions welcome. But this
one has the distinct advantage of not requiring the friend dance of
ilist's sentinel (which I'll point out is *also* in play for
MCFragment!) and seems to be using a nicely provided facility in
MCFragment to establish just such dummy nodes.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

llvm-svn: 256552
2015-12-29 09:32:18 +00:00
Chandler Carruth 6dd8f06db2 [ptr-traits] Sink several in-body method definitions to be out-of-line
inline definitions after the mutually recursive pair of types have been
defined. The two types mutually recurse specifically through
abstractions that require pointer traits which makes this kind of mutual
recursion especially tricky to get right in terms of ordering.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

llvm-svn: 256551
2015-12-29 09:24:42 +00:00
Chandler Carruth e0115344e6 [ptr-traits] Sink a constructor definition to the .cpp file and add
missing includes so that the pointee types for DenseMap pointer keys and
such are complete prior to us querying the pointer traits for them.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

llvm-svn: 256550
2015-12-29 09:24:39 +00:00
Chandler Carruth 388235fe85 [ptr-traits] Add a bunch of includes to provide complete types that are
used in pointer dense map key types or in other ways that require
pointer traits.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

llvm-svn: 256549
2015-12-29 09:06:21 +00:00
Chandler Carruth 8d736236d3 [ptr-traits] Split the MCFragment type hierarchy out of the MCAssembler
header to its own header, allowing users of fragments to have a narrower
header file, and avoid circular header dependencies when getting the
definition of MCSection prior to inspecting traits on MCSection
pointers.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

Note that this doesn't in any way change the design of MC, it is just
moving code around to allow the *header files* to be more fine grained.
Without this, it is impossible to get a complete type for MCSection
where it is needed.

If anyone would prefer a different slicing of the header files, I'm
happy to oblige of course. =]

llvm-svn: 256548
2015-12-29 09:06:16 +00:00
Chandler Carruth ebf579164f [MC] Fix the comment header for this header file. It was just
copy/pasted.

Happy for anyone to suggest a more precise or refined set of boilerplate
here, but the comments on the actual code seem descriptive and accurate.

llvm-svn: 256547
2015-12-29 09:06:10 +00:00
Daniel Jasper 6f5a1933b7 clang-format: [JS/TypeScript] Support "enum" as property name.
Before:
  enum: string
  [];

After:
  enum: string[];

llvm-svn: 256546
2015-12-29 08:54:23 +00:00
Marina Yatsina afb72f38f8 [ms inline asm] Add support for label names with '$' chars
In MS inline asm syntax a label with '$' char produces an error, while in AT&T it does not.
In AT&T inline asm syntax Clang escapes the '$' char and replaces it with "$$". Adopted same approach for MS syntax.

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

llvm-svn: 256545
2015-12-29 08:49:34 +00:00
Craig Topper 3661c62e4b De-virtualize mnemonicIsValid and remove from the base class. It's not called by any common code.
llvm-svn: 256544
2015-12-29 07:43:03 +00:00
Xinliang David Li 54dd683726 [PGO]: Do not update Data->Value field during profile write.
The profile reader no longer depends on this field to be updated and point
to owning func's vp data. The VP data also no longer needs to be allocated
in a contiguous memory space.

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

llvm-svn: 256543
2015-12-29 07:13:59 +00:00
Craig Topper d270501a6e [TableGen] Remove MnemonicContainsDot from AsmParser. It isn't used. NFC
llvm-svn: 256542
2015-12-29 07:03:30 +00:00
Craig Topper 3294966ed7 [X86] Remove declaration of ATTAsmParser. Its equivalent to the DefaultAsmParser. NFC
llvm-svn: 256541
2015-12-29 07:03:27 +00:00
Craig Topper 884409a552 [TableGen] Add missing space to output.
llvm-svn: 256540
2015-12-29 07:03:25 +00:00
Craig Topper e4e7415705 [TableGen] Use range-based for loops. NFC
llvm-svn: 256539
2015-12-29 07:03:23 +00:00