Commit Graph

3405 Commits

Author SHA1 Message Date
Ted Kremenek 24ea11d4e0 Renamed various traits and classes. Added "Infeasible" bit to ExplodedNodeImpl
so that nodes can be marked as representing an infeasible program point. This
flag lets the path-sensitive solver know that no successors should be generated
for such nodes.

llvm-svn: 45788
2008-01-09 23:11:36 +00:00
Ted Kremenek 84ab850e46 Renamed Stmt***Edge and ***StmtEdge (where *** = "Stmt" or "Blk") classes to
BExpr*** and ***BExpr respectively. These edges represent program locations
between the entrance/exit of a block and Block-level Expressions.

Also added ***SExpr and SExpr*** ProgramEdges to represent the locations in the
program between the evaluation of subexpressions and block-level expressions.

llvm-svn: 45786
2008-01-09 22:52:38 +00:00
Ted Kremenek fed4cce0cc Removed some files related to the path-sensitive solver as part of some
code restructuring.  (new files will be introduced shortly)

llvm-svn: 45785
2008-01-09 22:49:37 +00:00
Steve Naroff c6edcbdb5d Fix ASTContext::typesAreCompatible to allow for int/enum compatibility (C99 6.7.2.2p4).
Fix Sema::MergeFunctionDecl to allow for function type compatibility (by using the predicate on ASTContext). Function types don't have to be identical to be compatible...

llvm-svn: 45784
2008-01-09 22:43:08 +00:00
Steve Naroff 08ddb8c55c Teach Sema::ActOnCompoundLiteral about constraint C99 6.5.2.5p3.
llvm-svn: 45782
2008-01-09 20:58:06 +00:00
Chris Lattner 119d81a4f4 Fix isIntegerConstantExpr to compare against zero for casts to bool instead of
truncating.  This allows us to compile:
 void foo() {
  static _Bool foo = 4;
}

into:
@foo1 = internal global i8 1
instead of:
@foo1 = internal global i8 4

llvm-svn: 45779
2008-01-09 18:59:34 +00:00
Chris Lattner 41a1ef0dfe implement proper support for _Bool in memory, which is usually i8, not i1.
This fixes a crash reported by Seo Sanghyeon

llvm-svn: 45778
2008-01-09 18:47:25 +00:00
Fariborz Jahanian 6fa7516bc9 Type-cast RHS of assignment to prevent warning compiling rewritten foreach code.
llvm-svn: 45777
2008-01-09 18:15:42 +00:00
Fariborz Jahanian 22f2347791 Fixed a bug whereby a parethesized collection expression was not being rewritten correctly.
llvm-svn: 45776
2008-01-09 17:50:00 +00:00
Fariborz Jahanian b7e7ee9ff3 Typo fixed.
llvm-svn: 45771
2008-01-09 01:25:54 +00:00
Fariborz Jahanian 05d2876ec3 Another test case for testing rewriteing of nested foreach-statement.
llvm-svn: 45769
2008-01-09 00:47:02 +00:00
Fariborz Jahanian a305a5609e Remove dependency on objc.h
llvm-svn: 45767
2008-01-09 00:33:05 +00:00
Steve Naroff 66a26044f8 Teach Expr::isConstantExpr() about CompoundLiterals.
llvm-svn: 45764
2008-01-09 00:05:37 +00:00
Chris Lattner 82bebb2432 Fix a typo, patch by Mike Stump!
llvm-svn: 45763
2008-01-09 00:00:15 +00:00
Fariborz Jahanian 965a8961c7 Patch to rewrite ObjC2's foreach-stmt.
llvm-svn: 45760
2008-01-08 22:06:28 +00:00
Ted Kremenek 96b1ce4f0a Added VISIBILITY_HIDDEN to classes/structs in anonymous namespaces.
llvm-svn: 45750
2008-01-08 18:19:08 +00:00
Ted Kremenek 83ebcef8ae Added VISIBILITY_HIDDEN to classes/structs in anonymous namespace.
llvm-svn: 45749
2008-01-08 18:15:10 +00:00
Ted Kremenek 7e41c29a86 Added most of the boilerplate to the driver needed to run the graph-reachability
constant propagation analysis.

llvm-svn: 45747
2008-01-08 18:04:06 +00:00
Chris Lattner e3e358c317 readability improvement suggested by Sam Bishop, thanks!
llvm-svn: 45735
2008-01-08 04:13:21 +00:00
Steve Naroff 039ad3cf90 Fix Sema::CheckConditionalOperands(). The null pointer constant checks need to precede the check for two pointer operands.
llvm-svn: 45732
2008-01-08 01:11:38 +00:00
Ted Kremenek 9384343c11 Added nodes_iterator to the GraphTrait for ExplodedNode<>.
llvm-svn: 45730
2008-01-08 00:46:00 +00:00
Ted Kremenek a3da232ce7 Added GraphTraits<> partial specializations for ExplodedNode<> classes.
llvm-svn: 45729
2008-01-08 00:26:05 +00:00
Ted Kremenek 551e4ce74e Relocated comment in header.
llvm-svn: 45728
2008-01-08 00:07:06 +00:00
Ted Kremenek 35ff5b0ee6 Added more boilerplate for processing end-of-paths.
llvm-svn: 45724
2008-01-07 22:22:13 +00:00
Ted Kremenek 8569309bca Added ownership of "checker state" within the ExplodedGraph. Moved code that
creates the initial root node from the constructor of ReachabilityEngine to
ReachabilityEngine::ExecuteWorklist.

llvm-svn: 45722
2008-01-07 21:56:52 +00:00
Fariborz Jahanian dc917b9e07 Patch to start rewriting of ObjC2's foreach statement (work in progress).
llvm-svn: 45721
2008-01-07 21:40:22 +00:00
Fariborz Jahanian 6917870be5 Verify/add code to make sure types passed to interfaceTypesAreCompatible
are canonical. Asst in interfaceTypesAreCompatible if they are not.

llvm-svn: 45717
2008-01-07 20:12:21 +00:00
Chris Lattner a30be59fa2 Fix a nasty corner case that Neil noticed in PR1900, where we would
incorrectly apply the multiple include optimization to files with 
guards like:

#if !defined(x) MACRO

where MACRO could expand to different things in different contexts.
Thanks Neil!

llvm-svn: 45716
2008-01-07 19:50:27 +00:00
Ted Kremenek 1b0ea82459 Substituted all instances of the string "Objc" for "ObjC". This fixes
some naming inconsistencies in the names of classes pertaining to Objective-C
support in clang.

llvm-svn: 45715
2008-01-07 19:49:32 +00:00
Fariborz Jahanian 699e638e4f Make interfaceTypesAreCompatible a private method.
llvm-svn: 45713
2008-01-07 19:13:39 +00:00
Ted Kremenek 9dbf8a93a7 Renamed SimulVertex, SimulGraph, and SimulEngine to:
ExplodedNode, ExplodedGraph  (to match the vocabulary in the RHS paper)
  ReachabilityEngine
  
The implementation of the core of the path-sensitive dataflow solver has
been de-templatized and places in ReachabilityEngine.cpp.

The solver is still incomplete.

llvm-svn: 45711
2008-01-07 19:08:42 +00:00
Ted Kremenek dabea046f6 Minor tweak to serialization of ObjcForCollectionStmt: the three owned pointers
are now emitted in a batch, which reduces the metadata overhead in the
serialized bitcode.

llvm-svn: 45710
2008-01-07 18:35:04 +00:00
Fariborz Jahanian d5450b7f07 Limit type of foreach's element and collection to be a pointer to
objc object type.

llvm-svn: 45709
2008-01-07 18:14:04 +00:00
Fariborz Jahanian fef287cb67 Issue diagnostics if more than one declaration in objectove-c's foreach-stmt header.
llvm-svn: 45708
2008-01-07 17:52:35 +00:00
Chris Lattner f5c973d061 minor cleanup.
llvm-svn: 45706
2008-01-07 17:51:46 +00:00
Nate Begeman f7c3ff6f80 Fix typo
llvm-svn: 45682
2008-01-07 04:01:26 +00:00
Chris Lattner 4d3b0f579c rearrange some code.
llvm-svn: 45666
2008-01-06 22:50:31 +00:00
Chris Lattner e2949f42d3 some simplifications/cleanups to ?: sema.
llvm-svn: 45665
2008-01-06 22:42:25 +00:00
Chris Lattner cfb6f430b6 Emit warnings like "dereferencing void pointer" instead of trying to
pretty print the type name for void.

llvm-svn: 45664
2008-01-06 22:21:46 +00:00
Fariborz Jahanian 7b1b947ca1 twiks based on Chris's comment. No need to iterate thru a list of declarations
in a foreach-statement which is illegal (but not yet caught) .

llvm-svn: 45615
2008-01-05 01:40:08 +00:00
Ted Kremenek e84b32e506 Moved serialization code for ObjcForCollectionStmt to be in alphabetical order
with the rest of the Objective-C serialization code.

llvm-svn: 45609
2008-01-05 00:57:49 +00:00
Fariborz Jahanian bad3218954 Minor refactoring of foreach's semantics code per Chris's suggetion.
llvm-svn: 45604
2008-01-04 23:59:09 +00:00
Chris Lattner 881a212a70 unnest vector handling again.
llvm-svn: 45602
2008-01-04 23:32:24 +00:00
Fariborz Jahanian e908cab389 Added a comment, minor refactoring of foreach parsing code per Chris's suggestion.
llvm-svn: 45601
2008-01-04 23:23:46 +00:00
Chris Lattner f735409e11 we already test for exact type matches early, so we don't have to do
it explicitly for vectors.  This allows us to unnest some code.

llvm-svn: 45600
2008-01-04 23:20:56 +00:00
Chris Lattner a52c2f2e3e simplify some of this code by removing the else/if chain and by
stripping down to canonical types early.

llvm-svn: 45599
2008-01-04 23:18:45 +00:00
Fariborz Jahanian 3622e5954b Minor changes as suggested by Chris L.
llvm-svn: 45598
2008-01-04 23:04:08 +00:00
Chris Lattner a3fc41d616 move objc expr sema to its own file.
llvm-svn: 45597
2008-01-04 22:32:30 +00:00
Chris Lattner 4899a6aa6a Fix PR1897, patch by Wilhansen Li
llvm-svn: 45593
2008-01-04 19:12:28 +00:00
Chris Lattner 940cfebf90 add comments for the various AssignConvertType's, and split int->pointer from pointer->int.
llvm-svn: 45591
2008-01-04 18:22:42 +00:00
Chris Lattner 9bad62c72a Merge all the 'assignment' diagnostic code into one routine, decloning
it from several places.  This merges the diagnostics, making them more
uniform and fewer in number. This also simplifies and cleans up the code.

Some highlights:
1. This removes a bunch of very-similar diagnostics.
2. This renames AssignmentCheckResult -> AssignConvertType
3. This merges PointerFromInt + IntFromPointer which were always treated the same.
4. This updates a bunch of test cases that have minor changes to the produced diagnostics.

llvm-svn: 45589
2008-01-04 18:04:52 +00:00
Chris Lattner 94cf8061e7 fix a build problem where NULL isn't implicitly defined by the headers this file includes.
llvm-svn: 45587
2008-01-04 16:27:03 +00:00
Fariborz Jahanian 775d5d02af Patch to add semantics check for ObjC2's foreacn statement.
llvm-svn: 45561
2008-01-04 00:27:46 +00:00
Chris Lattner 816dea2fc5 generalize some of the conversion warnings.
llvm-svn: 45560
2008-01-03 23:38:43 +00:00
Chris Lattner 166ae81be1 update for changes in diagnostic strings.
llvm-svn: 45559
2008-01-03 23:36:08 +00:00
Chris Lattner 874e024f10 regroup assignment-related diagnostics, fix a mistake in one.
llvm-svn: 45558
2008-01-03 23:13:36 +00:00
Chris Lattner 0a788433eb give better diagnostics for converting between function pointer and void*.
llvm-svn: 45556
2008-01-03 22:56:36 +00:00
Ted Kremenek 739d350369 renamed class "GRCP" (Graph Reachabilty Constant Propagation) to
"GREngine" (Graph Reachability Engine).  The idea is to provide a separation
of concerns between the constant prop. details and the core analysis engine.

llvm-svn: 45555
2008-01-03 22:46:25 +00:00
Ted Kremenek 7c54e520e7 Implemented End-Of-Path processing.
llvm-svn: 45554
2008-01-03 22:29:38 +00:00
Ted Kremenek 0044908de0 Initial checking of GRConstantPropagation.cpp, which implements a constant
propagation analysis via graph reachability. This analysis (which is incomplete)
will be the basis for later developments on the core engine for path-sensitive
analysis analysis.

llvm-svn: 45552
2008-01-03 22:12:28 +00:00
Ted Kremenek fde239df06 Fixed misuse of pointer within SimulVertex::addPredecessor()
llvm-svn: 45551
2008-01-03 22:09:27 +00:00
Ted Kremenek 9d375282cf SimulGraph::getVertex() now also returns a bool indicating if the returned
vertex was freshly created.

llvm-svn: 45550
2008-01-03 22:08:52 +00:00
Ted Kremenek 6abe02ada6 Constified methods front() and back() in CFGBlock.
llvm-svn: 45549
2008-01-03 22:07:58 +00:00
Ted Kremenek d6c30e58e2 De-constified the pointers returned by the Dst() and Src() methods of
the various ProgramEdge classes.

llvm-svn: 45548
2008-01-03 22:07:01 +00:00
Fariborz Jahanian c89ea091a2 Couple more uninitialized before use warning elimination.
llvm-svn: 45547
2008-01-03 20:04:58 +00:00
Fariborz Jahanian 243c611a05 Remove cause of misc. "variable might be used uninitialized in this function" warnings.
llvm-svn: 45546
2008-01-03 20:01:35 +00:00
Fariborz Jahanian 5cc21a7e02 Fixed a bug reported by Chris, involving assiging 0 to a qualified object type.
llvm-svn: 45542
2008-01-03 18:46:52 +00:00
Chris Lattner 2b15cf705b simplify the lexer a bit, pulling stuff out of the default case.
llvm-svn: 45540
2008-01-03 17:58:54 +00:00
Fariborz Jahanian 732b8c2dc5 Patch to parse/build AST ObjC2's foreach statement.
llvm-svn: 45539
2008-01-03 17:55:25 +00:00
Chris Lattner 1800c18ebd fix long lines.
llvm-svn: 45531
2008-01-03 07:05:49 +00:00
Chris Lattner 20455f204f Fix a crash reported by Seo Sanghyeon.
llvm-svn: 45530
2008-01-03 06:36:51 +00:00
Fariborz Jahanian 8361552af9 New declarations/defs for Objc2's foreach-statement. This is work in progress.
llvm-svn: 45511
2008-01-02 22:54:34 +00:00
Chris Lattner 4f20351142 When promoting array to pointer for argument, don't lose type qualifiers.
llvm-svn: 45510
2008-01-02 22:50:48 +00:00
Ted Kremenek 161807f8d1 SimulVertex: Inverted argument order when calling the Profile method of StateTy.
SimulGraph: Inverted argument order when calling the Profile method of VertexTy
  (plus minor cleanups)
llvm-svn: 45508
2008-01-02 22:20:20 +00:00
Chris Lattner 7977cca8e8 Fix PR1895: a crash on an ugly gcc extension.
llvm-svn: 45505
2008-01-02 21:54:09 +00:00
Chris Lattner 266a2ff3ac Compute the proper sourcerange for an CompoundLiteralExpr.
llvm-svn: 45504
2008-01-02 21:46:24 +00:00
Ted Kremenek c7523bcaaa Converted state reference within SimulVertex from StateTy* to StateTy.
This is more flexible.

llvm-svn: 45502
2008-01-02 21:31:13 +00:00
Chris Lattner 54bb810997 Refactor the decl printer, patch by Mike Stump!
llvm-svn: 45497
2008-01-02 21:04:16 +00:00
Fariborz Jahanian 056e3a4e90 Issue diagnostic when objective-c's @interface is preceeded by a type specifier.
llvm-svn: 45491
2008-01-02 19:17:38 +00:00
Ted Kremenek 796b64337b Added/fixed some comments.
llvm-svn: 45490
2008-01-02 18:31:49 +00:00
Fariborz Jahanian 5e57e1890d Prevent crash on incorrect objc messaging expression.
llvm-svn: 45489
2008-01-02 18:09:46 +00:00
Ted Kremenek dc8ebe5022 Sprinkled 'typename' and fixed a few typos and type declaration errors to
make these headers compile.

llvm-svn: 45488
2008-01-02 17:45:00 +00:00
Ted Kremenek 2290828271 Added fixme.
llvm-svn: 45487
2008-01-02 17:05:47 +00:00
Ted Kremenek 032cb4433e Allocate vertices using a BumpPtrAllocator.
llvm-svn: 45486
2008-01-02 17:00:32 +00:00
Nate Begeman 330aaa79e0 Allow implicit casts during arithmetic for OCUVector operations
Add codegen support and test for said casts.

llvm-svn: 45443
2007-12-30 02:59:45 +00:00
Nate Begeman 627daba0fd Allow splat casts for OCU vector assignments & add some comments.
llvm-svn: 45442
2007-12-30 01:45:55 +00:00
Nate Begeman 16a3a9d5f9 Rename stats to print-stats to avoid conflicting with llvm's
stats statistic when clang is built as a dylib.

llvm-svn: 45441
2007-12-30 01:38:50 +00:00
Nate Begeman 628028bd27 Allow codegen of vector fdiv
llvm-svn: 45440
2007-12-30 01:28:16 +00:00
Chris Lattner a77acbdcae implement codegen support for most unary operators when
initializing a global.  This handles important cases like:
float foo3 = -0.01f;

llvm-svn: 45427
2007-12-29 23:43:37 +00:00
Chris Lattner 7429581c33 remove attributions from .def files.
llvm-svn: 45413
2007-12-29 20:03:32 +00:00
Chris Lattner 5926c0ebfb remove attribution from makefiles.
llvm-svn: 45412
2007-12-29 20:02:25 +00:00
Chris Lattner 5b12ab8c93 Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.

llvm-svn: 45410
2007-12-29 19:59:25 +00:00
Christopher Lamb c5fafa211a Fix OCUVector case in struct layout code.
llvm-svn: 45396
2007-12-29 05:10:55 +00:00
Christopher Lamb d91c3d4926 Enable CodeGen for member expressions based on call expressions returning aggregate types. This enables expressions like 'foo().member.submember'.
llvm-svn: 45395
2007-12-29 05:02:41 +00:00
Christopher Lamb fd9af54ad1 Make MemberExpr code safe w.r.t. address spaces.
llvm-svn: 45394
2007-12-29 04:06:57 +00:00
Christopher Lamb ad66035921 Fix an error in the base/idx accessors for ArraySubscriptExpr's that crops up with vector element access.
llvm-svn: 45390
2007-12-28 23:43:03 +00:00
Chris Lattner 7ef31d3c53 various cleanups. Use IgnoreParenCasts instead of inlined versions.
llvm-svn: 45382
2007-12-28 05:38:24 +00:00
Chris Lattner 934edb210a unindent cases in a switch stmt, no functionality change.
llvm-svn: 45381
2007-12-28 05:31:15 +00:00
Chris Lattner 0846494750 Change Sema::ActOnCallExpr to construct the CallExpr early and put it into
and OwningPtr instead of constructing only after all of sema is done.  This
has a couple of effects:
1. it fixes memory leaks from all the error cases in sema
2. it simplifies the code significantly.

The cost of this is that the error case now new's and delete's an expr where
it did not before, but we don't care about the perf of the error case.

llvm-svn: 45380
2007-12-28 05:29:59 +00:00
Chris Lattner 6420345a34 move file to proper place in project.
llvm-svn: 45379
2007-12-28 05:27:01 +00:00
Chris Lattner e4407ede20 Add accessors + iterator interface.
llvm-svn: 45378
2007-12-28 05:25:02 +00:00
Chris Lattner 02ac5e87e0 From Lucas Newman:
"Here's a tiny patch that lets the clang Xcode project build in any 
location, so llvm doesn't have to be checked out in your home folder."

llvm-svn: 45376
2007-12-28 00:38:23 +00:00
Chris Lattner 20bc6e06cd add a file I forgot to svn add.
llvm-svn: 45374
2007-12-27 21:46:27 +00:00
Chris Lattner cc10d93dcf alphabetize in project.
llvm-svn: 45373
2007-12-27 20:59:50 +00:00
Chris Lattner 807979824e use -emit-llvm-bc
llvm-svn: 45372
2007-12-27 20:35:58 +00:00
Chris Lattner 40ad6cd854 no need to verify this, no errors/warnings are expected.
llvm-svn: 45371
2007-12-27 20:31:56 +00:00
Chris Lattner 11221033be Fix a crash on a top-level objc string, patch by Nico Weber
llvm-svn: 45370
2007-12-27 20:29:42 +00:00
Chris Lattner 5e530bcee3 - Use Tok.isObjCAtKeyword instead of Tok.getIdentifierInfo()->getObjCKeywordID().
The later fails if the token is not an identifier.
 - Replace tabs with spaces.
 - Various other cleanups.

Patch by Nico Weber!

llvm-svn: 45368
2007-12-27 19:57:00 +00:00
Anders Carlsson c9d41e7d27 No need to do work that the folding builder does for us.
llvm-svn: 45361
2007-12-26 18:20:19 +00:00
Seo Sanghyeon acb00f4a73 Remove broken assert from CodeGen. Better check is done in Sema.
llvm-svn: 45358
2007-12-26 05:21:37 +00:00
Christopher Lamb 2b84813441 Make output files binary mode for -emit-llvm-bc
llvm-svn: 45348
2007-12-24 23:49:33 +00:00
Christopher Lamb d01dea749e Almost the best possible handling of stdin/stdout for llvm-emit-bc!
llvm-svn: 45346
2007-12-24 20:59:36 +00:00
Christopher Lamb 1c0f5d2436 Better handing of stdin/stdout for -emit-llvm-bc
llvm-svn: 45345
2007-12-24 20:56:07 +00:00
Christopher Lamb 5a3416409f Allow bitcode output to be redirected to stdout.
llvm-svn: 45340
2007-12-24 03:23:55 +00:00
Seo Sanghyeon 76270e6be6 Implement -emit-llvm-bc option
llvm-svn: 45339
2007-12-24 01:52:34 +00:00
Seo Sanghyeon 6f1b274976 String literal in aggregate expression
llvm-svn: 45330
2007-12-23 03:11:58 +00:00
Chris Lattner b907c3fca1 remove use of alloca.
llvm-svn: 45329
2007-12-23 01:40:15 +00:00
Anton Korobeynikov 03f8a3630d Unbreak mingw build
llvm-svn: 45328
2007-12-23 01:19:32 +00:00
Ted Kremenek dbc5385608 Added (incomplete) implementation of SimulEngine, a worklist-based dataflow
solver for path-sensitive, intra-procedural analysis.

llvm-svn: 45306
2007-12-22 01:43:37 +00:00
Fariborz Jahanian 4f41b272c9 Another test case, testing a variety of objective-c type comparisons.
llvm-svn: 45302
2007-12-22 00:17:49 +00:00
Fariborz Jahanian 24e1a0bd35 Another test for objective-c's type comparison.
llvm-svn: 45301
2007-12-21 23:48:59 +00:00
Ted Kremenek e7e26cd01e Converted Loc back to being of type ProgramEdge. Ultimately I believe we want
the ability to refer to the vertex set for all the vertices associated with an
edge. This will allow some nice queries over the graph, and (hopefully) will
reduce the memory footprint of SimulVertex.

llvm-svn: 45299
2007-12-21 23:23:12 +00:00
Ted Kremenek e1d1a9479f Added preliminary implementation of SimulGraph, which represents the
intra-procedural supergraph of a path-sensitive dataflow analysis.

llvm-svn: 45298
2007-12-21 23:21:58 +00:00
Ted Kremenek 908cff9fa4 Changed "Location" from "ProgramEdge" to "ProgramEdge&" (slightly more svelt
memory representation).

llvm-svn: 45297
2007-12-21 22:57:10 +00:00
Ted Kremenek 95416706ed SimulVertex now subclasses FoldingSetNode.
llvm-svn: 45296
2007-12-21 22:41:58 +00:00
Ted Kremenek 1616945a7d Added Profile method to SimulVertex.
llvm-svn: 45295
2007-12-21 22:40:41 +00:00
Fariborz Jahanian a7c705ddca This patch implements some of the more obscure type-checking involving
'id' quallified with protocols and static types which have categories and
inheritance which implement these protocols.

llvm-svn: 45294
2007-12-21 22:22:33 +00:00
Ted Kremenek fda0aaf01b Updated Xcode project to be in sync with recent changes in file locations
introduced in r45292 (http://llvm.org/viewvc/llvm-project?rev=45292&view=rev)

llvm-svn: 45293
2007-12-21 21:48:31 +00:00
Ted Kremenek bf593f81fa Directory restructing of Analysis files.
Created include/clang/Analysis/Analyses directory.
  - Moved LiveVariables.h and UninitializedValues.h into this dir.
  
Moved ExprDeclBitVector.h into Analysis/Support.

Updated all clients who use these headers to reflect the new paths.

llvm-svn: 45292
2007-12-21 21:42:19 +00:00
Ted Kremenek f55ed782b4 Renamed file AnalysisVertex.h to SimulVertex.h
llvm-svn: 45291
2007-12-21 21:17:22 +00:00
Ted Kremenek 3d8b0d6948 Renamed class AnalysisVertex to SimulVertex
llvm-svn: 45290
2007-12-21 21:16:58 +00:00
Ted Kremenek 93e2031187 Fixed successor order for CFG basic blocks when handling: x && y. The bug
is best explained by illustration:

[ B2 ]
     1: x
     T: [B2.1] && ...
   Predecessors (1): B4
   Successors (2): B3 B1

Block "B3" should be the block where we evaluate "y" when "x" evaluates to
true. Previously we had the successor list reversed. Now this behavior matches
with how we handle other conditional branches.

Thanks to Nuno Lopes for reporting this problem.

llvm-svn: 45288
2007-12-21 19:49:00 +00:00
Devang Patel 505b4f1fd4 Convert opaque type when struct definition is seen.
llvm-svn: 45287
2007-12-21 19:35:28 +00:00
Devang Patel 016e41e8a6 Keep track of llvm struct size while adding fields.
Update addPaddingFields() interface.

llvm-svn: 45284
2007-12-21 18:43:53 +00:00
Fariborz Jahanian 56b5c96ef7 Patch to compare to objective-c static types where one or the other
(but not both) may be a protocol qualified static type.

llvm-svn: 45283
2007-12-21 17:34:43 +00:00
Fariborz Jahanian fd6f3a2460 Test case for my last patch.
llvm-svn: 45277
2007-12-21 00:35:35 +00:00
Fariborz Jahanian ff7d2bf255 More objective-c type analysis. This time involving objective types
of conforming protocols (or not).

llvm-svn: 45276
2007-12-21 00:33:59 +00:00
Ted Kremenek b149889df6 Added class "StateVariant", a template class which serves to wrap states that
are generated by transfer functions used by the path-sensitive dataflow solver.

llvm-svn: 45273
2007-12-21 00:04:19 +00:00
Ted Kremenek f40d2740b6 Added initial implementation of "AnalysisVertex", a class to represent a
location*state vertex in an intra-procedural, path-sensitive dataflow
supergraph.

llvm-svn: 45272
2007-12-20 23:24:55 +00:00
Fariborz Jahanian 76fcf32632 Another test for objective-c type comparison.
llvm-svn: 45271
2007-12-20 22:53:29 +00:00
Fariborz Jahanian 4368af07a7 More objective-c type checking. This time comparing objective-c known objects.
llvm-svn: 45269
2007-12-20 22:37:58 +00:00
Ted Kremenek 71d643f8b1 Converted uses of scoped_ptr to OwningPtr.
llvm-svn: 45265
2007-12-20 19:47:16 +00:00
Fariborz Jahanian 63b19f1b6e Patch to do type-checking for objctive-c's object types.
More is yet to come.

llvm-svn: 45263
2007-12-20 19:24:10 +00:00
Chris Lattner 1991794112 add accessor.
llvm-svn: 45262
2007-12-20 19:14:21 +00:00
Seo Sanghyeon 58bdfda87c Add newline
llvm-svn: 45257
2007-12-20 07:22:20 +00:00
Chris Lattner 8304df9024 Fix trivial self-infinite-recursion
llvm-svn: 45248
2007-12-20 01:38:17 +00:00
Fariborz Jahanian 134cbefba2 More objective-c typechecking stuff. This is work in progress and more patches
are due to arrive.

llvm-svn: 45244
2007-12-20 01:06:58 +00:00
Chris Lattner 6c9ffe9529 Implement codegen for ordered comparison builtins.
llvm-svn: 45243
2007-12-20 00:44:32 +00:00
Ted Kremenek 371efafb94 Created initial implementation of "BuildSerializer", and ASTConsumer
which serializes ASTs to a common output directory.  This ASTConsumer
is invoked using a combination of "-o" and "-serialize" from the driver.

llvm-svn: 45241
2007-12-20 00:34:58 +00:00
Ted Kremenek 62c462f9c5 Renamed "FileEntry::getDev()" to "FileEntry::getDevice()"
llvm-svn: 45240
2007-12-20 00:29:44 +00:00
Chris Lattner 2da14fb84f implement semantic analysis for __builtin_islessequal and friends.
llvm-svn: 45239
2007-12-20 00:26:33 +00:00
Ted Kremenek 8babe3d9c4 Added method getFileEntryForID() to SourceManager.
llvm-svn: 45237
2007-12-20 00:15:17 +00:00
Chris Lattner e202e6af48 simplify some code.
llvm-svn: 45235
2007-12-20 00:05:45 +00:00
Chris Lattner 43be2e6004 refactor some code that handles sema of direct function calls.
llvm-svn: 45234
2007-12-19 23:59:04 +00:00
Chris Lattner 9b65d3506e Add iterator interface to function/method parameters.
llvm-svn: 45233
2007-12-19 23:58:25 +00:00
Ted Kremenek ca07147851 Split serialization ASTConsumers into two consumers: SingleFileSerializer and
BuildSerializer. The former serializes a single translation unit to a
corresponding .ast file. The second serializes ASTs to a common emission
direction.  The latter is not fully implemented yet.

llvm-svn: 45232
2007-12-19 23:49:37 +00:00
Ted Kremenek 96e05d4f31 Added methods createMainFileID() and createMainFileIDForMemBuffer() to
SourceManager to allow SourceManager to directly intern the MainFileID
when it is created.  Removed setMainFileID().

llvm-svn: 45231
2007-12-19 23:48:45 +00:00
Ted Kremenek 230bd918b2 Interned MainFileID within SourceManager. Since SourceManager is referenced by
both Preprocessor and ASTContext, we no longer need to explicitly pass
MainFileID around in function calls that also pass either Preprocessor or
ASTContext. This resulted in some nice cleanups in the ASTConsumers and the
driver.

llvm-svn: 45228
2007-12-19 22:51:13 +00:00
Ted Kremenek f7bfae6b45 Typo fix.
llvm-svn: 45227
2007-12-19 22:32:34 +00:00
Ted Kremenek 9a53275918 Added storage of the FileID of the the main source file of a translation unit
in SourceManager.

llvm-svn: 45225
2007-12-19 22:29:55 +00:00
Steve Naroff fa5751f842 Various tweaks to the get/lookup instance/class method API's.
llvm-svn: 45224
2007-12-19 22:27:04 +00:00
Ted Kremenek 6c7807716b Removed "SourceFile" from TranslationUnit. This same information will (soon)
be available by querying the SourceManager within the ASTContext referenced by
the TranslationUnit.

llvm-svn: 45223
2007-12-19 22:24:34 +00:00
Chris Lattner 7bd082e188 Describe Nico's script for gcc interception. Patch by Nico Weber.
llvm-svn: 45222
2007-12-19 22:17:19 +00:00
Ted Kremenek aff2343af3 Cleaned up "-o" option to print "-o=<path>" instead of "-o=<string>" when
doing clang --help.

llvm-svn: 45215
2007-12-19 19:50:41 +00:00
Ted Kremenek 6c0b224011 Added "-o" option to driver. ASTConsumers will need to be gradually
rewired to utilize this option.

Renamed option --serialize-ast --serialize.

llvm-svn: 45213
2007-12-19 19:47:59 +00:00
Chris Lattner c238331377 Add support for #pragma mark, which shouldn't warn about bogus tokens.
llvm-svn: 45212
2007-12-19 19:38:36 +00:00
Ted Kremenek 0061aeb316 Removed storing inode and device number in TranslationUnit.
Added "SourceFile" string to TranslationUnit to record corresponding
source file.

Updated serialization of TranslationUnits and logic in the driver to
correctly pass the source file information to the serializer.

llvm-svn: 45211
2007-12-19 19:27:38 +00:00
Chris Lattner 6a4f74593c fix some crazy indentation
llvm-svn: 45210
2007-12-19 19:23:28 +00:00
Steve Naroff 7e718bb3fd Soften the macro rewrite error to a warning (and change the text).
llvm-svn: 45209
2007-12-19 19:16:49 +00:00
Fariborz Jahanian 6a128ae962 Minor test twik.
llvm-svn: 45208
2007-12-19 19:07:24 +00:00
Ted Kremenek 0ec9a20bf0 Updated locations of TranslationUnit.[cpp,h] in XCode project.
Added AST/ASTConsumer.cpp to XCode project.

llvm-svn: 45206
2007-12-19 18:07:54 +00:00
Chris Lattner 2a70c95387 reenable this code, fix the testcase.
llvm-svn: 45205
2007-12-19 18:01:43 +00:00
Chris Lattner 99488aec20 disable my commit from yesterday, fixing a regression test failure.
llvm-svn: 45204
2007-12-19 17:49:45 +00:00
Fariborz Jahanian a1e3420c49 This patch concludes implementation of dynamic objective-c type qualified by
protocol list.

llvm-svn: 45203
2007-12-19 17:45:58 +00:00
Anders Carlsson 2c26cc232f Fix the embarassing typo for real this time (- vs _), sorry about breaking the tests Steve.
llvm-svn: 45202
2007-12-19 17:43:24 +00:00
Ted Kremenek 6c3777c319 Moved generation of the name of the serialized AST file into
CreateASTSerializer.

llvm-svn: 45201
2007-12-19 17:25:59 +00:00
Steve Naroff 55cb4be8ae Emit errors when attempting to rewrite ObjC expressions that originate from a macro expansion.
We plan on fixing this and removing this restriction after the break...

llvm-svn: 45200
2007-12-19 14:32:56 +00:00
Steve Naroff 735a2716de Revert Anders r45191 commit...it broke several of the tests.
llvm-svn: 45199
2007-12-19 14:11:27 +00:00
Anders Carlsson 721f601507 Fix an embarassing typo and add some very limited support for the aligned attribute.
llvm-svn: 45195
2007-12-19 07:19:40 +00:00
Anders Carlsson 081f1b411d Normalize attribute names if possible so we won't have to do two strcmps for every attribute.
llvm-svn: 45191
2007-12-19 06:16:30 +00:00
Chris Lattner 0f8a39c793 fix broken assert.
llvm-svn: 45189
2007-12-19 05:38:06 +00:00
Chris Lattner ea72f449fe Implement C99 6.7.5.3p1
llvm-svn: 45188
2007-12-19 05:31:29 +00:00
Ted Kremenek f4c38c9289 Refactored inode and device number into FileEntry, and changed the
ADT storing FileEntry's in FileManager from a map to a set.

llvm-svn: 45184
2007-12-18 22:29:39 +00:00
Ted Kremenek 8c8947fb92 When serializing SourceManager, we now serialize out absolute paths
to serialized source files.

llvm-svn: 45183
2007-12-18 22:12:19 +00:00
Ted Kremenek f70d24d2ae Moved ReadBitcodeFile and EmitBitcodeFile out of TranslationUnit and made them
the standalone functions ReadASTBitcodeFile and EmitASTBitcodeFile
respectively.

llvm-svn: 45180
2007-12-18 21:44:50 +00:00
Steve Naroff 824a9d8d4b Fix serious regression with ObjcInterfaceDecl. Now that we are storing -1 to mean undefined, we need to change the respective getters from unsigned->int.
llvm-svn: 45179
2007-12-18 21:41:31 +00:00
Ted Kremenek 25dbd71a4c Fixed broken includes introduced by recent (incomplete) patch to
TranslationUnit.

llvm-svn: 45177
2007-12-18 21:36:21 +00:00
Ted Kremenek afb98f9c09 Moved TranslationUnit.h to include path.
llvm-svn: 45176
2007-12-18 21:34:50 +00:00
Ted Kremenek 879b75018f Moved TranslationUnit from Driver to AST library.
llvm-svn: 45175
2007-12-18 21:34:28 +00:00
Fariborz Jahanian 9f0e310861 Refactoring work. ObjcQualifiedIdType is now derived from 'Type'.
llvm-svn: 45174
2007-12-18 21:33:44 +00:00
Ted Kremenek a51c88ccd8 Added to FileEntry a pointer to the <dev_t,ino_t> pair for the file, and
accessors to FileEntry to query these values.

llvm-svn: 45171
2007-12-18 20:45:25 +00:00
Chris Lattner 37bd2ecb11 local static vars are globals also. This fixes a testcase
reported by Seo.

llvm-svn: 45156
2007-12-18 08:16:44 +00:00
Chris Lattner d4fc27e937 remove the loc argument to Type::isConstantSizeType, which isn't useful.
llvm-svn: 45155
2007-12-18 07:18:16 +00:00
Chris Lattner 20aad334c7 Fix the location we emit the "not a constant" error for this:
int foo() {
  typedef int x[foo()];
  static int y = sizeof(x);
}

previously we'd emit it on the typedef, which made not sense at all.

llvm-svn: 45154
2007-12-18 07:15:40 +00:00
Chris Lattner 6d2d1b67ca Fix PR1863: an assertion due to not setting a location on return from
this method.

llvm-svn: 45153
2007-12-18 07:03:30 +00:00
Chris Lattner 78e34a00f4 Fix const propagation bug.
llvm-svn: 45152
2007-12-18 07:02:56 +00:00
Chris Lattner dcb7cc59ae Fix an nice and subtle parser bug reported by Nico Weber.
llvm-svn: 45149
2007-12-18 06:06:23 +00:00
Steve Naroff b723564c79 Add DefaultFunctionArrayConversion() to the indirection operator in Sema::ActOnUnaryOp().
This fixes a bug Chris forwarded from Oliver Hunt...

typedef struct { char name[100]; } entry;
char f1(entry *e) { return *e->name; }

llvm-svn: 45148
2007-12-18 04:06:57 +00:00
Steve Naroff b74406ba98 Fixe bogus error for variable argument methods. Sema::ObjcGetTypeForMethodDefinition() wasn't preserving the isVariadic boolean. Another fix is to avoid synthsizing the function decl entirely, however this is a separate issue that I don't want to deal with now. Also added a FIXME to Sema::CheckFunctionCall(), which is currently emitting a bogus warning.
llvm-svn: 45146
2007-12-18 03:41:15 +00:00
Anders Carlsson aa5c91980e Turns out the LLVMFoldingBuilder can fold InsertElement. Knowing this, we can get rid of our special casing of constants when creating vectors.
llvm-svn: 45145
2007-12-18 02:45:33 +00:00