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

957 Коммитов

Автор SHA1 Сообщение Дата
Fariborz Jahanian 00ae8d5955 Patch to warn on umimplemented methods coming from class's
protocols.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42436 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28 17:40:07 +00:00
Ted Kremenek a1de8c784a Fixed several bugs in the propagation of "uninitialized value"
taintness across expressions.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42421 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28 00:09:38 +00:00
Fariborz Jahanian d064951b0d Patch to use case-stmt for keywords used as selectgor names.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42416 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27 19:52:15 +00:00
Fariborz Jahanian d0b015461a Patch for method implementation. It populates ObjcImplementationDecl object with method implementation declarations .
It checks and warns on those methods declared in class interface and not implemented.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42412 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27 18:57:03 +00:00
Steve Naroff 4cbcb897fe Fix bug in SelectorInfo::getName() - method buffer needs to be passed by reference.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42411 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27 18:52:21 +00:00
Ted Kremenek aead1539e7 Created new "ExprDeclBitVector" type bundle for dataflow analyses that need boolean
values associated with ScopedDecls and CFGBlock-level Exprs.  This is the common
boilerplate needed by UninitializedValues and LiveVariables.

Refactored UninitializedValues to use ExprDeclBitVector.

Shortened the string diagnostic for UninitializedValues.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42408 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27 18:20:22 +00:00
Chris Lattner 271f1a6373 Fix some use of uninit variables issues, reported by Anton.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42396 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27 15:15:46 +00:00
Steve Naroff 68d331a78e Add SelectorInfo (similar in spirit to IdentifierInfo). The key difference is SelectorInfo is not string-oriented, it is a unique aggregate of IdentifierInfo's (using a folding set). SelectorInfo also has a richer API that simplifies the parser/action interface. 3 noteworthy benefits:
#1: It is cleaner. I never "liked" storing keyword selectors (i.e. foo:bar:baz) in the IdentifierTable.

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

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

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

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

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42395 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27 14:38:14 +00:00
Chris Lattner a9c0102172 objc messages have side effects, return true from hasLocalSideEffect,
fixing:

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42380 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 22:06:30 +00:00
Ted Kremenek c592522b86 Added extra guard for null Stmt* when traversing the AST using VisitChildren.
Added assertion that Block-level statements should not be NULL.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42376 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 21:36:20 +00:00
Ted Kremenek 322f58d383 Fixed two bugs in CFG construction:
BUG 1) 

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

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

BUG 2)

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42370 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 21:23:31 +00:00
Ted Kremenek 9f3d942e99 Removed option "-parse-ast-check" from clang driver. This is now implemented
using "-parse-ast -verify".

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

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42365 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 20:14:22 +00:00
Ted Kremenek 41193e4464 Moved "VerifyDiagnostics" variable declaration to right below ProgAction
declaration.  This is because this option is logically tightly connected
to the actions defined in ProgAction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42364 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 19:42:19 +00:00
Ted Kremenek 42e04c7a7f Removed inclusion of <memory>, which is no longer needed since we
aren't used auto_ptr's anymore.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42363 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 19:41:07 +00:00
Ted Kremenek d39bcd838f Refactored driver so that any action that is implemented using an
ASTConsumer can also be verified using the diagnostics checker.  From
the command line, users may activate diagnostic checking using the
"-verify" option.  For example, "clang -verify -warn-dead-stores"
checks if the warnings flagged by the dead store checker match those
in the comments.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42362 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 18:39:29 +00:00
Fariborz Jahanian d0b90bff98 This patch inserts ivars declared in @implementation in its object and verifies
that they conform(in type, name and numbers) to those declared in @interface. 
Test case highlights kind of checking we do here.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42360 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 18:27:25 +00:00
Fariborz Jahanian 095ffca8c5 Removed a few TODOs on things which are done.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42358 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 17:03:44 +00:00
Chris Lattner ccc213f5d4 Handle (int)1.0e40 as an i-c-e.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42334 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 00:47:26 +00:00
Hartmut Kaiser 27fd388f56 Updated VC++ build system.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42330 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 23:32:45 +00:00
Ted Kremenek a68951260a Updated XCode project to reflect that DataflowValues.h and DataflowSolver.h have
moved to include/clang/Analysis/FlowSensitive.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42327 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 22:45:38 +00:00
Ted Kremenek 1de632bf4a Moved "DataflowSolver.h" to the "include/" subtree. Adjusted client
code that uses the solver to reflect the new location.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42320 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 21:00:24 +00:00
Fariborz Jahanian 0da1c10338 Patch to make ObjcImplementationDecl derived from TypeDecl and supprt legacy
objective-c code with no @interface declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42319 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 21:00:20 +00:00
Ted Kremenek c5f45e387a Fixed broken English in comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42317 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 20:37:28 +00:00
Fariborz Jahanian ccb4f31424 This patch introduces a new class to keep track of class implementation info. It also adds more
semantic checks for class and protocol declarations. Test cases are good indications of kind of 
checking being done in this patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42311 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 18:38:09 +00:00
Ted Kremenek 445797873f Added "CheckASTConsumer", a function that generalizes
"CheckDiagnostics" (used for -parse-ast-check) to check the
diagnostics of any ASTConsumer.

Reimplemented CheckDiagnostics to use CheckASTConsumer instead.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42310 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 18:37:20 +00:00
Ted Kremenek 786d337d4d Changed command line options "-check-dead-stores" and
"-check-uninit-values" to "-warn-dead-stores" and
"-warn-uninit-values"


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42307 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 18:05:45 +00:00
Ted Kremenek e88f683fe9 Comment formatting changes. No real content changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42305 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 17:53:38 +00:00
Ted Kremenek 6179aaf737 Minor comment changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42304 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 17:51:05 +00:00
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