]> granicus.if.org Git - clang/log
clang
16 years agofix a nasty off-by-one error.
Chris Lattner [Fri, 23 May 2008 23:29:33 +0000 (23:29 +0000)]
fix a nasty off-by-one error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51519 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd some assertions to catch bad things before they die
Chris Lattner [Fri, 23 May 2008 23:10:58 +0000 (23:10 +0000)]
add some assertions to catch bad things before they die
somewhere deep in rewrite rope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51515 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofix an inconsistency computing offsets that caused a crash on rewrite-nest.m
Chris Lattner [Fri, 23 May 2008 23:06:56 +0000 (23:06 +0000)]
fix an inconsistency computing offsets that caused a crash on rewrite-nest.m

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51514 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDisable the use of PCH files when using xcodebuild.
Ted Kremenek [Fri, 23 May 2008 22:18:16 +0000 (22:18 +0000)]
Disable the use of PCH files when using xcodebuild.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51509 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMinor tweak to -ast-dump for ivars.
Steve Naroff [Fri, 23 May 2008 22:01:24 +0000 (22:01 +0000)]
Minor tweak to -ast-dump for ivars.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51508 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix range info for explicit ivar refs.
Steve Naroff [Fri, 23 May 2008 22:00:37 +0000 (22:00 +0000)]
Fix range info for explicit ivar refs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51507 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRevert r51498: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp...
Ted Kremenek [Fri, 23 May 2008 21:28:18 +0000 (21:28 +0000)]
Revert r51498: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=51498&r1=51497&r2=51498&view=diff

Turns out that there are multiple places where a redefinition diagnostic can be emitted.  A cleaner solution (without touching Sema) is to have
the Driver turn off these diagnostics.  (will submit this patch soon)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51502 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove a diagnostic (temporary hack that will be removed next week).
Steve Naroff [Fri, 23 May 2008 20:57:38 +0000 (20:57 +0000)]
Remove a diagnostic (temporary hack that will be removed next week).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51498 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agominor changes, collect the range of an expr before rewriting the subexprs
Chris Lattner [Fri, 23 May 2008 20:40:52 +0000 (20:40 +0000)]
minor changes, collect the range of an expr before rewriting the subexprs
no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51497 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMake sure method definitions get output with -ast-dump.
Steve Naroff [Fri, 23 May 2008 18:50:58 +0000 (18:50 +0000)]
Make sure method definitions get output with -ast-dump.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51494 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen known, include the analyzer build in the output of scan-build.
Ted Kremenek [Fri, 23 May 2008 18:17:05 +0000 (18:17 +0000)]
When known, include the analyzer build in the output of scan-build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51492 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMore test cases for retain/release checker. These cases handle not flagging leaks...
Ted Kremenek [Fri, 23 May 2008 17:25:17 +0000 (17:25 +0000)]
More test cases for retain/release checker.  These cases handle not flagging leaks for static variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51486 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofix typo
Gabor Greif [Fri, 23 May 2008 11:19:39 +0000 (11:19 +0000)]
fix typo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51479 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUnbreak build. Forget to check in this header file change with a previous commit.
Ted Kremenek [Fri, 23 May 2008 02:53:24 +0000 (02:53 +0000)]
Unbreak build.  Forget to check in this header file change with a previous commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51470 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix typo.
Ted Kremenek [Fri, 23 May 2008 01:40:41 +0000 (01:40 +0000)]
Fix typo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51466 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTweak AST dumper for ObjC ivars.
Steve Naroff [Fri, 23 May 2008 00:59:14 +0000 (00:59 +0000)]
Tweak AST dumper for ObjC ivars.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51463 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdditional retain/release checker regression tests.
Ted Kremenek [Thu, 22 May 2008 23:46:11 +0000 (23:46 +0000)]
Additional retain/release checker regression tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51454 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPrototyped support in the BugReporter to emit diagnostics of the form "p now aliases q".
Ted Kremenek [Thu, 22 May 2008 23:45:19 +0000 (23:45 +0000)]
Prototyped support in the BugReporter to emit diagnostics of the form "p now aliases q".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51453 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMake sure the source location for @property points the the @-sign (not the decl spec).
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51450 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoChange uses of llvm::Type::isFirstClassType to use the new
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51446 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoExpand retain/release checker to consider methods/function calls that cause a
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.

This addresses: <rdar://problem/5933215>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51433 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't use ostringstream (pulling in <sstream>) when creating the dead store diagnosti...
Ted Kremenek [Thu, 22 May 2008 16:28:24 +0000 (16:28 +0000)]
Don't use ostringstream (pulling in <sstream>) when creating the dead store diagnostic (simply not needed).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51432 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate driver include paths to work on darwin10.
Ted Kremenek [Thu, 22 May 2008 15:26:22 +0000 (15:26 +0000)]
Update driver include paths to work on darwin10.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51431 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPatch for PR2350; the issue was tnat we were allowing (with an error)
Eli Friedman [Thu, 22 May 2008 08:54:03 +0000 (08:54 +0000)]
Patch for PR2350; the issue was tnat we were allowing (with an error)
void f(const void) in one place and rejecting it in another.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51424 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMake debugging information usable. This is barebones, but it makes -g
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.

This commit shouldn't have any effect without -g.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51404 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMinor refactoring: compute the return value separately from emitting the
Eli Friedman [Thu, 22 May 2008 01:22:33 +0000 (01:22 +0000)]
Minor refactoring: compute the return value separately from emitting the
ret.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51403 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMake CurFuncDecl more specific; I have some code I'm going to land in a
Eli Friedman [Thu, 22 May 2008 01:16:59 +0000 (01:16 +0000)]
Make CurFuncDecl more specific; I have some code I'm going to land in a
bit that wants to use CurFuncDecl as a FunctionDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51402 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMove getAccessedFieldNo out of lib/AST/Expr.cpp into
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51398 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImprove dead stores diagnostics to include the variable name.
Ted Kremenek [Wed, 21 May 2008 22:59:16 +0000 (22:59 +0000)]
Improve dead stores diagnostics to include the variable name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51395 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove the unneeded #include of VMCore header "llvm/DerivedTypes.h".
Dan Gohman [Wed, 21 May 2008 20:26:42 +0000 (20:26 +0000)]
Remove the unneeded #include of VMCore header "llvm/DerivedTypes.h".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51392 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoExplicitly #include Support/Streams.h when using llvm::cout and friends.
Dan Gohman [Wed, 21 May 2008 20:19:16 +0000 (20:19 +0000)]
Explicitly #include Support/Streams.h when using llvm::cout and friends.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51391 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd Destroy method to Types, making there destruction more harmonious with
Ted Kremenek [Wed, 21 May 2008 16:38:54 +0000 (16:38 +0000)]
Add Destroy method to Types, making there destruction more harmonious with
the destruction of Decls and Stmts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51385 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix potential double-free.
Ted Kremenek [Wed, 21 May 2008 16:00:02 +0000 (16:00 +0000)]
Fix potential double-free.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51381 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixup ASTContext::PrintStats()...it was causing several test failures.
Steve Naroff [Wed, 21 May 2008 15:59:22 +0000 (15:59 +0000)]
Fixup ASTContext::PrintStats()...it was causing several test failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51380 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen destroying DeclStmts, also destroy the associated Decl (reclaim its memory).
Ted Kremenek [Wed, 21 May 2008 15:53:55 +0000 (15:53 +0000)]
When destroying DeclStmts, also destroy the associated Decl (reclaim its memory).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51379 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed bug in the transfer function for dereferences: the loaded value from EvalLoad...
Ted Kremenek [Wed, 21 May 2008 15:48:33 +0000 (15:48 +0000)]
Fixed bug in the transfer function for dereferences: the loaded value from EvalLoad should bind to the UnaryOperator*, not its subexpression.

Added test case to exercise this fix when checking for uses of uninitialized values.

Patch by Zhongxing Xu!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51377 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove an unnecessary/buggy if check. Ran into this with some other
Eli Friedman [Wed, 21 May 2008 13:24:44 +0000 (13:24 +0000)]
Remove an unnecessary/buggy if check. Ran into this with some other
changes in my tree, so I don't have a testcase which affects trunk.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51371 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoA small testcase; no patch, since it was a bug in a patch I never
Eli Friedman [Wed, 21 May 2008 13:21:01 +0000 (13:21 +0000)]
A small testcase; no patch, since it was a bug in a patch I never
committed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51370 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix this test so that it's valid; the point is to test for the crash,
Eli Friedman [Wed, 21 May 2008 05:37:55 +0000 (05:37 +0000)]
Fix this test so that it's valid; the point is to test for the crash,
not the missing diagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51365 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix the destruction "properly" in the sense that we actually destroy the
Eli Friedman [Wed, 21 May 2008 05:33:10 +0000 (05:33 +0000)]
Fix the destruction "properly" in the sense that we actually destroy the
ASTs.  This is a hack, but I haven't considered how we really
want to do this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51364 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPR2347: Fix crash iterating over VLAs; this started triggering because
Eli Friedman [Wed, 21 May 2008 05:06:46 +0000 (05:06 +0000)]
PR2347: Fix crash iterating over VLAs; this started triggering because
we now iterate over the whole AST when we destroy it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51363 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't kill the declarations if the translation unit doesn't own them
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51362 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a couple of bugs found by Neil Booth in the const-ness checking.
Eli Friedman [Wed, 21 May 2008 03:39:11 +0000 (03:39 +0000)]
Fix a couple of bugs found by Neil Booth in the const-ness checking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51361 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoProtect iso646.h from C++ (although I can't imagine why someone would
Eli Friedman [Wed, 21 May 2008 03:11:31 +0000 (03:11 +0000)]
Protect iso646.h from C++ (although I can't imagine why someone would
need it...).  Patch by Mike Stump.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51360 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd SemaInit.cpp to VC++ proj.
Steve Naroff [Tue, 20 May 2008 20:39:37 +0000 (20:39 +0000)]
Add SemaInit.cpp to VC++ proj.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51330 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoinitialize variable and fix a bunch of test failures
Nuno Lopes [Tue, 20 May 2008 18:03:51 +0000 (18:03 +0000)]
initialize variable and fix a bunch of test failures

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51326 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofix warning with gcc 4.1 (ptr to bool convertion)
Nuno Lopes [Tue, 20 May 2008 17:33:56 +0000 (17:33 +0000)]
fix warning with gcc 4.1 (ptr to bool convertion)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51324 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove hacks from ASTContext now that alignment gets reported correctly.
Eli Friedman [Tue, 20 May 2008 15:17:39 +0000 (15:17 +0000)]
Remove hacks from ASTContext now that alignment gets reported correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51322 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMissed an include.
Eli Friedman [Tue, 20 May 2008 14:27:34 +0000 (14:27 +0000)]
Missed an include.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51321 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMinor correction for PPC targets.
Eli Friedman [Tue, 20 May 2008 14:25:01 +0000 (14:25 +0000)]
Minor correction for PPC targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51320 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSome small changes to make the target info a bit more accurate.
Eli Friedman [Tue, 20 May 2008 14:21:01 +0000 (14:21 +0000)]
Some small changes to make the target info a bit more accurate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51319 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPerform stricter/more accurate checking for C99 constant expressions
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51318 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd a couple more headers. stddef was discussed on cfe-dev, and
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51317 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTest from PR2332; bug already fixed by r51311.
Eli Friedman [Tue, 20 May 2008 12:55:29 +0000 (12:55 +0000)]
Test from PR2332; bug already fixed by r51311.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51316 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDisable the function address cache; this doesn't have any ill effects,
Eli Friedman [Tue, 20 May 2008 09:21:07 +0000 (09:21 +0000)]
Disable the function address cache; this doesn't have any ill effects,
as far as I can tell, and it fixes code like test/CodeGen/functions.c.

(Whatever performance effect it might have, crashing on a
construct like this isn't really acceptable; I've run into this
multiple times.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51312 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix the scope of K&R-style argument declarations so that they don't
Eli Friedman [Tue, 20 May 2008 09:10:20 +0000 (09:10 +0000)]
Fix the scope of K&R-style argument declarations so that they don't
extend beyond the end of the function.

I'm not completely sure this is the right way to fix this bug, so
someone familiar with the parser should double-check.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51311 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix test (it was incorrectly succeeding).
Eli Friedman [Tue, 20 May 2008 09:04:19 +0000 (09:04 +0000)]
Fix test (it was incorrectly succeeding).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51310 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd codegen support for stack address intrinsics.
Eli Friedman [Tue, 20 May 2008 08:59:34 +0000 (08:59 +0000)]
Add codegen support for stack address intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51309 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix typo in test.
Eli Friedman [Tue, 20 May 2008 08:27:04 +0000 (08:27 +0000)]
Fix typo in test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51308 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd __builtin_frame_address and __builtin_return_address gcc builtins to
Eli Friedman [Tue, 20 May 2008 08:23:37 +0000 (08:23 +0000)]
Add __builtin_frame_address and __builtin_return_address gcc builtins to
Sema. No codegen yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51307 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplement codegen for comma operator for structs.
Eli Friedman [Tue, 20 May 2008 07:56:31 +0000 (07:56 +0000)]
Implement codegen for comma operator for structs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51304 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoBe a bit more defensive in SemaInit.
Eli Friedman [Tue, 20 May 2008 05:25:56 +0000 (05:25 +0000)]
Be a bit more defensive in SemaInit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51301 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd some more checking for compound literals.
Eli Friedman [Tue, 20 May 2008 05:22:08 +0000 (05:22 +0000)]
Add some more checking for compound literals.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51300 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoReclaim memory from chains of ScopedDecls, and reclaim memory for the initializers...
Ted Kremenek [Tue, 20 May 2008 04:49:55 +0000 (04:49 +0000)]
Reclaim memory from chains of ScopedDecls, and reclaim memory for the initializers of EnumConstantDecls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51299 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDelete AST nodes, not just Decls.
Ted Kremenek [Tue, 20 May 2008 04:10:52 +0000 (04:10 +0000)]
Delete AST nodes, not just Decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51298 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoReclaim memory allocated for ParmVarDecl's in FunctionDecl::Destroy.
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51297 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen serializing FunctionDecl, serialize out a reference to the previous declaration.
Ted Kremenek [Tue, 20 May 2008 03:33:58 +0000 (03:33 +0000)]
When serializing FunctionDecl, serialize out a reference to the previous declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51294 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove unnecessary #include (introduced by a recent patch of mine).
Ted Kremenek [Tue, 20 May 2008 00:47:23 +0000 (00:47 +0000)]
Remove unnecessary #include (introduced by a recent patch of mine).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51288 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTry to plug some memory leaks...
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51286 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRestructure constant structure init codegen so that it's possible to
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51285 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove code that shouldn't have any effect anymore.
Eli Friedman [Tue, 20 May 2008 00:04:21 +0000 (00:04 +0000)]
Remove code that shouldn't have any effect anymore.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51284 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplement CodeGen for __builtin_memcpy.
Eli Friedman [Mon, 19 May 2008 23:27:48 +0000 (23:27 +0000)]
Implement CodeGen for __builtin_memcpy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51282 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdated Xcode project.
Ted Kremenek [Mon, 19 May 2008 23:19:04 +0000 (23:19 +0000)]
Updated Xcode project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51281 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded Stmt::DestroyChildren, which will be used by the dstors of the subclasses of...
Ted Kremenek [Mon, 19 May 2008 22:02:12 +0000 (22:02 +0000)]
Added Stmt::DestroyChildren, which will be used by the dstors of the subclasses of Stmt to recursively delete their child AST nodes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51278 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMake the unused expression warning a bit less aggressive (found in PHP
Eli Friedman [Mon, 19 May 2008 21:24:43 +0000 (21:24 +0000)]
Make the unused expression warning a bit less aggressive (found in PHP
code).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51276 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSwitch on SemaInit; this makes some code in SemaDecl dead, but I'll give
Eli Friedman [Mon, 19 May 2008 20:29:35 +0000 (20:29 +0000)]
Switch on SemaInit; this makes some code in SemaDecl dead, but I'll give
it a few days to make sure there aren't any significant regressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51273 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdjust warning so that it doesn't fire when there is an error.
Eli Friedman [Mon, 19 May 2008 20:20:43 +0000 (20:20 +0000)]
Adjust warning so that it doesn't fire when there is an error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51269 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove illegal test.
Eli Friedman [Mon, 19 May 2008 20:17:34 +0000 (20:17 +0000)]
Remove illegal test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51267 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd errors for some illegal constructs (specifically, "int a = {{3}};"
Eli Friedman [Mon, 19 May 2008 20:12:18 +0000 (20:12 +0000)]
Add errors for some illegal constructs (specifically, "int a = {{3}};"
and "int a = {};").  I'll adjust the tests in a bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51265 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSome more SemaInit cleanup.
Eli Friedman [Mon, 19 May 2008 20:00:43 +0000 (20:00 +0000)]
Some more SemaInit cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51262 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoVarious fixes; solves (almost) all of the test regressions that would be
Eli Friedman [Mon, 19 May 2008 19:16:24 +0000 (19:16 +0000)]
Various fixes; solves (almost) all of the test regressions that would be
caused by enabling SemaInit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51261 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix the emission of expressions like char a[10] = "asdf"; previously,
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51259 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd proper type-checking for pointer additiion; before, we were accepting
Eli Friedman [Sun, 18 May 2008 18:08:51 +0000 (18:08 +0000)]
Add proper type-checking for pointer additiion; before, we were accepting
addition with a pointer and an integer even when it didn't make sense.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51228 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix support for _Bool bitfields. The issue is that the bitfield width
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51224 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMicro-optimization when checking for panic functions.
Ted Kremenek [Sat, 17 May 2008 00:42:01 +0000 (00:42 +0000)]
Micro-optimization when checking for panic functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51214 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix 80 col violation.
Ted Kremenek [Sat, 17 May 2008 00:40:45 +0000 (00:40 +0000)]
Fix 80 col violation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51213 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded panic function _XCAssertionFailureHandler.
Ted Kremenek [Sat, 17 May 2008 00:33:23 +0000 (00:33 +0000)]
Added panic function _XCAssertionFailureHandler.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51212 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoBackout of codegen-based fix to PR2334; this has been fixed differently
Eli Friedman [Fri, 16 May 2008 20:38:39 +0000 (20:38 +0000)]
Backout of codegen-based fix to PR2334; this has been fixed differently
at the Sema layer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51203 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSema-based fix for PR2334. The issue is that even if the two sides of
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51202 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix some prototypes, and implement some builtins until we have our header files compl...
Nate Begeman [Fri, 16 May 2008 18:59:42 +0000 (18:59 +0000)]
Fix some prototypes, and implement some builtins until we have our header files completed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51199 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCache leaks by the allocation site, not the leak location.
Ted Kremenek [Fri, 16 May 2008 18:33:44 +0000 (18:33 +0000)]
Cache leaks by the allocation site, not the leak location.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51198 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPartitioned BugTypeCachedLocation::isCached() into two methods: one that accepts...
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51197 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoReview nit.
Eli Friedman [Fri, 16 May 2008 17:54:49 +0000 (17:54 +0000)]
Review nit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51196 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoClean up ownership per review comment.
Eli Friedman [Fri, 16 May 2008 17:51:27 +0000 (17:51 +0000)]
Clean up ownership per review comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51195 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix review nit.
Eli Friedman [Fri, 16 May 2008 17:44:00 +0000 (17:44 +0000)]
Fix review nit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51194 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPatch for PR2334, and a similar ObjC bug.
Eli Friedman [Fri, 16 May 2008 17:37:11 +0000 (17:37 +0000)]
Patch for PR2334, and a similar ObjC bug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51193 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded CFGBlock::hasBinaryBranchTerminator().
Ted Kremenek [Fri, 16 May 2008 16:06:00 +0000 (16:06 +0000)]
Added CFGBlock::hasBinaryBranchTerminator().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51190 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMinor cleanup to isBuiltinConstantExpr.
Eli Friedman [Fri, 16 May 2008 13:28:37 +0000 (13:28 +0000)]
Minor cleanup to isBuiltinConstantExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51188 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed another regression introduced by r51113 caused by some refactoring
Ted Kremenek [Thu, 15 May 2008 22:24:49 +0000 (22:24 +0000)]
Fixed another regression introduced by r51113 caused by some refactoring
in Sema::CheckFunctionCall:

  http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080512/005706.html

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51168 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemoved bogus "return true" in Expr::isConstantExpr that returned true for all
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):

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080512/005706.html

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51164 91177308-0d34-0410-b5e6-96231b3b80d8