Commit Graph

3419 Commits

Author SHA1 Message Date
Nate Begeman 43eec490fb Support checking and codegen of constant vector globals
llvm-svn: 46343
2008-01-25 05:34:48 +00:00
Steve Naroff 78c6cdf95e Replace Sema::CheckVariableInitList, CheckConstantInitList, and CheckForCharArrayInitializer with CheckInitializerListTypes. The new routine now supports struct/union initializers.
This is a modified version of a patch by Eli Friedman. This version passes all of the clang tests and supports vectors:-)

Note that Eli and I are still unsatisfied the implementation of CheckInitializerListTypes(). We'd like to find a more elegant implementation. Nevertheless, this is a complex part of the standard (and may be hard to simplify). Since the complexity is localized to this routine, we can iterate without too much disruption:-)

llvm-svn: 46339
2008-01-25 00:51:06 +00:00
Chris Lattner 3efff5472b Fix a bug recovering from broken code with a goto that Eli reported.
llvm-svn: 46336
2008-01-25 00:01:10 +00:00
Chris Lattner 9046dc1080 Change the location we return for the EOF token to actually be on the last
line of the file, in the common case where a file ends with a newline.

llvm-svn: 46335
2008-01-25 00:00:30 +00:00
Chris Lattner 01b322cb02 Don't add an extra line to the end of the buffer, it doesn't really exist.
llvm-svn: 46330
2008-01-24 23:25:53 +00:00
Ted Kremenek 8a025806a4 Some minor restructuring around LValue and RValue types. The value "kind"
information is not separated into a "base" and "sub" type. Eventually the
value-tracking logic will know about LValues and RValues, but not about
specialized LValues and RValues; separating the "kind" information into bits
indicating whether an ExprValue is an LValue or an RValue from the bits that
specify the actual value type makes this separation easier.

llvm-svn: 46329
2008-01-24 23:19:54 +00:00
Steve Naroff d9d581fc7b Exclude vectors from Type::isScalar() predicate.
llvm-svn: 46328
2008-01-24 22:55:05 +00:00
Ted Kremenek f3d6d668b6 enum value name change.
llvm-svn: 46327
2008-01-24 22:44:24 +00:00
Ted Kremenek 3e742f9184 More cleanups to pretty-printing of states in GraphViz output.
llvm-svn: 46326
2008-01-24 22:27:20 +00:00
Ted Kremenek 053527478b Added transfer function for DeclStmt.
llvm-svn: 46323
2008-01-24 20:55:43 +00:00
Ted Kremenek 1fba169ce0 Adjusted storage of values for Stmt* so that we need only query if
a Stmt* is a block-level expression when we INSERT a value into the map, and
not also when we QUERY a value.

llvm-svn: 46321
2008-01-24 19:43:37 +00:00
Ted Kremenek fa8062c162 Fixed a bug where the values of block-level expressions were being recorded in
the value map as if the expressions were non-block-level expressions.

llvm-svn: 46319
2008-01-24 19:28:01 +00:00
Ted Kremenek 286f030911 Minor tweaks in the transfer functions for pre- and post- ++/-- where
we falsely constructed an APInt to represent the constant '1' instead of
using an APSInt (which has a sign).

llvm-svn: 46317
2008-01-24 19:00:57 +00:00
Ted Kremenek c9052ff8fd Added support for unary operator '-' for equality sets.
Added some workarounds for loss of signess information on some APSInt
operations. Considering the best route to integrate these into APSInt directly.
(FIXME's in GRConstants.cpp).

llvm-svn: 46310
2008-01-24 08:20:02 +00:00
Ted Kremenek 1c91a67086 Added transfer functions for pre- and post- increment/decrement operators.
llvm-svn: 46300
2008-01-24 02:28:56 +00:00
Ted Kremenek 33d8285b8d Added passing "ASTContext" to both GREngine and GRConstants.
Added initial support for integer casting operations to GRConstants.

llvm-svn: 46298
2008-01-24 02:02:54 +00:00
Ted Kremenek 4f1da522ca Minor tweak in GetValue to avoid an extra check for ParenExprs.
llvm-svn: 46294
2008-01-24 00:50:08 +00:00
Ted Kremenek 2517423c3c Implemented value tracking support for '*' and '*='.
Added "multiplication" support for equality sets.

llvm-svn: 46289
2008-01-23 23:42:27 +00:00
Ted Kremenek 5e02dc1b46 Implemented value tracking support for '+=' and '-='.
llvm-svn: 46288
2008-01-23 23:38:00 +00:00
Chris Lattner 2dd606839d add some assertions so that the rewriter dies violently with a useful
error instead of subtly with a mysterious one.

llvm-svn: 46287
2008-01-23 23:37:15 +00:00
Ted Kremenek cefae084a3 Removed extra GraphViz node attributes for GRConstants, as some of them were
causing problems with Dot.

llvm-svn: 46285
2008-01-23 22:54:57 +00:00
Ted Kremenek 930191c011 some prettying of the GraphViz visualization of GRConstants analysis results.
llvm-svn: 46284
2008-01-23 22:30:44 +00:00
Fariborz Jahanian 60a901621f Fixed a nasty bug which took a while to come up with a test case,
diagnose, and took even longer to fix. It has to do with rewriting of a message
receiver which is an 'ivar' reference. Fix, however, is to remove a code which
was not doing the right thing and no longer needed.

llvm-svn: 46279
2008-01-23 20:34:40 +00:00
Ted Kremenek 0a8d3767a3 Major "architectural" changes to the GRConstants analysis. We now reason about
abstract "L-values" and "R-values" when doing value tracking, and expanding
constant tracking to encompass tracking disjunctive sets of possible constants.
Further, the tree-walking is more efficient, as we don't blindly recurse the
tree if we won't generate new states.

llvm-svn: 46278
2008-01-23 19:59:44 +00:00
Chris Lattner 7238225c28 add support for -Wundef.
llvm-svn: 46274
2008-01-23 17:19:46 +00:00
Fariborz Jahanian 54e42318c0 Missing ObjC stuff. Patch by Mike Stump.
llvm-svn: 46268
2008-01-23 01:34:33 +00:00
Fariborz Jahanian 0a71ad2e07 Problem with ObjC's type-encoding of nested structs causing infinit recursion.
llvm-svn: 46260
2008-01-22 22:44:46 +00:00
Lauro Ramos Venancio db449040aa Fix a typo.
llvm-svn: 46259
2008-01-22 22:38:35 +00:00
Lauro Ramos Venancio 09af71c2a6 Implement bitfield write.
llvm-svn: 46258
2008-01-22 22:36:45 +00:00
Lauro Ramos Venancio 2ddcb25a3b Implement bitfield read.
llvm-svn: 46257
2008-01-22 20:17:04 +00:00
Chris Lattner 97ff7763dc Fix PR1936, a crash on malformed #if. Thanks to Neil for
noticing this!

llvm-svn: 46256
2008-01-22 19:34:51 +00:00
Lauro Ramos Venancio 0ae6cd5219 Fix two bugs in bitfield codegen.
llvm-svn: 46255
2008-01-22 19:15:30 +00:00
Gordon Henriksen f52da44530 Fix grammar.
llvm-svn: 46253
2008-01-22 18:46:25 +00:00
Chris Lattner d0d28b913e clarify wording.
llvm-svn: 46252
2008-01-22 17:14:30 +00:00
Steve Naroff af2a022563 - Add Sema::CheckStringLiteralInit, Sema::IsStringLiteralInit.
- Use previous hooks to simplify Sema::CheckInitializerTypes()...

llvm-svn: 46235
2008-01-22 00:55:40 +00:00
Steve Naroff f9eb598de3 Sema::CheckInitializerTypes(). Start simpliying and cleaning up...
llvm-svn: 46234
2008-01-21 23:53:58 +00:00
Lauro Ramos Venancio 111b3ba670 Add Ubuntu 7.10 include path.
llvm-svn: 46233
2008-01-21 23:08:35 +00:00
Fariborz Jahanian 7718e36e25 Elimate bogus warning when va_start is correctly used in
a method.

llvm-svn: 46232
2008-01-21 22:59:53 +00:00
Steve Naroff c505c6792c Add a predicate/getter when checking for incomplete array types ("[]").
llvm-svn: 46231
2008-01-21 22:59:18 +00:00
Lauro Ramos Venancio 37bae3e8aa Simplify the bitfield codegen.
llvm-svn: 46230
2008-01-21 22:54:57 +00:00
Fariborz Jahanian eab81cd03f Synthesize methods with va-arg list correctly.
llvm-svn: 46212
2008-01-21 20:14:23 +00:00
Lauro Ramos Venancio 71a9bb2b48 Fix the __SIZE_TYPE__ definition on x86_32. This fixes the alloca.c (wget 1.10.2) compilation.
llvm-svn: 46196
2008-01-20 04:02:16 +00:00
Fariborz Jahanian 137d693e09 Fixed comment.
llvm-svn: 46185
2008-01-19 01:03:17 +00:00
Steve Naroff c7d2df23f8 Fix two bugs with an @throw that doesn't have a statement.
- ObjCAtThrowStmt::getSourceRange() needs to check if it has a statement (and not go "boom":-)
- RewriteTest::RewriteObjCThrowStmt() needs to generate refer to the current exception. 

llvm-svn: 46184
2008-01-19 00:42:38 +00:00
Fariborz Jahanian 802583656e Patch to replace #import with #include.
llvm-svn: 46183
2008-01-19 00:30:35 +00:00
Steve Naroff 31c89f2bb0 Add Basic/Targets.cpp to the Xcode project...
llvm-svn: 46182
2008-01-18 23:34:17 +00:00
Steve Naroff acb6fa6bea Sema::FinalizeDeclaratorGroup(): Tighten up the tentative definition rule when dealing with arrays.
Bug submitted by Eli.

llvm-svn: 46179
2008-01-18 20:40:52 +00:00
Anders Carlsson 60bfc161a0 Assert that the type of the cast is equal to the _unqualified_ type of the subexpression. Fixes a problem spotted by Nuno Lopes.
llvm-svn: 46158
2008-01-18 02:25:57 +00:00
Fariborz Jahanian 159ee39f4d Insert #pragma once when rewriting a header file.
llvm-svn: 46155
2008-01-18 01:15:54 +00:00
Ted Kremenek 111ede6c00 Fixed bug in 'GetBinding' when doing the lookup of stored values. We now
use ImmutableMap::SlimFind(), which returns the correct value.

Added pruning of dead block-level expressions and Decls from our value map
using liveness information.

llvm-svn: 46154
2008-01-18 00:41:32 +00:00