Commit Graph

12195 Commits

Author SHA1 Message Date
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
Eli Friedman 5e9534b0ae Rewrite parts of MS ABI C++ layout. Based on work by r4start; I ended up doing this while I was trying to review his patch.
llvm-svn: 142325
2011-10-18 00:55:28 +00:00
John McCall 95ff270ee9 Fix several bugs with #pragma clang arc_cf_code_audited and macros.
llvm-svn: 142324
2011-10-18 00:44:04 +00:00
Argyrios Kyrtzidis 697729a7de Revert r142311, -mios-simulator-version-min does not work correctly.
llvm-svn: 142322
2011-10-18 00:22:49 +00:00
Argyrios Kyrtzidis 7e16493c9b Remove the hack where we sniff the __IPHONE_OS_VERSION_MIN_REQUIRED define.
We can use -mios-simulator-version-min now. rdar://10218700

llvm-svn: 142311
2011-10-17 23:41:26 +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
Argyrios Kyrtzidis ffe8b1c7be [arcmt] In ARC default for properties is 'strong' so just remove a 'retain' if possible,
instead of changing it to 'strong'. rdar://9984862.

llvm-svn: 142304
2011-10-17 23:14:16 +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
Eli Friedman cc66a2b067 Add missing newline.
llvm-svn: 142285
2011-10-17 21:48:31 +00:00
Ted Kremenek a08713ce86 Move about 20 random diagnostics under -W flags. Patch by Ahmed Charles!
llvm-svn: 142284
2011-10-17 21:47:53 +00:00
Eli Friedman a4c2602b71 Initial implementation of __atomic_is_lock_free. The input is the size of an atomic type rather than an atomic type itself just to save some implementation pain; I can change that if it seems worthwhile.
I think this is the last hook needed for <atomic> besides defines for ATOMIC_CHAR_LOCK_FREE and friends.

llvm-svn: 142281
2011-10-17 21:44:23 +00:00
DeLesley Hutchins 30abeb1680 Substitute for arguments in method calls -- functionality
llvm-svn: 142267
2011-10-17 21:38:02 +00:00
Richard Smith b12bf69769 Refactor __attribute__ parsing, and add a diagnostic if the r_paren at the end
of an attrib is missing. gcc does not allow the closing parenthesis to be omitted.

llvm-svn: 142255
2011-10-17 21:20:17 +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
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
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
Douglas Gregor 50cefbf212 When we end up having to parse the initializer of a C++ member early
in -fms-extensions mode, make sure we actually use that initializer
after having handled the declaration. Fixes PR11150.

llvm-svn: 142195
2011-10-17 17:09:53 +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
Douglas Gregor 71129d5e9e When building a module, use the macro definitions on the command line
as part of the hash rather than ignoring them. This means we'll end up
building more module variants (overall), but it allows configuration
macros such as NDEBUG to work so long as they're specified via command
line. More to come in this space.

llvm-svn: 142187
2011-10-17 14:55:37 +00:00
Erik Verbruggen fd979b1eaf Fixed merge-mistake where ActOnAccessSpecifier was called twice for every access specifier. The testcase has been changed to catch this too.
llvm-svn: 142186
2011-10-17 09:54:52 +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
Chandler Carruth 01ca696581 Add a testcase for r142121 based on an idea from Richard Smith. Thanks!
llvm-svn: 142160
2011-10-16 21:33:06 +00:00
Richard Smith 725810a2bb Split apart the state accumulated during constant expression evaluation and the
end result. Use this split to propagate state information and diagnostics
through more of constant expression evaluation.

llvm-svn: 142159
2011-10-16 21:26:27 +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 b92a877e31 Prove that non-overloaded function calls using init list arguments work.
llvm-svn: 142144
2011-10-16 18:19:11 +00:00
David Blaikie e4e9766e3c Remove the leftover partial comment.
llvm-svn: 142138
2011-10-16 14:41:13 +00:00
Chandler Carruth 454de773e1 I fixed this with r142127; these notes now make sense even w/o the caret.
llvm-svn: 142129
2011-10-16 09:41:04 +00:00
Chandler Carruth 9e8ce4ccb9 Now that macro expansion notes are real notes and go through the same
formatting as any other diagnostic, they will be properly line wrapped and
otherwise pretty printed. Let's take advantage of that and the new factoring to
add some helpful information to them (much like template backtrace notes and
other notes): the name of the macro whose expansion is being noted. This makes
a world of difference if caret diagnostics are disabled, making the expansion
notes actually useful in this case. It also helps ensure that in edge cases the
information the user needs is present. Consider:

% nl -ba t5.cc
     1  #define M(x, y, z) \
     2    y
     3
     4  M(
     5    1,
     6    2,
     7    3);

We now produce:
% ./bin/clang -fsyntax-only t5.cc
t5.cc:6:3: error: expected unqualified-id
  2,
  ^
t5.cc:2:3: note: expanded from macro: M
  y
  ^
1 error generated.

Without the added information in the note, the name of the macro being expanded
would never be shown.

This also deletes a FIXME to use the diagnostic formatting. It's not yet clear
to me that we *can* do this reasonably, and the production of this message was
my primary goal here anyways.

I'd love any comments or suggestions on improving these notes, their wording,
etc. Currently, I need to make them provide more helpful information in the
presence of a token-pasting buffer, and I'm pondering adding something along
the lines of "expanded from argument N of macro: ...".

llvm-svn: 142127
2011-10-16 09:30:08 +00:00
Chandler Carruth dc2f257680 Now that the structure of this is more reasonably laid out, fix a long
standing deficiency: we were providing no macro backtrace information
whenever caret diagnostics were turned off. This sinks the logic for
suppressing the code snippet and caret to the code that actually prints
tho code snippet and caret. Along the way, clean up the naming of
functions, remove some now fixed FIXMEs, and generally improve the
wording and logic of this process.

Add a test case exerecising this functionality. It is notable that the
resulting messages are extremely low quality. I'm working on a follow-up
patch that should address this and have left a FIXME in the test case.

llvm-svn: 142120
2011-10-16 07:20:28 +00:00
Chandler Carruth 5371981593 Add a prefix to the existing test to prepare for more tests of other
backtrace behavior.

llvm-svn: 142119
2011-10-16 07:20:23 +00:00
Chandler Carruth 33d64bf8e5 Fold two run lines into a single logical one, and move them down below
the important code in this test to make the test more stable. Now adding
further tests won't shift the line numbers occuring in the diagnostic
output.

llvm-svn: 142118
2011-10-16 07:20:21 +00:00
Chandler Carruth 322db385ac Rename this test to a more general name in preparation for adding more
tests to it to cover more of the macro bactrace functionality.

llvm-svn: 142116
2011-10-16 06:55:30 +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
Richard Smith 5d164bc5e0 Implement -Wc++98-compat warnings for the parser.
llvm-svn: 142056
2011-10-15 05:09:34 +00:00
Richard Smith 6b46488ff2 Testcase for half of r142048.
llvm-svn: 142053
2011-10-15 04:11:50 +00:00
Richard Smith a34f9c7fd5 Use of override keywords in C++98 should produce a warning by default.
llvm-svn: 142050
2011-10-15 04:01:16 +00:00
Eli Friedman 27ef75b0be Handle an edge case involving the conditional operator and throw expressions. PR10582.
llvm-svn: 142047
2011-10-15 02:10:40 +00:00
Richard Smith acd4d3d52a -Wc++98-compat warnings for the lexer.
This also adds a -Wc++98-compat-pedantic for warning on constructs which would
be diagnosed by -std=c++98 -pedantic (that is, it warns even on C++11 features
which we enable by default, with no warning, in C++98 mode).

llvm-svn: 142034
2011-10-15 01:18:56 +00:00
Peter Collingbourne 60188eb8bf Add c_alignas and cxx_alignas features
llvm-svn: 142020
2011-10-14 23:44:46 +00:00
Anton Korobeynikov f82017f3fe Missed tests for half FP support
llvm-svn: 142017
2011-10-14 23:32:50 +00:00
Eli Friedman 4b72fddd99 Misc fixes for atomics. Biggest fix is doing alignment correctly for _Atomic types.
llvm-svn: 142002
2011-10-14 20:59:01 +00:00
Richard Smith f679b5b6a6 -Wc++98-compat: warn on C++11 attributes and alignas.
llvm-svn: 141999
2011-10-14 20:48:27 +00:00