Steve Naroff [Sat, 4 Oct 2008 17:06:23 +0000 (17:06 +0000)]
Moved main control flow functions to bottom of file.
Reworked control flow to:
- rewrite the block expr body "in place".
- used Chris's new rewriter hook "getRewritenText" to "lift" the text for later use.
- finally, we do the block expr text replacement.
Ted Kremenek [Sat, 4 Oct 2008 05:50:14 +0000 (05:50 +0000)]
This is a big patch, but the functionality change is small and the rest of the patch consists of deltas due to API changes.
This patch overhauls the "memory region" abstraction that was prototyped (but never really used) as part of the Store.h. This patch adds MemRegion.h and MemRegion.cpp, which defines the class MemRegion and its subclasses. This classes serve to define an abstract representation of memory, with regions being layered on other regions to to capture the relationships between fields and variables, variables and the address space they are allocated in, and so on.
The main motivation of this patch is that key parts of the analyzer assumed that all value bindings were to VarDecls. In the future this won't be the case, and this patch removes lval::DeclVal and replaces it with lval::MemRegionVal. Now all pieces of the analyzer must reason about abstract memory blocks instead of just variables.
There should be no functionality change from this patch, but it opens the door for significant improvements to the analyzer such as field-sensitivity and object-sensitivity, both which were on hold until the memory abstraction got generalized.
The memory region abstraction also allows type-information to literally be affixed to a memory region. This will allow the some now redundant logic to be removed from the retain/release checker.
Steve Naroff [Fri, 3 Oct 2008 00:02:03 +0000 (00:02 +0000)]
Add getTypeSpecStartLoc() to VarDecls and FunctionDecls.
This is a temporary solution to help with the block rewriter (though it certainly has general utility).
Once DeclGroup's are implemented, this SourceLocation should be stored with it (since it applies to all the decls).
Daniel Dunbar [Thu, 2 Oct 2008 23:30:31 +0000 (23:30 +0000)]
Add Builtins.def attribute for "can be a constant expression".
- Enabled for builtins which are always constant expressions
(__builtin_huge_val*, __builtin_inf*, __builtin_constant_p,
__builtin_classify_type, __builtin___CFStringMakeConstantString).
Added Builtin::Context::isConstantExpr.
- Currently overly simply interface which only works for builtins
whose constantexprness does not depend on their arguments.
CallExpr::isBuiltinConstantExpr now takes an ASTContext argument.
Daniel Dunbar [Thu, 2 Oct 2008 18:44:07 +0000 (18:44 +0000)]
Add support for format string checking of object-size checking
versions of sprintf and friends.
- Added FIXME that this mechanism should be generalized.
Steve Naroff [Thu, 2 Oct 2008 17:12:56 +0000 (17:12 +0000)]
Changed Sema::CheckForConstantInitializer to allow global block literals.
This commit also includes some name changes in the blocks rewriter (no functionality change).
Daniel Dunbar [Wed, 1 Oct 2008 01:10:22 +0000 (01:10 +0000)]
ccc: Use CCC_NATIVE=1 by default.
- So far this works fairly well for me for building applications
using clang as a gcc substitute. If you are using ccc for a
different purpose and this is a problem, speak up! Note you can
also use CCC_NATIVE=0 to disable.
Daniel Dunbar [Wed, 1 Oct 2008 00:49:24 +0000 (00:49 +0000)]
Add simple interface for protecting runtime functions from name
collisions.
- Provide CodeGenModule::CreateRuntimeFunction which guarantees that
the function it creates will have the provided name in the final
module. This allows the runtime to have its functions protected
from declarations of the same name in the source code.
- One could argue that this is a reason to abuse the llvm::Module
namespace for dealing with function redeclarations. However, that
approach seems conceptually flawed to me. This one also happens to
be somewhat more efficient.
Ted Kremenek [Wed, 1 Oct 2008 00:21:14 +0000 (00:21 +0000)]
Add a QualType to ConjuredSymbol to represent the type and size of the symbol.
Use this updated interface when invalidating arguments passed by reference; the type of symbol is of the object passed by reference, not the reference itself.
Daniel Dunbar [Tue, 30 Sep 2008 21:20:51 +0000 (21:20 +0000)]
ccc: Infer action type upfront.
- More straightforward, e.g. -E should always imply action =
'preprocess' (I think).
- Pass another option through for OS X.
Add "SelectionParameter" class to represent drop-down boxes.
Added "Classification" field to Radar filing.
Modified FileRadar.scpt to take the classification as an argument.
Use objects to represent form parameters. This allows us to abstract away some
of the details of HTML rendering of form parameters, and also us with the
ability to delegate other actions (such as in the filling in of default values)
to specific parameter objects.
Steve Naroff [Tue, 30 Sep 2008 14:38:43 +0000 (14:38 +0000)]
Fix <rdar://problem/6191148> [sema] Objective-C method lookup (at global scope) fails to handle overloaded selectors properly.
Long standing bug in Sema::ActOnInstanceMessage(). We now warn when messaging an "id" with multiple method signatures in scope. The diags are a little verbose, however they can be streamlined if necessary.
Steve Naroff [Tue, 30 Sep 2008 10:07:56 +0000 (10:07 +0000)]
Improved fix for <rdar://problem/6247781> Parser rejecting properly mismatched properties.
Needed to make sure the relaxed type checking only applies to "readonly" properties.
Chris Lattner [Tue, 30 Sep 2008 01:00:25 +0000 (01:00 +0000)]
The definition of __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ follows
the target triple on darwin. For example i386-apple-darwin9 -> 1050 because
darwin9 is "10.5".
Chris Lattner [Mon, 29 Sep 2008 23:12:31 +0000 (23:12 +0000)]
Fix the root cause of PR2750 instead of the side effect.
NumericLiteral parser is not careful about overrun because
it should never be possible. It implicitly expects that its
input matched the regex for pp-constant. Because of this, it
knows it can't be pointing to a prefix of something that
looks like a number. This is all fine, except that __LINE__
does not prevent implicit concatenation from happening. Fix
__LINE__ to not do this.
Chris Lattner [Mon, 29 Sep 2008 22:28:25 +0000 (22:28 +0000)]
Fix va_arg handling to do argument decaying at the correct place. This
fixes problems handling references of va_list, which happens on x86_64.
This fixes PR2841 and rdar://6252231
Chris Lattner [Sun, 28 Sep 2008 06:05:35 +0000 (06:05 +0000)]
Fix rdar://6252231 - cannot call vsnprintf with va_list on x86_64,
by decaying __builtin_va_list's type when forming builtins. On
x86-64 (and other targets) __builtin_va_list is a typedef for
an array.
Chris Lattner [Sun, 28 Sep 2008 05:54:29 +0000 (05:54 +0000)]
Replace a comparison with a static list of builtins that was wrong (it
wasn't covering checking builtins like __builtin___vsnprintf_chk) with
a check that won't get out of date.