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