Argyrios Kyrtzidis
a9aabf7d51
Fix crash on an @interface nested inside @implementation, rdar://10336158
...
llvm-svn: 143085
2011-10-27 00:09:34 +00:00
Argyrios Kyrtzidis
f26b12ada0
For the "'@end' is missing in implementation context" point at the location of '@'.
...
llvm-svn: 143084
2011-10-27 00:09:29 +00:00
Fariborz Jahanian
3249a1e862
Do not warn when weak-import attribute is applied to enum
...
decl. in Darwin due to certain projects requirement.
// rdar://10277579
llvm-svn: 143082
2011-10-26 23:59:12 +00:00
Richard Smith
cab9a7d51c
Pull out conversion on LHS of -> and . into its own function. This happens
...
implicitly in LookupMemberExpr and explicitly in cases where template
instantiation doesn't redo the lookup.
llvm-svn: 143046
2011-10-26 19:06:56 +00:00
Eli Friedman
64d9504b8f
Compute the promoted integer type of fixed-width enums correctly. Found by inspection.
...
llvm-svn: 143021
2011-10-26 07:38:19 +00:00
Richard Smith
ae1bab56d9
Fix crash due to missing array-to-pointer decay when instantiating an unresolved
...
member expression. Refactoring to follow.
llvm-svn: 143017
2011-10-26 06:49:26 +00:00
Richard Smith
3d5c1fa93f
UnresolvedMemberExprs need lvalue-to-rvalue conversions during template
...
instantiations too.
llvm-svn: 143016
2011-10-26 06:15:36 +00:00
John McCall
526ab47a55
Restore r142914 and r142915, now with missing file and apparent
...
GCC compiler workaround.
llvm-svn: 142931
2011-10-25 17:37:35 +00:00
NAKAMURA Takumi
9a8f13961c
Revert r142914 and r142915, due to possibly missing file.
...
r142914: "Introduce a placeholder type for "pseudo object""
r142915: "Pull the pseudo-object stuff into its own file."
llvm-svn: 142921
2011-10-25 14:32:25 +00:00
John McCall
2ab33d28a8
Pull the pseudo-object stuff into its own file.
...
Tidy up some marginally related code just to annoy
single-purpose-commit lovers. No functionality change.
llvm-svn: 142915
2011-10-25 08:42:34 +00:00
John McCall
c4a2d3259f
Introduce a placeholder type for "pseudo object"
...
expressions: expressions which refer to a logical rather
than a physical l-value, where the logical object is
actually accessed via custom getter/setter code.
A subsequent patch will generalize the AST for these
so that arbitrary "implementing" sub-expressions can
be provided.
Right now the only client is ObjC properties, but
this should be generalizable to similar language
features, e.g. Managed C++'s __property methods.
llvm-svn: 142914
2011-10-25 07:27:56 +00:00
Richard Smith
d4268d91e7
Don't forget the lvalue-to-rvalue conversion on the LHS when instantiating a
...
dependent ->, where the member being referred to is an anonymous struct or
union. This path was missed by the fix in r142890.
llvm-svn: 142910
2011-10-25 06:33:21 +00:00
Douglas Gregor
4a2a8f7fb8
Check for unexpanded parameter packs in the name that guards a
...
Microsoft __if_exists/__if_not_exists statement. Also note that we
weren't traversing DeclarationNameInfo *at all* within the
RecursiveASTVisitor, which would be rather fatal for variadic
templates.
llvm-svn: 142906
2011-10-25 03:44:56 +00:00
Douglas Gregor
deb4a2be67
Implement support for dependent Microsoft __if_exists/__if_not_exists
...
statements. As noted in the documentation for the AST node, the
semantics of __if_exists/__if_not_exists are somewhat different from
the way Visual C++ implements them, because our parsed-template
representation can't accommodate VC++ semantics without serious
contortions. Hopefully this implementation is "good enough".
llvm-svn: 142901
2011-10-25 01:33:02 +00:00
Richard Smith
841222ea75
Don't forget the lvalue-to-rvalue conversion on the LHS of an -> when rebuilding
...
it during template instantiation, for a known RHS decl.
llvm-svn: 142890
2011-10-25 00:41:24 +00:00
Douglas Gregor
43edb32f1f
Rework Microsoft __if_exists/__if_not_exists parsing and semantic
...
analysis to separate dependent names from non-dependent names. For
dependent names, we'll behave differently from Visual C++:
- For __if_exists/__if_not_exists at class scope, we'll just warn
and then ignore them.
- For __if_exists/__if_not_exists in statements, we'll treat the
inner statement as a compound statement, which we only instantiate
in templates where the dependent name (after instantiation)
exists. This behavior is different from VC++, but it's as close as
we can get without encroaching ridiculousness.
The latter part (dependent statements) is not yet implemented.
llvm-svn: 142864
2011-10-24 22:31:10 +00:00
Douglas Gregor
89ab56d5fb
When we perform a lookup for a dependent name that is a member of an
...
unknown specialization, treat this the same way as if the name were
not found in the current instantiation. No actual functionality
change, since apparently nothing depends on this.
llvm-svn: 142862
2011-10-24 22:24:50 +00:00
Fariborz Jahanian
28f5fb9843
Minor refactoring of my last patch. Per Doug's suggestion.
...
llvm-svn: 142807
2011-10-24 17:30:45 +00:00
Ted Kremenek
81ce1c8a99
Rename AnalysisContext to AnalysisDeclContext. Not only is this name more accurate, but it frees up the name AnalysisContext for other uses.
...
llvm-svn: 142782
2011-10-24 01:32:45 +00:00
Peter Collingbourne
7d33cd3a2f
Fix grammar for C++11 alignment specifiers, and add a few FIXMEs.
...
llvm-svn: 142760
2011-10-23 20:07:52 +00:00
Peter Collingbourne
9f58d7b789
Diagnose unexpanded parameter packs in member initialisers (including
...
in-class member initialisers).
llvm-svn: 142758
2011-10-23 18:59:44 +00:00
Peter Collingbourne
05156e3231
Clean up duplicated code in Sema::BuildMemInitializer.
...
llvm-svn: 142757
2011-10-23 18:59:37 +00:00
Peter Collingbourne
8953e7c923
Improve unexpanded parameter pack diagnostics by using UPPC_Initializer here.
...
llvm-svn: 142756
2011-10-23 18:59:33 +00:00
Peter Collingbourne
e109a2ca59
Attach class template attributes to the templated CXXRecordDecl,
...
instead of silently discarding them.
As a side effect, this improves diagnostics for constexpr class
templates slightly.
llvm-svn: 142755
2011-10-23 17:07:16 +00:00
Ted Kremenek
142adc492b
[analyzer] Remove LocationContext creation methods from AnalysisManager, and change clients to use AnalysisContext instead.
...
WIP to remove/reduce ExprEngine's usage of AnalysisManager.
llvm-svn: 142739
2011-10-23 02:31:52 +00:00
Ted Kremenek
33ba99566f
Only emit implicit constant conversion truncation warnings in reachable code. Apparently this is what GCC does, and some code depends on this. Fixes <rdar://problem/10321089>.
...
llvm-svn: 142716
2011-10-22 02:37:33 +00:00
Fariborz Jahanian
e96f9c816b
Fixes a minor hick up to my last patch.
...
llvm-svn: 142711
2011-10-22 01:56:45 +00:00
Fariborz Jahanian
512a4cc967
objc: private methods can have their attributes, no diagnostic is required.
...
None private methods if their implementation have attribute, they must exactly
match those in their declarations. // rdar://10271563
llvm-svn: 142709
2011-10-22 01:21:15 +00:00
Argyrios Kyrtzidis
d4590a5d5f
Don't try to set the "array filler" in a InitListExpr twice.
...
llvm-svn: 142695
2011-10-21 23:02:22 +00:00
Fariborz Jahanian
47f9a73f51
c++: support gcc's application of weak attribute on
...
class declaration which forces any such class and any
class that inherits from such a class to have their
typeinfo symbols be marked as weak.
// rdar://10246395
A test/CodeGenCXX/weak-extern-typeinfo.cpp
M lib/Sema/SemaDeclCXX.cpp
M lib/Sema/SemaDeclAttr.cpp
M lib/CodeGen/CGRTTI.cpp
llvm-svn: 142693
2011-10-21 22:27:12 +00:00
DeLesley Hutchins
c20905110a
Thread safety analysis refactoring: invalid lock expressions.
...
llvm-svn: 142666
2011-10-21 18:10:14 +00:00
Fariborz Jahanian
2512747959
objective-c: Diagnose redeclaration of private
...
ivars in class extensions. // rdar://10309454
llvm-svn: 142664
2011-10-21 18:03:52 +00:00
Douglas Gregor
fbf8752597
When performing name lookup for the previous declaration of a field,
...
be sure to consider all of the possible lookup results. We were
assert()'ing (but behaving correctly) for unresolved values. Fixes
PR11134 / <rdar://problem/10290422>.
llvm-svn: 142652
2011-10-21 15:47:52 +00:00
Peter Collingbourne
99eddc3d92
Permit auto SCS on parameter declarations, C++03 [dcl.stc]p2
...
llvm-svn: 142649
2011-10-21 11:55:09 +00:00
Richard Smith
fe2750db42
Add -Wc++98-compat diagnostics for jumps which bypass initialization of non-POD
...
but trivially constructible and destructible variables in C++11 mode. Also
incidentally improve the precision of the wording for jump diagnostics in C++98
mode.
llvm-svn: 142619
2011-10-20 21:42:12 +00:00
Douglas Gregor
7f4fbecbe2
When fixing up the storage class for an anonymous union, don't mark
...
the anonymous union as valid: our fixes have Fix-Its.
llvm-svn: 142616
2011-10-20 20:40:00 +00:00
Douglas Gregor
f4ef4d2ec5
There's no point in marking a declaration invalid just because it
...
shadows a template parameter. Complain about the shadowing (or not,
under -fms-extensions), but don't invalidate the declaration. Merely
forget about the template parameter declaration.
llvm-svn: 142596
2011-10-20 17:58:49 +00:00
Douglas Gregor
44e5a0a72b
Diagnose class template (partial) specializations that occur in the
...
*wrong* class scope. This is one of the problems behind
<rdar://problem/9676205>.
llvm-svn: 142588
2011-10-20 16:41:18 +00:00
Douglas Gregor
f65d8ffca7
When we parse something that looks like a templated friend tag but
...
actually just has an extraneous 'template<>' header, strip off the
'template<>' header and treat it as a normal friend tag. Fixes PR10660
/ <rdar://problem/9958322>.
llvm-svn: 142587
2011-10-20 15:58:54 +00:00
Richard Smith
91c7bbde4b
Add -Wc++98-compat warning for enumerations in nested name specifiers.
...
llvm-svn: 142568
2011-10-20 03:28:47 +00:00
David Blaikie
733f7bb81f
FixIt insert 'static' for anonymous unions at global or namespace scope.
...
llvm-svn: 142566
2011-10-20 02:49:08 +00:00
David Blaikie
6f686fc271
Add a fixit to remove storage specifiers on anonymous enums.
...
llvm-svn: 142565
2011-10-20 02:10:55 +00:00
David Blaikie
30d15445ed
80 cols (one I created in my last commit, plus a bunch of others that were already there)
...
llvm-svn: 142552
2011-10-19 22:56:21 +00:00
David Blaikie
0a8e8999d6
Don't provide errors for anonymous unions when they're actually anonymous classes.
...
llvm-svn: 142551
2011-10-19 22:43:29 +00:00
Richard Smith
f720df0ed6
-Wc++98-compat: warn on nontrivial types used in unions and anonymous structs.
...
llvm-svn: 142541
2011-10-19 20:41:51 +00:00
Matt Beaumont-Gay
4b489fa629
Only warn at self-initialization if some later use is always uninitialized.
...
llvm-svn: 142538
2011-10-19 18:53:03 +00:00
Richard Smith
c620f554b9
-Wc++98-compat: diagnose if a reference is bound to a prvalue which does not
...
have an unambiguous accessible copying constructor; this is ill-formed in C++98.
llvm-svn: 142533
2011-10-19 16:55:56 +00:00
Douglas Gregor
e248eea214
Improve the warning for cv-qualifiers on free functions, from Ahmed Charles!
...
llvm-svn: 142478
2011-10-19 06:04:55 +00:00
David Blaikie
651c73ce78
Fix pr9789, assert-on-invalid while instantiating an (invalid) class template with a non-final parameter pack. Also improve the warning for non-final parameter packs in this scenario so it only fires once, rather than once for every template parameter after the non-final parameter pack.
...
llvm-svn: 142473
2011-10-19 05:19:50 +00:00
Argyrios Kyrtzidis
4e8b13613b
Don't forget to complete the objc interface before asking for information,
...
otherwise lldb will suffer.
llvm-svn: 142471
2011-10-19 02:25:16 +00:00
Richard Smith
a066ccfcf1
Add a -Wc++98-compat warning for friend functions of class templates which would
...
be implicitly instantiated (resulting in a redefinition) in C++98.
llvm-svn: 142468
2011-10-19 00:54:10 +00:00
Peter Collingbourne
a48f33f951
Move static array parameter checks to SemaExpr, per Doug's request
...
llvm-svn: 142465
2011-10-19 00:16:45 +00:00
Richard Smith
38c0e0417c
-Wc++98-compat: warn if a SFINAE substitution in C++11 suppresses an access
...
control diagnostic.
llvm-svn: 142463
2011-10-19 00:07:01 +00:00
Richard Smith
c82397332d
-Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 2.
...
llvm-svn: 142426
2011-10-18 21:39:00 +00:00
Douglas Gregor
e5c79d5ea8
Provide result types for code completions that describe built-in
...
expressions (this, sizeof, etc.).
llvm-svn: 142424
2011-10-18 21:20:17 +00:00
John McCall
e314e27c58
Macro metaprogramming for builtin types.
...
llvm-svn: 142420
2011-10-18 21:02:43 +00:00
Richard Smith
0bf8a492fd
-Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 1.
...
llvm-svn: 142419
2011-10-18 20:49:44 +00:00
Fariborz Jahanian
2f31b33f34
objc: more changes in use of IBOutletCollection attribute.
...
'Class' is disallowed as argument. If the argument is missing,
NSObject is assumed. // rdar://10296078
llvm-svn: 142409
2011-10-18 19:54:31 +00:00
Argyrios Kyrtzidis
b51684d7a1
Set the objc "property attributes as written" for extension properties as well.
...
llvm-svn: 142406
2011-10-18 19:49:16 +00:00
Richard Smith
c30493db3c
In C++11, a class's members are allowed to be nominated as friends.
...
llvm-svn: 142393
2011-10-18 18:33:57 +00:00
Douglas Gregor
09deffa067
Make it possible to compute the type of 'this' without capturing
...
it. Refactoring to be used in a moment.
llvm-svn: 142360
2011-10-18 16:47:30 +00:00
Douglas Gregor
4205feffcd
Add code completions for C++0x expressions
...
llvm-svn: 142357
2011-10-18 16:29:03 +00:00
Hans Wennborg
f99d04f841
Suggest %zu for size_t args to printf.
...
For PR11152. Make PrintSpecifier::fixType() suggest "%zu" for size_t, etc.
rather than looking at the underlying type and suggesting "%llu" or other
platform-specific length modifiers. Applies to C99 and C++11.
llvm-svn: 142342
2011-10-18 08:10:06 +00:00
Douglas Gregor
d793e7c3f7
Don't format the code completion for parameters of block literal
...
arguments as block literal arguments; the block literal argument code
completion should only go one level deep. Fixes <rdar://problem/10291294>.
llvm-svn: 142335
2011-10-18 04:23:19 +00:00
Richard Smith
83c19296ff
Add -Wc++11-compat warning for an inline specifier on an explicit instantiation.
...
llvm-svn: 142333
2011-10-18 03:44:03 +00:00
Douglas Gregor
f333f8c40d
When transforming the arguments for a C++ "new" expression, make sure
...
to drop the implicitly-generated value initialization expression used
for initializing scalars. Fixes <rdar://problem/10283928>.
llvm-svn: 142330
2011-10-18 02:43:19 +00:00
Richard Smith
050d261ec7
Refactor the checking for explicit template instantiations being performed in
...
the right namespace in C++11 mode. Teach the code to prefer the 'must be in
precisely this namespace' diagnostic whenever that's true, and fix a defect
which resulted in the -Wc++11-compat warning in C++98 mode sometimes being
omitted.
llvm-svn: 142329
2011-10-18 02:28:33 +00:00
Richard Smith
9fcc5c31c4
Perform lvalue-to-rvalue conversions on __builtin_offsetof array argument index
...
before typechecking, as suggested by John.
llvm-svn: 142308
2011-10-17 23:29:39 +00:00
Richard Smith
b15c11c819
Add -Wc++98-compat warnings for uses of the new keywords 'alignof', 'char16_t',
...
'char32_t', 'constexpr', 'decltype', 'noexcept', 'nullptr' and 'static_assert'.
llvm-svn: 142302
2011-10-17 23:06:20 +00:00
Tanya Lattner
49b3841398
The comparison of two vectors should return a signed result. hasIntegerRepresentation() used to always return false for vectors, but since it was changed, it also
...
changed the return type of a compare of two unsigned vectors to be unsigned. This patch removes the check for hasIntegerRepresentation since its not needed and returns the appropriate signed type.
I added a new test case and updated exisiting test cases that assumed an unsigned result.
llvm-svn: 142250
2011-10-17 21:00:38 +00:00
Fariborz Jahanian
502d2eee09
obj-c++: Fix a IRGen crash when getter is a reference type.
...
Fix is in Sema. // rdar://10153365
llvm-svn: 142249
2011-10-17 21:00:22 +00:00
Eli Friedman
15b1a7be1e
Add missing case to switch.
...
llvm-svn: 142246
2011-10-17 20:46:28 +00:00
John McCall
444bd25dff
Strip qualifiers off the type of an implicit property defined by
...
only a setter.
llvm-svn: 142236
2011-10-17 20:05:43 +00:00
Argyrios Kyrtzidis
bd8b150dfc
Introduce ASTConsumer::HandleTopLevelDeclInObjCContainer which accepts
...
top-level declarations that occurred inside an ObjC container.
This is useful to keep track of such decls otherwise when e.g. a function
is declared inside an objc interface, it is not passed to HandleTopLevelDecl
and it is not inside the DeclContext of the interface that is returned.
llvm-svn: 142232
2011-10-17 19:48:13 +00:00
Argyrios Kyrtzidis
1f4bee5601
Keep track when a ObjC interface/protocol was initially created as a forward reference.
...
llvm-svn: 142230
2011-10-17 19:48:06 +00:00
John McCall
4124c4924d
Teach the ARC compiler to not require __bridge casts when
...
passing/receiving CF objects at +0 to/from Objective-C methods
or audited C functions.
llvm-svn: 142219
2011-10-17 18:40:02 +00:00
John McCall
a072f5d454
Add a helper function for determining whether an expression
...
has placeholder type.
llvm-svn: 142203
2011-10-17 17:42:19 +00:00
Sebastian Redl
962070d49c
Revert r142142: "Make a C-style cast a const-cast, to suppress a GCC warning."
...
Richard already fixed the underlying issue, so the cast was superfluous.
llvm-svn: 142192
2011-10-17 16:53:50 +00:00
Douglas Gregor
ebf0049901
For modules, all macros that aren't include guards are implicitly
...
public. Add a __private_macro__ directive to hide a macro, similar to
the __module_private__ declaration specifier.
llvm-svn: 142188
2011-10-17 15:32:29 +00:00
Richard Smith
eda61288ad
Perform an lvalue-to-rvalue conversion on an array index in a __builtin_offsetof expression.
...
llvm-svn: 142179
2011-10-17 05:48:07 +00:00
Richard Smith
00ab3ae72b
Slightly simplify a constant expression check. No functional change.
...
llvm-svn: 142167
2011-10-16 23:01:09 +00:00
Peter Collingbourne
5aa6ecb619
Add sema checks for calls to functions taking static array parameters
...
llvm-svn: 142157
2011-10-16 21:17:32 +00:00
Sebastian Redl
b17be8dcfe
Implement overload resolution from init lists for scalar parameter types.
...
llvm-svn: 142148
2011-10-16 18:19:34 +00:00
Sebastian Redl
8b6412af46
Diagnose when omitting braces in direct list-initialization in C++0x.
...
This also applies to C99-style aggregate literals, should they be used in C++11, since they are effectively identical to constructor call list-initialization syntax.
llvm-svn: 142147
2011-10-16 18:19:28 +00:00
Sebastian Redl
2b47b7a3e6
In the verify-only pass, check that items that don't have an initializer in an init list can be value-initialized, at least when designated initializers are not involved. No test case yet, since early failures cannot be distinguished from late failures until overload resolution works.
...
llvm-svn: 142146
2011-10-16 18:19:20 +00:00
Sebastian Redl
5999aec4e1
Check for unavailable declarations in Sema::CanUseDecl.
...
llvm-svn: 142145
2011-10-16 18:19:16 +00:00
Sebastian Redl
cc152641c0
Drop the Diagnose parameter from Sema::PerformImplicitConversion again and instead use TryImplicitConversion in CheckSingleAssignmentConstraints when that function is in no-diagnostics mode.
...
llvm-svn: 142143
2011-10-16 18:19:06 +00:00
Sebastian Redl
47fa9a346d
Make a C-style cast a const-cast, to suppress a GCC warning. I should fix the underlying issue eventually, but this interface will probably change anyway.
...
llvm-svn: 142142
2011-10-16 18:18:59 +00:00
Fariborz Jahanian
c27cd1b881
Avoid duplicate unavailbility diagnostics in objc++.
...
// rdar://10268422
llvm-svn: 142078
2011-10-15 19:18:36 +00:00
Fariborz Jahanian
7c386f838a
obj-c++: allow the getter/setter to return/take parameters
...
by reference. // rdar://10188258
llvm-svn: 142075
2011-10-15 17:36:49 +00:00
Richard Smith
e41fac231c
Add -Wc++98-compat warning for deduced 'auto' type specifier.
...
llvm-svn: 142057
2011-10-15 05:42:01 +00:00
Anton Korobeynikov
f0c267e6e0
Provide half floating point support as a storage only type.
...
Lack of half FP was a regression compared to llvm-gcc.
llvm-svn: 142016
2011-10-14 23:23:15 +00:00
Eli Friedman
1e7a0c6a1d
Attempt to fix Windows buildbot, round 2.
...
llvm-svn: 142014
2011-10-14 23:10:30 +00:00
Eli Friedman
8d3e43ff4a
Add template instantiation support for AtomicExpr.
...
llvm-svn: 142012
2011-10-14 22:48:56 +00:00
Eli Friedman
e2c600cf43
Attempt to fix buildbot failure on Windows.
...
llvm-svn: 142008
2011-10-14 21:52:24 +00:00
Douglas Gregor
7e1aa5b7ac
Don't try to diagnose anything when we're passing incomplete types
...
through varargs. This only happens when we're in an unevaluated
context, where we don't want to trigger an error anyway. Fixes PR11131
/ <rdar://problem/10288375>.
llvm-svn: 141986
2011-10-14 20:34:19 +00:00
Richard Smith
96bd62f769
Reinstate r141898 (reverted in r141921), without the -Wc++98-compat-variadic-templates flag. Consensus is that -Wc++98-compat is a useful addition to clang, but per-C++11-feature warnings may not be.
...
Original patch by Jeffrey Yasskin.
llvm-svn: 141985
2011-10-14 20:31:37 +00:00
Richard Smith
465841e48c
[temp.explicit]p1: constexpr cannot be specified in explicit instantiations.
...
llvm-svn: 141982
2011-10-14 19:58:02 +00:00
Benjamin Kramer
b89514a9b8
Change operator<< for raw_ostream and NamedDecl to take a reference instead of a pointer.
...
Passing a pointer was a bad idea as it collides with the overload for void*.
llvm-svn: 141971
2011-10-14 18:45:37 +00:00
Fariborz Jahanian
e1e17cd8e2
Fix misplaced comment.
...
llvm-svn: 141967
2011-10-14 18:35:31 +00:00
Fariborz Jahanian
03df2b2e56
Make value kind based on the return type of the getter, not
...
property type, for when getter may be a reference type.
// rdar://10188258 revised.
llvm-svn: 141966
2011-10-14 18:31:36 +00:00
Douglas Gregor
f1404d7d49
Under ARC, merge the bit corresponding to the ns_returns_retained
...
attribute from the first declaration to later declarations. Fixes
<rdar://problem/10142572>.
llvm-svn: 141957
2011-10-14 15:55:40 +00:00
Matt Beaumont-Gay
c622163b0f
Only warn in -Wliteral-conversion if the conversion loses information
...
llvm-svn: 141955
2011-10-14 15:36:25 +00:00
Douglas Gregor
041b084f73
When declaring an out-of-line template, attempt to rebuild any types
...
within the template parameter list that may have changed now that we
know the current instantiation. Fixes <rdar://problem/10194295>.
llvm-svn: 141954
2011-10-14 15:31:12 +00:00
Erik Verbruggen
98ea7f6737
Added clang_getCompletionAnnotation and clang_getCompletionNumAnnotations to
...
retrieve annotations from completion string.
llvm-svn: 141953
2011-10-14 15:31:08 +00:00
Argyrios Kyrtzidis
dcaaa21fbe
Really protect from infinite loop when there are objc method redeclarations.
...
Serialization part will come later.
llvm-svn: 141950
2011-10-14 08:02:31 +00:00
Argyrios Kyrtzidis
c5e829cad2
Keep track of objc method redeclarations in the same interface.
...
Avoid possible infinite loop when iterating over an ObjCMethod's redeclarations.
llvm-svn: 141946
2011-10-14 06:48:06 +00:00
Jeffrey Yasskin
de8a104633
Revert the -Wc++98-compat flag because dgregor doesn't like it.
...
llvm-svn: 141921
2011-10-14 00:04:00 +00:00
Fariborz Jahanian
df4f7ca331
objc-arc: 'Class' property is implicitly __unsafe_unretained.
...
// rdar://10239594
llvm-svn: 141915
2011-10-13 23:45:45 +00:00
Nico Weber
39bfed8ad6
Extend -Wno-sizeof-array-argument to strncpy and friends.
...
This finds 2 bugs in chromium and 1 in hunspell, with 0 false positives.
llvm-svn: 141902
2011-10-13 22:30:23 +00:00
Jeffrey Yasskin
a722170eb9
Implement the first piece of a -Wc++98-compat flag so that people can build in
...
C++11 mode but keep their sources compatible with C++98. This patch implements
the -Wc++98-compat-variadic-templates sub-flag and -Wc++98-compat to include
it.
llvm-svn: 141898
2011-10-13 22:18:05 +00:00
Ted Kremenek
596fa16dd3
Tweak -Wuninitialized's handling of 'int x = x' to report that as the root cause of an uninitialized variable IFF there are other uses of that uninitialized variable. Fixes <rdar://problem/9259237>.
...
llvm-svn: 141881
2011-10-13 18:50:06 +00:00
Douglas Gregor
f4a06c2104
HasFormOfMemberPointer implies IsAddressOfOperand for an overload set. Simplify
...
llvm-svn: 141878
2011-10-13 18:26:27 +00:00
Douglas Gregor
cda2270217
Allow calling an overloaded function set by taking the address of the
...
functions, e.g., (&f)(0). Fixes <rdar://problem/9803316>.
llvm-svn: 141877
2011-10-13 18:10:35 +00:00
Erik Verbruggen
ca98f2a63f
Allow for annotate attributes after access specifiers. When such
...
attributes are found, propagate them to subsequent declarations.
llvm-svn: 141861
2011-10-13 09:41:32 +00:00
Douglas Gregor
ebcfbb5d22
When we determine that a function template specialization produced as
...
part of template argument deduction is ill-formed, we mark it as
invalid and treat it as a deduction failure. If we happen to find that
specialization again, treat it as a deduction failure rather than
silently building a call to the declaration.
Fixes PR11117, a marvelous bug where deduction failed after creating
an invalid specialization, causing overload resolution to pick a
different candidate. Then we performed a similar overload resolution
later, and happily picked the invalid specialization to
call... resulting in a silent link failure.
llvm-svn: 141809
2011-10-12 20:35:48 +00:00
Rafael Espindola
2d21ab024e
Add returns_twice to functions that are known to return twice. This implements
...
the same behavior of gcc by keeping the attribute out of the function type.
llvm-svn: 141803
2011-10-12 19:51:18 +00:00
Ted Kremenek
6effcb5082
Fix typo in name of diagnostic.
...
llvm-svn: 141793
2011-10-12 18:03:37 +00:00
Douglas Gregor
6a0e23ff8b
Teach __has_nothrow_assign not to complain about access (GCC and EDG
...
ignore access entirely for it) and not to crash on assignment operator
templates. Fixes PR11110.
llvm-svn: 141777
2011-10-12 15:40:49 +00:00
Richard Smith
fd53aaf7e7
constexpr: don't consider class types with mutable members to be literal types.
...
The standard doesn't allow this, but mutable constexpr variables break the
semantics so badly that we can't reasonably accept them.
llvm-svn: 141768
2011-10-12 05:08:15 +00:00
Fariborz Jahanian
fa643c8f3b
objc: note location of the previously declared
...
property in the diagnostic.
llvm-svn: 141745
2011-10-12 00:00:57 +00:00
John McCall
50a2c2c19d
Catch placeholder types in DefaultLvalueConversion
...
and DefaultFunctionArrayLvalueConversion. To prevent
significant regression for should-this-be-a-call fixits,
and to repair some such regression from the introduction of
bound member placeholders, make those placeholder checks
try to build calls appropriately. Harden the build-a-call
logic while we're at it.
llvm-svn: 141738
2011-10-11 23:14:30 +00:00
John McCall
3cec19f925
Rename SemaCXXCast.cpp to SemaCast.cpp.
...
llvm-svn: 141686
2011-10-11 17:38:55 +00:00
Alexis Hunt
77c1f9f888
Get rid of ShouldDeleteMoveConstructor.
...
llvm-svn: 141650
2011-10-11 06:43:29 +00:00
Alexis Hunt
1bc6f71ebc
Consolidate copy constructor deletion into ShouldDeleteSpecialMember.
...
llvm-svn: 141645
2011-10-11 04:55:36 +00:00
Eli Friedman
df14b3a837
Initial implementation of __atomic_* (everything except __atomic_is_lock_free).
...
llvm-svn: 141632
2011-10-11 02:20:01 +00:00
Francois Pichet
9a57fb5734
[Microsoft] If -fms-compatibility, then downgrade missing typename error to warning at function prototype scope.
...
llvm-svn: 141630
2011-10-11 01:50:09 +00:00
Kaelyn Uhrain
85308c6ecd
Add typo correction for type names.
...
The main motivation was to do typo correction in C++ "new" statements,
though picking it up in other places where type names are expected was
pretty much a freebie.
llvm-svn: 141621
2011-10-11 01:02:41 +00:00
Kaelyn Uhrain
8af2c9f5c6
Clean up DiagnoseInvalidRedeclaration a bit
...
llvm-svn: 141612
2011-10-11 00:28:52 +00:00
Kaelyn Uhrain
e1a9ff7934
Move a couple chunks of ActOnFunctionDeclarator to separate functions
...
llvm-svn: 141611
2011-10-11 00:28:49 +00:00
Kaelyn Uhrain
4dc695daea
Move some bool flags out of function parameter lists.
...
llvm-svn: 141610
2011-10-11 00:28:45 +00:00
Kaelyn Uhrain
0a32fcaf65
Only accept a typo correction if it doesn't trigger additional errors
...
llvm-svn: 141609
2011-10-11 00:28:39 +00:00
Douglas Gregor
2259d85a43
Don't crash in Sema::IsSimplyAccessible if the declaration is not a C++ class member. Fixes PR11108.
...
llvm-svn: 141600
2011-10-10 23:44:35 +00:00
Douglas Gregor
c7a3107baf
When performing a user-defined conversion via a constructor, be sure
...
to check whether the constructor is accessible. Fixes
<rdar://problem/10202900>.
llvm-svn: 141588
2011-10-10 22:41:00 +00:00
Ted Kremenek
bed648e0b0
Rework construction of CXXForRangeStmt not to recycle the same DeclRefExpr in multiple subexpressions. This breaks the tree structure
...
of the AST and completely breaks the CFG invariants.
Patch by Jim Goodnow II and reviewed by Richard Smith!
llvm-svn: 141586
2011-10-10 22:36:28 +00:00
Fariborz Jahanian
55b4e5c208
objc: err on a property designated both atomic and
...
nonatomic. // rdar://10260017
llvm-svn: 141580
2011-10-10 21:53:24 +00:00
Douglas Gregor
ab96bcf6ea
When substituting into a sizeof parameter pack expression in a context
...
where we can't expand (i.e., multi-level substitution), be sure to
substitute the pack with its level-reduced pack. Fixes PR10230.
llvm-svn: 141568
2011-10-10 18:59:29 +00:00
Richard Smith
caf3390d44
Constant expression evaluation refactoring:
...
- Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions,
and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert
behaviour.
- Factor out evaluation of bitfield bit widths.
- Fix a few places which would evaluate an expression twice: once to determine
whether it is a constant expression, then again to get the value.
llvm-svn: 141561
2011-10-10 18:28:20 +00:00
Douglas Gregor
0de5720737
Don't suggest 'noreturn' for function template instantiations, because
...
it might be wrong for other instantiations of the same function
template. Fixes PR10801.
llvm-svn: 141559
2011-10-10 18:15:57 +00:00
Kaelyn Uhrain
1a6eb99d45
Give nicer note when a member redeclaration has or lacks 'const'
...
llvm-svn: 141555
2011-10-10 18:01:37 +00:00
Fariborz Jahanian
9a81f848c8
objc: Some refactoring of overriding method decl. code
...
for future work.
llvm-svn: 141553
2011-10-10 17:53:29 +00:00
Douglas Gregor
6e8da6a291
Don't analyze comparisons in type- or value-dependent
...
subexpressions. Fixes PR10291.
llvm-svn: 141552
2011-10-10 17:38:18 +00:00
Douglas Gregor
556e5860f9
Per C++ [class.bit]p2, unnamed bit-fields are not members. Fixes PR10289.
...
llvm-svn: 141549
2011-10-10 17:22:13 +00:00
Richard Smith
f368fb40df
constexpr: Disable checking of constructor member initializer lists for
...
constexpr constructor templates. Such checking is optional, and currently hard
to get right since clang doesn't generate implicit member initializers until
instantiation (even for non-dependent members).
This is needed for clang to accept libstdc++ from g++4.6 in c++0x mode.
llvm-svn: 141547
2011-10-10 16:38:04 +00:00
Douglas Gregor
bcc9539323
Don't complain about qualified property or ivar access when the
...
qualifier itself is invalid. Crasher noticed by Fariborz.
llvm-svn: 141544
2011-10-10 16:09:49 +00:00
Douglas Gregor
b06fa540e8
When adding a direct initializer to a declaration, allow the
...
initializer to update the type of the declaration. For example, this
allows us to determine the size of an incomplete array from its
initializer. Fixes PR10288.
llvm-svn: 141543
2011-10-10 16:05:18 +00:00
Douglas Gregor
728d00b8e7
Parse the initializer for a class member after handling its
...
declarator, so that the declarator is in scope for the
initializer. Fixes PR9989.
llvm-svn: 141539
2011-10-10 14:49:18 +00:00
Douglas Gregor
877d4ebba4
Always add the built-in overload candidates for operators &&, ||, and
...
!. Fixes PR9865.
llvm-svn: 141537
2011-10-10 14:05:31 +00:00
Alexis Hunt
d6da876bac
Begin work consolidating ShouldDelete* functions.
...
Begin with just default constructors. One note is that as a side effect
of this, a conformance test was removed on the basis that this is almost
certainly a defect as with most of union initialization. As it is, clang
does not implement union initialization close to the standard as it's
quite broken as written. I hope to write a paper addressing the issues
eventually.
llvm-svn: 141528
2011-10-10 06:18:57 +00:00
Douglas Gregor
16e65616d6
Implement the restrictions in C++ [class.friend]p6, which disallow
...
defining a friend function with a qualified name or in a local
class. Fixes PR9853.
llvm-svn: 141524
2011-10-10 01:11:59 +00:00
Douglas Gregor
12340e5b18
Diagnose attempts to qualify the name of an instance variable or
...
property in an Objective-C++ member access expression. Fixes PR9759.
llvm-svn: 141522
2011-10-09 23:22:49 +00:00
Douglas Gregor
f7b98957ac
Push "out-of-line" declarations into scope when their lexical/semantic
...
redeclaration contexts are the same, as occurs within linkage
specifications. Fixes PR9162.
llvm-svn: 141521
2011-10-09 22:57:49 +00:00
Douglas Gregor
56636589ff
The effective context of a friend function is its lexical
...
context. Fixes PR9103.
llvm-svn: 141520
2011-10-09 22:38:36 +00:00
Douglas Gregor
f892c7fe60
For the various CF and NS attributes, don't complain if the parameter
...
or return types are dependent. Fixes PR9049.
llvm-svn: 141518
2011-10-09 22:26:49 +00:00
Douglas Gregor
0c83c8128b
Per the note in C++0x [temp.deduct.call]p4, don't attempt template
...
argument deduction against a function parameter that has no deducible
template parameters in it. Fixes PR8598.
llvm-svn: 141517
2011-10-09 22:06:46 +00:00
Douglas Gregor
e9d075e434
A friend template specialization is also dependent if any of its
...
template arguments are dependent. Fixes PR10913.
llvm-svn: 141515
2011-10-09 20:59:17 +00:00
Douglas Gregor
668d362503
Only allow taking the address of an expression of type 'overloaded
...
function type' when that expression is actually an overloaded function
reference (and not the address of an overloaded function
reference). Fixes PR11066.
llvm-svn: 141514
2011-10-09 19:10:41 +00:00
Douglas Gregor
bb64afcc39
Diagnose attempts to declare a non-static data member with a
...
non-identifier name. Fixes PR10839.
llvm-svn: 141513
2011-10-09 18:55:59 +00:00
Douglas Gregor
c4475e8cd6
When building source location information for an _Atomic type, be sure
...
to fill in the source locations for the underlying value type. Fixes
an intermittent crasher (due to uninitialized data) in the PCH test
for _Atomic types.
llvm-svn: 141512
2011-10-09 18:45:17 +00:00
Douglas Gregor
4d328b6e16
After instantiating a 'noexcept' expression, be sure to convert it to
...
a boolean value and check that it is a constant expression. Fixes
PR11084.
llvm-svn: 141511
2011-10-09 18:31:23 +00:00
Benjamin Kramer
ec44099cf8
Initialize the HadMultipleCandidates flag.
...
Found by valgrind.
llvm-svn: 141510
2011-10-09 17:58:25 +00:00
Fariborz Jahanian
9059124b41
objc: Do not warn about mismatch on Super's readonly property attribute,
...
related to a readwrite property, and
Sub's readwrite property. // rdar://9396329
llvm-svn: 141497
2011-10-08 17:45:33 +00:00
Benjamin Kramer
ec173a5c92
Silence a warning about casting away constness.
...
llvm-svn: 141496
2011-10-08 16:15:07 +00:00
NAKAMURA Takumi
82a351197f
Whitespace
...
llvm-svn: 141486
2011-10-08 11:31:46 +00:00
Fariborz Jahanian
13d3f86577
objc++: some minor cleanup and a test case
...
for atomic setters which requires assignment operator.
llvm-svn: 141415
2011-10-07 21:08:14 +00:00
Chandler Carruth
08d0491006
Hack in a workaround for PR11082 until we have a proper fix. This
...
un-breaks every glib-dependent compile with Clang.
I'm not sure this is even the best workaround, so suggestions welcome.
llvm-svn: 141381
2011-10-07 18:40:27 +00:00
John McCall
f937c023bf
Rename TagDecl::isDefinition -> isCompleteDefinition
...
for better self-documenting code, since the semantics
are subtly different from getDefinition().
llvm-svn: 141355
2011-10-07 06:10:15 +00:00
Fariborz Jahanian
9cd57a7061
objc: Improve on diagnostic when atomic proeprty is synthesized
...
on one accessor and user-provide with another.
llvm-svn: 141343
2011-10-06 23:47:58 +00:00
John McCall
9776e438cf
Move type-checking for C-style casts in C into the now-misnamed
...
SemaCXXCast.cpp. Should have no functionality change.
llvm-svn: 141336
2011-10-06 23:25:11 +00:00
Argyrios Kyrtzidis
c281c96675
Implicitly assume that a ObjC category to an unavailable interface is also unavailable;
...
only give an 'unavailable' error on the @implementation of the category. rdar://10234078
llvm-svn: 141335
2011-10-06 23:23:27 +00:00
Argyrios Kyrtzidis
9321ad3f97
When using an unavailable/deprecated interface Foo inside Foo's interface/implementation
...
don't emit unavailable errors.
llvm-svn: 141334
2011-10-06 23:23:20 +00:00
Eli Friedman
0dfb889575
Support for C1x _Atomic specifier (see testcase). This is primarily being committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic.
...
Thanks to Jeffrey Yasskin for the thorough review!
llvm-svn: 141330
2011-10-06 23:00:33 +00:00
Fariborz Jahanian
565ed7a4c1
objc++: For atomic properties of c++ class objec typet, appropriate
...
operator= is called. Issue a warning for non-trivial case until
runtime support is provided. // rdar://6137845
llvm-svn: 141302
2011-10-06 18:38:18 +00:00
Richard Smith
43a87fe86a
PR11067: A definition of a constexpr static variable doesn't need an initializer if the in-class declaration had one. Such a declaration must be initialized by a constant expression.
...
llvm-svn: 141279
2011-10-06 09:21:12 +00:00
Erik Verbruggen
2e657ffd8e
Added CXAvailability_NotAccessible to indicate that a declaration is available, but not accessible from the current code completion context.
...
llvm-svn: 141278
2011-10-06 07:27:49 +00:00
Peter Collingbourne
485b80fecc
OpenCL: add a non-standard extension, cl_clang_storage_class_specifiers,
...
which enables support for C99 storage-class specifiers.
This extension is intended to be used by implementations to implement
OpenCL C built-in functions.
llvm-svn: 141271
2011-10-06 03:01:00 +00:00
Argyrios Kyrtzidis
78181b4b45
Fix the rewriter, rdar://10234024.
...
llvm-svn: 141201
2011-10-05 19:37:56 +00:00
Abramo Bagnara
635ed24e1d
Added a flag to identify resolved overloaded function references.
...
llvm-svn: 141171
2011-10-05 07:56:41 +00:00
John McCall
b50451a188
Refactor the analysis of C++ cast expressions so that even
...
C-style and functional casts are built in SemaCXXCast.cpp.
Introduce a helper class to encapsulate most of the random
state being passed around, at least one level down.
llvm-svn: 141170
2011-10-05 07:41:44 +00:00
Fariborz Jahanian
48c69106e4
c: assignment/init of a function pointer whose function(s)
...
return to one which does not return (has noreturn attribute)
should warn as it is an unsafe assignment. // rdar://10095762
c++ already handles this. This is the c version.
llvm-svn: 141141
2011-10-05 00:05:34 +00:00
Douglas Gregor
b0e6c8a350
Don't allow an rvalue reference to bind to the result of a calling a
...
conversion function whose result type is an lvalue reference. The
initialization code already handled this properly, but overload
resolution was allowing the binding. Fixes PR11003 /
<rdar://problem/10233078>.
llvm-svn: 141137
2011-10-04 23:59:32 +00:00
Eli Friedman
606c103644
Remove a nonsensical bit of code from InitListChecker::getStructuredSubobjectInit which was increasing the reserved size for an init list past its maximum possible size. Fixes PR11056, a case where we were reserving a bunch of memory for arrays that was never actually used.
...
(No testcase because I don't think we have any way to actually write a testcase for this; the chosen value of NumElements has no effects on anything other than performance and memory usage.)
llvm-svn: 141106
2011-10-04 20:31:48 +00:00
Fariborz Jahanian
f2a7b0eade
objc: Turn diagnostic on property type mismatch in
...
continuation class into warning. // rdar://10231514
llvm-svn: 141100
2011-10-04 18:44:26 +00:00
Argyrios Kyrtzidis
52f53fb303
Improve location fidelity of objc decls.
...
-Add the location of the class name to all objc container decls, not just ObjCInterfaceDecl.
-Make objc decls consistent with the rest of the NamedDecls and have getLocation() point to the
class name, not the location of '@'.
llvm-svn: 141061
2011-10-04 04:48:02 +00:00
Fariborz Jahanian
ed1933b02b
objc arc: Suppress certain arc diagnostics on unavailable
...
functions. // rdar://10186536
llvm-svn: 141037
2011-10-03 22:11:57 +00:00
Abramo Bagnara
fd3a455ac7
Fixed source range for template implicit instantiations.
...
llvm-svn: 141018
2011-10-03 20:34:03 +00:00
Fariborz Jahanian
082a6a14a5
objc++: Accessing explicit property of reference type need
...
not bind to a temporary. Fixes //rdar://10188258
llvm-svn: 141009
2011-10-03 17:58:21 +00:00
Rafael Espindola
70107f989c
Propagate __attribute__((returns_twice)) from C to IL.
...
llvm-svn: 141002
2011-10-03 14:59:42 +00:00
Argyrios Kyrtzidis
b8c3aaf479
Allow getting all source locations of selector identifiers in a ObjCMethodDecl.
...
Instead of always storing all source locations for the selector identifiers
we check whether all the identifiers are in a "standard" position; "standard" position is
-Immediately before the arguments: -(id)first:(int)x second:(int)y;
-With a space between the arguments: -(id)first: (int)x second: (int)y;
-For nullary selectors, immediately before ';': -(void)release;
In such cases we infer the locations instead of storing them.
llvm-svn: 140989
2011-10-03 06:37:04 +00:00
Argyrios Kyrtzidis
a6011e25a1
Allow getting all source locations of selector identifiers in a ObjCMessageExpr.
...
Instead of always storing all source locations for the selector identifiers
we check whether all the identifiers are in a "standard" position; "standard" position is
-Immediately before the arguments: [foo first:1 second:2]
-With a space between the arguments: [foo first: 1 second: 2]
-For nullary selectors, immediately before ']': [foo release]
In such cases we infer the locations instead of storing them.
llvm-svn: 140987
2011-10-03 06:36:51 +00:00
Argyrios Kyrtzidis
59ad1e3f57
ArrayRef'ize ObjCMessageExpr
...
llvm-svn: 140986
2011-10-03 06:36:45 +00:00
Argyrios Kyrtzidis
dfd6570643
Pass from the parser the locations of selector identifiers when creating
...
objc method decls.
They are not stored in the AST yet.
llvm-svn: 140984
2011-10-03 06:36:36 +00:00
Argyrios Kyrtzidis
3849394b81
Don't keep NumSelectorArgs in the ObjCMethodDecl, the number can be derived from the selector.
...
llvm-svn: 140983
2011-10-03 06:36:29 +00:00
Argyrios Kyrtzidis
f934ec8b7b
Pass all the locations of the selector identifiers for a message expression from the parser.
...
They are not kept in the AST yet.
llvm-svn: 140982
2011-10-03 06:36:17 +00:00
Peter Collingbourne
7277fe8aed
CUDA: diagnose invalid calls across targets
...
llvm-svn: 140978
2011-10-02 23:49:40 +00:00
Peter Collingbourne
619a8c7df3
CUDA: add separate diagnostics for too few/many exec config args
...
llvm-svn: 140977
2011-10-02 23:49:29 +00:00
Peter Collingbourne
740afe276f
Add ConvertArgumentsForCall diagnostics for at least/at most n args
...
llvm-svn: 140976
2011-10-02 23:49:20 +00:00
Peter Collingbourne
34a20b081e
CUDA: diagnose unconfigured calls to global functions
...
llvm-svn: 140975
2011-10-02 23:49:15 +00:00
John McCall
a55902bf98
Parse attributes written in an ObjC method parameter type as
...
attributes on the parameter declaration.
llvm-svn: 140944
2011-10-01 09:56:14 +00:00
John McCall
42856de542
Hey, maybe we shouldn't silently ignore decl attributes
...
on declarators written as types.
llvm-svn: 140931
2011-10-01 05:17:03 +00:00
Richard Smith
eb3c10c248
constexpr: semantic checking for constexpr functions and constructors. Based in
...
part on patches by Peter Collingbourne.
We diverge from the C++11 standard in a few areas, mostly related to checking
constexpr function declarations, and not just definitions. See WG21 paper
N3308=11-0078 for details.
Function invocation substitution is not available in this patch; constexpr
functions cannot yet be used from within constant expressions.
llvm-svn: 140926
2011-10-01 02:31:28 +00:00
John McCall
e4fe245716
Allow the results of cf_returns_not_retained function
...
calls, or calls to audited functions without an explicit
return attribute, to be casted without a bridge cast.
Tie this mechanism in with the existing exceptions to
the cast restrictions. State those restrictions more
correctly and generalize.
llvm-svn: 140912
2011-10-01 01:01:08 +00:00
Argyrios Kyrtzidis
201d377109
Mark a TagDecl when it is free standing (e.g. "struct foo;")
...
llvm-svn: 140894
2011-09-30 22:11:31 +00:00
Fariborz Jahanian
044a5be6fb
objc arc: allow objc_returns_inner_pointer on methods that return
...
a reference type, since inner reference is much like an inner pointer.
// rdar://10139365
llvm-svn: 140880
2011-09-30 20:50:23 +00:00
Benjamin Kramer
7827da0e75
Fix compiler warning about && in ||.
...
This time the warning found an actual bug, we don't want to handle
force_align_arg_pointer differently than __force_align_arg_pointer__.
llvm-svn: 140877
2011-09-30 20:32:22 +00:00
Eli Friedman
271002fc99
Support dllimport and dllexport on x86-64 Windows. PR10978. Patch by Ruben Van Boxem.
...
llvm-svn: 140871
2011-09-30 18:53:25 +00:00
Argyrios Kyrtzidis
12afd70370
[libclang] Introduce CXCursor_CXXAccessSpecifier for C++'s public:/private:/protected: specifiers.
...
Patch by Paolo Capriotti!
llvm-svn: 140864
2011-09-30 17:58:23 +00:00
John McCall
32f5fe1467
Add explicit attributes to mark functions as having had their
...
CoreFoundation object-transfer properties audited, and add a #pragma
to cause them to be automatically applied to functions in a particular
span of code. This has to be implemented largely in the preprocessor
because of the requirement that the region be entirely contained in
a single file; that's hard to impose from the parser without registering
for a ton of callbacks.
llvm-svn: 140846
2011-09-30 05:12:12 +00:00
Richard Smith
7cd25b2836
constexpr functions are implicitly const. More tests to follow.
...
llvm-svn: 140831
2011-09-30 00:45:47 +00:00
Richard Smith
7b729cdbff
Suggest adding 'constexpr' if the GNU extension for in-class initializers for static const float members is used in C++11 mode.
...
llvm-svn: 140828
2011-09-30 00:33:19 +00:00
Richard Smith
256336d9ab
Mark the ExtWarn for in-class initialization of static const float members as a GNU extension. Don't extend the scope of this extension to all literal types in C++0x mode.
...
llvm-svn: 140820
2011-09-29 23:18:34 +00:00
Fariborz Jahanian
6b854c5d37
Minor refactoring. Enumerators may inherit the deprecated/unavailable
...
attributes from the enumeration type.
// rdar://10201690
llvm-svn: 140818
2011-09-29 22:45:21 +00:00
Richard Smith
ee6311df69
In C++0x, static const volatile data members cannot be initialized in-class.
...
llvm-svn: 140809
2011-09-29 21:28:14 +00:00
Richard Smith
2316cd8b79
constexpr: semantic checking for constexpr variables.
...
We had an extension which allowed const static class members of floating-point type to have in-class initializers, 'as a C++0x extension'. However, C++0x does not allow this. The extension has been kept, and extended to all literal types in C++0x mode (with a fixit to add the 'constexpr' specifier).
llvm-svn: 140801
2011-09-29 19:11:37 +00:00
Fariborz Jahanian
d71061298c
c - Enumerators may inherit the deprecated/unavailable
...
attributes from the enumeration type.
// rdar://10201690
llvm-svn: 140800
2011-09-29 18:40:01 +00:00
John McCall
f1e8b34f6c
Add an ns_bridged attribute, used to specify that a
...
pointer to the annotated struct type can be used as an
Objective-C object pointer. If an argument is given, the
type is actually "toll-free bridged" to the specific type
named there, rather than just to 'id'.
For now, we cannot rely on all types being so annotated,
and we'll always have to have exceptions for things like
CFTypeRef (aka const void*), but this is clearly a good
foundation for improving toolage in this area.
llvm-svn: 140779
2011-09-29 07:17:38 +00:00
Ted Kremenek
7fd1723619
Like IBOutletCollection, it only makes sense to apply the IBOutlet annotation to Objective-C object types. Fixes <rdar://problem/10142685>.
...
llvm-svn: 140778
2011-09-29 07:02:25 +00:00
Ted Kremenek
6e302b2e6e
Do not warn about empty format strings when there are no data arguments. Fixes <rdar://problem/9473155>.
...
llvm-svn: 140777
2011-09-29 05:52:16 +00:00
David Blaikie
7833b7db1f
Unnecessary else
...
llvm-svn: 140775
2011-09-29 04:06:47 +00:00
Fariborz Jahanian
97676979a7
objc arc: Diagnose block pointer type mismatch when
...
some arguments types are ns_consumed and some otherwise
matching types are not. This is objc side of
// rdar://10187884
llvm-svn: 140729
2011-09-28 21:52:05 +00:00
Fariborz Jahanian
600ba208ab
objc++ arc: Diagnose block pointer type mismatch when
...
some arguments types are ns_consumed and some otherwise
matching types are not. This fixes the objc++ side only *auch*.
// rdar://10187884
llvm-svn: 140717
2011-09-28 20:22:05 +00:00
Ted Kremenek
3f443a71dc
Tweak -Wobjc-missing-super-calls to not warning about missing [super dealloc] when in GC-only mode, and to not warning about missing [super finalize] when not using GC.
...
llvm-svn: 140713
2011-09-28 19:32:29 +00:00
Argyrios Kyrtzidis
83c337d600
For __weak/__strong/etc. ownership attributes, don't macro expand them in diagnostics.
...
llvm-svn: 140711
2011-09-28 18:35:06 +00:00
Eli Friedman
9ab36372db
PR11002: Make sure we emit sentinel warnings with a valid source location. (Ideally, we want to use the location returned by getLocForEndOfToken, but that is not always successful.)
...
llvm-svn: 140658
2011-09-27 23:46:37 +00:00
Ted Kremenek
ab2dcc8de6
Include prefix with default synthesized ivars.
...
llvm-svn: 140657
2011-09-27 23:39:40 +00:00
Douglas Gregor
75acd925d0
Only print _Bool as 'bool' when 'bool' is defined as an object-like
...
macro whose only replacement token is '_Bool'.
llvm-svn: 140656
2011-09-27 23:30:47 +00:00
Douglas Gregor
c0b07286cf
When 'bool' is not a built-in type but is defined as a macro, print
...
'bool' rather than '_Bool' within types, to make things a bit more
readable. Fixes <rdar://problem/10063263>.
llvm-svn: 140650
2011-09-27 22:38:19 +00:00
Fariborz Jahanian
ac8dbf0fc7
objcetive-c-arc: When overriding a method, its ns_consumed patameter
...
attribute must match its overriden method. Same also for
ns_returns_retained/not_retained on the result type.
This is one half of // rdar://10187884
llvm-svn: 140649
2011-09-27 22:35:36 +00:00
Eli Friedman
be4b363060
Get rid of useless helper Sema::CastCategory.
...
llvm-svn: 140642
2011-09-27 21:58:52 +00:00
Douglas Gregor
486b74e596
Revert r139989 and r140031, which implemented the Objective-C type
...
system change in <rdar://problem/10109725> that allows conversion from
'self' in class methods to the root of the class's hierarchy. This
conversion rule is a hack that has non-trivial repurcussions
(particularly with overload resolution).
llvm-svn: 140605
2011-09-27 16:10:05 +00:00
Bill Wendling
d9dcf18cb0
Revert r140589. It was causing failures during llvm compilation:
...
llvm[1]: Compiling CommandLine.cpp for Debug+Asserts build
if /Users/void/llvm/llvm-opt.obj/Release+Asserts/bin/clang++ -I/Users/void/llvm/llvm.obj/include -I/Users/void/llvm/llvm.obj/lib/Support -I/Users/void/llvm/llvm.src/include -I/Users/void/llvm/llvm.src/lib/Support -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -g -fno-exceptions -fno-common -Woverloaded-virtual -Wcast-qual -m64 -Wall -W -Wno-unused-parameter -Wwrite-strings -c -MMD -MP -MF "/Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.d.tmp" -MT "/Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.o" -MT "/Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.d" /Users/void/llvm/llvm.src/lib/Support/CommandLine.cpp -o /Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.o ; \
then /bin/mv -f "/Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.d.tmp" "/Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.d"; else /bin/rm "/Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.d.tmp"; exit 1; fi
In file included from /Users/void/llvm/llvm.src/lib/Support/CommandLine.cpp:25:
/Users/void/llvm/llvm.src/include/llvm/Support/system_error.h:690:14: error: unknown type name 'make_error_condition'; did you mean 'error_condition'?
{*this = make_error_condition(_e);}
^~~~~~~~~~~~~~~~~~~~
error_condition
...
llvm-svn: 140599
2011-09-27 10:09:33 +00:00
Eli Friedman
f272d40d7c
PR11009: Fix a FIXME which was leading to an assertion failure with rvalue references.
...
llvm-svn: 140594
2011-09-27 01:11:35 +00:00
Kaelyn Uhrain
d889d2461f
Add typo correction for the type name in C++ "new" statements
...
llvm-svn: 140589
2011-09-27 00:33:13 +00:00
Fariborz Jahanian
698bd3113e
objc - don't complain about unimplemented property when conforming
...
protocol declares the property, as well as one of its superclasses.
Property will be implemented in the super class. // rdar://10120691
llvm-svn: 140586
2011-09-27 00:23:52 +00:00
Ted Kremenek
d41f346875
Fix regression of -Warray-bounds involving varargs functions [PR 11007].
...
llvm-svn: 140584
2011-09-26 23:36:13 +00:00
Fariborz Jahanian
0ee58d6b4b
objc - compare setter/property types using
...
hasSameUnqualifiedType in //rdar://10156674
llvm-svn: 140576
2011-09-26 22:59:09 +00:00
Fariborz Jahanian
23ef165920
objc - in matching setter argument type to its property type,
...
ingore the type qualifiers. // rdar://10156674
llvm-svn: 140571
2011-09-26 22:12:27 +00:00
Fariborz Jahanian
6d5d6a277a
objc-arc: mark functions which return types which can't be dealt with
...
in arc mode and are in system headers as unavailable.
// rdar://10186625
llvm-svn: 140565
2011-09-26 21:23:35 +00:00
Eli Friedman
d8d7a37437
CheckStringInit has side effects; make sure we don't run it in VerifyOnly mode, at least for the moment. <rdar://problem/10185490>.
...
Sebastian, please take a look at this; I'm not entirely sure it is the right thing to do.
llvm-svn: 140552
2011-09-26 19:09:09 +00:00
Eli Friedman
ed0f9168de
Fix a typo in the new VerifyOnly handling in SemaInit. No visible difference at the moment, as far as I can tell.
...
llvm-svn: 140546
2011-09-26 18:53:43 +00:00
David Blaikie
b5784324b3
Rename DiagnosticInfo to Diagnostic as per issue 5397
...
llvm-svn: 140493
2011-09-26 01:18:08 +00:00
David Blaikie
9c902b5502
Rename Diagnostic to DiagnosticsEngine as per issue 5397
...
llvm-svn: 140478
2011-09-25 23:23:43 +00:00
Benjamin Kramer
afe718f373
Add a missing increment to avoid infinite looping in the regression test.
...
Also make sure we set the error flag when correcting a typo.
llvm-svn: 140466
2011-09-25 02:41:26 +00:00
Benjamin Kramer
c9d78d7444
Update CMake build.
...
llvm-svn: 140462
2011-09-24 18:21:37 +00:00
Sebastian Redl
a72462cdf4
Add a special note for overload resolution when an initializer list argument
...
cannot be converted.
This is in preparation for overload resolution of initializer lists.
Currently, you will always get this message when you try to pass an init
list to an overloaded function.
llvm-svn: 140461
2011-09-24 17:48:32 +00:00
Sebastian Redl
a74948d347
Correctly parse braced member initializers (even in delayed parsing) and correctly pass
...
the information on to Sema. There's still an incorrectness in the way template instantiation
works now, but that is due to a far larger underlying representational problem.
Also add a test case for various list initialization cases of scalars, which test this
commit as well as the previous one.
llvm-svn: 140460
2011-09-24 17:48:25 +00:00
Sebastian Redl
12757ab4cb
Treat list-initialization of scalars as a first-class citizen in C++11.
...
Allow empty initializer lists for scalars, which mean value-initialization.
Constant evaluation for single-element and empty initializer lists for scalars.
Codegen for empty initializer lists for scalars.
Test case comes in next commit.
llvm-svn: 140459
2011-09-24 17:48:14 +00:00
Sebastian Redl
b49c46c25c
Give InitListChecker a verification-only mode, where it neither emits diagnostics nor
...
builds a semantic (structured) initializer list, just reports on whether it can match
the given list to the target type.
Use this mode for doing init list checking in the initial step of initialization, which
will eventually allow us to do overload resolution based on the outcome.
llvm-svn: 140457
2011-09-24 17:48:00 +00:00
Sebastian Redl
7de1fb410c
In Initialization, add step kind SK_ListConstructorCall (list-initialization
...
resolves to a constructor call in C++11) and failure kind
FK_ListInitializationFailed (early InitListChecker run failed).
llvm-svn: 140456
2011-09-24 17:47:52 +00:00
Sebastian Redl
a846cac01b
Inline Sema::CheckInitList into its only user.
...
llvm-svn: 140455
2011-09-24 17:47:46 +00:00