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

979 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek 4cd8b3cd4f 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
2007-09-25 17:47:04 +00:00
Hartmut Kaiser 2c9334d3f0 Updated VC++ build system
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42295 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 13:08:03 +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
Chris Lattner 92dfb4784f use the right rounding mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42291 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 04:29:44 +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 f37bb25120 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
2007-09-24 05:14:57 +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 987b15db39 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
2007-09-22 19:04:13 +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
Hartmut Kaiser 763051df06 Updated VC++ project files
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42177 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-20 21:54:10 +00:00
Ted Kremenek 4f5a2abc40 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
2007-09-20 21:47:32 +00:00
Ted Kremenek 11de5cbe81 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
2007-09-20 21:42:55 +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
Hartmut Kaiser 2367e638d8 Updated VC++ project files.
Disambiguated a variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42161 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-20 13:35:09 +00:00
Ted Kremenek 80de08fc6f 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
2007-09-19 21:29:43 +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 2cc62aad7d 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
2007-09-19 03:01:22 +00:00
Steve Naroff 660fa00780 Remove alloca import...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42117 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 23:56:42 +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 44e402611f 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
2007-09-18 23:30:21 +00:00
Ted Kremenek 59d1827c1a 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
2007-09-18 21:47:41 +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 294a7c9cf1 Add overloaded versions of DataflowSolver::runOnBlock to simplify
invocation of the solver.

UninitializedValues checker now uses CFG::runOnAllBlocks to query the
computed dataflow values (tighter code).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42107 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 21:08:21 +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 8e2806573e Moved TransferFunction object within DataflowSolver to be a instance
variable instead of a temporary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42102 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 18:17:19 +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
Hartmut Kaiser 2f94f3ce15 alloca.h doesn't exist on Windows.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42089 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 12:16:59 +00:00
Gabor Greif 7ffc9ed4aa alloca.h is needed on Solaris
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42088 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 11:01:25 +00:00