Steve Naroff [Thu, 22 May 2008 23:24:08 +0000 (23:24 +0000)]
Make sure the source location for @property points the the @-sign (not the decl spec).
Also added a FIXME related to how we represent @properties in the ObjCInterfaceDecl AST.
Dan Gohman [Thu, 22 May 2008 22:12:56 +0000 (22:12 +0000)]
Change uses of llvm::Type::isFirstClassType to use the new
llvm::Type::isSingleValueType. Currently these two functions have
the same behavior, but soon isFirstClassType will return true for
struct and array types.
Clang may some day want to use of isFirstClassType for some of
these some day as an optimization, but it'll require some
consideration.
Ted Kremenek [Thu, 22 May 2008 17:31:13 +0000 (17:31 +0000)]
Expand retain/release checker to consider methods/function calls that cause a
tracked object to "escape": it's reference count might be incremented by the
called function, thus causing an object's lifetime to extend beyond when the
local reference count is decremented to 0.
Eli Friedman [Thu, 22 May 2008 01:40:10 +0000 (01:40 +0000)]
Make debugging information usable. This is barebones, but it makes -g
actually work (instead of crashing llc), and there's enough info emitted
to get line number information in gdb. This should hopefully be helpful
for debugging non-working programs.
I got rid of the begin/endregion calls because the implementation wasn't
working; someone who knows the debugging info a bit better might try to
add it. I really have no clue how a compiler is supposed to emit them.
Dan Gohman [Thu, 22 May 2008 00:50:06 +0000 (00:50 +0000)]
Move getAccessedFieldNo out of lib/AST/Expr.cpp into
lib/CodeGen/CGExpr.cpp and to change include/clang/AST/Attr.h to
use its own enum for visibility types instead of using
llvm::GlobalValue::VisibilityTypes. These changes eliminate
dependencies in the AST library on LLVM's VMCore library.
Eli Friedman [Wed, 21 May 2008 05:01:55 +0000 (05:01 +0000)]
Don't kill the declarations if the translation unit doesn't own them
(specifically, for TranslationUnits created from SerializationTest.cpp).
Fixes a double-free bug in the serialization tests.
Eli Friedman [Tue, 20 May 2008 13:48:25 +0000 (13:48 +0000)]
Perform stricter/more accurate checking for C99 constant expressions
in Sema, per discussion on mailing list. This doesn't cause any changes
in the test results. I'll probably add some more tests at some point,
but it's an open question what we need to accept to be compatible with
real code.
This doesn't touch the existing isConstantExpr method on Expr; that
should be addressed somehow eventually (either removed or refined to
whatever is appropriate).
Eli Friedman [Tue, 20 May 2008 13:34:26 +0000 (13:34 +0000)]
Add a couple more headers. stddef was discussed on cfe-dev, and
consensus was that it was fine; iso646 is trivial.
We actually don't need that many headers overall... on Ubuntu, at least,
all we need are stdint.h, stdarg.h, limits.h, and float.h to stop
depending on having gcc's headers around for normal code.
On a side note, the path searching needs some improvement; I had to
hardcode the path to my header directory into clang.cpp to get the
driver to use it consistently.
Ted Kremenek [Tue, 20 May 2008 03:56:00 +0000 (03:56 +0000)]
Reclaim memory allocated for ParmVarDecl's in FunctionDecl::Destroy.
Fixed a bug in ParmVarDecl::param_end(): Handle the case where there are no
ParmVarDecls for a FunctionDecl, but its function prototype has formal arguments
(can happen with typedefs).
Ted Kremenek [Tue, 20 May 2008 00:43:19 +0000 (00:43 +0000)]
Try to plug some memory leaks...
1) Sema::ParseAST now constructs a TranslationUnit object to own the top-level Decls, which releases the top-level Decls upon exiting ParseAST.
2) Bug fix: TranslationUnit::~TranslationUnit handles the case where a Decl is added more than once as a top-level Decl.
3) Decl::Destroy is now a virtual method, obviating the need for a special dispatch based on DeclKind.
3) FunctionDecl::Destroy now releases its Body using its Destroy method.
4) Added Stmt::Destroy and Stmt::DestroyChildren, which recursively delete the child ASTs of a Stmt and call their dstors. We may need to special case dstor/Destroy methods for particular Stmt subclasses that own other dynamically allocated objects besides AST nodes.
5) REGRESSION: We temporarily are not deallocating attributes; a FIXME is provided.
Eli Friedman [Tue, 20 May 2008 00:11:07 +0000 (00:11 +0000)]
Restructure constant structure init codegen so that it's possible to
implement bitfield codegen (although I don't envy the person who
implements it). This also prevents a crash on code like that from PR2309
(it's still broken, but it fails more gracefully).
Eli Friedman [Mon, 19 May 2008 17:51:16 +0000 (17:51 +0000)]
Fix the emission of expressions like char a[10] = "asdf"; previously,
they were causing bad code to be emitted. There are two fixes here: one
makes sure we emit a string that is long enough, and one makes sure we
properly handle string initialization in init lists.
Eli Friedman [Sat, 17 May 2008 20:03:47 +0000 (20:03 +0000)]
Fix support for _Bool bitfields. The issue is that the bitfield width
used for _Bool is not the same as the primitive width (which for _Bool
is 1 bit). The load and store changes add some casts to make the
types consistent. The EmitLValue changes make sure that the pointer is
of an appropriate type for loading the bitfield.
This isn't perfect, but it's an improvement, and getting everything
right depends on actually laying out structs in an ABI-compliant way.
Eli Friedman [Fri, 16 May 2008 20:37:07 +0000 (20:37 +0000)]
Sema-based fix for PR2334. The issue is that even if the two sides of
the condidtional have compatible types, they are not necessarily the
same type. Therefore, we cast to the composite type. As a hack, for
the moment we assume that the composite type is the type of the
left-hand expression; this isn't correct, but it's good enough for most
purposes.
Ted Kremenek [Fri, 16 May 2008 18:33:14 +0000 (18:33 +0000)]
Partitioned BugTypeCachedLocation::isCached() into two methods: one that accepts and ExplodedNode, and the other that accepts a ProgramPoint. The default behavior is to cache bug reports by the
location they occur (the end node). Subclasses can override this behavior by providing a different ProgramPoint.
The bug was that the logic from the helper methods used by CheckFunctionCall
were being inverted (a subtle bug). This would cause the parser to discard
any valid AST nodes involving several builtins (see patch).
This removes the last regression failure I'm seeing in the test suite: Analysis-Apple/NoReturn.
Ted Kremenek [Thu, 15 May 2008 21:49:04 +0000 (21:49 +0000)]
Removed bogus "return true" in Expr::isConstantExpr that returned true for all
expressions. This appears to be a regression introduced in r51113 that caused
many test cases to fail (there is still a test case in the Analysis directory
that is failing):
Eli Friedman [Wed, 14 May 2008 19:38:39 +0000 (19:38 +0000)]
Implementation of __builtin_shufflevector, a portable builtin capable of
expressing the full flexibility of the LLVM shufflevector instruction.
The expected immediate usage is in *mmintrin.h, so that they don't
depend on the mess of gcc-inherited (and not completely implemented)
shuffle builtins.