Eli Friedman
bc5ed6ef52
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
2008-05-29 11:22:45 +00:00
Eli Friedman
08d7802a40
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
2008-05-29 11:10:27 +00:00
Eli Friedman
32ea35fee9
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
2008-05-29 11:08:17 +00:00
Eli Friedman
a07b76419a
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
2008-05-29 11:03:17 +00:00
Eli Friedman
0408f6805c
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
2008-05-29 10:58:49 +00:00
Eli Friedman
a1d91fe84d
Implementation of stdarg.h.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51672 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 10:40:55 +00:00
Chris Lattner
3d2e8c7b70
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
2008-05-28 18:45:56 +00:00
Chris Lattner
8d36616a09
give location info to another paren expr.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51646 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-28 16:38:23 +00:00
Chris Lattner
54bd7cb491
add an assertion
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51645 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-28 16:35:02 +00:00
Chris Lattner
aec3a1eb21
Fix a couple crashes on invalid input.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 23:32:43 +00:00
Ted Kremenek
915e972098
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
2008-05-27 23:18:07 +00:00
Ted Kremenek
30aba6d2aa
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
2008-05-27 23:17:16 +00:00
Devang Patel
2fb86e61e3
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
2008-05-27 22:45:40 +00:00
Devang Patel
bf20b68e92
Fix test case
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51618 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 22:44:22 +00:00
Eli Friedman
bcfd5d4ac6
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
2008-05-27 15:59:57 +00:00
Eli Friedman
b1851249d7
A few more cases for aggregate values.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51596 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 15:51:49 +00:00
Eli Friedman
f4e8533405
Implementation of __builtin_ctlz.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51595 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 15:32:46 +00:00
Eli Friedman
211f6adf13
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
2008-05-27 15:24:04 +00:00
Eli Friedman
a1d642db81
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
2008-05-27 08:43:22 +00:00
Eli Friedman
8ef1f26775
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
2008-05-27 07:57:14 +00:00
Eli Friedman
3e4177f233
Add FIXME.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51585 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 05:09:49 +00:00
Eli Friedman
2742496d75
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
2008-05-27 05:07:37 +00:00
Eli Friedman
6f7e2eee91
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
2008-05-27 04:58:01 +00:00
Eli Friedman
80f3346981
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
2008-05-27 04:23:47 +00:00
Eli Friedman
3b6c493f29
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
2008-05-27 04:22:24 +00:00
Eli Friedman
f6a943e047
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
2008-05-27 04:20:05 +00:00
Eli Friedman
3c0eb160ca
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
2008-05-27 03:33:27 +00:00
Eli Friedman
cbadaf6ced
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
2008-05-27 03:14:44 +00:00
Eli Friedman
b26153c2b0
Stop leaking the TUDecl.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51575 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 03:08:09 +00:00
Eli Friedman
1f3105e1ee
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
2008-05-27 02:01:50 +00:00
Eli Friedman
0c99509927
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
2008-05-26 12:59:39 +00:00
Eli Friedman
1849128c7d
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
2008-05-25 14:13:57 +00:00
Eli Friedman
f84eda3725
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
2008-05-25 14:03:31 +00:00
Eli Friedman
402256fc66
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
2008-05-25 13:49:22 +00:00
Eli Friedman
638e14413a
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
2008-05-25 13:22:35 +00:00
Eli Friedman
bf0c9bdd49
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
2008-05-25 05:26:09 +00:00
Sanjiv Gupta
1c6a38bcea
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
2008-05-25 05:15:42 +00:00
Eli Friedman
143520261e
Fix this test on non-X86 platforms.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51552 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-25 04:43:38 +00:00
Eli Friedman
0613c37d79
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
2008-05-25 04:34:57 +00:00
Ted Kremenek
39165e2a19
Fix variable misspelling.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51548 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 16:16:30 +00:00
Ted Kremenek
508b381d32
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
2008-05-24 16:14:34 +00:00
Ted Kremenek
e4863992a2
Don't analyze .o files.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 16:09:00 +00:00
Ted Kremenek
61cd988a7e
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
2008-05-24 15:58:54 +00:00
Ted Kremenek
ebf27b1831
Call the correct destructor.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51544 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 15:09:56 +00:00
Steve Naroff
2c33a16437
This fixes a VC++ build failure.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51528 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 00:16:40 +00:00
Chris Lattner
514b24cb53
fix a nasty off-by-one error.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51519 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 23:29:33 +00:00
Chris Lattner
0d3ab3f121
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
2008-05-23 23:10:58 +00:00
Chris Lattner
9ed7cfd351
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
2008-05-23 23:06:56 +00:00
Ted Kremenek
cfd4c7bef7
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
2008-05-23 22:18:16 +00:00
Steve Naroff
218543b10e
Minor tweak to -ast-dump for ivars.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51508 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 22:01:24 +00:00