Commit Graph

19062 Commits

Author SHA1 Message Date
Aaron Ballman b7243381c2 Added the attribute name to the err_attribute_wrong_number_arguments diagnostic for clarity; updated almost all of the affected test cases.
Thanks to Fariborz Jahanian for the suggestion!

llvm-svn: 186980
2013-07-23 19:30:11 +00:00
Richard Trieu 79b45389c3 Add new diagnostic messages when too many arguments are presented to a
function-like macro.  Clang will attempt to correct the arguments by detecting
braced initializer lists:

1) If possible, suggest parentheses around arguments
containing braced lists which will give the proper number of arguments.
2) If a braced list is detected at the start of a macro argument, it cannot be
corrected by parentheses.  Instead, just point out the location of these
braced lists.

llvm-svn: 186971
2013-07-23 18:01:49 +00:00
Rafael Espindola 8c4245455a Remove the -ccc-echo option that is now unused.
llvm-svn: 186970
2013-07-23 17:58:53 +00:00
Argyrios Kyrtzidis 0661a71698 [libclang] Expose the rest of the array types.
Patch by Che-Liang Chiou!

llvm-svn: 186967
2013-07-23 17:36:21 +00:00
Aaron Ballman 086e428b5b Going back to using getName for consistency.
llvm-svn: 186966
2013-07-23 17:35:26 +00:00
Hans Wennborg a93246b265 Expand test/Driver/at_file.c test to check that PR16209 is fixed.
It was fixed by r186603.

llvm-svn: 186962
2013-07-23 17:26:56 +00:00
Jordan Rose 9b3d2c0260 Remove line number from test/Analysis/crash-trace.c.
...and hopefully, finally, unbreak buildbots.

llvm-svn: 186953
2013-07-23 16:12:18 +00:00
Jordan Rose 440ab0e2ae Mark test/Analysis/crash-trace.c as requiring crash recovery.
This plus Rafael's fix at r186943 should keep all the buildbots happy.

llvm-svn: 186950
2013-07-23 16:02:54 +00:00
Rafael Espindola 33c37f67df Convert another test to -###.
llvm-svn: 186949
2013-07-23 15:57:21 +00:00
Aaron Ballman b06c690c5d Fixing the build bots from the previous commit.
llvm-svn: 186947
2013-07-23 15:21:34 +00:00
Rafael Espindola f9bc4a02c7 Add missing quotes for -###.
Sorry about forgetting to include this in the previous patch.

llvm-svn: 186946
2013-07-23 15:20:22 +00:00
Rafael Espindola bf0d338e41 Use -### instead of -ccc-echo.
This is still a fairly odd test. Clang wants to run gcc for assembling. At
least with -### it only prints that instead of actually trying to run it with
-ccc-echo.

llvm-svn: 186945
2013-07-23 15:17:51 +00:00
Aaron Ballman 283ef4234c Replacing some manual diagnostic checks with an existing helper method. Adding missing test cases for the diagnostics.
llvm-svn: 186944
2013-07-23 15:16:00 +00:00
Rafael Espindola b914b58e9c Run %clang_cc1, it is the one that actually crashes.
llvm-svn: 186943
2013-07-23 15:02:28 +00:00
Aaron Ballman bcee83e99d Removed a redundant diagnostic and replaced it with a more standard one. Added a test case for the diagnostic.
llvm-svn: 186942
2013-07-23 14:54:24 +00:00
Aaron Ballman 2998227501 Consolidate several attribute argument diagnostics into a single, selectable diagnostic. This makes the diagnostic more consistent.
llvm-svn: 186940
2013-07-23 14:03:57 +00:00
Aaron Ballman 7ced167a09 Correcting the NSObject and Overloadable attribute diagnostics so that the count reported matches reality.
llvm-svn: 186936
2013-07-23 12:13:14 +00:00
Richard Smith f4198b7598 C++1y literal suffix support:
* Allow ns, us, ms, s, min, h as numeric ud-suffixes
 * Allow s as string ud-suffix

llvm-svn: 186933
2013-07-23 08:14:48 +00:00
Jordan Rose 316cdda54b [analyzer] Enable pseudo-destructor expressions.
These are cases where a scalar type is "destructed", usually due to
template instantiation (e.g. "obj.~T()", where 'T' is 'int'). This has
no actual effect and the analyzer should just skip over it.

llvm-svn: 186927
2013-07-23 02:15:20 +00:00
Jordan Rose a45ffe17c7 [analyzer] Add test for crash tracing (r186639)
llvm-svn: 186926
2013-07-23 02:15:16 +00:00
Jordan Rose 7b982b30c0 Revert "[analyzer] Add very limited support for temporary destructors"
The analyzer doesn't currently expect CFG blocks with terminators to be
empty, but this can happen when generating conditional destructors for
a complex logical expression, such as (a && (b || Temp{})). Moreover,
the branch conditions for these expressions are not persisted in the
state. Even for handling noreturn destructors this needs more work.

This reverts r186498.

llvm-svn: 186925
2013-07-23 02:15:11 +00:00
Matt Arsenault efb38192b0 Error on more illegal kernel argument types for OpenCL
bool, half, pointers and structs / unions containing any
of these are not allowed. Does not yet reject size_t and
related integer types that are also disallowed.

llvm-svn: 186908
2013-07-23 01:23:36 +00:00
Eli Bendersky e6cbf1c04f Make the nomathbuiltin.c test less demanding.
This should hopefully unbreak the Windows bots at http://bb.pgr.jp

llvm-svn: 186906
2013-07-23 01:09:17 +00:00
David Blaikie 613c69500d Further simplify test case from r186894
llvm-svn: 186905
2013-07-23 01:01:17 +00:00
Eli Friedman 088d39afc6 Integers which are too large should be an error.
Switch some warnings over to errors which should never have been warnings
in the first place.  (Also, a minor fix to the preprocessor rules for
integer literals while I'm here.)

llvm-svn: 186903
2013-07-23 00:25:18 +00:00
Adrian Prantl adaeb8947a Simplify testcase.
rdar://problem/14386148

llvm-svn: 186901
2013-07-23 00:21:48 +00:00
Eli Bendersky aefa5e2ff2 Add a -fno-math-builtin option to the Clang -cc1
llvm-svn: 186899
2013-07-23 00:13:01 +00:00
Fariborz Jahanian 9e543afe19 ObjectiveC migration. Better handle migration to conforming
protocols by ignoring cases where all protocol properties
and methods are optional.

llvm-svn: 186895
2013-07-22 23:50:04 +00:00
Adrian Prantl 52f5b2502f Debug Info: Acknowledge the alignment when locating byref block variables.
Fixes rdar://problem/14386148

llvm-svn: 186894
2013-07-22 23:44:26 +00:00
Eli Friedman d1eec9cc96 Testcase for PR16673.
llvm-svn: 186891
2013-07-22 23:30:13 +00:00
Enea Zaffanella c7cb48c4b9 Fixed implementation of C89 6.5.7 p3.
Warning should be emitted only for InitListExpr nodes.

llvm-svn: 186859
2013-07-22 19:10:20 +00:00
Fariborz Jahanian d0f6f79f4e Objective-C migration: Use NS_OPTIONS when enumerators
have shift/bitwise operators or are power of 2.

llvm-svn: 186856
2013-07-22 18:53:45 +00:00
Argyrios Kyrtzidis ec852d908f [arcmt] Only disable ARC in the second compilation if there were actually ARC errors in the checking phase.
rdar://14490204

llvm-svn: 186850
2013-07-22 18:13:54 +00:00
Richard Smith ccf0151b71 Add testcase for PR16134, which no longer crashes with ToT.
llvm-svn: 186849
2013-07-22 18:09:32 +00:00
Aaron Ballman bf5cf8c6ea This test was missing its -verify argument.
llvm-svn: 186847
2013-07-22 17:55:04 +00:00
Reid Kleckner e7de47efbe [ms-cxxabi] Emit linkonce complete dtors in TUs that need them
Based on Peter Collingbourne's destructor patches.

Prior to this change, clang was considering ?1 to be the complete
destructor and the base destructor, which was wrong.  This lead to
crashes when clang tried to emit two LLVM functions with the same name.

In this ABI, TUs with non-inline dtors might not emit a complete
destructor.  They are emitted as inline thunks in TUs that need them,
and they always delegate to the base dtors of the complete class and its
virtual bases.  This change uses the DeferredDecls machinery to emit
complete dtors as needed.

Currently in clang try body destructors can catch exceptions thrown by
virtual base destructors.  In the Microsoft C++ ABI, clang may not have
the destructor definition, in which case clang won't wrap the virtual
virtual base destructor calls in a try-catch.  Diagnosing this in user
code is TODO.

Finally, for classes that don't use virtual inheritance, MSVC always
calls the base destructor (?1) directly.  This is a useful code size
optimization that avoids emitting lots of extra thunks or aliases.
Implementing it also means our existing tests continue to pass, and is
consistent with MSVC's output.

We can do the same for Itanium by tweaking GetAddrOfCXXDestructor, but
it will require further testing.

Reviewers: rjmccall

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1066

llvm-svn: 186828
2013-07-22 13:51:44 +00:00
Enea Zaffanella 1aac546d31 Implement the part of C89 6.5.7 p3 requiring a constant initializer list
when initializing aggregate/union types, no matter if static or not.

llvm-svn: 186817
2013-07-22 10:58:26 +00:00
Richard Smith 35828f1db6 PR16288: A template is only missing a default template argument if it provides
any default template arguments, not if it inherits some.

llvm-svn: 186804
2013-07-22 03:31:14 +00:00
Richard Smith bc46e4341e Implement DR257 / fix PR16659:
A constructor for an abstract class does not call constructors for virtual
  base classes, so it is not an error if no initializer is present for the
  virtual base and the virtual base cannot be default initialized.

Also provide a (disabled by default, for now) warning for the case where a
virtual base class's initializer is ignored in an abstract class's constructor,
and address a defect in DR257 where it was not carried through to C++11's rules
for implicit deletion of special member functions.

Based on a patch by Maurice Bos.

llvm-svn: 186803
2013-07-22 02:56:56 +00:00
Richard Smith 4e155170e8 Test updates missed from r186799.
llvm-svn: 186800
2013-07-21 23:13:17 +00:00
Richard Smith 8d0dc31dca Tighten up the set of operator new/operator delete calls we're permitted to
optimize, to follow the permissions granted in N3664. Under those rules, only
calls generated by new-expressions and delete-expressions are permitted to be
optimized, and direct calls to ::operator new and ::operator delete must be
treated as normal calls.

llvm-svn: 186799
2013-07-21 23:12:18 +00:00
Lubos Lunak 1f490f3aea report unused-value warning also for warn_unused types
llvm-svn: 186793
2013-07-21 13:15:58 +00:00
Richard Smith 72d74057ea Add missing check for creating an instance of an abstract class through an
implicit conversion sequence.

llvm-svn: 186769
2013-07-20 19:41:36 +00:00
Richard Smith 070a5d6750 Undisable a test for a c++98-compat warning for inheriting constructors now that we implement them.
llvm-svn: 186768
2013-07-20 19:22:08 +00:00
Lubos Lunak edc138880d add type attribute warn_unused, for -Wunused-variable warnings (pr#14253)
The functionality is equivalent to the GCC attribute. Variables of tagged
types will be warned about as unused if they are not used in any way
except for possible (even non-trivial) ctors/dtors called. Useful for tagging
classes like std::string (which is not part of this commit).

llvm-svn: 186765
2013-07-20 15:05:36 +00:00
Lubos Lunak ba5ee4da1d avoid bogus warnings about "unknown" pragmas with -frewrite-includes (pr#14831)
llvm-svn: 186764
2013-07-20 14:30:01 +00:00
Lubos Lunak 4c22f6a695 fix sometimes incorrect line numbers in -frewrite-includes mode (pr#14795)
Every #include is surrounded by #if 0 in order to comment it out, which adds
lines. That is fixed up right after, but that all can be inside #if part
that is not processed, so fix up also after every end of a conditional part.

llvm-svn: 186763
2013-07-20 14:23:27 +00:00
Richard Trieu 8ed6f2aacf If a default argument is a dependent type, get the real type from the desugared
template.  Passing around dependent types can lead to integral arguments that
cannot be evaluated.

llvm-svn: 186757
2013-07-20 03:49:02 +00:00
Eli Friedman a54333264a Fix bug in computing POD-for-layout.
A class with a field of non-POD-for-layout type is not POD-for-layout.
This computation should not depend on whether the field is of POD type
in the language sense.

Fixes PR16537.

Patch by Josh Magee.

llvm-svn: 186741
2013-07-20 01:06:31 +00:00
Eli Friedman 75807f239e Make IgnoreParens() look through ChooseExprs.
This is the same way GenericSelectionExpr works, and it's generally a
more consistent approach.

A large part of this patch is devoted to caching the value of the condition
of a ChooseExpr; it's needed to avoid threading an ASTContext into
IgnoreParens().

Fixes <rdar://problem/14438917>.

llvm-svn: 186738
2013-07-20 00:40:58 +00:00