Commit Graph

204750 Commits

Author SHA1 Message Date
Rafael Espindola 05cbccc649 Simplify, NFC.
In these two contexts we really just want the raw n_value. No need to use
getSymbolValue which checks for special cases where, semantically, the symbol
has no value.

llvm-svn: 241584
2015-07-07 13:58:32 +00:00
Daniel Jasper b9edcfb018 clang-format: Don't wrap before the ] of a lambda introducer.
Before:
  return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa([=
  ](int iiiiiiiiiiii) {
    return aaaaaaaaaaaaaaaaaaaaaaa != aaaaaaaaaaaaaaaaaaaaaaa;
  });

After:
  return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa([=](
      int iiiiiiiiiiii) {
    return aaaaaaaaaaaaaaaaaaaaaaa != aaaaaaaaaaaaaaaaaaaaaaa;
  });

llvm-svn: 241583
2015-07-07 13:50:50 +00:00
Aaron Ballman 7c04eae204 Silence -Wparentheses warnings (and ran it through clang-format); NFC.
llvm-svn: 241582
2015-07-07 13:25:57 +00:00
Aaron Ballman a0ea996da4 Silence a -Wcast-qual warning; NFC.
llvm-svn: 241581
2015-07-07 13:22:55 +00:00
Aaron Ballman 385a8c0202 Silence a -Wunused-variable warning; NFC.
llvm-svn: 241580
2015-07-07 13:21:26 +00:00
Aaron Ballman d36fd7de66 Appease MSVC 2013 a few more times, which was complaining about a syntax error with an unexpected close curly brace. For some reason, the range-based for loop requires curly braces to compile in MSVC.
llvm-svn: 241579
2015-07-07 13:19:10 +00:00
Aaron Ballman d6678c8bb7 Appease MSVC 2013, which was complaining about a syntax error with an unexpected close curly brace. For some reason, the range-based for loop requires curly braces to compile in MSVC.
llvm-svn: 241578
2015-07-07 12:54:02 +00:00
Aaron Ballman 5bcb832307 Changing a use of alignof() into llvm::alignOf() for MSVC compatibility. This requires changing a static_assert into an assert, too.
llvm-svn: 241577
2015-07-07 12:50:30 +00:00
Pavel Labath be9f9c177a Enclose CLANG_USED_LIBS in --start/end-group when linking liblldb (bug #24044)
Patch by Eugene Zelenko.

llvm-svn: 241576
2015-07-07 12:24:33 +00:00
Pavel Labath df0ee89d45 LLDB standalone build: check if Clang was built independently from LLVM
This is fix for bug 23704: LLDB standalone build always include
ClangConfig.cmake even if Clang was built with LLVM (ClangConfig.cmake
doesn't exist).

Patch by: Eugene Zelenko

llvm-svn: 241575
2015-07-07 12:08:09 +00:00
Pavel Labath 066fc8b194 Fix-up ProcessKDP wrt. StringExtractor move
llvm-svn: 241574
2015-07-07 11:00:55 +00:00
Pavel Labath 67add94108 Fix build after recent clang interface changes
llvm-svn: 241573
2015-07-07 10:11:16 +00:00
Pavel Labath f805e1905c Fix cmake build after recent JSON changes
I have moved StringExtractor.h into the include/ folder so that it can be properly included by
everyone.

llvm-svn: 241572
2015-07-07 10:08:41 +00:00
Kuba Brecka 61db9ebdea [asan] Add missing $ASAN_OPTIONS to some test cases
Since http://reviews.llvm.org/D10294, ASan test cases now respect default env. options via `ASAN_OPTION=$ASAN_OPTIONS:additional_options=xxx`.  This patch adds this to a few test cases where it's still missing.

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

llvm-svn: 241571
2015-07-07 09:55:00 +00:00
David Majnemer 381326d771 [IR] Make getFirstNonPHI return null if the BB is empty
getFirstNonPHI's documentation states that it returns null if there is
no non-PHI instruction.  However, it instead returns a pointer to the
end iterator.  The implementation of getFirstNonPHI claims that
dereferencing the iterator will result in an assertion failure but this
doesn't occur.  Instead, machinery like getFirstInsertionPt will attempt
to isa<> this invalid memory which results in unpredictable behavior.
Instead, make getFirst* return null if no such instruction exists.

llvm-svn: 241570
2015-07-07 09:15:29 +00:00
Tamas Berghammer ed1fa2084c Leave OS as unspecified unknown if it isn't specified in the ELF file
This is the redone of r238623 what was reverted with the refactor
in r239148.

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

llvm-svn: 241569
2015-07-07 09:11:59 +00:00
Akira Hatanaka c269482af3 Add a comment to explain how the decision to pass feature "+long-calls" is made.
llvm-svn: 241568
2015-07-07 08:28:42 +00:00
Denis Protivensky b612902faa Fix gcc warnings of different enum and non-enum types in ternaries
llvm-svn: 241567
2015-07-07 07:48:48 +00:00
Akira Hatanaka 1bc8af78f4 [ARM] Define a subtarget feature and use it to decide whether long calls should
be emitted.

This is needed to enable ARM long calls for LTO and enable and disable it on a
per-function basis.

Out-of-tree projects currently using EnableARMLongCalls to emit long calls
should start passing "+long-calls" to the feature string (see the changes made
to clang in r241565).

rdar://problem/21529937

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

llvm-svn: 241566
2015-07-07 06:54:42 +00:00
Akira Hatanaka 3fb33a5d18 [ARM] Pass subtarget feature "+long-calls" instead of passing backend option
"-arm-long-calls".

This change allows using -mlong-calls/-mno-long-calls for LTO and enabling or
disabling long call on a per-function basis.

rdar://problem/21529937

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

llvm-svn: 241565
2015-07-07 06:42:05 +00:00
Douglas Gregor 0a8890ff45 Don't rely on the use of non-POD types within unions.
They aren't universally supported and we're not getting any benefit
from using them.

llvm-svn: 241564
2015-07-07 06:20:46 +00:00
Douglas Gregor 89442bbb79 s/__nonnull/_Nonnull in a test for Objective-C __kindof.
llvm-svn: 241563
2015-07-07 06:20:41 +00:00
Douglas Gregor 25123c040d [AST] Add a comment for ObjCMethodDecl::getSendResultType() function.
llvm-svn: 241562
2015-07-07 06:20:39 +00:00
Douglas Gregor cedcd9f860 [libclang] Implement proper code-completion in an ObjC type parameter position.
rdar://19670303

llvm-svn: 241561
2015-07-07 06:20:36 +00:00
Douglas Gregor 7fa93c7730 [libclang] When inferring nonnull use the contextual keyword for the code-completion results,
when appropriate.

rdar://20742295

llvm-svn: 241560
2015-07-07 06:20:31 +00:00
Douglas Gregor 9b7b3e9038 [libclang] Replace ObjC generic parameters when code-completing method implementations.
rdar://20643768

llvm-svn: 241559
2015-07-07 06:20:27 +00:00
Douglas Gregor 4c850f3a64 [libclang] Fix code-completion of block parameters that are marked with nullability specifier.
rdar://20755276

llvm-svn: 241558
2015-07-07 06:20:22 +00:00
Douglas Gregor c3425b1ff9 [libclang] Replace ObjC generic parameters in code-completion results.
rdar://19369529

llvm-svn: 241557
2015-07-07 06:20:19 +00:00
Douglas Gregor ab7f0b342f The AST importer had a bug where it would enter into an infinite recursion
when importing type parameter lists.  The reason is that type parameters
have their DeclContexts set to the interface that is parameterized with those
types, and the importer would follow that loop and blow the stack out.

I've changed the way this works so that the type parameters are only imported
after the interface that contains them has been registered via the Imported()
function.

This is tested by LLDB.

<rdar://problem/20315663>

llvm-svn: 241556
2015-07-07 06:20:12 +00:00
Marshall Clow bc4c89a977 The rest of N4279 and LWG#2464 - for unordered_map
llvm-svn: 241555
2015-07-07 05:45:35 +00:00
Douglas Gregor e7ac0776cb Fix alignment check for ObjCObjectTypeLoc.
llvm-svn: 241554
2015-07-07 04:23:51 +00:00
Jason Molenda 3f661e0899 When debugserver is running on an iOS device, call
proc_set_wakemon_params() to raise the limit on the # of wakeups
per second that are acceptable before the system may send an 
EXC_RESOURCE signal to debugserver.  

<rdar://problem/19631512> 

llvm-svn: 241553
2015-07-07 04:15:43 +00:00
NAKAMURA Takumi 7c754ea264 Fix \param in r241472. [-Wdocumentation]
llvm-svn: 241552
2015-07-07 04:09:55 +00:00
Douglas Gregor d0880e3ae3 Use llvm::alignOf rather than alignof()
llvm-svn: 241551
2015-07-07 04:06:31 +00:00
Douglas Gregor 0e929100e7 Factor the simpleTransform() visitor so that it is not a local class.
Older versions of Clang cannot handle such local classes properly
rdar://problem/19386032.

llvm-svn: 241550
2015-07-07 03:58:59 +00:00
Douglas Gregor 1ac1b63c9c Implement variance for Objective-C type parameters.
Introduce co- and contra-variance for Objective-C type parameters,
which allows us to express that (for example) an NSArray is covariant
in its type parameter. This means that NSArray<NSMutableString *> * is
a subtype of NSArray<NSString *> *, which is expected of the immutable
Foundation collections.

Type parameters can be annotated with __covariant or __contravariant
to make them co- or contra-variant, respectively. This feature can be
detected by __has_feature(objc_generics_variance). Implements
rdar://problem/20217490.

llvm-svn: 241549
2015-07-07 03:58:54 +00:00
Douglas Gregor ab209d83be Implement the Objective-C __kindof type qualifier.
The __kindof type qualifier can be applied to Objective-C object
(pointer) types to indicate id-like behavior, which includes implicit
"downcasting" of __kindof types to subclasses and id-like message-send
behavior. __kindof types provide better type bounds for substitutions
into unspecified generic types, which preserves more type information.

llvm-svn: 241548
2015-07-07 03:58:42 +00:00
Douglas Gregor 10dc9d80cb Warn when an intended Objective-C specialization was actually a useless protocol qualification.
Warn in cases where one has provided redundant protocol qualification
that might be a typo for a specialization, e.g., NSArray<NSObject>,
which is pointless (NSArray declares that it conforms to NSObject) and
is likely to be a typo for NSArray<NSObject *>, i.e., an array of
NSObject pointers. This warning is very narrow, only applying when the
base type being qualified is parameterized, has the same number of
parameters as their are protocols listed, all of the names can also
refer to types (including Objective-C class types, of course), and at
least one of those types is an Objective-C class (making this a typo
for a missing '*'). The limitations are partly for performance reasons
(we don't want to do redundant name lookup unless we really need to),
and because we want the warning to apply in very limited cases to
limit false positives.

Part of rdar://problem/6294649.

llvm-svn: 241547
2015-07-07 03:58:28 +00:00
Douglas Gregor 5054cb0467 Warn when an Objective-C collection literal element is converted to an incompatible type.
Objective-C collection literals produce unspecialized
NSArray/NSDictionary objects that can then be implicitly converted to
specialized versions of these types. In such cases, check that the
elements in the collection are suitable for the specialized
collection. Part of rdar://problem/6294649.

llvm-svn: 241546
2015-07-07 03:58:22 +00:00
Douglas Gregor 9bda6cff20 C++ support for Objective-C lightweight generics.
Teach C++'s tentative parsing to handle specializations of Objective-C
class types (e.g., NSArray<NSString *>) as well as Objective-C
protocol qualifiers (id<NSCopying>) by extending type-annotation
tokens to handle this case. As part of this, remove Objective-C
protocol qualifiers from the declaration specifiers, which never
really made sense: instead, provide Sema entry points to make them
part of the type annotation token. Among other things, this properly
diagnoses bogus types such as "<NSCopying> id" which should have been
written as "id <NSCopying>".

Implements template instantiation support for, e.g., NSArray<T>*
in C++. Note that parameterized classes are not templates in the C++
sense, so that cannot (for example) be used as a template argument for
a template template parameter. Part of rdar://problem/6294649.

llvm-svn: 241545
2015-07-07 03:58:14 +00:00
Douglas Gregor c5e07f5c11 Improve the Objective-C common-type computation used by the ternary operator.
The Objective-C common-type computation had a few problems that
required a significant rework, including:
  - Quadradic behavior when finding the common base type; now it's
  linear.
  - Keeping around type arguments when computing the common type
  between a specialized and an unspecialized type
  - Introducing redundant protocol qualifiers.

Part of rdar://problem/6294649. Also fixes rdar://problem/19572837 by
addressing a longstanding bug in
ASTContext::CollectInheritedProtocols().

llvm-svn: 241544
2015-07-07 03:58:01 +00:00
Douglas Gregor e83b95641f Substitute type arguments into uses of Objective-C interface members.
When messaging a method that was defined in an Objective-C class (or
category or extension thereof) that has type parameters, substitute
the type arguments for those type parameters. Similarly, substitute
into property accesses, instance variables, and other references.

This includes general infrastructure for substituting the type
arguments associated with an ObjCObject(Pointer)Type into a type
referenced within a particular context, handling all of the
substitutions required to deal with (e.g.) inheritance involving
parameterized classes. In cases where no type arguments are available
(e.g., because we're messaging via some unspecialized type, id, etc.),
we substitute in the type bounds for the type parameters instead.

Example:

  @interface NSSet<T : id<NSCopying>> : NSObject <NSCopying>
  - (T)firstObject;
  @end

  void f(NSSet<NSString *> *stringSet, NSSet *anySet) {
    [stringSet firstObject]; // produces NSString*
    [anySet firstObject]; // produces id<NSCopying> (the bound)
  }

When substituting for the type parameters given an unspecialized
context (i.e., no specific type arguments were given), substituting
the type bounds unconditionally produces type signatures that are too
strong compared to the pre-generics signatures. Instead, use the
following rule:

  - In covariant positions, such as method return types, replace type
    parameters with “id” or “Class” (the latter only when the type
    parameter bound is “Class” or qualified class, e.g,
    “Class<NSCopying>”)
  - In other positions (e.g., parameter types), replace type
    parameters with their type bounds.
  - When a specialized Objective-C object or object pointer type
    contains a type parameter in its type arguments (e.g.,
    NSArray<T>*, but not NSArray<NSString *> *), replace the entire
    object/object pointer type with its unspecialized version (e.g.,
    NSArray *).

llvm-svn: 241543
2015-07-07 03:57:53 +00:00
Douglas Gregor e9d95f1ecc Handle Objective-C type arguments.
Objective-C type arguments can be provided in angle brackets following
an Objective-C interface type. Syntactically, this is the same
position as one would provide protocol qualifiers (e.g.,
id<NSCopying>), so parse both together and let Sema sort out the
ambiguous cases. This applies both when parsing types and when parsing
the superclass of an Objective-C class, which can now be a specialized
type (e.g., NSMutableArray<T> inherits from NSArray<T>).

Check Objective-C type arguments against the type parameters of the
corresponding class. Verify the length of the type argument list and
that each type argument satisfies the corresponding bound.

Specializations of parameterized Objective-C classes are represented
in the type system as distinct types. Both specialized types (e.g.,
NSArray<NSString *> *) and unspecialized types (NSArray *) are
represented, separately.

llvm-svn: 241542
2015-07-07 03:57:35 +00:00
Douglas Gregor 85f3f9513d Parsing, semantic analysis, and AST for Objective-C type parameters.
Produce type parameter declarations for Objective-C type parameters,
and attach lists of type parameters to Objective-C classes,
categories, forward declarations, and extensions as
appropriate. Perform semantic analysis of type bounds for type
parameters, both in isolation and across classes/categories/extensions
to ensure consistency.

Also handle (de-)serialization of Objective-C type parameter lists,
along with sundry other things one must do to add a new declaration to
Clang.

Note that Objective-C type parameters are typedef name declarations,
like typedefs and C++11 type aliases, in support of type erasure.

Part of rdar://problem/6294649.

llvm-svn: 241541
2015-07-07 03:57:15 +00:00
Jason Molenda 27467eab81 For the "ios" target add a shell script phase at the end which
removes the LLDB.framework/Resources and LLDB.framework/Swift
directories.  This isn't a deep bundle on ios builds; it is shallow.
    
<rdar://problem/16676101>

llvm-svn: 241540
2015-07-07 03:38:42 +00:00
Marshall Clow 8aaf517db7 Implement N4279 and LWG#2664 for <map>. Reviewed as http://reviews.llvm.org/D10669
llvm-svn: 241539
2015-07-07 03:37:33 +00:00
Peter Collingbourne 8e17451d54 COFF: Fix bug involving archives defining a symbol multiple times.
Previously we were unnecessarily loading lazy symbols if they appeared in an
archive multiple times, as can happen with comdat symbols. This change fixes
the bug by only loading symbols from archives at load time if the original
symbol was undefined.

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

llvm-svn: 241538
2015-07-07 02:15:25 +00:00
Alex Lorenz 36962cd925 MIR Parser: Verify the implicit machine register operands.
This commit verifies that the parsed machine instructions contain the implicit
register operands as specified by the MCInstrDesc. Variadic and call
instructions aren't verified.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 241537
2015-07-07 02:08:46 +00:00
Juergen Ributzka 9622cdf4b9 [StackMap Liveness] Calling the base class' getAnalysisUsage method. NFCI.
Calling into the base class' getAnalysisUsage method after we did our pass
specific modifications. This shouldn't really matter since this is the last
pass in the pipeline anyways.

llvm-svn: 241536
2015-07-07 02:05:18 +00:00
Juergen Ributzka c111fcc0a0 [StackMap Liveness] No need to cache the MachineFunction. NFC.
Don't cache the MachineFunction in the pass and range'ify some loops.

llvm-svn: 241535
2015-07-07 02:05:15 +00:00