Daniel Dunbar
4087e24f73
Evaluate ==,!= for complex types.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63280 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 06:43:41 +00:00
Douglas Gregor
58e22b19ad
Add another devilish testcase for designated initializers
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63262 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 01:10:11 +00:00
Douglas Gregor
6fbdc6bd38
Eliminate infinite looping in a wacky case with designated initializers. Simplifies (somewhat) the actually checking of the initializer expression following the designators
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63257 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 00:39:20 +00:00
Douglas Gregor
34e7946831
Improvements to code-generation and semantic analysis of designated
...
initializers.
- We now initialize unions properly when a member other than the
first is named by a designated initializer.
- We now provide proper semantic analysis and code generation for
GNU array-range designators *except* that side effects will occur
more than once. We warn about this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63253 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 23:36:17 +00:00
Daniel Dunbar
a5fd07bbc5
Implement basic _Complex integer constant folding.
...
- Merged into single ComplexEvaluator, these share too much logic to
be worth splitting for float/int (IMHO). Will split on request.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 22:24:07 +00:00
Douglas Gregor
4c67834407
Code generation support for C99 designated initializers.
...
The approach I've taken in this patch is relatively straightforward,
although the code itself is non-trivial. Essentially, as we process
an initializer list we build up a fully-explicit representation of the
initializer list, where each of the subobject initializations occurs
in order. Designators serve to "fill in" subobject initializations in
a non-linear way. The fully-explicit representation makes initializer
lists (both with and without designators) easy to grok for codegen and
later semantic analyses. We keep the syntactic form of the initializer
list linked into the AST for those clients interested in exactly what
the user wrote.
Known limitations:
- Designating a member of a union that isn't the first member may
result in bogus initialization (we warn about this)
- GNU array-range designators are not supported (we warn about this)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63242 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 21:54:33 +00:00
Ted Kremenek
abf439731b
retain/release checker: Always generate an "autorelease" summary for an "autorelease" message, and have the summary processing logic treat it as a no-op in GC mode. This change is motivated to encode more of the semantics in the summaries themselves for eventual better diagnostics.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 21:44:40 +00:00
Daniel Dunbar
64cfdb7da3
Handle complex types in ASTContext::mergeTypes
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63238 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 21:22:12 +00:00
Ted Kremenek
a7ecc3788d
Add autorelease test case.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63237 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 21:20:48 +00:00
Sebastian Redl
21593acb93
Implement pointer to member handling in static_cast.
...
Fix a stupid mistake in UnwrapSimilarPointers that made any two member pointers compatible as long as the pointee was the same.
Make a few style corrections as suggested by Chris.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63215 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 18:33:18 +00:00
Douglas Gregor
6697312178
Complete semantic checking for typedef redeclarations in C++. The
...
rules are slightly different than in C, and now we handle both
dialects properly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63211 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 17:15:10 +00:00
Ted Kremenek
23b8eaa836
retain/release checker: Improve diagnostics to indicate that CF objects are not automatically garbage collected.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63187 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 06:25:48 +00:00
Chris Lattner
e86e4cd097
fix a crash I introduced, thanks to Ted for the awesome reduced
...
testcase :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63182 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 05:42:38 +00:00
Nuno Lopes
b243b7d98e
add test for PR2502, which was already fixed some time ago
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63160 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 00:44:33 +00:00
Nuno Lopes
010d514380
fix PR3427: fix debuginfo for incomplete array types
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63158 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 00:35:17 +00:00
Sebastian Redl
db64728e69
Add handling of member pointers to reinterpret_cast.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63150 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 23:18:31 +00:00
Anders Carlsson
03eb543cf7
If an input constraint refers to an output constraint, it should have the same constraint info as the output constraint. Fixes PR3417
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63127 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 20:38:24 +00:00
Chris Lattner
c8e9cd6e32
eliminate some random .ll file outputs
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63117 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 18:56:08 +00:00
Ted Kremenek
d76d47eb5f
Fix bug in BasicStore::getLValueElement where if the base of an array subscript expression was an ElementRegion we stacked another ElementRegion on top of that.
...
This fixes PR 3422.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63110 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 18:29:03 +00:00
Eli Friedman
adf077f46b
Fix for PR3418: make sure to handle the RHS of expressions starting with
...
__extension__. This sort of construct shows up in the gcc source code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63100 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 08:43:38 +00:00
Chris Lattner
b9c3f966b1
Introduce a new PresumedLoc class to represent the concept of a location
...
as reported to the user and as manipulated by #line. This is what __FILE__,
__INCLUDE_LEVEL__, diagnostics and other things should follow (but not
dependency generation!).
This patch also includes several cleanups along the way:
- SourceLocation now has a dump method, and several other places
that did similar things now use it.
- I cleaned up some code in AnalysisConsumer, but it should probably be
simplified further now that NamedDecl is better.
- TextDiagnosticPrinter is now simplified and cleaned up a bit.
This patch is a prerequisite for #line, but does not actually provide
any #line functionality.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 07:57:44 +00:00
Chris Lattner
202fd2c4fb
Fix a bug that I noticed by inspection.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63094 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 05:34:03 +00:00
Daniel Dunbar
2e2558ec5f
Fix definition of __builtin_ia32_vec_set_v2di and de-XFAIL
...
builtins-x86.c.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63069 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 23:43:02 +00:00
Sebastian Redl
f20269b428
Add support for member pointers to const_cast.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63055 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 22:19:12 +00:00
Sebastian Redl
9e5e4aaf8b
Remove an implemented FIXME and extend test cases. Follow-up on Doug's review.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63032 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 19:54:48 +00:00
Chris Lattner
478a18ec47
add parsing and constraint enforcement for GNU line marker directives.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63003 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 06:19:46 +00:00
Chris Lattner
8e60a29e25
add another sanity test.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63001 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 05:44:13 +00:00
Chris Lattner
359cc44754
parse and enforce required constraints on #line directives. Right now
...
we just discard them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62999 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 05:29:08 +00:00
Sebastian Redl
4433aafbc2
Implement implicit conversions for pointers-to-member.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62971 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-25 19:43:20 +00:00
Eli Friedman
3941b18b8e
Make the constant folder aware of
...
__builtin___CFStringMakeConstantString. (We get into trouble in
GenerateStaticBlockVarDecl if the constant folder isn't accurate.)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62949 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-25 01:54:01 +00:00
Eli Friedman
f01158941b
Fix the address of a label to be properly considered and emitted as a
...
constant.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62948 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-25 01:21:06 +00:00
Eli Friedman
13ca96a238
Fix for PR2100: merge types for variables.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62947 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 23:49:55 +00:00
Eli Friedman
9804bc26b8
Correct test; sorry for any inconvenience.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62946 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 23:44:26 +00:00
Sebastian Redl
8edef7c31d
Make tentative parsing of pointer-to-member decls work, and fix other stuff pointed out by Doug.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62944 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 23:29:36 +00:00
Eli Friedman
dca2b7314f
PR3062: statement expressions should be illegal at file scope. I don't
...
think this has any significant effects at the moment, but it could
matter if we start constant-folding statement expressions like gcc does.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62943 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 23:09:00 +00:00
Eli Friedman
769e411b72
Fix for PR2910: implement CodeGen for non-constant offsetof.
...
Note that there are still other issues in this area; see PR3396.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62942 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 22:38:55 +00:00
Chris Lattner
da02747256
Implement C99 6.5.3.4p1, rejecting sizeof(bitfield)
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62936 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 21:29:22 +00:00
Sebastian Redl
f30208ad5b
Add support for declaring pointers to members.
...
Add serialization support for ReferenceType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 21:16:55 +00:00
Chris Lattner
31e21e0562
Fix PR3386 by handling GCC's rules for alignof, which are substantially
...
different than those for sizeof. Reject alignof(bitfield) like gcc does.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62928 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 20:17:12 +00:00
Daniel Dunbar
8f826f0e0c
Fix invalid evaluation of _Complex float (real & imaginary parts had
...
mismatched semantics).
- Enforce this in APValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 19:08:01 +00:00
Anders Carlsson
79bc64ceb2
Handle the 'e' constraint. Fixes PR3385
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62923 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 18:03:09 +00:00
Anders Carlsson
91b9f2072a
Ignore parens when determining if an expr is a string literal. Fixes PR3382.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62922 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 17:47:50 +00:00
Ted Kremenek
8318304afd
Fix crash ElementRegion::getRValueType() when the RvalueType of the ArrayRegion is a typedef and not (directly) a pointer.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62909 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 06:11:36 +00:00
Ted Kremenek
3148eb4a75
More hacking on static analyzer diagnostics. When emitting summary diagnostics the code paths for diagnostics involving paths or single locations are now unified. This patch also constifies many arguments/methods that are touched by this logic, leading to a nice overall code cleanup.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62903 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 00:55:43 +00:00
Douglas Gregor
d6f584ff26
More APSInt appeasement
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62884 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 22:22:29 +00:00
Douglas Gregor
53d3d8e066
Hopefully the last of the APSInt signedness issues with initializers. Fixes PR clang/3378
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62876 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 21:04:18 +00:00
Douglas Gregor
0804888d91
Allow subtraction of function pointer types in C, as a GNU extension. Fixes rdar://problem/6520707
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 19:03:35 +00:00
Douglas Gregor
e3fa2de90e
Make sure all of the isUnsigned flags line up when comparing initializer values, to really really fix PR clang/3377
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 18:58:42 +00:00
Daniel Dunbar
b09fae74ac
Handle pointer arithmetic on function pointers.
...
- <rdar://problem/6518844> Clang-generated bitcode crashes LLVM while compiling function pointer addition expression
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62857 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 18:51:09 +00:00
Douglas Gregor
f6c717c3dc
Properly manage the bit-widths of APInts/APSInts in array initialization.
...
Fixes PR clang/3377
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62851 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 16:54:12 +00:00