Граф коммитов

320 Коммитов

Автор SHA1 Сообщение Дата
Fariborz Jahanian d0b90bff98 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
2007-09-26 18:27:25 +00:00
Ted Kremenek 1de632bf4a 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
2007-09-25 21:00:24 +00:00
Fariborz Jahanian 0da1c10338 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
2007-09-25 21:00:20 +00:00
Fariborz Jahanian ccb4f31424 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
2007-09-25 18:38:09 +00:00
Ted Kremenek fdd225ed6f 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
2007-09-25 04:31:27 +00:00
Ted Kremenek d9bfa8c49c Added extra "constness" to parameter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42292 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 04:30:51 +00:00
Ted Kremenek 67cfad6fda 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
2007-09-25 04:26:20 +00:00
Ted Kremenek d33218cd68 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
2007-09-24 06:10:20 +00:00
Chris Lattner 031b2d21fe Fix for 64-bit systems.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42253 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-23 23:53:07 +00:00
Hartmut Kaiser a8ae51f79d 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
2007-09-23 23:39:51 +00:00
Chris Lattner 3d2313ef5d add comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42237 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-22 18:48:32 +00:00
Chris Lattner c9bec4bfea 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
2007-09-22 18:47:25 +00:00
Chris Lattner 1c9bdaef20 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
2007-09-22 18:38:30 +00:00
Chris Lattner 525a05093a 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
2007-09-22 18:29:59 +00:00
Fariborz Jahanian b27c156688 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
2007-09-22 00:01:35 +00:00
Chris Lattner 764a7ce521 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
2007-09-21 18:15:22 +00:00
Fariborz Jahanian 894c57f565 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
2007-09-21 15:40:54 +00:00
Ted Kremenek 57634c7cec 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
2007-09-20 21:42:03 +00:00
Ted Kremenek adfb987d19 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
2007-09-20 21:40:36 +00:00
Fariborz Jahanian bd51b8745c 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
2007-09-20 20:26:44 +00:00
Fariborz Jahanian 1d5b0e37cd 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
2007-09-20 17:54:07 +00:00
Ted Kremenek d2a4a1af10 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
2007-09-19 21:21:39 +00:00
Fariborz Jahanian 397fcc117e 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
2007-09-19 19:14:32 +00:00
Ted Kremenek 5e97d4b5ec 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
2007-09-19 18:18:40 +00:00
Ted Kremenek b2977544b4 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
2007-09-19 18:00:03 +00:00
Ted Kremenek ba0c5d6305 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
2007-09-19 17:59:28 +00:00
Steve Naroff 21d5a95b8f 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
2007-09-19 16:18:46 +00:00
Steve Naroff 563477da25 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
2007-09-18 23:55:05 +00:00
Ted Kremenek fe1b1e686f 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
2007-09-18 23:40:51 +00:00
Ted Kremenek f5a9518ec4 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
2007-09-18 23:30:45 +00:00
Ted Kremenek 43a1698cfb More refactoring and code reduction.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42109 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 21:43:18 +00:00
Ted Kremenek a90b0d1e58 Added member template CFG::VisitBlockStmts to provide a succinct way
of visiting all block-level statements in a CFG.

Tightened implementation of UninitializedValues.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42106 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 20:59:00 +00:00
Ted Kremenek a36c654034 Additional comments and cosmetic cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42105 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 20:44:03 +00:00
Fariborz Jahanian fd225cc227 Patch for object creation and handling of category declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42104 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 20:26:58 +00:00
Ted Kremenek 105bfee9d6 Modified DataFlowValues and DataflowSolver to associate dataflow value
with CFG *edges* instead of blocks.  This will fascilitate dataflow
analyses that are sensitive to block terminators, and also simplifies
some reasoning.

Updated UninitializedValues to comply to this new interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42099 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 18:02:44 +00:00
Ted Kremenek 4c64e8ee46 Added type "CFG::Edge" to encapsulate the notion of directed-edges
within source-level CFGs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42098 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 18:01:15 +00:00
Fariborz Jahanian 00933591a2 Uses more description name for method implementation kind argument.
Moves such argument as the last argument and uses defaul value.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 00:25:23 +00:00
Fariborz Jahanian 146fbb0c8b Patch to remove ObjcProtoMethodDecl and use ObjcMethodDecl
instead for @protocol method decls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42070 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 22:36:42 +00:00
Steve Naroff 6d6cfbfa8c Add a comment and remove unused constructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42063 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 21:26:50 +00:00
Hartmut Kaiser 0bcccc763b Fixed a VC++ issue related to bitmasks. As it turns out the compiler fills the unused bits of the word a bitmask is stored in with '1' (or randomly, I can't tell, I've seen '1' so far only), which creates wrong results in certain cases.
Please review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42061 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 21:11:08 +00:00
Fariborz Jahanian 25e077d59a Patch to add objective-c's @protocl type declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42060 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 21:07:36 +00:00
Steve Naroff 708391a0e6 Finish defining Action API for message expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42059 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 21:01:15 +00:00
Ted Kremenek 2bf55140b8 UninitialuzedValues now only tracks BlockVarDecls; obviating false positives with
globals and function parameters.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42055 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 20:49:30 +00:00
Steve Naroff 37387c9328 - Refactored ObjcKeywordInfo into ObjcKeywordInfo, ObjcKeywordDecl, and ObjcKeywordMessage.
- Removed helper ObjcGetSelectorInfo(), moving the code directly into ObjcBuildMethodDeclaration().
- Many refinements to ParseObjCMessageExpression().
- Add ActOnMessageExpression().

Next step, finish the message actions and (finally) create/instantiate an ObjcMessageExpr AST.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42050 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 20:25:27 +00:00
Ted Kremenek cd5860ce7a More progress on UnitializedValues checker. We now have preliminary support
for reporting errors and running the checker.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42046 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 19:59:27 +00:00
Ted Kremenek 20ee4fbee7 Split tracking of unitialized values for Decls and CFGBlock-level expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42041 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 18:31:23 +00:00
Ted Kremenek 56d516d18a Removed "ObserverTy" from core DataflowValues types. The observer
mechanism can be implemented simply by affixing the Observer to an
analysis meta data, so it doesn't need to be a required type.  This
also permits analyses not to implement an Observer if it doesn't make
sense.

Changed "DataflowValues::MetaDataTy" to
"DataflowValues::AnalysisDataTy" to reflect that the type
enscapsulated the data associated with analyzing a given CFG.

Changed CFGStmtVisitor::BlockStmt_VisitImplicitControlFlowStmt(Stmt*)
to ...VisitImplicitControlFlowExpr(Expr*).  The type narrowing is more
precise and more useful to clients.

Added CFGStmtVisitor::BlockStmt_VisitExpr to reflect the visitation of
expressions at the block statement level.  This captures all implicit
control-flow statements as well as other expressions that are hoisted
to the block level (such as conditions for terminators and function
calls).  This is especially useful for dataflow analysis.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42034 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 17:14:52 +00:00
Steve Naroff e5ea380858 Add const to debug hook...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42025 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 14:49:06 +00:00
Steve Naroff 3f128ad269 Add support for ObjC keyword selectors.
- Add SelectorInfo/SelectorTable classes, modeled after IdentifierInfo/IdentifierTable.
- Add SelectorTable instance to ASTContext, created lazily through ASTContext::getSelectorInfo().
- Add SelectorInfo slot to ObjcMethodDecl.
- Add helper function to derive a SelectorInfo from ObjcKeywordInfo.

Misc: Got the Decl stats stuff up and running again...it was missing support for ObjC AST's.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42023 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 14:16:13 +00:00
Chris Lattner 4b1aa816bb remove some obsolete interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42014 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-16 19:47:56 +00:00