]> granicus.if.org Git - clang/log
clang
16 years agoUse Identifier::getLength() instead of strlen() in Selector::getName() and MultiKeywo...
Steve Naroff [Tue, 2 Oct 2007 02:01:22 +0000 (02:01 +0000)]
Use Identifier::getLength() instead of strlen() in Selector::getName() and MultiKeywordSelector::getName().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42524 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded a missing #include.
Hartmut Kaiser [Tue, 2 Oct 2007 00:36:52 +0000 (00:36 +0000)]
Added a missing #include.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42516 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd comment to ObjcClassDecl.
Steve Naroff [Tue, 2 Oct 2007 00:10:42 +0000 (00:10 +0000)]
Add comment to ObjcClassDecl.
Move ObjcClassDecl to be next to ObjcForwardProtocolDecl. Since they are very similar, might want to unify their names (e.g. ObjcForwardClassDecl).
Change indentation of ObjcForwardProtocolDecl to conform to everything else in DeclObjC.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42513 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdated VC++ build system.
Hartmut Kaiser [Mon, 1 Oct 2007 23:57:52 +0000 (23:57 +0000)]
Updated VC++ build system.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42512 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd comments for ObjC Decl's.
Steve Naroff [Mon, 1 Oct 2007 22:54:34 +0000 (22:54 +0000)]
Add comments for ObjC Decl's.
Removed a constructor that was #if 0's out.
Added a FIXME for fariborz...categories shouldn't inherit from ScopedDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42507 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMigrated LiveVariables and UninitializedVariables to now use the
Ted Kremenek [Mon, 1 Oct 2007 20:33:52 +0000 (20:33 +0000)]
Migrated LiveVariables and UninitializedVariables to now use the
tracked BlkExpr information now maintained by the CFG class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42498 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCFG objects now internally store a (lazily created) map from block-level
Ted Kremenek [Mon, 1 Oct 2007 19:33:33 +0000 (19:33 +0000)]
CFG objects now internally store a (lazily created) map from block-level
expressions to IDs.  This is used by various dataflow analyses, but is
also useful for anyone querying a CFG to determine where an expression
is evaluated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42495 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMove ObjC decls to DeclObjC.h, a new AST header.
Steve Naroff [Mon, 1 Oct 2007 19:00:59 +0000 (19:00 +0000)]
Move ObjC decls to DeclObjC.h, a new AST header.
Update clients and add to project file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42494 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMoved two bitfields back to top of class ObjcMethodDecl so they pack
Fariborz Jahanian [Mon, 1 Oct 2007 17:19:59 +0000 (17:19 +0000)]
Moved two bitfields back to top of class ObjcMethodDecl so they pack
with those in their base class. In response to clattner's
September 30, 2007 12:54:49 AM PDT email.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42491 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTook care of clatter's suggestions, dated.
Fariborz Jahanian [Mon, 1 Oct 2007 16:53:59 +0000 (16:53 +0000)]
Took care of clatter's suggestions, dated.
September 30, 2007 12:36:58 AM PDT and
September 30, 2007 12:50:05 AM PDT

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42490 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemoved "hasImplicitControlFlow" from class CFG, and moved it to class Stmt
Ted Kremenek [Mon, 1 Oct 2007 16:34:52 +0000 (16:34 +0000)]
Removed "hasImplicitControlFlow" from class CFG, and moved it to class Stmt
as a member function.  This function is no longer needed within the CFG
class, and logically belongs to the Stmt class as a predicate for a
Stmt instance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42489 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUnused ObjcProtoMethod is removed.
Fariborz Jahanian [Sun, 30 Sep 2007 18:53:32 +0000 (18:53 +0000)]
Unused ObjcProtoMethod is removed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42485 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd a new getLength() method to IdentifierInfo, which relies on a newly added
Chris Lattner [Sun, 30 Sep 2007 08:32:27 +0000 (08:32 +0000)]
Add a new getLength() method to IdentifierInfo, which relies on a newly added
method to StringMapEntry.  Steve, please use this to remove the
strlen calls in selector processing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42481 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a bug I just introduced.
Chris Lattner [Sun, 30 Sep 2007 08:31:00 +0000 (08:31 +0000)]
Fix a bug I just introduced.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42479 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoimprove comment.
Chris Lattner [Sun, 30 Sep 2007 08:13:22 +0000 (08:13 +0000)]
improve comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42478 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agosimplify an expression
Chris Lattner [Sun, 30 Sep 2007 08:01:04 +0000 (08:01 +0000)]
simplify an expression

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42477 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoThis patch fixes all issues mentioned in clattner's feedback of
Fariborz Jahanian [Sat, 29 Sep 2007 18:24:58 +0000 (18:24 +0000)]
This patch fixes all issues mentioned in clattner's feedback of
September 28, 2007 4:39:24 PM PDT
Please let me know if I missed anything.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42473 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCode clean up. Moved couple of static functions to be private members of Sema class.
Fariborz Jahanian [Sat, 29 Sep 2007 17:14:55 +0000 (17:14 +0000)]
Code clean up. Moved couple of static functions to be private members of Sema class.
Avoiding passing a Sema object to these utility functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42472 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPatch to remove use of has table for protocol name lookup. This patch mirrors my
Fariborz Jahanian [Sat, 29 Sep 2007 17:04:06 +0000 (17:04 +0000)]
Patch to remove use of has table for protocol name lookup. This patch mirrors my
previous patch to do the same for class name lookup using a hash table.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42471 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemoved use of hash table for class decls and do a name look up directly.
Fariborz Jahanian [Sat, 29 Sep 2007 00:54:24 +0000 (00:54 +0000)]
Removed use of hash table for class decls and do a name look up directly.
There is still an issue if doing ScopedLookup is an overkill and we can
just access the decl using the identifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42463 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd some comments to MultiKeywordSelector, make all methods private, add a friend...
Steve Naroff [Fri, 28 Sep 2007 23:39:26 +0000 (23:39 +0000)]
Add some comments to MultiKeywordSelector, make all methods private, add a friend, move some methods around.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42456 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded ProgramEdge.h, which defines ProgramEdge (and subclasses) that
Ted Kremenek [Fri, 28 Sep 2007 23:15:21 +0000 (23:15 +0000)]
Added ProgramEdge.h, which defines ProgramEdge (and subclasses) that
encapsulate a program point within a CFG for use by our path-sensitive
dataflow solver.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42455 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoYesterday I discovered that 78% of all selectors in "Cocoa.h" take 0/1 argument.
Steve Naroff [Fri, 28 Sep 2007 22:22:11 +0000 (22:22 +0000)]
Yesterday I discovered that 78% of all selectors in "Cocoa.h" take 0/1 argument.

This motivated implementing a devious clattner inspired solution:-)

This approach uses a small value "Selector" class to point to an IdentifierInfo for the 0/1 case. For multi-keyword selectors, we instantiate a MultiKeywordSelector object (previously known as SelectorInfo). Now, the incremental cost for selectors is only 24,800 for Cocoa.h! This saves 156,592 bytes, or 86%!! The size reduction is also the result of getting rid of the AST slot, which was not strictly necessary (we will associate a selector with it's method using another table...most likely in Sema).

This change was critical to make now, before we have too many clients.

I still need to add some comments to the Selector class...will likely add later today/tomorrow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42452 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDo not codegen dummy block.
Devang Patel [Fri, 28 Sep 2007 21:49:18 +0000 (21:49 +0000)]
Do not codegen dummy block.
Dummy block is an empty block with no predecessors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42451 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed bug where assignments to variables wrapped in parentheses would not
Ted Kremenek [Fri, 28 Sep 2007 21:29:33 +0000 (21:29 +0000)]
Fixed bug where assignments to variables wrapped in parentheses would not
properly kill variables.  e.g:

(x) = 1;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42450 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed UninitializedValues to properly propagate uninitialized "taint"
Ted Kremenek [Fri, 28 Sep 2007 21:08:51 +0000 (21:08 +0000)]
Fixed UninitializedValues to properly propagate uninitialized "taint"
in assignment operations of the form +=, -=, *=, etc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42449 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDeadStores no longer reports warnings for stores to non-local variables.
Ted Kremenek [Fri, 28 Sep 2007 20:48:41 +0000 (20:48 +0000)]
DeadStores no longer reports warnings for stores to non-local variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42447 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSignificant cleanups and bug-fixes to LiveVariables. Uses new refactored
Ted Kremenek [Fri, 28 Sep 2007 20:38:59 +0000 (20:38 +0000)]
Significant cleanups and bug-fixes to LiveVariables.  Uses new refactored
ExprDeclBitVector class for defining dataflow state.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42446 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRefactored ExprDeclBitVector into two classes:
Ted Kremenek [Fri, 28 Sep 2007 20:12:10 +0000 (20:12 +0000)]
Refactored ExprDeclBitVector into two classes:
 DeclBitVector
 ExprDeclBitVector (which subclasses the former)

DeclBitVector is for analyses that just want to track bitvector state
for declarations.

ExprDeclBitVector is for analyses that want to track bitvector state
for both both declarations and CFGBlock-level expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42445 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed bug where declaration initializer expressions were not
Ted Kremenek [Fri, 28 Sep 2007 17:55:50 +0000 (17:55 +0000)]
Fixed bug where declaration initializer expressions were not
traversed by the visitor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42438 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded iterator mechanism to iterator over the decls and expressions
Ted Kremenek [Fri, 28 Sep 2007 17:55:22 +0000 (17:55 +0000)]
Added iterator mechanism to iterator over the decls and expressions
tracked by an ExprDeclBitVector analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42437 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPatch to warn on umimplemented methods coming from class's
Fariborz Jahanian [Fri, 28 Sep 2007 17:40:07 +0000 (17:40 +0000)]
Patch to warn on umimplemented methods coming from class's
protocols.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42436 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed several bugs in the propagation of "uninitialized value"
Ted Kremenek [Fri, 28 Sep 2007 00:09:38 +0000 (00:09 +0000)]
Fixed several bugs in the propagation of "uninitialized value"
taintness across expressions.

Made "smart-culling" of taint propagation (for error reporting)
correctly handle conditional expressions and a few other edge cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42421 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPatch to use case-stmt for keywords used as selectgor names.
Fariborz Jahanian [Thu, 27 Sep 2007 19:52:15 +0000 (19:52 +0000)]
Patch to use case-stmt for keywords used as selectgor names.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42416 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPatch for method implementation. It populates ObjcImplementationDecl object with...
Fariborz Jahanian [Thu, 27 Sep 2007 18:57:03 +0000 (18:57 +0000)]
Patch for method implementation. It populates ObjcImplementationDecl object with method implementation declarations .
It checks and warns on those methods declared in class interface and not implemented.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42412 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix bug in SelectorInfo::getName() - method buffer needs to be passed by reference.
Steve Naroff [Thu, 27 Sep 2007 18:52:21 +0000 (18:52 +0000)]
Fix bug in SelectorInfo::getName() - method buffer needs to be passed by reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42411 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCreated new "ExprDeclBitVector" type bundle for dataflow analyses that need boolean
Ted Kremenek [Thu, 27 Sep 2007 18:20:22 +0000 (18:20 +0000)]
Created new "ExprDeclBitVector" type bundle for dataflow analyses that need boolean
values associated with ScopedDecls and CFGBlock-level Exprs.  This is the common
boilerplate needed by UninitializedValues and LiveVariables.

Refactored UninitializedValues to use ExprDeclBitVector.

Shortened the string diagnostic for UninitializedValues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42408 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix some use of uninit variables issues, reported by Anton.
Chris Lattner [Thu, 27 Sep 2007 15:15:46 +0000 (15:15 +0000)]
Fix some use of uninit variables issues, reported by Anton.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42396 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd SelectorInfo (similar in spirit to IdentifierInfo). The key difference is Selecto...
Steve Naroff [Thu, 27 Sep 2007 14:38:14 +0000 (14:38 +0000)]
Add SelectorInfo (similar in spirit to IdentifierInfo). The key difference is SelectorInfo is not string-oriented, it is a unique aggregate of IdentifierInfo's (using a folding set).  SelectorInfo also has a richer API that simplifies the parser/action interface. 3 noteworthy benefits:

#1: It is cleaner. I never "liked" storing keyword selectors (i.e. foo:bar:baz) in the IdentifierTable.

#2: It is more space efficient. Since Cocoa keyword selectors can be quite long, this technique is space saving. For Cocoa.h, pulling the keyword selectors out saves ~180k. The cost of the SelectorInfo data is ~100k. Saves ~80k, or 43%.

#3: It results in many API simplifications. Here are some highlights:

- Removed 3 actions (ActOnKeywordMessage, ActOnUnaryMessage, & one flavor of ObjcBuildMethodDeclaration that was specific to unary messages).
- Removed 3 funky structs from DeclSpec.h (ObjcKeywordMessage, ObjcKeywordDecl, and ObjcKeywordInfo).
- Removed 2 ivars and 2 constructors from ObjCMessageExpr (fyi, this space savings has not been measured).

I am happy with the way it turned out (though it took a bit more hacking than I expected). Given the central role of selectors in ObjC, making sure this is "right" will pay dividends later.

Thanks to Chris for talking this through with me and suggesting this approach.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42395 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoobjc messages have side effects, return true from hasLocalSideEffect,
Chris Lattner [Wed, 26 Sep 2007 22:06:30 +0000 (22:06 +0000)]
objc messages have side effects, return true from hasLocalSideEffect,
fixing:

VoidMethod.m:14:5: warning: expression result unused
    [Greeter hello];
    ^~~~~~~~~~~~~~~

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42380 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded extra guard for null Stmt* when traversing the AST using VisitChildren.
Ted Kremenek [Wed, 26 Sep 2007 21:36:20 +0000 (21:36 +0000)]
Added extra guard for null Stmt* when traversing the AST using VisitChildren.
Added assertion that Block-level statements should not be NULL.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42376 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed two bugs in CFG construction:
Ted Kremenek [Wed, 26 Sep 2007 21:23:31 +0000 (21:23 +0000)]
Fixed two bugs in CFG construction:

BUG 1)

CFG failed to build for empty functions, or functions containing only
NullStmts or empty compound statements.

We now handle such cases, although now we cannot test for CFG
construction failure by asserting that the last block constructed is
not NULL (since it now may be).

BUG 2)

CFG construction segfaulted on some cases when walking the AST and not
taking into account that some children of a statement may be NULL.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42370 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemoved option "-parse-ast-check" from clang driver. This is now implemented
Ted Kremenek [Wed, 26 Sep 2007 20:14:22 +0000 (20:14 +0000)]
Removed option "-parse-ast-check" from clang driver.  This is now implemented
using "-parse-ast -verify".

Updated all test cases (using a sed script) that invoked -parse-ast-check to
now use -parse-ast -verify.

Fixed a bug where using "-verify" instead of "-parse-ast-check" would not
correctly create the DiagClient needed to accumulate diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42365 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMoved "VerifyDiagnostics" variable declaration to right below ProgAction
Ted Kremenek [Wed, 26 Sep 2007 19:42:19 +0000 (19:42 +0000)]
Moved "VerifyDiagnostics" variable declaration to right below ProgAction
declaration.  This is because this option is logically tightly connected
to the actions defined in ProgAction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42364 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemoved inclusion of <memory>, which is no longer needed since we
Ted Kremenek [Wed, 26 Sep 2007 19:41:07 +0000 (19:41 +0000)]
Removed inclusion of <memory>, which is no longer needed since we
aren't used auto_ptr's anymore.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42363 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRefactored driver so that any action that is implemented using an
Ted Kremenek [Wed, 26 Sep 2007 18:39:29 +0000 (18:39 +0000)]
Refactored driver so that any action that is implemented using an
ASTConsumer can also be verified using the diagnostics checker.  From
the command line, users may activate diagnostic checking using the
"-verify" option.  For example, "clang -verify -warn-dead-stores"
checks if the warnings flagged by the dead store checker match those
in the comments.

Note that we still have the option "-parse-ast-check" for backwards
comptability with existing test cases.  This option is now equivalent to
"-parse-ast -verify".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42362 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoThis patch inserts ivars declared in @implementation in its object and verifies
Fariborz Jahanian [Wed, 26 Sep 2007 18:27:25 +0000 (18:27 +0000)]
This patch inserts ivars declared in @implementation in its object and verifies
that they conform(in type, name and numbers) to those declared in @interface.
Test case highlights kind of checking we do here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42360 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemoved a few TODOs on things which are done.
Fariborz Jahanian [Wed, 26 Sep 2007 17:03:44 +0000 (17:03 +0000)]
Removed a few TODOs on things which are done.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42358 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoHandle (int)1.0e40 as an i-c-e.
Chris Lattner [Wed, 26 Sep 2007 00:47:26 +0000 (00:47 +0000)]
Handle (int)1.0e40 as an i-c-e.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42334 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdated VC++ build system.
Hartmut Kaiser [Tue, 25 Sep 2007 23:32:45 +0000 (23:32 +0000)]
Updated VC++ build system.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42330 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdated XCode project to reflect that DataflowValues.h and DataflowSolver.h have
Ted Kremenek [Tue, 25 Sep 2007 22:45:38 +0000 (22:45 +0000)]
Updated XCode project to reflect that DataflowValues.h and DataflowSolver.h have
moved to include/clang/Analysis/FlowSensitive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42327 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMoved "DataflowSolver.h" to the "include/" subtree. Adjusted client
Ted Kremenek [Tue, 25 Sep 2007 21:00:24 +0000 (21:00 +0000)]
Moved "DataflowSolver.h" to the "include/" subtree.  Adjusted client
code that uses the solver to reflect the new location.

Created "FlowSensitive" subdirectory in include/clang/Analysis to hold
header files relating to flow-sensitive analyses.  Moved
"DataflowValues.h" into this subdirectory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42320 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPatch to make ObjcImplementationDecl derived from TypeDecl and supprt legacy
Fariborz Jahanian [Tue, 25 Sep 2007 21:00:20 +0000 (21:00 +0000)]
Patch to make ObjcImplementationDecl derived from TypeDecl and supprt legacy
objective-c code with no @interface declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42319 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed broken English in comment.
Ted Kremenek [Tue, 25 Sep 2007 20:37:28 +0000 (20:37 +0000)]
Fixed broken English in comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42317 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoThis patch introduces a new class to keep track of class implementation info. It...
Fariborz Jahanian [Tue, 25 Sep 2007 18:38:09 +0000 (18:38 +0000)]
This patch introduces a new class to keep track of class implementation info. It also adds more
semantic checks for class and protocol declarations. Test cases are good indications of kind of
checking being done in this patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42311 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded "CheckASTConsumer", a function that generalizes
Ted Kremenek [Tue, 25 Sep 2007 18:37:20 +0000 (18:37 +0000)]
Added "CheckASTConsumer", a function that generalizes
"CheckDiagnostics" (used for -parse-ast-check) to check the
diagnostics of any ASTConsumer.

Reimplemented CheckDiagnostics to use CheckASTConsumer instead.

Added driver option -warn-dead-stores-check, which checks the
diagnostics generated by the DeadStores checker.  This is implemented
using CheckASTConsumer.111

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42310 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoChanged command line options "-check-dead-stores" and
Ted Kremenek [Tue, 25 Sep 2007 18:05:45 +0000 (18:05 +0000)]
Changed command line options "-check-dead-stores" and
"-check-uninit-values" to "-warn-dead-stores" and
"-warn-uninit-values"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42307 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoComment formatting changes. No real content changes.
Ted Kremenek [Tue, 25 Sep 2007 17:53:38 +0000 (17:53 +0000)]
Comment formatting changes.  No real content changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42305 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMinor comment changes.
Ted Kremenek [Tue, 25 Sep 2007 17:51:05 +0000 (17:51 +0000)]
Minor comment changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42304 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemoved "EverKilled" class in DeadStores checker; it is no longer used.
Ted Kremenek [Tue, 25 Sep 2007 17:47:04 +0000 (17:47 +0000)]
Removed "EverKilled" class in DeadStores checker; it is no longer used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42301 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdated VC++ build system
Hartmut Kaiser [Tue, 25 Sep 2007 13:08:03 +0000 (13:08 +0000)]
Updated VC++ build system

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42295 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFurther refactored DataflowSolver. Now most code for the solver is shared
Ted Kremenek [Tue, 25 Sep 2007 04:31:27 +0000 (04:31 +0000)]
Further refactored DataflowSolver.  Now most code for the solver is shared
between forward and backward analyses, with trait classes being used
to implement the key differences in operations/functionality.

Converted the LiveVariables analysis to use the generic DataflowSolver.  This,
along with removing some extra functionality that was not needed, reduced
the code for LiveVariables by over half.

Modified Driver code to handle the updated interface to LiveVariables.

Modified the DeadStores checker to handle the update interface to
LiveVariables.

Updated DataflowValues (generic ADT to store dataflow values) to also
store values for blocks.  This is used by DeadStores.  Updated some comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42293 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded extra "constness" to parameter.
Ted Kremenek [Tue, 25 Sep 2007 04:30:51 +0000 (04:30 +0000)]
Added extra "constness" to parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42292 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agouse the right rounding mode.
Chris Lattner [Tue, 25 Sep 2007 04:29:44 +0000 (04:29 +0000)]
use the right rounding mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42291 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded PersistentMap, an ADT that implements a map data structure that
Ted Kremenek [Tue, 25 Sep 2007 04:26:20 +0000 (04:26 +0000)]
Added PersistentMap, an ADT that implements a map data structure that
is persistent.  Adds/removals to a PersistentMap do not result in
a map being modified, but a new map being created.  This will be useful
for path-sensitive analyses.

The current implementation mainly makes copies to implement this
functionality.  If the map turns out to be extensively used, this
implementation will be replaced with a more efficient one that uses
data sharing (see comments in PersistentMap.h for more information).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42290 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded smart pointer class "IntrusiveSPtr" that handles reference
Ted Kremenek [Mon, 24 Sep 2007 06:10:20 +0000 (06:10 +0000)]
Added smart pointer class "IntrusiveSPtr" that handles reference
counted objects that maintain their own internal reference count.
This smart pointer implementation is compatible with LLVM-style
down-casting (see in llvm: include/llvm/Support/Casting.h).

Implemented "RefCounted", a base class that objects that wish to be
managed using IntrusiveSPtrs can subclass.

Reference counted objects are being targeted for use in path-sensitive
dataflow analyses where managing many live objects becomes difficult.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42260 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoIf we see an invalid #ifdef directive, enter a conditional compilation region
Chris Lattner [Mon, 24 Sep 2007 05:14:57 +0000 (05:14 +0000)]
If we see an invalid #ifdef  directive, enter a conditional compilation region
so that we don't emit an error on the #endif.  Suggestion by Neil.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42258 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix for 64-bit systems.
Chris Lattner [Sun, 23 Sep 2007 23:53:07 +0000 (23:53 +0000)]
Fix for 64-bit systems.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42253 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed VC++ bitfield to unsigned/signed sign propagation issue.
Hartmut Kaiser [Sun, 23 Sep 2007 23:39:51 +0000 (23:39 +0000)]
Fixed VC++ bitfield to unsigned/signed sign propagation issue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42252 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse the APFloat routines to evaluate FP immediates as
Chris Lattner [Sat, 22 Sep 2007 19:04:13 +0000 (19:04 +0000)]
Use the APFloat routines to evaluate FP immediates as
integer constant expressions.  The only questionable
thing is that we now reject:

void foo() {
  switch (1) {
  case (int)1.0e10000:
    ;
  }
}

with:

t.c:5:13: error: case label does not reduce to an integer constant
  case (int)1.0e10000:
       ~~~~~^~~~~~~~~

GCC accepts this, emitting the pedwarn:
t.c:5: warning: floating constant exceeds range of 'double'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42238 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd comments.
Chris Lattner [Sat, 22 Sep 2007 18:48:32 +0000 (18:48 +0000)]
add comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42237 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agofurther apfloat'ize the front-end, allowing codegen to pass
Chris Lattner [Sat, 22 Sep 2007 18:47:25 +0000 (18:47 +0000)]
further apfloat'ize the front-end, allowing codegen to pass
APFloat straight through to LLVM now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42236 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agowork around bugs and missing features in apfloat.
Chris Lattner [Sat, 22 Sep 2007 18:38:30 +0000 (18:38 +0000)]
work around bugs and missing features in apfloat.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42235 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse APFloat for the representation of FP immediates, ask the target
Chris Lattner [Sat, 22 Sep 2007 18:29:59 +0000 (18:29 +0000)]
Use APFloat for the representation of FP immediates, ask the target
for *which* apfloat to use for a particular type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42234 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoThis patch adds to new things to clang:
Fariborz Jahanian [Sat, 22 Sep 2007 00:01:35 +0000 (00:01 +0000)]
This patch adds to new things to clang:
1. Handles saving and checking on protocols used in an @interface declaration
2. Checks and saves class's super class.
3. Adds semantic check to category declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42218 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMake case sorting deterministic by not depending on pointer
Chris Lattner [Fri, 21 Sep 2007 18:15:22 +0000 (18:15 +0000)]
Make case sorting deterministic by not depending on pointer
values.  Patch mostly by Gabor Greif for PR1682.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42203 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoThis patch instantiates objects for forward protocols and in general handles use of
Fariborz Jahanian [Fri, 21 Sep 2007 15:40:54 +0000 (15:40 +0000)]
This patch instantiates objects for forward protocols and in general handles use of
protocols referenced in @protocol declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42191 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdated VC++ project files
Hartmut Kaiser [Thu, 20 Sep 2007 21:54:10 +0000 (21:54 +0000)]
Updated VC++ project files

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42177 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdated XCode project with locations of "Analysis" visitor header files.
Ted Kremenek [Thu, 20 Sep 2007 21:47:32 +0000 (21:47 +0000)]
Updated XCode project with locations of "Analysis" visitor header files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42176 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdated header file inlcude to new location of
Ted Kremenek [Thu, 20 Sep 2007 21:42:55 +0000 (21:42 +0000)]
Updated header file inlcude to new location of
Analysis/Visitors/*Visitors.h files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42175 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRenamed "include/clang/Analysis/CFGVisitors" "<snip>/Analysis/Visitors".
Ted Kremenek [Thu, 20 Sep 2007 21:42:03 +0000 (21:42 +0000)]
Renamed "include/clang/Analysis/CFGVisitors" "<snip>/Analysis/Visitors".

"Visitors" is more general than "CFGVisitors", as we aren't just using
visitation useful for CFG analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42174 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMoved include/clang/Analysis/*Visitor.h to include/clang/Analysis/CFGVisitors.
Ted Kremenek [Thu, 20 Sep 2007 21:40:36 +0000 (21:40 +0000)]
Moved include/clang/Analysis/*Visitor.h to include/clang/Analysis/CFGVisitors.

We had enough visitors that it was cluttering the Analysis directory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42173 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoHandle forward declaration of classes and prevent re-instantiation of
Fariborz Jahanian [Thu, 20 Sep 2007 20:26:44 +0000 (20:26 +0000)]
Handle forward declaration of classes and prevent re-instantiation of
ObjcInterfaceClass Objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42172 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMatch to do some semantic analysis on objective-c class decl.
Fariborz Jahanian [Thu, 20 Sep 2007 17:54:07 +0000 (17:54 +0000)]
Match to do some semantic analysis on objective-c class decl.
1. Detect used of undeclared/forward declared super class.
2. Detect duplicate definition of a class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42168 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdated VC++ project files.
Hartmut Kaiser [Thu, 20 Sep 2007 13:35:09 +0000 (13:35 +0000)]
Updated VC++ project files.
Disambiguated a variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42161 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded support to clang driver to view ASTs using GraphViz. This
Ted Kremenek [Wed, 19 Sep 2007 21:29:43 +0000 (21:29 +0000)]
Added support to clang driver to view ASTs using GraphViz.  This
functionality is still preliminary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42152 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMoved GraphTraits<Stmt*> to StmtGraphTraits.h. This allows consumers of Stmt.h not...
Ted Kremenek [Wed, 19 Sep 2007 21:21:39 +0000 (21:21 +0000)]
Moved GraphTraits<Stmt*> to StmtGraphTraits.h.  This allows consumers of Stmt.h not to have to pay the cost
of parsing the GraphTraits templates if they don't need that functionality.

Defined nodes_iterator for GraphTraits<Stmt*> to be based on llvm::df_iterator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42150 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPatch to parse objective-c's @try-statement and @throw-statement.
Fariborz Jahanian [Wed, 19 Sep 2007 19:14:32 +0000 (19:14 +0000)]
Patch to parse objective-c's @try-statement and @throw-statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42148 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded GraphTraits template specialization for Stmt* to treat ASTs like graphs.
Ted Kremenek [Wed, 19 Sep 2007 18:18:40 +0000 (18:18 +0000)]
Added GraphTraits template specialization for Stmt* to treat ASTs like graphs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42146 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMore refactoring: decl and expr regisitration now uses CFGRecStmtDeclVisitor.
Ted Kremenek [Wed, 19 Sep 2007 18:00:03 +0000 (18:00 +0000)]
More refactoring: decl and expr regisitration now uses CFGRecStmtDeclVisitor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42145 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded two new visitors that extend CFGStmtVisitor: CFGRecStmtVisitor and CFGRecStmtDe...
Ted Kremenek [Wed, 19 Sep 2007 17:59:28 +0000 (17:59 +0000)]
Added two new visitors that extend CFGStmtVisitor: CFGRecStmtVisitor and CFGRecStmtDeclVisitor.
The extended functionality of these visitors is that they automatically visit all statements in
an AST (no explicit recursion is required from subclasses), and the for the latter, decls are visited
as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42144 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove SelectorTable/SelectorInfo, simply store all selectors in the central Identifi...
Steve Naroff [Wed, 19 Sep 2007 16:18:46 +0000 (16:18 +0000)]
Remove SelectorTable/SelectorInfo, simply store all selectors in the central IdentifierTable.

Rationale:

We currently have a separate table to unique ObjC selectors. Since I don't need all the instance data in IdentifierInfo, I thought this would save space (and make more sense conceptually).

It turns out the cost of having duplicate entries for unary selectors (i.e. names without colons) outweighs the cost difference between the IdentifierInfo & SelectorInfo structures. Here is the data:

Two tables:

*** Selector/Identifier Stats:
# Selectors/Identifiers: 51635
Bytes allocated:         1999824

One table:

*** Identifier Table Stats:
# Identifiers:   49500
Bytes allocated: 1990316

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42139 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove #include of config.h, it is no longer needed.
Steve Naroff [Wed, 19 Sep 2007 03:01:22 +0000 (03:01 +0000)]
Remove #include of config.h, it is no longer needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42126 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove alloca import...
Steve Naroff [Tue, 18 Sep 2007 23:56:42 +0000 (23:56 +0000)]
Remove alloca import...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42117 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoProgress on message expressions...
Steve Naroff [Tue, 18 Sep 2007 23:55:05 +0000 (23:55 +0000)]
Progress on message expressions...

- Add ObjcMessageExpr AST node and associated constructors.
- Add SourceLocation's to ActOnKeywordMessage/ActOnUnaryMessage API.
- Instantiate message expressions...
- Replace alloca usage with SmallString.

Next step, installing a correct type, among other tweaks...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42116 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDataflowSolver now acccepts an "_Equal" template parameter that allows the user
Ted Kremenek [Tue, 18 Sep 2007 23:40:51 +0000 (23:40 +0000)]
DataflowSolver now acccepts an "_Equal" template parameter that allows the user
to specify how two dataflow values should be compared for equality.  The default
is to use std::equal_to.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42115 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed bug where getBitRef would incorrectly grab the bit from the
Ted Kremenek [Tue, 18 Sep 2007 23:30:45 +0000 (23:30 +0000)]
Fixed bug where getBitRef would incorrectly grab the bit from the
wrong bitvector.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42114 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoChanged solver to use "==" operator when comparing dataflow values
Ted Kremenek [Tue, 18 Sep 2007 23:30:21 +0000 (23:30 +0000)]
Changed solver to use "==" operator when comparing dataflow values
rather than a special "equal" method defined in the class for the
value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42113 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMinor performance fix in transfer function logic. Previously we
Ted Kremenek [Tue, 18 Sep 2007 21:47:41 +0000 (21:47 +0000)]
Minor performance fix in transfer function logic. Previously we
called VisitStmt, but VisitChildren is more direct and creates less
boilerplate logic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42110 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMore refactoring and code reduction.
Ted Kremenek [Tue, 18 Sep 2007 21:43:18 +0000 (21:43 +0000)]
More refactoring and code reduction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42109 91177308-0d34-0410-b5e6-96231b3b80d8