aboutsummaryrefslogtreecommitdiff
path: root/test/SemaObjCXX
AgeCommit message (Collapse)Author
2013-05-06Grab-bag of bit-field fixes:John McCall
- References to ObjC bit-field ivars are bit-field lvalues; fixes rdar://13794269, which got me started down this. - Introduce Expr::refersToBitField, switch a couple users to it where semantically important, and comment the difference between this and the existing API. - Discourage Expr::getBitField by making it a bit longer and less general-sounding. - Lock down on const_casts of bit-field gl-values until we hear back from the committee as to whether they're allowed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181252 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-17Extended VerifyDiagnosticConsumer to also verify source file for diagnostic.Andy Gibbs
VerifyDiagnosticConsumer previously would not check that the diagnostic and its matching directive referenced the same source file. Common practice was to create directives that referenced other files but only by line number, and this led to problems such as when the file containing the directive didn't have enough lines to match the location of the diagnostic in the other file, leading to bizarre file formatting and other oddities. This patch causes VerifyDiagnosticConsumer to match source files as well as line numbers. Therefore, a new syntax is made available for directives, for example: // expected-error@file:line {{diagnostic message}} This extends the @line feature where "file" is the file where the diagnostic is generated. The @line syntax is still available and uses the current file for the diagnostic. "file" can be specified either as a relative or absolute path - although the latter has less usefulness, I think! The #include search paths will be used to locate the file and if it is not found an error will be generated. The new check is not optional: if the directive is in a different file to the diagnostic, the file must be specified. Therefore, a number of test-cases have been updated with regard to this. This closes out PR15613. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179677 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-09When checking for illegal expressions in a default-argumentJohn McCall
expression, look through pseudo-object expressions. rdar://13602832 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179080 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-08<rdar://problem/13540921> Fix a crasher when an Objective-C for-in loop gets ↵Douglas Gregor
a non-variable iteration declaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179053 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-08<rdar://problem/13540921> Cope with instantiations of the C++11 range-based ↵Douglas Gregor
for loop that end up being Objective-C fast enumeration loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179037 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-08<rdar://problem/13540921> Cope with deduced 'auto' in a C++11 for-range loop ↵Douglas Gregor
that is actually an Objective-C fast enumeration loop. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179035 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28Fold together the two implementations of 6.7.3p2 in SemaType. Fix two bugs, ↵Richard Smith
each of which was only present in one version: * Give the right diagnostic for 'restrict' applied to a non-pointer, non-reference type. * Don't reject 'restrict' applied indirectly to an Objective-C object pointer type (eg, through template instantiation). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178200 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-27Objective-C: Issue more precise warning when userFariborz Jahanian
is accessing 'isa' as an object pointer. // rdar://13503456. FixIt to follow in another patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178179 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19Add a clarifying note when a return statement is rejected becauseJohn McCall
we expect a related result type. rdar://12493140 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177378 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-08Sema: Preserve attributes on parameters in instantiated function templates.Jordan Rose
This was causing correctness issues for ARC and the static analyzer when a function template has "consumed" Objective-C object parameters (i.e. parameters that will be released by the function before returning). The fix is threefold: (1) Actually copy over the attributes from old ParmVarDecls to new ones. (2) Have Sema::BuildFunctionType only work for building FunctionProtoTypes, which it was doing anyway. This allows us to pass an ExtProtoInfo instead of a plain ExtInfo and several flags. (3) Drop param attributes as part of StripImplicitInstantiation, which is used when an implicit instantiation is followed by an explicit one. <rdar://problem/12685622> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176728 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-07Improve LLDB's implicit cast-to-id to work with C++11 auto and any ↵Douglas Gregor
Objective-C object type <rdar://problem/13338107>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176665 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-04Perform non-overload placeholder conversions on the operandsJohn McCall
to a subscript operator. rdar://13332183 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176428 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22objective-C arc: Diagnostic can not say to use bridgeFariborz Jahanian
casts with c++ named casts. Change notes to say use bridge with c-style cast instead. // rdar://12788838 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175850 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-17One can override an Objective-C ARC ownership qualifier that came fromDouglas Gregor
a template parameter; make that also include one that came from 'auto'. Fixes <rdar://problem/12078752>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172770 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-17In Objective-C ARC, completely ignore ownership qualifiers on theDouglas Gregor
return type of a function by canonicalizing them away. They are useless anyway, and conflict with our rules for template argument deduction and __strong. Fixes <rdar://problem/12367446>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172768 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-09put back diagnostics when flexible members are capturedFariborz Jahanian
in lambdas. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171921 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-08Remove lambda from my last patch.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171915 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-08objectiveC blocks: It is impractical to capture Fariborz Jahanian
struct variables with flexiable array members in blocks (and lambdas). Issue error instead of crashing in IRGen. // rdar://12655829 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171912 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-03Fix capitalization of Objective-C in diagnostic.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171440 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29Fix crash-on-invalid. <rdar://problem/12765391>.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168851 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-19clang/test: Suppress two tests on LLP64 target, Windows x64.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168303 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-14Accept and pass arguments to __unknown_anytype in argumentJohn McCall
positions of Objective-C methods. It is possible to recover a lot of type information about Objective-C methods from the reflective metadata for their implementations. This information is not rich when it comes to struct types, however, and it is not possible to produce a type in the debugger's round-tripped AST which will really do anything useful during type-checking. Therefore we allow __unknown_anytype in these positions, which essentially disables type-checking for that argument. We infer the parameter type to be the unqualified type of the argument expression unless that expression is an explicit cast, in which case it becomes the type-as-written of that cast. rdar://problem/12565338 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167896 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-13Don't try to save the assigned value in a Objective-C property assignmentEli Friedman
if the type of the value is a non-trivial class type. Fixes PR14318. (There's a minor ObjC++ language change here: given that we can't save the value, the type of the assignment expression is void in such cases.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167884 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-24Add a simple test involving decltype on Objective-C properties and ivarsDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166562 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs
VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166280 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18Fix Objective-C implicit property synthesis for C++ classes so we use valid Eli Friedman
source locations in places where it is necessary for diagnostics. By itself, this causes assertions, so while I'm here, also fix property synthesis for properties of C++ class type so we use so we properly set up a scope and mark variable declarations. <rdar://problem/12514189>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166219 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-02-Wformat: Don't check format strings in uninstantiated templates.Jordan Rose
Also applies to -Wnonnull, -Wtype-safety, and -Wnon-pod-varargs. All of these can be better checked at instantiation time. This change does not actually affect regular CallExpr function calls, since the checks there only happen after overload resolution. However, it will affect Objective-C method calls. <rdar://problem/12373934> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164984 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-24objective-C: remove use of 'ivar' in favor ofFariborz Jahanian
'instance variable' in text of all diagnostics for objective-C: // rdar://12352442 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164559 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-17objective-C: peroform property attribute consistencyFariborz Jahanian
checking on property declared in class extension. // rdar://12214070 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164053 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-14Test removed.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163918 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-14objective-C arc: remove -Warc-abi in its entirety.Fariborz Jahanian
// rdar://10554025 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163917 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-14In debugger mode, allow comparisons between pointers and integersDouglas Gregor
without a cast. Fixes <rdar://problem/11830912>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163873 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-12objective-C++ test for my previous patch.Fariborz Jahanian
// rdar://12280826 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163741 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10objective-C: Improving diagnostocs for missing call toFariborz Jahanian
super's annotated methods. // rdar://6386358 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163517 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-07objective-C: introduce __attribute((objc_requires_super)) on methodFariborz Jahanian
in classes. Use it to flag those method implementations which don't contain call to 'super' if they have 'super' class and it has the method with this attribute set. This is wip. // rdar://6386358 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163434 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-05objective-c++11: c++11 does not change pod-ness whenFariborz Jahanian
type is an unqualified objc pointer in arc. Treat it just as being treated in c++98. This fixes a bogus vararg warning with -std=c++11. //rdar://12229679 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163236 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-30objective-C ARC: under -Wexplicit-ownership-type diagnose thoseFariborz Jahanian
method parameter types which are reference to an objective-C pointer to object with no explicit ownership. // rdar://10907090 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162959 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23When disambiguating an expression-statement from a declaraton-statement, if theRichard Smith
statement starts with an identifier for which name lookup will fail either way, look at later tokens to disambiguate in order to improve error recovery. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162464 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-16objective-C++: issue diagnostic when ivar type isFariborz Jahanian
an abstract c++ class. // rdar://12095239 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162052 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10objective-C++: dalyed parsing of ctors with memberFariborz Jahanian
initializer list defined inside an objc class implementation. wip git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161699 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10objective-C++: delay parsing of ctor with try blockFariborz Jahanian
with member initializer list defined inside an objc implementation block. wip. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161692 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10objective-C++: delayed parsing of member function withFariborz Jahanian
function-try-block occuring in objc's implementation block. wip. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161675 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10objective-C++: Delayed parsing of most commonFariborz Jahanian
member functions defined inside an objc class implementation. wip. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161667 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07Objective-C pointer types don't have C-linkage, even though they areDouglas Gregor
non-POD. Fixes <rdar://problem/12031870>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161395 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-01Fix an assertion failure instantiating a constexpr function from within a ↵Eli Friedman
-dealloc method. PR13401. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161135 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30Improvements to vexing-parse warnings. Make the no-parameters case moreRichard Smith
accurate by asking the parser whether there was an ambiguity rather than trying to reverse-engineer it from the DeclSpec. Make the with-parameters case have better diagnostics by using semantic information to drive the warning, improving the diagnostics and adding a fixit. Patch by Nikola Smiljanic. Some minor changes by me to suppress diagnostics for declarations of the form 'T (*x)(...)', which seem to have a very high false positive rate, and to reduce indentation in 'warnAboutAmbiguousFunction'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160998 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27objective-c arc: When function calls with known CFCreate naming conventionFariborz Jahanian
are cast to retainable types, only suggest CFBridgingRelease/ CFBridgingRetain and not the __bridge casts. // rdar://11923822 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160900 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-27revert r160839 for now.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160895 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26objc-arc: When objects with known CF semantics are assigned toFariborz Jahanian
retainable types in arc, only suggest CFBridgingRelease/ CFBridgingRetain and not the confusing __bridge casts. // rdar://11923822 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160839 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23When we have an Objective-C object with non-trivial lifetime in aDouglas Gregor
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>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160615 91177308-0d34-0410-b5e6-96231b3b80d8