]> granicus.if.org Git - clang/log
clang
17 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

17 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

17 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

17 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

17 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

17 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

17 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

17 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

17 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

17 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

17 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

17 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

17 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

17 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

17 years agoAdd overloaded versions of DataflowSolver::runOnBlock to simplify
Ted Kremenek [Tue, 18 Sep 2007 21:08:21 +0000 (21:08 +0000)]
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

17 years agoAdded member template CFG::VisitBlockStmts to provide a succinct way
Ted Kremenek [Tue, 18 Sep 2007 20:59:00 +0000 (20:59 +0000)]
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

17 years agoAdditional comments and cosmetic cleanups.
Ted Kremenek [Tue, 18 Sep 2007 20:44:03 +0000 (20:44 +0000)]
Additional comments and cosmetic cleanups.

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

17 years agoPatch for object creation and handling of category declarations.
Fariborz Jahanian [Tue, 18 Sep 2007 20:26:58 +0000 (20:26 +0000)]
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

17 years agoMoved TransferFunction object within DataflowSolver to be a instance
Ted Kremenek [Tue, 18 Sep 2007 18:17:19 +0000 (18:17 +0000)]
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

17 years agoModified DataFlowValues and DataflowSolver to associate dataflow value
Ted Kremenek [Tue, 18 Sep 2007 18:02:44 +0000 (18:02 +0000)]
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

17 years agoAdded type "CFG::Edge" to encapsulate the notion of directed-edges
Ted Kremenek [Tue, 18 Sep 2007 18:01:15 +0000 (18:01 +0000)]
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

17 years agoalloca.h doesn't exist on Windows.
Hartmut Kaiser [Tue, 18 Sep 2007 12:16:59 +0000 (12:16 +0000)]
alloca.h doesn't exist on Windows.

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

17 years agoalloca.h is needed on Solaris
Gabor Greif [Tue, 18 Sep 2007 11:01:25 +0000 (11:01 +0000)]
alloca.h is needed on Solaris

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

17 years agoUses more description name for method implementation kind argument.
Fariborz Jahanian [Tue, 18 Sep 2007 00:25:23 +0000 (00:25 +0000)]
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

17 years agoUpdated VC++ project files after file rename.
Hartmut Kaiser [Mon, 17 Sep 2007 23:33:12 +0000 (23:33 +0000)]
Updated VC++ project files after file rename.

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

17 years agoPatch to remove ObjcProtoMethodDecl and use ObjcMethodDecl
Fariborz Jahanian [Mon, 17 Sep 2007 22:36:42 +0000 (22:36 +0000)]
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

17 years agoBug fix to merging of data flow values (merge incorrectly made values
Ted Kremenek [Mon, 17 Sep 2007 21:59:08 +0000 (21:59 +0000)]
Bug fix to merging of data flow values (merge incorrectly made values
too "conservative").

Several revisions to UninitializedValues checker after testing.  We
now appear to be working correctly (probably some bugs still, but main
functionality appears to be there).  Implemented careful emitting of
warnings so that we wouldn't get a cascade of warnings for simply not
defining a single variable and using it everywhere.  This way the
warnings point closer to the root cause rather than "symptoms" from
using values derived from uninitialized variables.

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

17 years agoAdd a comment and remove unused constructors.
Steve Naroff [Mon, 17 Sep 2007 21:26:50 +0000 (21:26 +0000)]
Add a comment and remove unused constructors.

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

17 years agoMade driver flag --check-uninit-values more self-explanatory.
Ted Kremenek [Mon, 17 Sep 2007 21:21:20 +0000 (21:21 +0000)]
Made driver flag --check-uninit-values more self-explanatory.

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

17 years agoFixed a VC++ issue related to bitmasks. As it turns out the compiler fills the unused...
Hartmut Kaiser [Mon, 17 Sep 2007 21:11:08 +0000 (21:11 +0000)]
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

17 years agoPatch to add objective-c's @protocl type declaration.
Fariborz Jahanian [Mon, 17 Sep 2007 21:07:36 +0000 (21:07 +0000)]
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

17 years agoFinish defining Action API for message expressions.
Steve Naroff [Mon, 17 Sep 2007 21:01:15 +0000 (21:01 +0000)]
Finish defining Action API for message expressions.

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

17 years agoRe-added UninitializedValues.cpp to the XCode project because the file was renamed.
Ted Kremenek [Mon, 17 Sep 2007 20:52:52 +0000 (20:52 +0000)]
Re-added UninitializedValues.cpp to the XCode project because the file was renamed.

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

17 years agoRenamed file due to mispelling.
Ted Kremenek [Mon, 17 Sep 2007 20:50:02 +0000 (20:50 +0000)]
Renamed file due to mispelling.

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

17 years agoUninitialuzedValues now only tracks BlockVarDecls; obviating false positives with
Ted Kremenek [Mon, 17 Sep 2007 20:49:30 +0000 (20:49 +0000)]
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

17 years ago- Refactored ObjcKeywordInfo into ObjcKeywordInfo, ObjcKeywordDecl, and ObjcKeywordMe...
Steve Naroff [Mon, 17 Sep 2007 20:25:27 +0000 (20:25 +0000)]
- 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

17 years agoMore progress on UnitializedValues checker. We now have preliminary support
Ted Kremenek [Mon, 17 Sep 2007 19:59:27 +0000 (19:59 +0000)]
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

17 years agoSplit tracking of unitialized values for Decls and CFGBlock-level expressions.
Ted Kremenek [Mon, 17 Sep 2007 18:31:23 +0000 (18:31 +0000)]
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

17 years agoRemoved "ObserverTy" from core DataflowValues types. The observer
Ted Kremenek [Mon, 17 Sep 2007 17:14:52 +0000 (17:14 +0000)]
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

17 years agoRemoved check for NULL CFG. Bad CFGs will fire an assertion failure
Ted Kremenek [Mon, 17 Sep 2007 17:10:02 +0000 (17:10 +0000)]
Removed check for NULL CFG.  Bad CFGs will fire an assertion failure
in the CFG builder logic.

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

17 years agoWhen building CFGs we now (unconditionally) add an empty CFGBlock to the CFG
Ted Kremenek [Mon, 17 Sep 2007 16:18:02 +0000 (16:18 +0000)]
When building CFGs we now (unconditionally) add an empty CFGBlock to the CFG
to serve as the entry block.  An empty entry block (just as with an
empty exit block, which we already have) simplifies building analyses on top
of CFGs with very little extra overhead.

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

17 years agoAdded ASTConsumer.h to XCode project.
Ted Kremenek [Mon, 17 Sep 2007 16:09:32 +0000 (16:09 +0000)]
Added ASTConsumer.h to XCode project.

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

17 years agoFix a few 80 column violations.
Steve Naroff [Mon, 17 Sep 2007 15:07:43 +0000 (15:07 +0000)]
Fix a few 80 column violations.

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

17 years agoAdd const to debug hook...
Steve Naroff [Mon, 17 Sep 2007 14:49:06 +0000 (14:49 +0000)]
Add const to debug hook...

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

17 years agoAdd support for ObjC keyword selectors.
Steve Naroff [Mon, 17 Sep 2007 14:16:13 +0000 (14:16 +0000)]
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

17 years agoFixed unterminated string issue.
Hartmut Kaiser [Mon, 17 Sep 2007 12:29:55 +0000 (12:29 +0000)]
Fixed unterminated string issue.

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

17 years agomake var in anon namespace static. Use \n instead of std::endl.
Chris Lattner [Mon, 17 Sep 2007 06:16:32 +0000 (06:16 +0000)]
make var in anon namespace static.  Use \n instead of std::endl.

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

17 years agoSilenced a VC++ warning.
Hartmut Kaiser [Sun, 16 Sep 2007 21:35:35 +0000 (21:35 +0000)]
Silenced a VC++ warning.
Updated VC++ project files.

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

17 years agoremove some obsolete interfaces.
Chris Lattner [Sun, 16 Sep 2007 19:47:56 +0000 (19:47 +0000)]
remove some obsolete interfaces.

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

17 years agoswitch the llvm emitter to ASTConsumer interface.
Chris Lattner [Sun, 16 Sep 2007 19:46:59 +0000 (19:46 +0000)]
switch the llvm emitter to ASTConsumer interface.

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

17 years agoFrom Justin Handville:
Chris Lattner [Sun, 16 Sep 2007 19:27:16 +0000 (19:27 +0000)]
From Justin Handville:

"The ExpectedStr search was starting at the end of the comment string.
This patch starts the search at the beginning of the comment string.
After applying this patch, clang -parse-ast-check on negative test
case source files worked as expected."

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

17 years agoFix html problem, patch by Justin Handville
Chris Lattner [Sun, 16 Sep 2007 19:25:23 +0000 (19:25 +0000)]
Fix html problem, patch by Justin Handville

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

17 years agofix some warnings, patch by Justin Handville
Chris Lattner [Sun, 16 Sep 2007 19:23:47 +0000 (19:23 +0000)]
fix some warnings, patch by Justin Handville

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

17 years agodecl counting isn't implemented yet for objc. -stats probably crashes for it.
Chris Lattner [Sun, 16 Sep 2007 19:23:04 +0000 (19:23 +0000)]
decl counting isn't implemented yet for objc.  -stats probably crashes for it.
Patch by Justin Handville

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

17 years agoFix a GCC warning, patch by Justin Handville
Chris Lattner [Sun, 16 Sep 2007 19:12:45 +0000 (19:12 +0000)]
Fix a GCC warning, patch by Justin Handville

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

17 years agofix warning.
Chris Lattner [Sun, 16 Sep 2007 19:11:53 +0000 (19:11 +0000)]
fix warning.

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

17 years agoFixes/tweaks that prevent "defaults-i.m" from compiling.
Steve Naroff [Sun, 16 Sep 2007 16:16:00 +0000 (16:16 +0000)]
Fixes/tweaks that prevent "defaults-i.m" from compiling.

- Allow classnames as the receiver (removing a FIXME from ParseObjCMessageExpression).
- Added a FIXME to ParseObjCMessageExpression()...we need to return a message expr AST node!

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

17 years agoRename statement actions (from Parse-prefix to ActOn-prefix).
Steve Naroff [Sun, 16 Sep 2007 14:56:35 +0000 (14:56 +0000)]
Rename statement actions (from Parse-prefix to ActOn-prefix).

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

17 years agoRename expression actions (from Parse-prefix to ActOn-prefix).
Steve Naroff [Sun, 16 Sep 2007 03:34:24 +0000 (03:34 +0000)]
Rename expression actions (from Parse-prefix to ActOn-prefix).

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

17 years agoFixed a problem VC++ revealed in release mode. Please verify.
Hartmut Kaiser [Sun, 16 Sep 2007 00:31:07 +0000 (00:31 +0000)]
Fixed a problem VC++ revealed in release mode. Please verify.

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

17 years agoFixed two problems VC++ revealed in release mode. Please verify.
Hartmut Kaiser [Sun, 16 Sep 2007 00:28:28 +0000 (00:28 +0000)]
Fixed two problems VC++ revealed in release mode. Please verify.

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

17 years agoUpdated VC++ build system.
Hartmut Kaiser [Sun, 16 Sep 2007 00:04:22 +0000 (00:04 +0000)]
Updated VC++ build system.
Silenced a couple of VC++ warnings.

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

17 years agoswitch the various CFG-based stuff over to using ASTConsumer interface,
Chris Lattner [Sat, 15 Sep 2007 23:21:08 +0000 (23:21 +0000)]
switch the various CFG-based stuff over to using ASTConsumer interface,
this eliminates their dependence on the preprocessor and eliminates some
duplicated code.

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

17 years agoconvert ast printer and dumper ocver to ASTConsumer interface,
Chris Lattner [Sat, 15 Sep 2007 23:02:28 +0000 (23:02 +0000)]
convert ast printer and dumper ocver to ASTConsumer interface,
genericizing them and eliminating boilerplate code.

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

17 years agoadd a new ASTConsumer consumer to simplify stuff in the driver.
Chris Lattner [Sat, 15 Sep 2007 22:56:56 +0000 (22:56 +0000)]
add a new ASTConsumer consumer to simplify stuff in the driver.
Switch -parse-ast over to it.

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

17 years agoInitial checkin of rewriter interface. It is just stubbed out for now.
Chris Lattner [Sat, 15 Sep 2007 22:21:22 +0000 (22:21 +0000)]
Initial checkin of rewriter interface.  It is just stubbed out for now.

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

17 years agopretty print some nodes more nicely.
Chris Lattner [Sat, 15 Sep 2007 21:49:37 +0000 (21:49 +0000)]
pretty print some nodes more nicely.

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

17 years agofix comment
Chris Lattner [Sat, 15 Sep 2007 21:48:50 +0000 (21:48 +0000)]
fix comment

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

17 years agoStart converting Action methods from Parse-prefix to ActOn-prefix.
Steve Naroff [Sat, 15 Sep 2007 18:49:24 +0000 (18:49 +0000)]
Start converting Action methods from Parse-prefix to ActOn-prefix.

The previous naming scheme was confusing, since it resulted in both the Parser and Action modules having methods with the same name. In addition, the Action module never does any parsing...

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

17 years agoCouple of new classes for objective-c's @protocol typings.
Fariborz Jahanian [Sat, 15 Sep 2007 18:27:26 +0000 (18:27 +0000)]
Couple of new classes for objective-c's @protocol typings.

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

17 years agoAdded several files to XCode project file...
Ted Kremenek [Fri, 14 Sep 2007 23:13:28 +0000 (23:13 +0000)]
Added several files to XCode project file...

    Analysis/DataflowSolver.h
    Analysis/UnintializedValues.cpp
    include/clang/Analysis/CFGVarDeclVisitor.h
    include/clang/Analysis/DataflowValues.h
    include/clang/Analysis/UninitializedValues.h

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

17 years agoRename Action::ParseRecordBody() to ProcessFieldDecls(), and add a visibility argument.
Steve Naroff [Fri, 14 Sep 2007 23:09:53 +0000 (23:09 +0000)]
Rename Action::ParseRecordBody() to ProcessFieldDecls(), and add a visibility argument.

Remove Action::ObjcAddVisibilityToIvars(). No need for an extra API when it is trivial to add this info to the previous hook.

In general, I want to start migrating away from having Actions prefixed with "Parse" (which is confusing, since the Action API doesn't do any parsing, per se).

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

17 years agoPrototype implementation of new template-based dataflow solver.
Ted Kremenek [Fri, 14 Sep 2007 22:49:21 +0000 (22:49 +0000)]
Prototype implementation of new template-based dataflow solver.

Preliminary implementation of UninitializedValues, which is based on
new solver (doesn't work yet, but compiles).

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

17 years agoSeveral improvement to Sema::ParseRecordBody()...
Steve Naroff [Fri, 14 Sep 2007 22:20:54 +0000 (22:20 +0000)]
Several improvement to Sema::ParseRecordBody()...

- Adding a safer prologue. The previous prologue would accept a null and therefore assume we had an interface (which was incorrect).
- Fixed FieldDecl's classof method. This allowed me to simplify some unnecessary casting.
- When diagnosing errors, make sure the FieldDecl/EnclosingDecl are marked as invalid. In addition, don't delete the field...rather, add all fields to the enclosing decl. Memory management can/should be done elsewhere. This code was never "upgraded" to the recently added invalid decl strategy.

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

17 years agoPatch to store ivars into interface class object.
Fariborz Jahanian [Fri, 14 Sep 2007 21:08:27 +0000 (21:08 +0000)]
Patch to store ivars into interface class object.

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

17 years agoSemantic analysis for objective-c ivars.
Fariborz Jahanian [Fri, 14 Sep 2007 16:27:55 +0000 (16:27 +0000)]
Semantic analysis for objective-c ivars.

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

17 years agoNow that the dust has settled on the Decl refactoring, I noticed FieldDecl didn't...
Steve Naroff [Fri, 14 Sep 2007 02:20:46 +0000 (02:20 +0000)]
Now that the dust has settled on the Decl refactoring, I noticed FieldDecl didn't need NextDeclarator.  As a result, I'm removing it.

Removing both slots (NextDeclarator/Next) end up reducing the size of fields/ivars by 40%.

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

17 years agoMove Decl::NextDeclarator (w/ setters/getters) down to ScopedDecl/FieldDecl.
Steve Naroff [Thu, 13 Sep 2007 23:52:58 +0000 (23:52 +0000)]
Move Decl::NextDeclarator (w/ setters/getters) down to ScopedDecl/FieldDecl.

Decl is now svelte:-)

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

17 years agoPhase 2 of making the Decl class more lightweight...
Steve Naroff [Thu, 13 Sep 2007 21:41:19 +0000 (21:41 +0000)]
Phase 2 of making the Decl class more lightweight...

Move Identifier/Loc instance variables (and associated getters/setters) down from Decl to ScopedDecl/FieldDecl.

Objc AST's can now inherit from Decl without getting instance variables and types that are C specific. For now, I am keeping NextDeclarator, since I believe it may be useful to ObjC. If not, it can be moved later.

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

17 years agoPatch for collecting ivars before running action on them.
Fariborz Jahanian [Thu, 13 Sep 2007 20:56:13 +0000 (20:56 +0000)]
Patch for collecting ivars before running action on them.

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

17 years agoAdd "ScopedDecl" AST, used by ValueDecl and TypeDecl.
Steve Naroff [Thu, 13 Sep 2007 18:10:37 +0000 (18:10 +0000)]
Add "ScopedDecl" AST, used by ValueDecl and TypeDecl.

This allows us to sink the "Next" field, which isn't used by FieldDecl and ObjcIvarDecl.

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

17 years agoupdate to match llvm mainline api
Chris Lattner [Thu, 13 Sep 2007 06:19:18 +0000 (06:19 +0000)]
update to match llvm mainline api

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

17 years agoadjust to a change in the LLVM APIs, this is still very hackish until
Chris Lattner [Thu, 13 Sep 2007 01:26:11 +0000 (01:26 +0000)]
adjust to a change in the LLVM APIs, this is still very hackish until
the front-end adopts APFloat though.  This fixes test/CodeGen/mandel.c

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

17 years agoWhen dumping out errors about unsupported stuff, emit loc info.
Chris Lattner [Thu, 13 Sep 2007 01:17:29 +0000 (01:17 +0000)]
When dumping out errors about unsupported stuff, emit loc info.

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

17 years agomake the sourcemgr available through ASTContext.
Chris Lattner [Thu, 13 Sep 2007 01:14:03 +0000 (01:14 +0000)]
make the sourcemgr available through ASTContext.

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

17 years agoAdd ASTContext::StringMap<char> to unique selector names.
Steve Naroff [Wed, 12 Sep 2007 23:08:22 +0000 (23:08 +0000)]
Add ASTContext::StringMap<char> to unique selector names.

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

17 years agoMinor space tightening.
Ted Kremenek [Wed, 12 Sep 2007 20:28:48 +0000 (20:28 +0000)]
Minor space tightening.
Removed extraneous call to Observer->ObserveStmt when handling DeclRefExprs.

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

17 years agoRemove a FIXME. Replace a couple asserts with an appropriate error
Steve Naroff [Wed, 12 Sep 2007 20:13:48 +0000 (20:13 +0000)]
Remove a FIXME. Replace a couple asserts with an appropriate error
diagnostic for illegal initializers.

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

17 years agoFixed recursion bug: should call Visit on child instead of VisitStmt.
Ted Kremenek [Wed, 12 Sep 2007 20:11:39 +0000 (20:11 +0000)]
Fixed recursion bug: should call Visit on child instead of VisitStmt.

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

17 years agoFixed logic bug in recursion to visiting child statements.
Ted Kremenek [Wed, 12 Sep 2007 20:08:31 +0000 (20:08 +0000)]
Fixed logic bug in recursion to visiting child statements.

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

17 years agoAdded files CFGStmtVisitor and DataflowStmtVisitor to XCode project.
Ted Kremenek [Wed, 12 Sep 2007 19:12:02 +0000 (19:12 +0000)]
Added files CFGStmtVisitor and DataflowStmtVisitor to XCode project.

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

17 years agoMigrated LiveVariables to use the new DataflowStmtVisitor interface. The code
Ted Kremenek [Wed, 12 Sep 2007 19:10:52 +0000 (19:10 +0000)]
Migrated LiveVariables to use the new DataflowStmtVisitor interface.  The code
is much simpler now.

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

17 years agoAdded extensions (subclasses) to the StmtVisitor class that
Ted Kremenek [Wed, 12 Sep 2007 19:09:12 +0000 (19:09 +0000)]
Added extensions (subclasses) to the StmtVisitor class that
are useful for dataflow analysis: CFGStmtVisitor and DataflowStmtVisitor.

CFGStmtVisitor is the same as StmtVisitor is that it has separate visitors
for "root" statements in a CFGBlock (statements that have a designated
slot int the list of statements in a CFGBlock).  It also recognizes statements
that have implicit control-flow, and calls special visitor methods for those.

DataflowStmtVisitor extends CFGStmtVisitor to serve as a template for
implementing transfer functions.  It does a pre-/post-order traversal of
substatements depending on whether we are doing a forward/backward analysis.
It also has special handling for implicit-control-flow statements so that
they are visited only once.

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

17 years agoPatch for building method declaration nodes. Also fixed a segfault in cocoa.m due
Fariborz Jahanian [Wed, 12 Sep 2007 18:23:47 +0000 (18:23 +0000)]
Patch for building method declaration nodes. Also fixed a segfault in cocoa.m due
to use of @property.

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

17 years agoRemoved clang solution file for VC++, which didn't work properly because of hard...
Hartmut Kaiser [Wed, 12 Sep 2007 15:39:04 +0000 (15:39 +0000)]
Removed clang solution file for VC++, which didn't work properly because of hard coded paths in the llvm project files.
Changed windows detection to use LLVM pp constant.

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

17 years agoFix the following bug submitted by Ted Kremenek:
Steve Naroff [Wed, 12 Sep 2007 14:07:44 +0000 (14:07 +0000)]
Fix the following bug submitted by Ted Kremenek:

void func() {
int xx = xx; // incorrectly diagnosed 'xx' as an undeclared identifier.
}

This smallish bug resulted in a largish fix. Here are some highlights:

- Needed to make sure ParseDeclarator is called *before* parsing any
initializer. Removed the "Init" argument to ParseDeclarator.
- Added AddInitializerToDecl() to the Action & Sema classes.
In Sema, this hook is responsible for validating the initializer and
installing it into the respective decl.
- Moved several semantic checks from ParseDeclarator() to
FinalizeDeclaratorGroup(). Previously, this hook was only responsible for
reversing a list. Now it plays a much larger semantic role.

All of the above changes ended up simplifying ParseDeclarator(), which
is goodness...

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

17 years agoAdded static method "CFG::hasImplicitControlFlow".
Ted Kremenek [Tue, 11 Sep 2007 22:08:24 +0000 (22:08 +0000)]
Added static method "CFG::hasImplicitControlFlow".

This method is used to determine if an expression contains implicit
control-flow, and thus appears in a distinct statement slot in the CFG.

For example:

  (1) x = ... ? ... ? ...

  logically becomes:

  (1) ... ? ... : ...  (a unique statement slot for the ternary ?)
  (2) x = [E1]         (where E1 is actually the ConditionalOperator*)

A client of the CFG, when walking the statement at (2), will encounter
E1.  In this case, hasImplicitControlFlow(E1) == true, and the client
will know that the expression E1 is explicitly placed into its own statement
slot to capture the implicit control-flow it has.

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

17 years agoFixed bug where ternary expressions and GCC-style conditional expressions
Ted Kremenek [Tue, 11 Sep 2007 21:29:43 +0000 (21:29 +0000)]
Fixed bug where ternary expressions and GCC-style conditional expressions
where not reversing the order of their subexpression blocks.

Added feature where CallExprs are placed in their own statement slot in
a CFGBlock.  Thus we have a designated "return site" within a CFGBlock when
reasoning about function calls.

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

17 years ago- Add an ObjcIvarDecl AST node (a subclass of FieldDecl).
Steve Naroff [Tue, 11 Sep 2007 21:17:26 +0000 (21:17 +0000)]
- Add an ObjcIvarDecl AST node (a subclass of FieldDecl).
- Instantiate the node in Sema::ParseField(), based on the type of the TagDecl.
- Add Sema::ObjcAddInstanceVariable(), responsible for adorning/adding the ObjcIvarDecl.

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

17 years agoChange ObjcMethodDecl class derivation.
Fariborz Jahanian [Tue, 11 Sep 2007 18:45:55 +0000 (18:45 +0000)]
Change ObjcMethodDecl class derivation.

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