]> granicus.if.org Git - clang/log
clang
16 years agoUpdate to follow recent LLVM changes
Anton Korobeynikov [Thu, 29 May 2008 17:42:01 +0000 (17:42 +0000)]
Update to follow recent LLVM changes

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

16 years agoImplement support for -w, which silences all warnings. PR2384.
Chris Lattner [Thu, 29 May 2008 15:36:45 +0000 (15:36 +0000)]
Implement support for -w, which silences all warnings. PR2384.

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

16 years agoMore complete/correct implementation of the comparison operators for
Eli Friedman [Thu, 29 May 2008 15:17:49 +0000 (15:17 +0000)]
More complete/correct implementation of the comparison operators for
constant expressions.

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

16 years agoFix an extremely subtle bug with pointer comparisons: they have to be
Eli Friedman [Thu, 29 May 2008 15:09:15 +0000 (15:09 +0000)]
Fix an extremely subtle bug with pointer comparisons: they have to be
unsigned because it's possible (at least in theory) to have
have both positive and negative pointers pointing to the same object.

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

16 years agoRearrange EmitLValueForField a bit to work properly for _Bool bitfields
Eli Friedman [Thu, 29 May 2008 11:33:25 +0000 (11:33 +0000)]
Rearrange EmitLValueForField a bit to work properly for _Bool bitfields
in unions (we don't want to do the union-specific bitcast for
bit-fields).

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

16 years agoAdd codegen support for a few more kinds of initializer constant
Eli Friedman [Thu, 29 May 2008 11:22:45 +0000 (11:22 +0000)]
Add codegen support for a few more kinds of initializer constant
expressions.

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

16 years agoAdd CodeGen support for alignment on globals, both for unusual natural
Eli Friedman [Thu, 29 May 2008 11:10:27 +0000 (11:10 +0000)]
Add CodeGen support for alignment on globals, both for unusual natural
alignment and alignment attributes.

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

16 years agoA couple minor fixes to make debug info usable for arbitrary code: don't
Eli Friedman [Thu, 29 May 2008 11:08:17 +0000 (11:08 +0000)]
A couple minor fixes to make debug info usable for arbitrary code: don't
emit incomplete types, because they crash llc, and always use the
logical location as the current location so we don't crash doing invalid
queries on CurLoc.

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

16 years agoTentative declarations are supposed to have common linkage, not weak.
Eli Friedman [Thu, 29 May 2008 11:03:17 +0000 (11:03 +0000)]
Tentative declarations are supposed to have common linkage, not weak.
This change makes clang generate the same thing as llvm-gcc.

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

16 years agoAlways use packed structs. This isn't really very nice, but there's
Eli Friedman [Thu, 29 May 2008 10:58:49 +0000 (10:58 +0000)]
Always use packed structs.  This isn't really very nice, but there's
nothing fundamentally wrong with it. Emitting unpacked structs where
possible is more work for almost no practical benefit.  We'll probably
want to fix it at some point anyway, but it's low priority.

The issue with long double in particular is that LLVM thinks an X86 long
double is 10 bytes, while clang considers it for all purposes to be
either 12 or 16 bytes, depending on the platform, even in a packed
struct.

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

16 years agoImplementation of stdarg.h.
Eli Friedman [Thu, 29 May 2008 10:40:55 +0000 (10:40 +0000)]
Implementation of stdarg.h.

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

16 years agoFix rewrite rope to keep the leaf list up-to-date as it erases leaves
Chris Lattner [Wed, 28 May 2008 18:45:56 +0000 (18:45 +0000)]
Fix rewrite rope to keep the leaf list up-to-date as it erases leaves
from the rope.  rdar://5952468

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

16 years agogive location info to another paren expr.
Chris Lattner [Wed, 28 May 2008 16:38:23 +0000 (16:38 +0000)]
give location info to another paren expr.

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

16 years agoadd an assertion
Chris Lattner [Wed, 28 May 2008 16:35:02 +0000 (16:35 +0000)]
add an assertion

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

16 years agoFix a couple crashes on invalid input.
Chris Lattner [Tue, 27 May 2008 23:32:43 +0000 (23:32 +0000)]
Fix a couple crashes on invalid input.

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

16 years agoWhen the build command is xcodebuild, set the magical environment variable LDPLUSPLUS...
Ted Kremenek [Tue, 27 May 2008 23:18:07 +0000 (23:18 +0000)]
When the build command is xcodebuild, set the magical environment variable LDPLUSPLUS to g++ to ensure that C++ object files are linked with g++ instead of gcc.

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

16 years agoCorrectly check to see if we are analyzing C++ files (skip).
Ted Kremenek [Tue, 27 May 2008 23:17:16 +0000 (23:17 +0000)]
Correctly check to see if we are analyzing C++ files (skip).

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

16 years agoCheck first member alignment and uses packed struct if required.
Devang Patel [Tue, 27 May 2008 22:45:40 +0000 (22:45 +0000)]
Check first member alignment and uses packed struct if required.

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

16 years agoFix test case
Devang Patel [Tue, 27 May 2008 22:44:22 +0000 (22:44 +0000)]
Fix test case

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

16 years agoAdd the copysign builtins; I ran into a program that wanted
Eli Friedman [Tue, 27 May 2008 15:59:57 +0000 (15:59 +0000)]
Add the copysign builtins; I ran into a program that wanted
__builtin_copysign.

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

16 years agoA few more cases for aggregate values.
Eli Friedman [Tue, 27 May 2008 15:51:49 +0000 (15:51 +0000)]
A few more cases for aggregate values.

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

16 years agoImplementation of __builtin_ctlz.
Eli Friedman [Tue, 27 May 2008 15:32:46 +0000 (15:32 +0000)]
Implementation of __builtin_ctlz.

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

16 years agoAssume statement expressions have side effects; this gets rid of a lot
Eli Friedman [Tue, 27 May 2008 15:24:04 +0000 (15:24 +0000)]
Assume statement expressions have side effects; this gets rid of a lot
of extra warnings in the Python source.

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

16 years agoThe cache is working again; re-enable it.
Eli Friedman [Tue, 27 May 2008 08:43:22 +0000 (08:43 +0000)]
The cache is working again; re-enable it.

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

16 years agoGet the type right for wide string literals; it's wchar_t, not char.
Eli Friedman [Tue, 27 May 2008 07:57:14 +0000 (07:57 +0000)]
Get the type right for wide string literals; it's wchar_t, not char.

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

16 years agoAdd FIXME.
Eli Friedman [Tue, 27 May 2008 05:09:49 +0000 (05:09 +0000)]
Add FIXME.

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

16 years agoDon't swap function decls, and add them to the scope as they are
Eli Friedman [Tue, 27 May 2008 05:07:37 +0000 (05:07 +0000)]
Don't swap function decls, and add them to the scope as they are
encountered.  Mixing up the decls is unintuitive, and confuses the AST
destruction code. Fixes PR2360.

Note that there is a need to look up the characteristics and
declarations of a function associated with a particular name or decl,
but the original swapping code doesn't solve it properly.
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-May/001644.html is one
suggestion for how to fix that.

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

16 years agoAdd a more reliable check for whether a static declaration has already
Eli Friedman [Tue, 27 May 2008 04:58:01 +0000 (04:58 +0000)]
Add a more reliable check for whether a static declaration has already
been used.  In preparation for the fix to PR2360, but also a minor bug
in its own right.

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

16 years agoStop leaking the main Sema object. (Leak found using valgrind.)
Eli Friedman [Tue, 27 May 2008 04:23:47 +0000 (04:23 +0000)]
Stop leaking the main Sema object. (Leak found using valgrind.)

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

16 years agoStop leaking the target data. (Leak found with valgrind.)
Eli Friedman [Tue, 27 May 2008 04:22:24 +0000 (04:22 +0000)]
Stop leaking the target data.  (Leak found with valgrind.)

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

16 years agoGeneralize the float type generation code, and specifically fix the
Eli Friedman [Tue, 27 May 2008 04:20:05 +0000 (04:20 +0000)]
Generalize the float type generation code, and specifically fix the
codegen of X86 long double.

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

16 years agoImplementation of gcc mode attribute; this is significant because
Eli Friedman [Tue, 27 May 2008 03:33:27 +0000 (03:33 +0000)]
Implementation of gcc mode attribute; this is significant because
it fixes PR2204.  Not too much to say about the implementation; it works
in a similar way to the vector size attribute.

At some point, we need to modify the targets to provide information
about the appropriate types.

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

16 years agoRewrite struct/union layout. This is mostly cleanup; this might also fix
Eli Friedman [Tue, 27 May 2008 03:14:44 +0000 (03:14 +0000)]
Rewrite struct/union layout. This is mostly cleanup; this might also fix
a few bugs, but I don't know of any in particular. This has good effects
besides cleanup, though: it also should make it easier to implement the
aligned and packed attributes, and also target-specific struct layouts,
because the code won't have to be duplicated in codegen.

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

16 years agoStop leaking the TUDecl.
Eli Friedman [Tue, 27 May 2008 03:08:09 +0000 (03:08 +0000)]
Stop leaking the TUDecl.

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

16 years agoChange diagnostic per suggestion, to make it a bit clearer what is
Eli Friedman [Tue, 27 May 2008 02:01:50 +0000 (02:01 +0000)]
Change diagnostic per suggestion, to make it a bit clearer what is
happening.

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

16 years agoEmit memmove, not memcpy, for structure copies; this is unfortunately
Eli Friedman [Mon, 26 May 2008 12:59:39 +0000 (12:59 +0000)]
Emit memmove, not memcpy, for structure copies; this is unfortunately
required for correctness in cases of copying a struct to itself or to
an overlapping struct (itself for cases like *a = *a, and overlapping
is possible with unions).

Hopefully, this won't end up being a perf issue; LLVM *should* be able
to optimize memmove to memcpy in a lot of cases, and for small copies
the generated code *should* be mostly comparable. (In reality, LLVM
is currently horrible at optimizing memmove, but that's a bug, not a
fundamental issue.)

gcc currently generates wrong code; that's
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667.

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

16 years agoFix for PR2001. I'm not really fond of it, but it is correct (unless
Eli Friedman [Sun, 25 May 2008 14:13:57 +0000 (14:13 +0000)]
Fix for PR2001. I'm not really fond of it, but it is correct (unless
someone tries to make a bitfield volatile?).

Not sure how to write a test; any suggestions?

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

16 years agoCount the number of initializable members correctly in structs/unions
Eli Friedman [Sun, 25 May 2008 14:03:31 +0000 (14:03 +0000)]
Count the number of initializable members correctly in structs/unions
with unnamed members.

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

16 years agoDiagnose implicit init list for empty aggregate, like struct {}. Fixes
Eli Friedman [Sun, 25 May 2008 13:49:22 +0000 (13:49 +0000)]
Diagnose implicit init list for empty aggregate, like struct {}.  Fixes
PR2151 (by not creating the empty implicit init list).

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

16 years agoMove the error checking for variable-sized objects so we don't
Eli Friedman [Sun, 25 May 2008 13:22:35 +0000 (13:22 +0000)]
Move the error checking for variable-sized objects so we don't
double-report errors; fixes PR2362.

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

16 years agoMake sure to define __sparc__ on Solaris; this should "fix"
Eli Friedman [Sun, 25 May 2008 05:26:09 +0000 (05:26 +0000)]
Make sure to define __sparc__ on Solaris; this should "fix"
test/Codegen/mandel.c on Solaris. :-)

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

16 years agoGenerate subprogram debug info with -g.
Sanjiv Gupta [Sun, 25 May 2008 05:15:42 +0000 (05:15 +0000)]
Generate subprogram debug info with -g.
Also take care of freeing memory at the right places.

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

16 years agoFix this test on non-X86 platforms.
Eli Friedman [Sun, 25 May 2008 04:43:38 +0000 (04:43 +0000)]
Fix this test on non-X86 platforms.

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

16 years agoAlways initialize NEXT_CATCH; fixes a Valgrind uninitialized read error
Eli Friedman [Sun, 25 May 2008 04:34:57 +0000 (04:34 +0000)]
Always initialize NEXT_CATCH; fixes a Valgrind uninitialized read error
(originally reported in PR1682).

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

16 years agoFix variable misspelling.
Ted Kremenek [Sat, 24 May 2008 16:16:30 +0000 (16:16 +0000)]
Fix variable misspelling.

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

16 years agoDon't use inferlanguage to override the default language for all files.
Ted Kremenek [Sat, 24 May 2008 16:14:34 +0000 (16:14 +0000)]
Don't use inferlanguage to override the default language for all files.

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

16 years agoDon't analyze .o files.
Ted Kremenek [Sat, 24 May 2008 16:09:00 +0000 (16:09 +0000)]
Don't analyze .o files.

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

16 years agoCleanup indentation and remove some dead code.
Ted Kremenek [Sat, 24 May 2008 15:58:54 +0000 (15:58 +0000)]
Cleanup indentation and remove some dead code.

Analyze files not compiled using "-c".  This fixes:

<rdar://problem/5961638> invoke checker when gcc is not called with "-c"

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

16 years agoCall the correct destructor.
Ted Kremenek [Sat, 24 May 2008 15:09:56 +0000 (15:09 +0000)]
Call the correct destructor.

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

16 years agoThis fixes a VC++ build failure.
Steve Naroff [Sat, 24 May 2008 00:16:40 +0000 (00:16 +0000)]
This fixes a VC++ build failure.

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

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