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

17 years agoFor looking at "dead stores" in declarations, we now check to see
Ted Kremenek [Tue, 11 Sep 2007 17:24:14 +0000 (17:24 +0000)]
For looking at "dead stores" in declarations, we now check to see
if the assigned value is a constant expression, e.g.:

int x = 0;

We then check to see if "x" is ever reassigned later.  If so, we don't
emit a warning.  This is because programmers frequently use defensive
programming to make sure a variable has a defined value.

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

17 years agoFixed potential NULL dereference when iterating over a chain of Decls.
Ted Kremenek [Tue, 11 Sep 2007 17:00:40 +0000 (17:00 +0000)]
Fixed potential NULL dereference when iterating over a chain of Decls.

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

17 years agoget rid of ugly "warning: no newline at end of file"
Gabor Greif [Tue, 11 Sep 2007 15:32:40 +0000 (15:32 +0000)]
get rid of ugly "warning: no newline at end of file"
warnings that some compilers diagnose

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

17 years agoFixed isFunctionPointerType to correctly handle typedefs.
Ted Kremenek [Mon, 10 Sep 2007 22:54:34 +0000 (22:54 +0000)]
Fixed isFunctionPointerType to correctly handle typedefs.

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

17 years agoFix the following bug submitted by Justin Handville.
Steve Naroff [Mon, 10 Sep 2007 22:17:00 +0000 (22:17 +0000)]
Fix the following bug submitted by Justin Handville.

int main(int argc, char* argv[])
{
  return 0;
}

After speaking briefly with Chris, we decided this should be a front-end fix.

The fix...have Sema::GetTypeForDeclarator() do the default function/array conversion, as
I outlined in the 9/9 email on this topic.

Since this conversion is done before Sema::ParseParamDeclarator(), I thought I could
remove the conversion from Sema::ParseParamDeclarator(). Unfortunately, this didn't work.
The conversion apparently needs to be done in both places (which doesn't make sense to me).

Will investigate.

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

17 years agoSome small tweaks to the recent Objc support...
Steve Naroff [Mon, 10 Sep 2007 20:51:04 +0000 (20:51 +0000)]
Some small tweaks to the recent Objc support...

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

17 years agoEarly patch to collect objective-c methods inserts them in
Fariborz Jahanian [Mon, 10 Sep 2007 20:33:04 +0000 (20:33 +0000)]
Early patch to collect objective-c methods inserts them in
class object.

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

17 years agoFixed LiveVariables to no longer track the liveness of function pointers
Ted Kremenek [Mon, 10 Sep 2007 17:36:42 +0000 (17:36 +0000)]
Fixed LiveVariables to no longer track the liveness of function pointers
that refer to direct function calls.

Modified interface of LiveVariables to only track liveness of VarDecls.
This cleans up a bunch of edge cases, and removed the bug just mentioned.

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

17 years agoModified dumping of Decl information to including the Decl type.
Ted Kremenek [Mon, 10 Sep 2007 17:32:55 +0000 (17:32 +0000)]
Modified dumping of Decl information to including the Decl type.

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

17 years agoAdded "isFunctionPointerType()" so that we can readily see if a DeclRefExpr
Ted Kremenek [Mon, 10 Sep 2007 17:20:54 +0000 (17:20 +0000)]
Added "isFunctionPointerType()" so that we can readily see if a DeclRefExpr
refers to a function.

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

17 years agoRenaming of the LiveVariablesAuditor interface. Changed "Auditor" and
Ted Kremenek [Mon, 10 Sep 2007 15:56:38 +0000 (15:56 +0000)]
Renaming of the LiveVariablesAuditor interface.  Changed "Auditor" and
"Audit" to "Observer" and "Observe"

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

17 years agoDon't rely on ADL to find this member, patch by Justin Handville
Chris Lattner [Sat, 8 Sep 2007 01:29:20 +0000 (01:29 +0000)]
Don't rely on ADL to find this member, patch by Justin Handville

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

17 years ago-check-dead-stores now no longer prints out the function declarations
Ted Kremenek [Fri, 7 Sep 2007 23:54:15 +0000 (23:54 +0000)]
-check-dead-stores now no longer prints out the function declarations
for each function.  This was the behavior prior to the following patch:

http://llvm.org/viewvc/llvm-project?view=rev&revision=41779

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

17 years agoRefactored driver options that perform analyses/work over CFGs to use
Ted Kremenek [Fri, 7 Sep 2007 23:47:56 +0000 (23:47 +0000)]
Refactored driver options that perform analyses/work over CFGs to use
"CFGVisitor", which now handles all the boilerplate for iterating over
the function definitions in a translation unit and building the CFGs.
This logic was previously replicated for each driver option that used
CFGs.

The options -dump-cfg, -view-cfg, -check-dead-stores, and
-dump-live-variables now use this refactored code.

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

17 years agoFixed compilation on Windows.
Hartmut Kaiser [Fri, 7 Sep 2007 14:34:20 +0000 (14:34 +0000)]
Fixed compilation on Windows.
Silenced a couple of warnings.
Added *.vcproj file for new clangAnalysis library.
Renamed Basic to clangBasic projects.

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

17 years agoAdded more checking in "dead stores" for values that are initialized
Ted Kremenek [Thu, 6 Sep 2007 23:39:53 +0000 (23:39 +0000)]
Added more checking in "dead stores" for values that are initialized
but never used.

Fix a bug in LiveVariables where uses on the LHS of self-assign
operators (e.g +=, *=, etc) would not be properly recorded in the
liveness state of the variable.

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

17 years agoMinor bug fixes to corner cases where LiveVariables would crash on some CFGs
Ted Kremenek [Thu, 6 Sep 2007 23:25:10 +0000 (23:25 +0000)]
Minor bug fixes to corner cases where LiveVariables would crash on some CFGs
that contained no declarations, or when a variable is declared but never used.

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

17 years agoForgot to check in the actual "dead stores" checker in the last commit!
Ted Kremenek [Thu, 6 Sep 2007 23:01:46 +0000 (23:01 +0000)]
Forgot to check in the actual "dead stores" checker in the last commit!

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

17 years agoAdded "Dead Stores", a flow-sensitive checker that checks for stores
Ted Kremenek [Thu, 6 Sep 2007 23:00:42 +0000 (23:00 +0000)]
Added "Dead Stores", a flow-sensitive checker that checks for stores
to variables that are no longer live.  This analysis is built on top
of CFGs and the LiveVariables analysis.

changes to driver:
 added driver option "-check-dead-stores" to run the analysis

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

17 years agoLiveVariables:
Ted Kremenek [Thu, 6 Sep 2007 21:26:58 +0000 (21:26 +0000)]
LiveVariables:
 - Finished 99% of analysis logic.  Probably a few bugs.
 - Added querying functions to query liveness.
 - Added better pretty printing of liveness.
 - Added better bookkeeping of per-variable liveness information.
 - Added LiveVariablesAuditor interface, which allows "lazy" querying
   of intra-basic block liveness information.

Driver:
 - Minor cleanups involved in dumping liveness information.

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

17 years agoThe goal of this commit is to get just enough Sema support to recognize Objective...
Steve Naroff [Thu, 6 Sep 2007 21:24:23 +0000 (21:24 +0000)]
The goal of this commit is to get just enough Sema support to recognize Objective-C classes
as types. That said, the AST nodes ObjcInterfaceDecl, ObjcInterfaceType, and ObjcClassDecl are *very*
preliminary.

The good news is we no longer need -parse-noop (aka MinimalActions) to parse cocoa.m.

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

17 years agoAdded LabelLoc to GotoStmt to record the source location of the label token
Ted Kremenek [Thu, 6 Sep 2007 17:11:52 +0000 (17:11 +0000)]
Added LabelLoc to GotoStmt to record the source location of the label token
in the actual GotoStmt.

Fixed bug where GotoStmt::getSourceRange incorrectly used the target LabelStmt
to compute its extent.

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

17 years agoAdded libClangAnalysis
Ted Kremenek [Thu, 6 Sep 2007 15:58:13 +0000 (15:58 +0000)]
Added libClangAnalysis

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

17 years agoAdded an early implementation of Live-Variables analysis built on
Ted Kremenek [Thu, 6 Sep 2007 00:17:54 +0000 (00:17 +0000)]
Added an early implementation of Live-Variables analysis built on
source-level CFGs.  This code may change significantly in the near
future as we explore different means to implement dataflow analyses.

Added a driver option, -dump-live-variables, to view the output of
live variable analysis.  This output is very ALPHA; it will be improved shortly.

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

17 years agoremove the FATAL classifier.
Chris Lattner [Thu, 6 Sep 2007 00:16:35 +0000 (00:16 +0000)]
remove the FATAL classifier.

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

17 years agoremove sorry.
Chris Lattner [Thu, 6 Sep 2007 00:14:09 +0000 (00:14 +0000)]
remove sorry.

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

17 years agoStart implementing Actions interface for ObjC classes, instance variables, and methods.
Steve Naroff [Wed, 5 Sep 2007 23:30:30 +0000 (23:30 +0000)]
Start implementing Actions interface for ObjC classes, instance variables, and methods.

Lot's of small changes to the parser.

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

17 years agoPatch for parsing objective-c style method calls.
Fariborz Jahanian [Wed, 5 Sep 2007 23:08:20 +0000 (23:08 +0000)]
Patch for parsing objective-c style method calls.

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

17 years agoMoved tracking of CFG block IDs into the CFG class.
Ted Kremenek [Wed, 5 Sep 2007 20:02:05 +0000 (20:02 +0000)]
Moved tracking of CFG block IDs into the CFG class.
Added CFG::getNumBlockIDs() to query the number of distinct block ids created.

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

17 years ago1. Fix parsing of method prototype involving c-style argument declarations.
Fariborz Jahanian [Wed, 5 Sep 2007 19:52:07 +0000 (19:52 +0000)]
1. Fix parsing of method prototype involving c-style argument declarations.
2. Fixes all allowable key-words used as selectors.
3. Template to do the messaging parse.
4. A test case for all allowable selector names.

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

17 years agoFixed a typo pointed out by Anders Calrsson.
Fariborz Jahanian [Tue, 4 Sep 2007 21:42:12 +0000 (21:42 +0000)]
Fixed a typo pointed out by Anders Calrsson.

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

17 years agoSimplified initializer semantic analysis by adding the following 2 methods:
Steve Naroff [Tue, 4 Sep 2007 21:13:33 +0000 (21:13 +0000)]
Simplified initializer semantic analysis by adding the following 2 methods:

- ArrayType::getBaseType(), and
- ConstantArrayType::getMaximumElements().

Wanted to do this cleanup before adding structure support, which will add more complexity.

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

17 years agoPatch to parse objective-c's @compatibility_alias directive.
Fariborz Jahanian [Tue, 4 Sep 2007 19:26:51 +0000 (19:26 +0000)]
Patch to parse objective-c's @compatibility_alias directive.

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

17 years agoSet eol and mime type properties for VC8 build files
Hartmut Kaiser [Tue, 4 Sep 2007 19:15:17 +0000 (19:15 +0000)]
Set eol and mime type properties for VC8 build files

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

17 years agoUpdated VC8 project files.
Hartmut Kaiser [Tue, 4 Sep 2007 19:06:30 +0000 (19:06 +0000)]
Updated VC8 project files.

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

17 years agoUpdated calls to CreateGEP to new interface in LLVM mainline.
Ted Kremenek [Tue, 4 Sep 2007 17:20:08 +0000 (17:20 +0000)]
Updated calls to CreateGEP to new interface in LLVM mainline.

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