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.
Douglas Gregor [Tue, 16 Dec 2008 00:38:16 +0000 (00:38 +0000)]
Make name lookup when we're inside a declarator's scope, such as ClassName::func, work with the new unqualified name lookup code. Test it with default arguments in out-of-line member definitions
Douglas Gregor [Tue, 16 Dec 2008 00:08:34 +0000 (00:08 +0000)]
Added a test for default arguments added to out-of-line member
functions. They work except that name lookup within the default
arguments needs to be deferred until the class definition is complete
(see FIXME in the test).
Douglas Gregor [Mon, 15 Dec 2008 23:53:10 +0000 (23:53 +0000)]
Diagnose erroneous uses of out-of-line member definitions and scope
specifiers. Specifically:
* Determine when an out-of-line function definition does not match
any declaration within the class or namespace (including coping
with overloaded functions).
* Complain about typedefs and parameters that have scope specifiers.
* Complain about out-of-line declarations that aren't also
definitions.
* Complain about non-static data members being declared out-of-line.
* Allow cv-qualifiers on out-of-line member function definitions.
Douglas Gregor [Mon, 15 Dec 2008 21:24:18 +0000 (21:24 +0000)]
Place constructors and destructors into the DeclContext of the class,
just like all other members, and remove the special variables in
CXXRecordDecl to store them. This eliminates a lot of special-case
code for constructors and destructors, including
ActOnConstructor/ActOnDeclarator and special lookup rules in
LookupDecl. The result is far more uniform and manageable.
Ted Kremenek [Mon, 15 Dec 2008 19:56:42 +0000 (19:56 +0000)]
Preprocessor: Allocate MacroInfo objects using a BumpPtrAllocator instead using new/delete. This speeds up -Eonly on Cocoa.h using the regular lexer by 1.8% and the PTHLexer by 3%.
Douglas Gregor [Mon, 15 Dec 2008 17:33:16 +0000 (17:33 +0000)]
Don't double-destroy constructors defined out-of-line. This is a
half-solution; the real solution is coming when constructors and
destructors are treated like all other functions by ActOnDeclarator.