Commit Graph

8665 Commits

Author SHA1 Message Date
Benjamin Kramer e3895eb050 Use the location of the copy assignment when diagnosing classes that are nontrivial because of it.
llvm-svn: 160962
2012-07-30 16:41:40 +00:00
Richard Smith f86b0ae196 PR13433: In Microsoft mode, don't require function calls within decltype
expressions to have complete return types (or accessible destructors). If the
return type is required to be complete for some other reason (for instance, if
it is needed by overload resolution), then it will still be required to be
complete. This is apparently required in order to parse a MSVC11 header.

llvm-svn: 160924
2012-07-28 19:54:11 +00:00
Fariborz Jahanian f7759e8fab assert on ACC_bottom when checking for invalid
CF to ARC conversions.

llvm-svn: 160923
2012-07-28 18:59:49 +00:00
Fariborz Jahanian 3ac187731e more objc-arc: With ACC_bottom, we just provide
__bride fixit, as it doesn't matter which cast to
use. // rdar://11923822

llvm-svn: 160906
2012-07-28 00:11:31 +00:00
Fariborz Jahanian ae5bbfc0d0 objc-arc: change per Jordy's comments.
// rdar://11923822

llvm-svn: 160902
2012-07-27 23:55:46 +00:00
Fariborz Jahanian 36986c6e0f objective-c arc: When function calls with known CFCreate naming convention
are cast to retainable types, only suggest CFBridgingRelease/
CFBridgingRetain and not the __bridge casts.
// rdar://11923822

llvm-svn: 160900
2012-07-27 22:37:07 +00:00
Fariborz Jahanian 84c97cafd0 revert r160839 for now.
llvm-svn: 160895
2012-07-27 21:34:23 +00:00
Anna Zaks c77a3b1aab Consolidate ObjC lookupPrivateMethod methods from Sema and DeclObjC.
Also, fix a subtle bug, which occurred due to lookupPrivateMethod
defined in DeclObjC.h not looking up the method inside parent's
categories.

Note, the code assumes that Class's parent object has the same methods
as what's in the Root class of a the hierarchy, which is a heuristic
that might not hold for hierarchies which do not descend from NSObject.
Would be great to fix this in the future.

llvm-svn: 160885
2012-07-27 19:07:44 +00:00
Benjamin Kramer a2dcac1095 Fix PR13394: Erasing from a vector changes the end of the vector, so make sure we always have the right end.
llvm-svn: 160855
2012-07-27 10:21:08 +00:00
NAKAMURA Takumi 836926dbdf clang/lib: [CMake] Update tblgen'd dependencies.
llvm-svn: 160851
2012-07-27 06:18:33 +00:00
NAKAMURA Takumi 075c89bc06 clang/lib: [CMake] Reformat, alphabetize lists.
llvm-svn: 160850
2012-07-27 06:18:12 +00:00
Richard Smith d3b5c90865 Final piece of core issue 1330: delay computing the exception specification of
a defaulted special member function until the exception specification is needed
(using the same criteria used for the delayed instantiation of exception
specifications for function temploids).

EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like
EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to
resolve the exception specification.

This is enabled for all C++ modes: it's a little faster in the case where the
exception specification isn't used, allows our C++11-in-C++98 extensions to
work, and is still correct for C++98, since in that mode the computation of the
exception specification can't fail.

The diagnostics here aren't great (in particular, we should include implicit
evaluation of exception specifications for defaulted special members in the
template instantiation backtraces), but they're not much worse than before.

Our approach to the problem of cycles between in-class initializers and the
exception specification for a defaulted default constructor is modified a
little by this change -- we now reject any odr-use of a defaulted default
constructor if that constructor uses an in-class initializer and the use is in
an in-class initialzer which is declared lexically earlier. This is a closer
approximation to the current draft solution in core issue 1351, but isn't an
exact match (but the current draft wording isn't reasonable, so that's to be
expected).

llvm-svn: 160847
2012-07-27 04:22:15 +00:00
Fariborz Jahanian 226459efff objc-arc: When objects with known CF semantics are assigned to
retainable types in arc, only suggest CFBridgingRelease/
CFBridgingRetain and not the confusing __bridge casts.
// rdar://11923822

llvm-svn: 160839
2012-07-26 23:17:04 +00:00
Tanya Lattner 4bfc355094 Disable the warning for missing prototypes for OpenCL kernels. Includes testcase.
llvm-svn: 160766
2012-07-26 00:08:28 +00:00
Richard Smith 2589b9808e PR12057: Allow variadic template pack expansions to cross lambda boundaries.
Rather than adding a ContainsUnexpandedParameterPack bit to essentially every
AST node, we tunnel the bit directly up to the surrounding lambda expression
when we reach a context where an unexpanded pack can not normally appear.
Thus any statement or declaration within a lambda can now potentially contain
an unexpanded parameter pack.

llvm-svn: 160705
2012-07-25 03:56:55 +00:00
Richard Smith 7ac3c6af87 Pedantic -pedantic correction. Duplicate cv-qualifiers are permitted in C++11
unless they appear in a decl-specifier-seq.

llvm-svn: 160688
2012-07-24 20:24:58 +00:00
Hans Wennborg 84ce606b91 Tweak warning text for returning incomplete type from extern "C" functions.
A warning was added in r150128 for returning non-C compatible
user-defined types from functions with C linkage.

This makes the text more clear for the case when the type isn't
decidedly non-C compatible, but incomplete.

llvm-svn: 160681
2012-07-24 17:59:41 +00:00
Nick Lewycky 085970736f Emit debug info for dynamic initializers. Permit __attribute__((nodebug)) on
variables that have static storage duration, it removes debug info on the
emitted initializer function but not all debug info about this variable.

llvm-svn: 160659
2012-07-24 01:40:49 +00:00
Nick Lewycky cfb4517cc0 Fix whitespace, whoops missed a spot!
llvm-svn: 160658
2012-07-24 01:37:23 +00:00
Nick Lewycky b9e4a3a756 Fix whitespace, tabs to spaces. No functionality change.
llvm-svn: 160657
2012-07-24 01:31:55 +00:00
Richard Trieu c320c745cc Change APInt to APSInt in one instance. Also change a call to operator==() to
APSInt::isSameValue() when comparing different sized APSInt's.

llvm-svn: 160641
2012-07-23 20:21:35 +00:00
Michael Han 3be3b44cdb Refactor handler functions for thread safety attributes.
Make handler functions for thread safety attributes consistent with other attributes handler functions
by removing the bool parameter from some of the thread safety attributes handler functions and extracting
common checks out of different handler functions.

llvm-svn: 160635
2012-07-23 18:48:41 +00:00
Sylvestre Ledru 830885ca64 Fix a typo (the the => the)
llvm-svn: 160622
2012-07-23 08:59:39 +00:00
Douglas Gregor 6fa6942dda When we have an Objective-C object with non-trivial lifetime in a
structor class under ARC, that struct/class does not have a trivial
move constructor or move assignment operator. Fixes the rest of
<rdar://problem/11738725>.

llvm-svn: 160615
2012-07-23 04:23:39 +00:00
Richard Smith 505df2340a PR12917: Remove incorrect assumption that lambda mangling information cannot
change once it's been assigned. It can change in two ways:
 1) In a template instantiation, the context declaration should be the
    instantiated declaration, not the declaration in the template.
 2) If a lambda appears in the pattern of a variadic pack expansion, the
    mangling number will depend on the pack length.

llvm-svn: 160614
2012-07-22 23:45:10 +00:00
Aaron Ballman 9bca21ed25 No longer assuming the number of prototype arguments is always less than the number of formal parameters for a variadic function call.
llvm-svn: 160570
2012-07-20 20:40:35 +00:00
Eric Christopher 7457aaf8c9 Reset the layout of an ObjC class if we see an ivar in a category
or implementation since we've now got a different layout.

Fixes rdar://11842763

llvm-svn: 160526
2012-07-19 22:22:51 +00:00
Aaron Ballman 44475e2771 Removing a spurious comment, no functionality changes.
llvm-svn: 160522
2012-07-19 21:00:48 +00:00
Jordan Rose 3e0ec58c09 For varargs, diagnose passing ObjC objects by value like other non-POD types.
While we still want to consider this a hard error (non-POD variadic args are
normally a DefaultError warning), delaying the diagnostic allows us to give
better error messages, which also match the usual non-POD errors more closely.

In addition, this change improves the diagnostic messages for format string
argument type mismatches by passing down the type of the callee, so we can
say "variadic method" or "variadic function" appropriately.

<rdar://problem/11825593>

llvm-svn: 160517
2012-07-19 18:10:23 +00:00
Jordan Rose 58bbe4206f Don't crash checking a format string if one of the arguments is invalid.
Previously, we would ask for the SourceLocation of an argument even if
it were NULL (i.e. if Sema resulted in an ExprError trying to build it).

<rdar://problem/11890818>

llvm-svn: 160515
2012-07-19 18:10:08 +00:00
Aaron Ballman 24a1047c8c Relaxed enumeration constant naming rules for scoped enumerators so they no longer emit a diagnostic when the enumeration's name matches that of the class. Fixes PR13128.
llvm-svn: 160490
2012-07-19 03:12:23 +00:00
Richard Smith 0bf93aa6b1 Fix OverloadCandidateSet::clear to not leak PartialDiagnostics, found by Samuel
Panzer. I've not been able to trigger a failure caused by this, so no test yet.
Also included is a small change from Paul Robinson to only consider the
FailureKind if the overload candidate did actually fail.

llvm-svn: 160470
2012-07-18 23:52:59 +00:00
Richard Smith af136f8191 PR13381, part 2: when determining if a defaulted special member function should
be defined as deleted, take cv-qualifiers on class members into account when
looking up the copy or move constructor or assignment operator which will be
used for them.

llvm-svn: 160418
2012-07-18 03:51:16 +00:00
Richard Smith 1c6461ef63 PR13381: consider cv-qualifiers on a class member's type when determining which
constructor will be used for moving that object, in the computation of its
exception specification.

llvm-svn: 160417
2012-07-18 03:36:00 +00:00
Richard Smith 198223b7e6 PR13386: When matching up parameters between a function template declaration
and a function template instantiation, if there's a parameter pack in the
declaration and one at the same place in the instantiation, don't assume that
the pack wasn't expanded -- it may have expanded to nothing. Instead, go ahead
and check whether the parameter pack was expandable. We can do this as a
side-effect of the work we'd need to do anyway, to find how many parameters
were produced.

llvm-svn: 160416
2012-07-18 01:29:05 +00:00
Douglas Gregor a906ad2f9e When performing the deduced/actual argument type check for C++
[temp.deduct.call]p4 under Objective-C++ ARC, make sure to adjust the
qualifiers to introduce the implicit strong lifetime when
needed. Fixes <rdar://problem/11825671>.

llvm-svn: 160412
2012-07-18 00:14:59 +00:00
Douglas Gregor 951de307e4 Remove unnecessary spacing around Objective-C object literal code
completions. Fixes <rdar://problem/11889572>.

llvm-svn: 160407
2012-07-17 23:24:47 +00:00
Rafael Espindola 60a2bba976 Handle the case where the base type is not dependent, but the derived one is.
Fixes pr13353.cpp.

llvm-svn: 160393
2012-07-17 20:24:05 +00:00
Fariborz Jahanian 268fec1e2e Issue warning when assigning out-of-range integer values to enums.
Due to performance cost, this is an opt-in option placed
under -Wassign-enum. // rdar://11824807

llvm-svn: 160382
2012-07-17 18:00:08 +00:00
Jordan Rose 63ffaa8c18 -Wobjc-literal-compare: don't warn when comparing against nil.
Checks against nil often appear as guards in macros, and comparing
Objective-C literals to nil has well-defined behavior (if tautological).

On OS X, 'nil' has not been typed as 'id' since 10.6 (possibly earlier),
so the warning was already not firing, but other runtimes continue to use
((id)0) or some variant. This change accepts comparisons to any null pointer;
to keep it simple, it looks through all casts (not just casts to 'id').

PR13276

llvm-svn: 160379
2012-07-17 17:46:48 +00:00
Jordan Rose ea70bf7154 Add -Wobjc-string-compare under -Wobjc-literal-compare.
Suggested by Ted, since string literal comparison is at least slightly more
sensible than comparison of runtime literals. (Ambiguous language on
developer.apple.com implies that strings are guaranteed to be uniqued within
a translation unit and possibly across a linked binary.)

llvm-svn: 160378
2012-07-17 17:46:44 +00:00
Jordan Rose 7660f78fb9 Now that -Wobjc-literal-compare is a warning, put the fixit on a note.
Recovering as if the user had actually called -isEqual: is a bit too far from
the semantics of the program as written, /even though/ it's probably what they
intended.

llvm-svn: 160377
2012-07-17 17:46:40 +00:00
Rafael Espindola e3a14bb95b Merge visibility from previous decls before looking at visibility pragma. This
is a bit fuzzy, but matches gcc behavior and existing code bases seem to
depend on it.

llvm-svn: 160364
2012-07-17 15:14:47 +00:00
Rafael Espindola f97c636812 Record visibility pragmas when we see a tag declaration. We might use it
to build a type before seeing the definition.

llvm-svn: 160339
2012-07-17 04:22:25 +00:00
Richard Smith b21dd02e61 Uninitialized variables: two little changes:
* Treat compound assignment as a use, at Jordy's request.
 * Always add compound assignments into the CFG, so we can correctly diagnose the use in 'return x += 1;'

llvm-svn: 160334
2012-07-17 01:27:33 +00:00
David Blaikie 1f4ff15c91 Simplify float comparison checks by using early return.
Found while investigating PR13330

llvm-svn: 160318
2012-07-16 20:47:22 +00:00
David Blaikie 5a0956e98d Fix rejects-valid: explicit specialization of redeclared deleted function template.
Review by Richard Smith.

llvm-svn: 160306
2012-07-16 18:50:45 +00:00
Daniel Jasper 3e1a9cf3b8 Add correct parenthesis range to CXXConstructExprs inside
CXXFunctionalCastExprs.

llvm-svn: 160252
2012-07-16 08:05:07 +00:00
Richard Smith 8093465a0b PR13365: Fix code which was trying to treat an array of DeducedTemplateArgument
as an array of its base class TemplateArgument. Switch the const
TemplateArgument* parameters of InstantiatingTemplate's constructors to
ArrayRef<TemplateArgument> to prevent this from happening again in the future.

llvm-svn: 160245
2012-07-16 01:09:10 +00:00
Rafael Espindola faf556b745 Without this patch clang warns on
struct __attribute__((visibility("hidden"))) zed {
};
struct __attribute__((visibility("hidden"))) zed;

Which is a bit silly and got a lot noisier now that we correctly handle
visibility pragmas. This patch fixes that and also has some extra quality
improvements:

* We now produce an error instead of a warning for

struct __attribute__((visibility("hidden"))) zed {
};
struct __attribute__((visibility("default"))) zed;

* The "after definition" warning now points to the new attribute that is
  ignored instead of pointing to the declaration.

llvm-svn: 160227
2012-07-15 01:33:40 +00:00