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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
David Blaikie
9c902b5502
Rename Diagnostic to DiagnosticsEngine as per issue 5397
...
llvm-svn: 140478
2011-09-25 23:23:43 +00:00
David Blaikie
aa347f9392
Removing a bunch of dead returns/breaks after llvm_unreachables.
...
llvm-svn: 140407
2011-09-23 20:26:49 +00:00
Douglas Gregor
b1fa148837
Don't propagate the 'availability' attribute through declaration
...
merging for overrides. One might want to make a method's availability
in a superclass different from that of its subclass. Fixes
<rdar://problem/10166223>.
llvm-svn: 140406
2011-09-23 20:23:42 +00:00
David Blaikie
83d382b1ca
Switch assert(0/false) llvm_unreachable.
...
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
David Blaikie
751c558d8e
ArrayRef-ifying the fields passed to Sema::ActOnFields
...
llvm-svn: 140293
2011-09-22 02:58:26 +00:00