Commit Graph

3710 Commits

Author SHA1 Message Date
Steve Naroff 4cc387212a Fix spelling in comment.
llvm-svn: 46906
2008-02-09 17:25:18 +00:00
Steve Naroff 45173e0ac0 Fix <rdar://problem/5733511> clang doesn't emit error for const array.
llvm-svn: 46905
2008-02-09 16:59:44 +00:00
Eli Friedman a62f3e1352 Expose the logic for field address codegen; it is needed for aggregate
initializers, and I don't want to duplicate the bitfield-handling code.  
(I'll send a patch for aggregate initializers to the mailing 
list sometime soon.)

llvm-svn: 46904
2008-02-09 08:50:58 +00:00
Steve Naroff a369922449 A bunch-o changes to fix <rdar://problem/5716046> incomplete implementation of ObjC class warning is incomplete
As part of this fix, I made a low-level change to the text diagnostics machinery (to basically avoid printing duplicate source lines/carets when you have multiple diagnostics that refer to the same exact place). For now, this only happens with we don't have a source range (could be extended to support source ranges as well). 

llvm-svn: 46897
2008-02-08 22:06:17 +00:00
Ted Kremenek b54312d5a0 Split off expression-bindings in ValueState from variable-bindings.
llvm-svn: 46892
2008-02-08 21:10:02 +00:00
Ted Kremenek 4142cc834b Changed "GetValue" methods to take an
Expr* instead of a Stmt*, since we only
store bindings for Expr*.

llvm-svn: 46891
2008-02-08 20:29:23 +00:00
Lauro Ramos Venancio d74057fa87 Fix a bitfield regression. Reported by Anders Carlsson.
llvm-svn: 46889
2008-02-08 19:46:46 +00:00
Ted Kremenek 80ff44ff30 Moved implementation of "RemoveDeadBindings" from the main
GRConstants logic to ValueStateManager.

llvm-svn: 46888
2008-02-08 19:17:19 +00:00
Ted Kremenek 5d9073c776 Removed ability to create symbol bindings
in VarKey and VariableBindingsTy.

llvm-svn: 46887
2008-02-08 19:08:13 +00:00
Steve Naroff 8c099c3f03 Use getLogicalLineNumber() in FuzzyParseMicrosoftAsmStatement(), it's more general and simplifies the code.
llvm-svn: 46885
2008-02-08 18:01:27 +00:00
Ted Kremenek 09d6ba1496 Moved that clang doesn't depend on llvm-gcc above
the subsection of building clang with llvm.

llvm-svn: 46884
2008-02-08 07:32:26 +00:00
Ted Kremenek fd39e73b7a Implemented transfer functions for "<<" and ">>" when the RValues are
ConcreteInts.

llvm-svn: 46883
2008-02-08 07:14:58 +00:00
Eric Christopher 6aa87cbb63 Add instructions for building clang while building llvm.
llvm-svn: 46881
2008-02-08 07:10:48 +00:00
Ted Kremenek 707b07ccf9 Implemented transfer functions for Statement-Expressions and Commas.
Fixed bug in dispatching to the correct transfer function for |=, &=, and ^|.

llvm-svn: 46880
2008-02-08 07:05:39 +00:00
Eric Christopher 2dc30a5ac8 De-^Mify file.
llvm-svn: 46879
2008-02-08 06:45:49 +00:00
Steve Naroff db5f7d7699 Support fuzzy parsing MS line-oriented __asm's that originate from a macro (a case where we can't obtain source line info). As the test case indicates, we don't currently support line-oriented asm statements that mix file/macro body tokens.
llvm-svn: 46878
2008-02-08 03:36:19 +00:00
Ted Kremenek fd641f1056 More variable renamings.
llvm-svn: 46875
2008-02-08 03:02:48 +00:00
Ted Kremenek 173743da67 Renamed InvalidValue to UnknownVal.
Renamed UninitializedValue to UninitializedVal.

llvm-svn: 46874
2008-02-08 02:57:34 +00:00
Eli Friedman 113eed5cff Fix indentation.
llvm-svn: 46873
2008-02-08 01:24:30 +00:00
Eli Friedman 1974e5321a Detabify SemaExpr. My text editor defaults to 8 spaces per tab, so it
gets kind of annoying.

llvm-svn: 46872
2008-02-08 01:19:44 +00:00
Eli Friedman 4297826cac Improve diagnostic for illegal array initialization.
llvm-svn: 46869
2008-02-08 00:48:24 +00:00
Anders Carlsson 5c6c05956e Put back the top-level asm code; all tests pass now.
llvm-svn: 46868
2008-02-08 00:33:21 +00:00
Anders Carlsson 0fae4f56df Back out 46855 for now, it causes test failures on Darwin.
llvm-svn: 46867
2008-02-08 00:23:11 +00:00
Steve Naroff 4e79d340bd - Add support for fuzzy parsing line-oriented __asm's (yuck).
- Change handling of __w64 to a built-in macro.

llvm-svn: 46864
2008-02-07 23:24:32 +00:00
Lauro Ramos Venancio 9eff02d9f8 Simplify bitfield codegen.
Fix codegen of struct { short a[3]; int b:15; }.

llvm-svn: 46859
2008-02-07 19:29:53 +00:00
Lauro Ramos Venancio 0f166de892 Fix codegen of
struct {
  char a[3];
  unsigned char b:1;
};

Fix PR1990.

llvm-svn: 46856
2008-02-07 18:18:58 +00:00
Anders Carlsson bcc3a4bf64 Handle top-level asm declarations.
llvm-svn: 46855
2008-02-07 17:19:11 +00:00
Steve Naroff 6936a08704 Minor cleanup from yesterday's -fms-extension commit. Move __int* MS keywords to predefined macros. This removes some of the MS-madness from Parser::ParseDeclarationSpecifiers().
llvm-svn: 46852
2008-02-07 15:26:07 +00:00
Ted Kremenek e187d0511f Added some more opcode pretty-printing.
Minor cleanups with generating nodes for NULL-pointer dereferences.

llvm-svn: 46851
2008-02-07 15:20:13 +00:00
Ted Kremenek d74da0838f Added proof-of-concept NULL pointer diagnostics to GRConstants.
Modified the driver to pass the Diagnostic object to GRConstants.

llvm-svn: 46847
2008-02-07 06:33:19 +00:00
Ted Kremenek 149512c013 Added support to distinguish between both implicit and explicit null dereferences.
llvm-svn: 46846
2008-02-07 06:04:18 +00:00
Chris Lattner 3b5054dda0 Implement support for the extremely atrocious MS /##/ extension,
which pastes together a comment.  This is only enabled with 
-fms-extensions of course.

llvm-svn: 46845
2008-02-07 06:03:59 +00:00
Chris Lattner f96e8d0925 these aren't tokens.
llvm-svn: 46844
2008-02-07 05:57:50 +00:00
Ted Kremenek e324704e62 Added recording of "implicit" NULL dereferences of symbolic pointers.
llvm-svn: 46843
2008-02-07 05:48:01 +00:00
Eli Friedman 69d56cff31 Add a FIXME for alternate address spaces.
llvm-svn: 46841
2008-02-07 05:24:51 +00:00
Chris Lattner 6bd4c7f94f get the tree building again
llvm-svn: 46840
2008-02-07 05:01:42 +00:00
Ted Kremenek 88da1de048 Added several guards in transfer functions for "InvalidValues".
Fixed bug in RemoveDeadBindings by implementing a simple "mark-and-sweep"
cleaner over the bindings, starting from the Decls and block-level expressions
that are considered "live" by the Liveness analysis.

Fixed bug in isa<> implementation for class LValue.

Added "VisitDeclRefExpr" to GRConstants so that we explicitly bind the current
value of variable to the Block-level Expression (i.e., when the DeclRefExpr is
at the CFGBlock level).

llvm-svn: 46839
2008-02-07 04:16:04 +00:00
Steve Naroff b2c80c7c7b Implement -fms-extensions. This allows us to fuzzy parse non-standard MS constructs used in "windows.h".
llvm-svn: 46838
2008-02-07 03:50:06 +00:00
Ted Kremenek a56c08a2e4 Fixed bug in LiveVariables analysis where Block-level exprs appearing
as the initializers for DeclStmts were not being registered as being
live at the start of the DeclStmt.

llvm-svn: 46837
2008-02-07 02:38:55 +00:00
Ted Kremenek 43523e0fe8 Added transfer function logic for ReturnStmts.
Fixed insidious bug in handling dereferences.

llvm-svn: 46835
2008-02-07 01:08:27 +00:00
Ted Kremenek 4aa77cee11 Minor reordering of the serialization of the fields of MemberExpr to result
in a smaller encoding on disk.

llvm-svn: 46832
2008-02-06 23:03:14 +00:00
Ted Kremenek cdd0be1dc1 Major code refactoring/cleanup with transfer function logic. Now the
code structure is more suitable for additional symbolic analysis.

llvm-svn: 46831
2008-02-06 22:50:25 +00:00
Eli Friedman 1242fff6ec Make sure to propagate qualifiers through the member operator.
llvm-svn: 46830
2008-02-06 22:48:16 +00:00
Chris Lattner 871e0ceffb explicitly document that return statement argument does not necessarily follow the result type of the function. Add testcase.
llvm-svn: 46823
2008-02-06 21:20:34 +00:00
Anders Carlsson 377ad02de5 Use the subprocess module instead of os.system. Patch by Sam Bishop.
llvm-svn: 46819
2008-02-06 19:03:27 +00:00
Ted Kremenek afa5f492e5 Added main transfer function support for unary operator "!".
llvm-svn: 46815
2008-02-06 17:56:00 +00:00
Ted Kremenek 17b65b557b Added assumption logic for symbolic non-lvalues when used in conditions such as
"if(x)". On the true branch we know the value is != 0, and on the false branch
we know it is 0.

llvm-svn: 46814
2008-02-06 17:32:17 +00:00
Anders Carlsson d3b06cda3c Add pointer + int (and vice versa) to the constant emitter.
llvm-svn: 46812
2008-02-06 07:23:14 +00:00
Anders Carlsson 093f1a099f Generate code for the various __builtin_ctz functions.
llvm-svn: 46811
2008-02-06 07:19:27 +00:00
Chris Lattner b818af539f now that ConvertTagDeclType is nice and simple, use it from UpdateCompletedType.
llvm-svn: 46809
2008-02-06 06:06:49 +00:00
Chris Lattner d11482ea22 simplify and speed up type refinement logic. No functionality change.
llvm-svn: 46808
2008-02-06 06:03:51 +00:00
Chris Lattner a64dde6b48 only convert the type name once, not each type it is refined.
llvm-svn: 46807
2008-02-06 05:48:29 +00:00
Eli Friedman 220ee41011 Fix the codegen of structs with flexible array members.
llvm-svn: 46806
2008-02-06 05:33:51 +00:00
Chris Lattner 3340b92582 simplify a bunch of code.
llvm-svn: 46805
2008-02-06 05:29:46 +00:00
Chris Lattner 56096f3020 rename TypeHolderMap to TypeCache, which more aptly describes what it is.
llvm-svn: 46804
2008-02-06 05:21:55 +00:00
Chris Lattner ee9fafd533 split tagged decl layout into its own method.
llvm-svn: 46803
2008-02-06 05:18:32 +00:00
Chris Lattner f6e3669eb2 only update the llvm type for a struct when we used the struct
previously in an opaque context.  If we didn't do this, 
computing its layout could be wasted: just be lazy.

llvm-svn: 46802
2008-02-06 05:12:09 +00:00
Chris Lattner 68be60694e sink more of the type related code into CodeGenTypes.
llvm-svn: 46801
2008-02-06 05:08:19 +00:00
Chris Lattner 8b945ee058 codegen static variables in a function into a different namespace from
static variables outside functions.

llvm-svn: 46800
2008-02-06 04:54:32 +00:00
Eli Friedman d49a720d52 Be a bit stricter about array type compatibility.
llvm-svn: 46799
2008-02-06 04:53:22 +00:00
Chris Lattner a5e4d30942 Finish off the refactoring of type handling stuff. Now we recompile every
tag decl after it has been completed

llvm-svn: 46798
2008-02-06 04:51:19 +00:00
Ted Kremenek 73451846a7 Fixed bug in '=' transfer function: RHS does not have to be a non-LValue.
llvm-svn: 46797
2008-02-06 04:41:14 +00:00
Ted Kremenek d17f05435a Fixed signedness bug in cast transfer function when casting integers to pointers.
Removed lval::SymIntConstraintVal; wrappers for symbolic constraints are not lvalues (only integers that evaluate to !0 or 0).

llvm-svn: 46796
2008-02-06 04:31:33 +00:00
Ted Kremenek b2652827e6 Modified state pretty-printing to include the '!=' and '==' constraints on
symbols (for constant integers).

llvm-svn: 46795
2008-02-06 03:56:15 +00:00
Ted Kremenek 0ea8fea0ba Disabled operator= for ValueStateImpl.
ValueState no longer inherits FoldingSetNode (not needed).
Removed redundant operator= implementation for ValueState (it simply did the default behavior).

llvm-svn: 46794
2008-02-06 02:50:36 +00:00
Ted Kremenek 4ff4e7ce9f Fixed bug when allocating a ValueStateImpl object in getPersistentState()
using the bump-pointer allocator and a placed new; we accidentally allocated
a ValueStateImpl* instead, causing an overrun when we did a placed new().

llvm-svn: 46793
2008-02-06 02:45:20 +00:00
Chris Lattner adf1f51fc5 move the codegen ASTConsumer out of the driver into libcodegen,
eliminating a bunch of forwarding methods and generally 
simplifying things.

llvm-svn: 46792
2008-02-06 02:01:47 +00:00
Chris Lattner b5eda6253b pull .ll and .bc writing out of the ASTConsumer destructors into some top
level code in clang.  This is a cleanup, but does implement "-o" for 
-emit-llvm.  One effect of this is that "clang foo.c -emit-llvm" will now
emit into foo.ll instead of stdout.  Use "clang foo.c -emit-llvm -o -" or 
"clang < foo.c -emit-llvm" to get the old behavior.

llvm-svn: 46791
2008-02-06 01:42:25 +00:00
Ted Kremenek 03e7b55f22 Added some skeleton code for performing "assume" on symbols: e.g. assume($0 != 0).
This action will add constraints to the possible values of a symbol.
Still needs to be debugged.

llvm-svn: 46789
2008-02-06 00:54:14 +00:00
Chris Lattner 622c193a32 inform astconsumer about tagdecls as they are defined.
llvm-svn: 46788
2008-02-06 00:51:33 +00:00
Chris Lattner fe0e0af434 pass the astconsumer into Sema's ctor, clean up some stuff in
Sema::ActOnTranslationUnitScope.  The various ObjC pieces at the top
of Sema.cpp should be moved into SemaObjC or something.

llvm-svn: 46787
2008-02-06 00:46:58 +00:00
Chris Lattner 8082d870bd rename ASTSTreamer.{h|cpp} -> ParseAST.{h|cpp}
llvm-svn: 46786
2008-02-06 00:23:21 +00:00
Chris Lattner 4afeded499 kill the ASTStreamer class, inlining it into its only client: clang::ParseAST
llvm-svn: 46785
2008-02-06 00:15:02 +00:00
Anders Carlsson 3ed4aea198 Even more inline asm codegen fixes.
llvm-svn: 46784
2008-02-06 00:11:32 +00:00
Nate Begeman 3399bb424c simple implementation of __builtin_alloca
llvm-svn: 46783
2008-02-06 00:02:50 +00:00
Steve Naroff 2352150043 Add a FIXME to clarify previous commit/experiment.
llvm-svn: 46782
2008-02-05 23:59:27 +00:00
Anders Carlsson 487e527fcf Handle the memory clobber.
llvm-svn: 46780
2008-02-05 23:30:20 +00:00
Anders Carlsson b737b6247f Improvements to inline asm code generation.
llvm-svn: 46779
2008-02-05 23:18:57 +00:00
Ted Kremenek 38b32e976c Added pretty-printing support for lval::SymIntConstraintVal and
nonlval::SymIntConstraintVal.

Reworked transfer function for '==' and '!=' for LValues to return
SymIntConstraintVal when comparing a symbol with a constant.

llvm-svn: 46778
2008-02-05 23:08:41 +00:00
Anders Carlsson 19fe116fc0 Handle simple asm statements correctly.
llvm-svn: 46777
2008-02-05 23:03:50 +00:00
Chris Lattner 9413a016f4 simplify some code.
llvm-svn: 46774
2008-02-05 22:40:55 +00:00
Ted Kremenek 8f6dcfaa30 Moved implementation of cast<> for SymbolData closer to SymbolData's definition.
llvm-svn: 46772
2008-02-05 22:21:54 +00:00
Ted Kremenek 1ee50cd9c1 Added new "NonLValue" class: SymIntConstraintVal. This class represents a binary
contraint between a symbol and an integer constant.

llvm-svn: 46771
2008-02-05 22:10:48 +00:00
Ted Kremenek 1e3fa134de Moved subclasses of LValue and NonLValue into their own namespaces.
This noticeably cleans up the naming of these classes.

llvm-svn: 46770
2008-02-05 21:52:21 +00:00
Ted Kremenek a4aa95bd9d Added "SymIntConstraint", a utility class to represent intermediate values for
transfer function evaluation that represent constraints between symbolic values
and constant integers.

llvm-svn: 46769
2008-02-05 21:32:43 +00:00
Steve Naroff e6016798bf Fix Parser::ParseObjCTryStmt() to allow for trailing @-keyword statements/expressions.
This bug fix is the result of not having 2-token lookahead to recognize specific @-keywords.

llvm-svn: 46768
2008-02-05 21:27:35 +00:00
Anders Carlsson fcbb11a86f Add some binops.
llvm-svn: 46766
2008-02-05 20:54:21 +00:00
Anders Carlsson b170d0cf7e More improvements to inline asm CG.
llvm-svn: 46762
2008-02-05 20:01:53 +00:00
Ted Kremenek e1bbf8e549 Added "batch" processing versions of Nodify and SetValue. Created typedefs
for buffers for RValues and States.

llvm-svn: 46759
2008-02-05 19:35:18 +00:00
Ted Kremenek 1cc95f6cd3 Added a "ConstantNotEq" map to ValueState (and added necessary typedefs and factory objects to ValueStateManager).
llvm-svn: 46758
2008-02-05 18:51:06 +00:00
Ted Kremenek 961ec7bc22 Added some comments.
llvm-svn: 46756
2008-02-05 18:24:17 +00:00
Ted Kremenek db814b5415 Renamed typedef "iterator" in ValueState to "vb_iterator" (for "VariableBindings").
llvm-svn: 46755
2008-02-05 18:19:15 +00:00
Ted Kremenek 17e5b5c99e Reordered fields/methods in ValueState to make it more aesthetically pleasing.
llvm-svn: 46754
2008-02-05 18:17:58 +00:00
Anders Carlsson 063ab86775 Use correct flag value.
llvm-svn: 46752
2008-02-05 17:26:36 +00:00
Anders Carlsson d0cd0d89a0 Append input argument to args vector.
llvm-svn: 46751
2008-02-05 16:57:38 +00:00
Anders Carlsson 952a99592f Add code generation for inline asm statements.
llvm-svn: 46750
2008-02-05 16:35:33 +00:00
Chris Lattner b1537ebdd4 rewrite some of the type refinement code to eliminate dangling pointers
simplify the code and generally make it more robust.

llvm-svn: 46745
2008-02-05 08:06:13 +00:00
Ted Kremenek d8902e06ba Overhauling of "ValueState" so that it represents its own functional data
structure that can contain several maps, not just one.

llvm-svn: 46744
2008-02-05 07:17:49 +00:00
Chris Lattner 86964a9653 Change the key of CGRecordLayouts from being an llvm type* to being a decl*. LLVM
Type*'s can change as types are refined, so we can't use them as a stable key in
the map.  Decls don't change, so use them instead.

This patch was written by Anders, but he's too shy to commit it himself :)

llvm-svn: 46743
2008-02-05 06:55:31 +00:00
Chris Lattner b977b6a59b Relax an assertion, fixing PR1968
llvm-svn: 46742
2008-02-05 06:37:34 +00:00