Eli Friedman [Sun, 21 Dec 2008 01:15:32 +0000 (01:15 +0000)]
Fix for PR3246: an empty clobber list is the empty string, not a null
string.
That said, we should probably try and track down the correct clobber
lists for the targets that don't have them (PPC, ARM, and Sparc),
so that we can generate correct code.
Douglas Gregor [Sat, 20 Dec 2008 23:49:58 +0000 (23:49 +0000)]
Add support for member references (E1.E2, E1->E2) with C++ semantics,
which can refer to static data members, enumerators, and member
functions as well as to non-static data members.
Implement correct lvalue computation for member references in C++.
Compute the result type of non-static data members of reference type properly.
Eli Friedman [Sat, 20 Dec 2008 23:11:59 +0000 (23:11 +0000)]
Make VLAs usable, and make basic usage work correctly. Also, add a
simple test that actually does VLA codegen.
Note that despite the fact that the alloca isn't in the entry block, it
should dominate all uses; this is guaranteed by the restrictions on goto
into VLA scope in C99.
Strangely enough, name of ObjC class is not encoded into the
full encoding of the class which has an ivar of pointer to this
class. Its name is encoded in the type for the ivar in the
ivar-list metadata. This patch conforms to the above rule.
Zhongxing Xu [Sat, 20 Dec 2008 06:32:12 +0000 (06:32 +0000)]
Lazy bingding for region-store manager.
* Now Bind() methods take and return GRState* because binding could
also alter GDM.
* No variables are initialized except those declared with initial
values.
* failed C test cases are due to bugs in RemoveDeadBindings(),
which removes constraints that is still alive. This will be fixed in later
patch.
* default value of array and struct regions will be implemented in later patch.
Douglas Gregor [Thu, 18 Dec 2008 19:37:40 +0000 (19:37 +0000)]
Ultrasimplistic sketch for the parsing of C++ template-ids. This won't
become useful or correct until we (1) parse template arguments
correctly, (2) have some way to turn template-ids into types,
declarators, etc., and (3) have a real representation of templates.
Chris Lattner [Thu, 18 Dec 2008 07:27:21 +0000 (07:27 +0000)]
add a simple fast-path for the common case of [] and [4] in
array size declarators. No need to go through all the trouble
of parsing crazy things like [static const 4] when most code
doesn't need it.
Chris Lattner [Thu, 18 Dec 2008 06:50:14 +0000 (06:50 +0000)]
Clean up the C89/C++ warnings about C99 array features to not
emit duplicate diags (some in parser and some in sema) and to
warn about use of typequals in array sizes. This implements
PR2759.
Daniel Dunbar [Thu, 18 Dec 2008 04:52:14 +0000 (04:52 +0000)]
Allow ABI to use StructRet even for scalar values.
- Update comment to reflect fact that StructRet is now supported for
any type (modulo LLVM support).
- No functionality change, no scalar types currently use this
feature.
Ted Kremenek [Wed, 17 Dec 2008 23:52:11 +0000 (23:52 +0000)]
Rewrite PTHLexer::DiscardToEndOfLine() to not use GetToken and instead only read the bytes needed to determine if a token is not at the start of the line.
Ted Kremenek [Wed, 17 Dec 2008 23:08:31 +0000 (23:08 +0000)]
PTHLexer::isNextPPTokenLParen() no longer calls GetToken() and just reads the token kind from the token data buffer. This results in a minor speedup and reduces the dependency on GetToken().
Ted Kremenek [Wed, 17 Dec 2008 21:50:35 +0000 (21:50 +0000)]
CF-retain/release checker:
- Fix regression reported in <rdar://problem/6452745>. After a null check, null references to resources should not have a retain count. This regression was caused by removing the call to "GRTransferFuncs::EvalAssume" in BasicConstraintManager.
- Added a test case to test this behavior.
This patch will build the Records lazily per Steve's comments.
Note that one test duplicate-ivar-check.m will fail because I
need to re-implement duplicate ivar checking.
Ted Kremenek [Wed, 17 Dec 2008 19:42:34 +0000 (19:42 +0000)]
Fix <rdar://problem/6451816>:
- Because of the introduction of AnonTypedRegions when reasoning about casts, we
had a regression in the "symbolication" of variable values passed-by-reference
to a function. This is now fixed in CFRefCount.cpp (-checker-cfref) by
blasting through the layer of AnonTypedRegions when symbolicating the value of
the variable. This logic may get moved elsewhere. Note that this change
affects only -checker-cfref and not -checker-simple; eventually this logic
should get pulled out of CFRefCount.cpp into a more common place. All users
use -checker-cfref by default, and -checker-simple should probably just be
removed.
- Updated test 'Analysis/uninit-vals-ps.c' to only use -checker-cfref and added
a test case for this regression.
Douglas Gregor [Wed, 17 Dec 2008 16:48:01 +0000 (16:48 +0000)]
Make the injected-class-name of a C++ class a separate RecordDecl from the class itself, with a different scope. This eliminates some ownership issues, so that the RecordDecl only lives in a single context
Douglas Gregor [Wed, 17 Dec 2008 16:19:15 +0000 (16:19 +0000)]
Removed the warning
warning: statement was disambiguated as declaration
because it is currently firing in cases where the declaration would
not actually parse as a statement. We'd love to bring this warning
back if we can make it more accurate.
Ted Kremenek [Tue, 16 Dec 2008 22:13:33 +0000 (22:13 +0000)]
Add new GRWorkList class that uses two queues:
- one queue (FIFO) to queue up nodes at block entrances
- another queue (LIFO) to queue up other nodes
- The idea is to explore basic blocks to completion, but to do a BFS exploration of blocks.
Ted Kremenek [Tue, 16 Dec 2008 22:02:27 +0000 (22:02 +0000)]
ProgramPoint:
- Added four new ProgramPoint types that subclass PostStmt for use in
GRExprEngine::EvalLocation:
- PostOutOfBoundsCheckFailed
- PostUndefLocationCheckFailed
- PostNullCheckFailed
- PostLocationChecksSucceed
These were created because of a horribly subtle caching bug in EvalLocation
where a node representing an "bug condition" in EvalLocation (e.g. a null
dereference) could be re-used as the "non-bug condition" because the Store did
not contain any information to differentiate between the two. The extra
program points just disables any accidental caching between EvalLocation and
its callers.
GRExprEngine:
- EvalLocation now returns a NodeTy* instead of GRState*. This should be used as the "vetted" predecessor for EvalLoad/EvalStore.
Douglas Gregor [Tue, 16 Dec 2008 21:30:33 +0000 (21:30 +0000)]
Delay parsing of default arguments of member functions until the class
is completely defined (C++ [class.mem]p2).
Reverse the order in which we process the definitions of member
functions specified inline. This way, we'll get diagnostics in the
order in which the member functions were declared in the class.
Eli Friedman [Tue, 16 Dec 2008 20:15:50 +0000 (20:15 +0000)]
Silence a couple more operator precedence warnings; this shouldn't
change the semantics. Please correct this if the precedence was
actually supposed to be something different.