Commit Graph

13045 Commits

Author SHA1 Message Date
Ted Kremenek 3b204e4c2e Add some basic type checking for attributes ns_returns_retained and
cf_returns_retained. Currently this attribute can now be applied to any
Objective-C method or C function that returns a pointer or Objective-C object
type.

Modify the tablegen definition of diagnostic 'warn_attribute_wrong_decl_type' to
expect that the diagnostics infrastructure will add quotes around the attribute
name when appropriate. Alonq with this change, I modified the places where this
warning is issued to passed the attribute's IdentifierInfo* instead of having a
hard-coded C constant string.

llvm-svn: 71718
2009-05-13 21:07:32 +00:00
Ted Kremenek 2b77677322 Update checker build.
llvm-svn: 71716
2009-05-13 20:49:00 +00:00
Douglas Gregor bbbb02d463 Explicit instantiations of templates now instantiate the definitions
of class members (recursively). Only member classes are actually
instantiated; the instantiation logic for member functions and
variables are just stubs.

llvm-svn: 71713
2009-05-13 20:28:22 +00:00
Anders Carlsson 5879fbd933 Disable access control by default. It can be enabled with the -faccess-control option. When we have better support for it, we can enable it by default again.
llvm-svn: 71706
2009-05-13 19:49:53 +00:00
Ted Kremenek 4060be74d9 Add PostStmt::getStmtAs(). This unbreaks the build.
llvm-svn: 71701
2009-05-13 19:23:41 +00:00
Ted Kremenek bae777254a Enhance diagnostics value tracking logic for null dereferences and uninitialized values.
llvm-svn: 71700
2009-05-13 19:16:35 +00:00
Ted Kremenek a2d3093da7 Add ExplodedNode utility methods 'getLocationAs()' and 'getFirstPred()'
llvm-svn: 71699
2009-05-13 19:14:06 +00:00
Daniel Dunbar 8a35ef85d8 Driver: Emit an unsupported error on -iframework.
llvm-svn: 71698
2009-05-13 19:05:04 +00:00
Daniel Dunbar ffdb8439d7 ABI handling: Fix invalid assertion, it is possible for a valid
coercion to be specified which truncates padding bits. It would be
nice to still have the assert, but we don't have any API call for the
unpadding size of a type yet.

llvm-svn: 71695
2009-05-13 18:54:26 +00:00
Douglas Gregor f61eca93c0 Improve the semantic checking for explicit instantiations of
templates. In particular:
  - An explicit instantiation can follow an implicit instantiation (we
  were improperly diagnosing this as an error, previously).
  - In C++0x, an explicit instantiation that follows an explicit
  specialization of the same template specialization is ignored. In
  C++98, we just emit an extension warning.
  - In C++0x, an explicit instantiation must be in a namespace
  enclosing the original template. C++98 has no such requirement.

Also, fixed a longstanding FIXME regarding the integral type that is
used for the size of a constant array type when it is being instantiated.

llvm-svn: 71689
2009-05-13 18:28:20 +00:00
Ted Kremenek 5801f65a52 Fix crasher reported in PR 4209 caused by an invalid summary
generation when EvalObjCMessageExpr() did not resolve the
ObjCInterfaceDecl* for a receiver when the receiver's symbolic value
wasn't being explicitly tracked.

llvm-svn: 71685
2009-05-13 18:16:01 +00:00
Fariborz Jahanian 027b886a99 Some early declarations to support sentinel attribute on
message dispatches (and function calls later). No change in
functionality.

llvm-svn: 71683
2009-05-13 18:09:35 +00:00
Chris Lattner 939952c19c remove the obsolete -fprint-source-range-info option
llvm-svn: 71675
2009-05-13 17:08:18 +00:00
Fariborz Jahanian 1880136520 Removed 4-letter :) word in comment.
Used simple array for Selector build.

llvm-svn: 71674
2009-05-13 16:19:02 +00:00
Ted Kremenek 4554f9b134 Fix <rdar://problem/6880975> [format string] Assertion failed: (Arg < NumArgs && "Arg access out of range!").
For format string checking, only check the type of the format
specifier for non-vararg functions.

llvm-svn: 71672
2009-05-13 16:06:05 +00:00
Ted Kremenek 051a03d698 Fix crasher in CFRefCount.cpp reported by Nikita Zhuk due to recently added autorelease tracking.
llvm-svn: 71647
2009-05-13 07:12:33 +00:00
Chris Lattner ff96dd0301 Fix rdar://6880630 - # in _Pragma does not start a preprocessor directive.
llvm-svn: 71643
2009-05-13 06:10:29 +00:00
Chris Lattner c898a68998 convert test to use -verify
llvm-svn: 71642
2009-05-13 06:07:25 +00:00
Chris Lattner cfd0fadc75 rename test
llvm-svn: 71641
2009-05-13 06:07:04 +00:00
Chris Lattner b70f3de625 Fix rdar://6880951 by rejecting vectors of vectors.
It seems dubious to me that isIntegerType() returns true for
vectors of integers, but not complex integers.  This should 
probably be rethought, I'll file a bugzilla.

llvm-svn: 71640
2009-05-13 05:13:44 +00:00
Chris Lattner df24298b40 reject use of the GNU _Decimal32 extension with a diagnostic, not an abort.
rdar://6880104

llvm-svn: 71639
2009-05-13 05:02:08 +00:00
Chris Lattner 5868c03191 eli correctly points out that this code is dead, just rip it out for
now until someone does it right

llvm-svn: 71638
2009-05-13 04:52:12 +00:00
Chris Lattner afde259240 implement __sync_synchronize and __sync_lock_release,
rdar://6880573

llvm-svn: 71637
2009-05-13 04:46:13 +00:00
Chris Lattner 94578cba76 add support for __sync_nand_and_fetch and __sync_fetch_and_nand,
rdar://6880573

llvm-svn: 71636
2009-05-13 04:37:52 +00:00
Chris Lattner e2df3f9fe5 Fix rdar://6880874 - [sema] crash on array types with different index sizes
llvm-svn: 71634
2009-05-13 04:12:56 +00:00
Chris Lattner 851eb927d7 Fix rdar://6881069, a crash on a form of vector_size that we
don't support.  While it would be nice to support this eventually,
this form is not common at all (just seen in gcc testsuite) and
it might be better to model vector_size as a type attribute anyway.
For now just emit a nice error on it.

llvm-svn: 71633
2009-05-13 04:00:12 +00:00
Chris Lattner 46813bbfa2 Fix rdar://6880259 - invalid function name in block call (__NSConcreteGlobalBlock2)
by using the appropriate CGM interface instead of directly creating a global.

llvm-svn: 71617
2009-05-13 02:50:56 +00:00
Chris Lattner f160b5f9e1 When we expect two arguments but have zero, make sure to add
two empty arguments.  Also, add an assert so that this bug
manifests as an assertion failure, not a valgrind problem.

This fixes rdar://6880648 - [cpp] crash in ArgNeedsPreexpansion

llvm-svn: 71616
2009-05-13 00:55:26 +00:00
Fariborz Jahanian d9d6e6e039 Changed wording of warning when attribute is on
method definition.

llvm-svn: 71615
2009-05-13 00:47:33 +00:00
Douglas Gregor a1f4997368 Semantic analysis for explicit instantiation of class templates. We
still aren't instantiating the definitions of class template members,
and core issues 275 and 259 will both affect the checking that we do
for explicit instantiations (but are not yet implemented).

llvm-svn: 71613
2009-05-13 00:25:59 +00:00
Daniel Dunbar 98d7164ab0 Tweak wording
llvm-svn: 71611
2009-05-13 00:23:53 +00:00
Douglas Gregor 1b57ff32a8 Implement parsing for explicit instantiations of class templates, e.g.,
template class X<int>;

This also cleans up the propagation of template information through
declaration parsing, which is used to improve some diagnostics.

llvm-svn: 71608
2009-05-12 23:25:50 +00:00
Daniel Dunbar e83b560e06 Note a few more unsupported language extensions.
llvm-svn: 71607
2009-05-12 23:12:07 +00:00
Ted Kremenek 14fbc56a09 Update checker build.
llvm-svn: 71605
2009-05-12 22:44:02 +00:00
Chris Lattner d98e7cf7c1 improve the diagnostic for uses of the GCC "global variable in a register" extension.
This implements rdar://6880449 - improve diagnostic for usage of "global register variable" GCC extension

llvm-svn: 71599
2009-05-12 21:44:00 +00:00
Douglas Gregor 36312bb5ee Parser::ParseDeclarationOrFunctionDefinition no longer needs to accept
template parameters.

llvm-svn: 71598
2009-05-12 21:43:46 +00:00
Fariborz Jahanian 2bd617c46c Method attributes may only be specified on method
declarations.

llvm-svn: 71597
2009-05-12 21:36:23 +00:00
Douglas Gregor 2399628cea Refactor the parsing of declarations so that template declarations can
parse just a single declaration and provide a reasonable diagnostic
when the "only one declarator per template declaration" rule is
violated. This eliminates some ugly, ugly hackery where we used to
require thatn the layout of a DeclGroup of a single element be the
same as the layout of a single declaration.

llvm-svn: 71596
2009-05-12 21:31:51 +00:00
Chris Lattner e541ea3a61 implement l-value codegen of comma expr
llvm-svn: 71595
2009-05-12 21:28:12 +00:00
Chris Lattner e0be0dfced push GlobalDecl through enough of the CodeGenModule interfaces
to allow us to support generation of deferred ctors/dtors.
It looks like codegen isn't emitting a call to the dtor in 
member-functions.cpp:test2, but when it does, its body should
get emitted.

llvm-svn: 71594
2009-05-12 21:21:08 +00:00
Chris Lattner d035ebda2f add an initial stab at emitting deferred c++ inline functions. This handles static
functions and methods declared inline, but not ctors/dtors or methods not declared
inline (apparently my previous patch wasn't good enough).

llvm-svn: 71591
2009-05-12 21:02:27 +00:00
Chris Lattner eb7466d24a cleanups, no functionality change.
llvm-svn: 71590
2009-05-12 20:58:15 +00:00
Chris Lattner da7a0977d6 Method who have definitions in structs/classes are semantically inline.
Per the FIXME, it might be interesting to track whether the inline keyword
was also used on the method, but for now we don't do this.  Testcase pending.

llvm-svn: 71589
2009-05-12 20:55:07 +00:00
Chris Lattner bea5b622be static methods don't get this pointers.
llvm-svn: 71586
2009-05-12 20:27:19 +00:00
Chris Lattner e7834115eb revert my previous patch, I committed the wrong file.
llvm-svn: 71585
2009-05-12 20:26:52 +00:00
Douglas Gregor 2779733d0e Diagnostic wording fix, from Anders Johnsen
llvm-svn: 71584
2009-05-12 20:24:52 +00:00
Chris Lattner cd74ffa3eb static methods don't get this pointers.
llvm-svn: 71583
2009-05-12 20:21:39 +00:00
Ted Kremenek 1272f706ca Fix: <rdar://problem/6320065> false positive - init method returns an object owned by caller
Now 'init' methods are treated by the retain/release checker as
claiming their receiver and allocating a new object.

llvm-svn: 71579
2009-05-12 20:06:54 +00:00
Fariborz Jahanian e4128642a7 Fixed typos, used DenseSet for keeping track of
selectors which need use Nonfrgile API for
message dispatch.

llvm-svn: 71578
2009-05-12 20:06:41 +00:00
Douglas Gregor 9e0d21a444 Align the N/A in the C++ status table, from Anders Johnsen
llvm-svn: 71576
2009-05-12 18:36:58 +00:00