summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
...
* Teach -Wuninitialized-experimental to also warnTed Kremenek2011-01-251-8/+31
| | | | | | about uninitialized variables captured by blocks. llvm-svn: 124213
* Teach -Wuninitialized-experimental about sizeof().Ted Kremenek2011-01-231-0/+10
| | | | llvm-svn: 124076
* Removing debug printing logic from UninitializedValuesV2.Ted Kremenek2011-01-201-16/+0
| | | | llvm-svn: 123944
* Relax CFG assertions in UninitializedValuesV2 whenTed Kremenek2011-01-201-14/+13
| | | | | | | | | | | handling pseudo-path sensitivity, and instead use those assertion conditions as dynamic checks. These assertions would be violated when analyzing a CFG where some branches where optimized away during CFG construction because their branch conditions could be trivially determined. llvm-svn: 123943
* Add rudimentary path-sensitivity to UnintializedValuesV2Ted Kremenek2011-01-201-17/+120
| | | | | | | | | | | | analysis for short-circuited operations. For branch written like "if (x && y)", we maintain two sets of dataflow values for the outgoing branches. This suppresses some common false positives for -Wuninitialized-experimental. This change introduces some assertion failures when running on the LLVM codebase. WIP. llvm-svn: 123923
* Change QualType::getTypePtr() to return a const pointer, then change aJohn McCall2011-01-192-7/+7
| | | | | | thousand other things which were (generally inadvertantly) relying on that. llvm-svn: 123814
* Teach UninitializedValuesV2 to implicitly reason about C++Ted Kremenek2011-01-181-12/+64
| | | | | | | | references by monitoring whether an access to a variable is solely to compute it's lvalue or to do an lvalue-to-rvalue conversion (i.e., a load). llvm-svn: 123777
* Correctly enable test/Sema/unit-variables.c,Ted Kremenek2011-01-181-1/+3
| | | | | | | thus identifying a minor logical flaw in UninitializedValuesV2.cpp. llvm-svn: 123734
* Teach UninitializedValuesV2 about "int x = x" andTed Kremenek2011-01-181-8/+14
| | | | | | also properly handle confluence of loops. llvm-svn: 123733
* Add AnalysisContext::dumpCFG.Anders Carlsson2011-01-161-0/+4
| | | | llvm-svn: 123602
* Unbreak the MSVC build again: replace bzero by memset.Francois Pichet2011-01-151-1/+1
| | | | llvm-svn: 123538
* Add initial prototype for implementation ofTed Kremenek2011-01-152-0/+363
| | | | | | -Wuninitialized based on CFG dataflow analysis. WIP. llvm-svn: 123512
* [analyzer] Add 'bool ignorePrefix' parameter to ↵Argyrios Kyrtzidis2011-01-111-1/+6
| | | | | | | | | | | cocoa::deriveNamingConvention to control whether the prefix should be ignored. E.g. if ignorePrefix is true, "_init" and "init" selectors will both be result in InitRule, but if ignorePrefix is false, only "init" will return InitRule. llvm-svn: 123262
* Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,Alexis Hunt2011-01-081-4/+4
| | | | | | | more accurate, and makes it make sense for it to hold a delegating constructor call. llvm-svn: 123084
* Remove a kludge from analysis based warnings that used to detectChandler Carruth2011-01-081-3/+2
| | | | | | | | | | | | | | | | temporaries with no-return destructors. The CFG now properly supports temporaries and implicit destructors which both makes this kludge no longer work, and conveniently removes the need for it. Turn on CFG handling of implicit destructors and initializers. Several ad-hoc benchmarks don't indicate any measurable performance impact from growing the CFG, and it fixes real correctness problems with warnings. As a result of turning on these CFG elements, we started to tickle an inf-loop in the unreachable code logic used for warnings. The fix is trivial. llvm-svn: 123056
* Add semantic checking that the "thousands grouping"Ted Kremenek2011-01-081-0/+18
| | | | | | | prefix in a printf format string is matched with the appropriate conversion specifier. llvm-svn: 123055
* Add printf format string parsing support for 'Ted Kremenek2011-01-081-1/+5
| | | | | | prefix to format conversions (POSIX extension). llvm-svn: 123054
* Fix crash in CFGBuilder on invalid code. We still needTed Kremenek2011-01-071-20/+23
| | | | | | | | | to reject this code, but at least clang doesn't crash anymore. Crash reported in PR 8880. llvm-svn: 123017
* The -fshort-wchar option causes wchar_t to become unsigned, in addition to beingChris Lattner2010-12-251-1/+2
| | | | | | | 16-bits in size. Implement this by splitting WChar into two enums, like we have for char. This fixes a miscompmilation of XULRunner, PR8856. llvm-svn: 122558
* Rename static analyzer namespace 'GR' to 'ento'.Ted Kremenek2010-12-231-1/+1
| | | | llvm-svn: 122492
* [analyzer] Refactoring: Move stuff into namespace 'GR'.Argyrios Kyrtzidis2010-12-221-0/+1
| | | | llvm-svn: 122423
* Fix assertion failure in cocoa::deriveNamingConvention()Ted Kremenek2010-12-171-4/+6
| | | | | | when the selector is the string 'mutable'. llvm-svn: 122046
* Move CocoaConventions.[h,cpp] from libCheckerTed Kremenek2010-12-172-0/+173
| | | | | | | | | to libAnalysis. Similar to Format (format string checking), CocoaConventions has the potential to serve clients other than the static analyzer. llvm-svn: 122040
* Rename several methods/functions in the analyzerTed Kremenek2010-12-171-78/+78
| | | | | | | to start with lowercase characters. No functionality change. llvm-svn: 122035
* Start migration of static analyzer to using theTed Kremenek2010-12-164-97/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit lvalue-to-rvalue casts that John McCall recently introduced. This causes a whole bunch of logic in the analyzer for handling lvalues to vanish. It does, however, raise a few issues in the analyzer w.r.t to modeling various constructs (e.g., field accesses to compound literals). The .c/.m analysis test cases that fail are due to a missing lvalue-to-rvalue cast that will get introduced into the AST. The .cpp failures were more than I could investigate in one go, and the patch was already getting huge. I have XFAILED some of these tests, and they should obviously be further investigated. Some highlights of this patch include: - CFG no longer requires an lvalue bit for CFGElements - StackFrameContext doesn't need an 'asLValue' flag - The "VisitLValue" path from GRExprEngine has been eliminated. Besides the test case failures (XFAILed), there are surely other bugs that are fallout from this change. llvm-svn: 121960
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-10/+10
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* More anonymous struct/union redesign. This one deals with anonymous field ↵Francois Pichet2010-12-041-2/+2
| | | | | | | | | | | | | | | | used in a constructor initializer list: struct X { X() : au_i1(123) {} union { int au_i1; float au_f1; }; }; clang will now deal with au_i1 explicitly as an IndirectFieldDecl. llvm-svn: 120900
* Although we currently have explicit lvalue-to-rvalue conversions, they'reJohn McCall2010-12-041-2/+19
| | | | | | | | | | | | | | | | | | | not actually frequently used, because ImpCastExprToType only creates a node if the types differ. So explicitly create an ICE in the lvalue-to-rvalue conversion code in DefaultFunctionArrayLvalueConversion() as well as several other new places, and consistently deal with the consequences throughout the compiler. In addition, introduce a new cast kind for loading an ObjCProperty l-value, and make sure we emit those nodes whenever an ObjCProperty l-value appears that's not on the LHS of an assignment operator. This breaks a couple of rewriter tests, which I've x-failed until future development occurs on the rewriter. Ted Kremenek kindly contributed the analyzer workarounds in this patch. llvm-svn: 120890
* Fix range in printf warnings for invalid conversion specifiers.Ted Kremenek2010-12-021-1/+1
| | | | llvm-svn: 120735
* Let StackFrameContext represent if the call expr is evaluated as lvalue.Zhongxing Xu2010-11-241-5/+6
| | | | | | This is required for supporting const reference to temporary objects. llvm-svn: 120093
* print asLValue attribute of CFGStmt.Zhongxing Xu2010-11-241-0/+3
| | | | llvm-svn: 120086
* Refactor AddStmtChoice to make it easier to use; also add comments on how ↵Zhanyong Wan2010-11-241-49/+57
| | | | | | the class works. Reviewed by kremenek. llvm-svn: 120080
* Stylistic changes to CFG.cpp:Zhanyong Wan2010-11-221-24/+22
| | | | | | | | | | | 1. "no 'else' after 'return'" -- this is for conformance with the coding standards. 2. move 'else' to the line of the previous '}' -- this is for consistency. Reviewed by kremenek. llvm-svn: 119983
* Fix PR8419. Reviewed by kremenek and xuzhongxing.Zhanyong Wan2010-11-221-0/+17
| | | | llvm-svn: 119960
* The 'X' printf type has a valid alternative form. Fixes PR8641.Anders Carlsson2010-11-211-1/+2
| | | | llvm-svn: 119946
* Remove invalid assertion from CFG builder. When building the CFG pieces for ↵Ted Kremenek2010-11-151-1/+2
| | | | | | | | | a ternary '?' expression, it is possible for the confluence block to only have a single predecessor due to calls to 'noreturn' functions. Fixes assertion failure reported in PR 8619. llvm-svn: 119284
* Revert r118991.Zhongxing Xu2010-11-141-8/+1
| | | | | | | | | Elidable CXXConstructExpr should inhibit calling destructor for temporary that is copied, not the one created. This is because eliding copy constructor means that the object that was to be copied will be constructed directly in memory the copy would be constructed in. llvm-svn: 119044
* Do not add implicit dtors for CXXBindTemporaryExpr with elidable Zhongxing Xu2010-11-131-1/+8
| | | | | | CXXConstructExpr. llvm-svn: 118991
* Don't warn when matching %p to nullptr.Anders Carlsson2010-11-061-2/+2
| | | | llvm-svn: 118344
* Do not add elidable CXXConstructExpr as block-level expr.Zhongxing Xu2010-11-031-1/+2
| | | | llvm-svn: 118165
* Added generating destructors for temporary objects. Two cases I know of, ↵Marcin Swiderski2010-11-031-31/+295
| | | | | | | | | that are not handled properly: 1. For statement: const C& c = C(0) ?: C(1) destructors generated for condition will not differ from those generated for case without prolonged lifetime of temporary, 2. There will be no destructor for constant reference member bound to temporary at the exit from constructor. llvm-svn: 118158
* Explicitly handle CXXBindTemporaryExpr, CXXFunctionalCastExpr, Zhongxing Xu2010-11-011-0/+51
| | | | | | | and ImplicitCastExpr to propagate asLValue AddStmtChoice property. But do not propagate AlwaysAdd property. llvm-svn: 117909
* Make all CXXConstructExpr's block-level expressions. This is required by Zhongxing Xu2010-11-011-1/+28
| | | | | | method inlining. Temporarily fail a test case. llvm-svn: 117907
* Added CFGTerminator class, that holds information about CFGBlock terminator ↵Marcin Swiderski2010-10-292-6/+7
| | | | | | statement. llvm-svn: 117642
* If visiting RHS causes us to finish 'Block', e.g. the RHS is a StmtExprZhongxing Xu2010-10-271-3/+8
| | | | | | | | | containing a DoStmt, and the LHS doesn't create a new block, then we should return RBlock. Otherwise we'll incorrectly return NULL. Also relax an assertion in VisitWhileStmt(). Reset 'Block' when it is finished. llvm-svn: 117436
* Added generation of destructors for member constant size arrays.Marcin Swiderski2010-10-251-2/+15
| | | | | | There's only one destructor call generated for each not empty array (at least for now this should be enough). llvm-svn: 117252
* Added generation of destructors for constant size arrays.Marcin Swiderski2010-10-251-2/+10
| | | | | | There's only one destructor call generated for each not empty array (at least for now this should be enough). llvm-svn: 117251
* - Fixed subexpressions evaluation order for binary operators to match order ↵Marcin Swiderski2010-10-241-7/+9
| | | | | | | | in code generated with the compiler, - Fixed test cases for unreachable code warnings produced by Sema. llvm-svn: 117220
* Previously, the printf warnings would say your arguments type was 'int' when ↵Ted Kremenek2010-10-211-1/+15
| | | | | | | | | | it was really a 'char' or a 'short'. This fixes that and allows the hints to suggest 'h' modifiers for small ints. Patch by Justin Bogner! llvm-svn: 116996
* Death to blocks, or at least the word "block" in one particular obnoxiouslyJohn McCall2010-10-151-4/+4
| | | | | | ambiguous context. llvm-svn: 116567
OpenPOWER on IntegriCloud