aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis
AgeCommit message (Collapse)Author
2011-03-01Teach CFGBuilder to prune trivially unreachable case statements.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126797 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01In preparation for fixing PR 6884, rework CFGElement to have getAs<> return ↵Ted Kremenek
pointers instead of fresh CFGElements. - Also, consoldiate getDtorKind() and getKind() into one "kind". - Add empty getDestructorDecl() method to CFGImplicitDtor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126738 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-28Get rid of the areExceptionsEnabled() getter from LangOptions.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126598 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-24Fix tiny error in CFG construction for BinaryConditionalOperators, making ↵Ted Kremenek
sure the branch always has two successors. Also teach Environment::getSVal() about OpaqueValueExprs. This fixes a crash reported in PR9287, and also fixes a false positive involving the value of such ternary expressions not properly getting propagated. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126362 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-23Teach CFGBuilder about null pointer constants in conditionals, and how they ↵Ted Kremenek
can be used to prune branches. Fixes false null pointer dereference warning in PR 8183. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126305 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-23Migrate CFGReachabilityAnalysis out of the IdempotentOperationsChecker and ↵Ted Kremenek
into its own analysis file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126289 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-23Have IdempotentOperationsChecker pull its CFGStmtMap from AnalysisContext.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126288 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-21Fix a CFGBuilder bug exposed on convoluted control-flow in the Linux kernel.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126149 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-20Add a LangOptions::areExceptionsEnabled and start using it.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126062 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19Fix a -Wuninitialized warning; it's actually a false positive,John McCall
but it's not reasonable for the diagnostic to figure that out. Pointed out by Benjamin Kramer. Also clarify the logic here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126017 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-17Change the representation of GNU ?: expressions to use a different expressionJohn McCall
class and to bind the shared value using OpaqueValueExpr. This fixes an unnoticed problem with deserialization of these expressions where the deserialized form would lose the vital pointer-equality trait; or rather, it fixes it because this patch also does the right thing for deserializing OVEs. Change OVEs to not be a "temporary object" in the sense that copy elision is permitted. This new representation is not totally unawkward to work with, but I think that's really part and parcel with the semantics we're modelling here. In particular, it's much easier to fix things like the copy elision bug and to make the CFG look right. I've tried to update the analyzer to deal with this in at least some obvious cases, and I think we get a much better CFG out, but the printing of OpaqueValueExprs probably needs some work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125744 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-17Step #1/N of implementing support for __label__: split labels intoChris Lattner
LabelDecl and LabelStmt. There is a 1-1 correspondence between the two, but this simplifies a bunch of code by itself. This is because labels are the only place where we previously had references to random other statements, causing grief for AST serialization and other stuff. This does cause one regression (attr(unused) doesn't silence unused label warnings) which I'll address next. This does fix some minor bugs: 1. "The only valid attribute " diagnostic was capitalized. 2. Various diagnostics printed as ''labelname'' instead of 'labelname' 3. This reduces duplication of label checking between functions and blocks. Review appreciated, particularly for the cindex and template bits. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125733 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-15Fix memory leak in CFGBuilder resulting from tracking scope information ↵Ted Kremenek
using SmallVectors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125550 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-13Give some convenient idiomatic accessors to Stmt::child_range andJohn McCall
Stmt::const_child_range, then make a bunch of places use them instead of the individual iterator accessors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125450 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11Don't report dead stores on unreachable code paths. Fixes ↵Ted Kremenek
<rdar://problem/8405222>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125415 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10CMake: LLVM_NO_RTTI must be obsolete now!NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125275 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01Enhance -Wuninitialized to better reason about || and &&, tracking dual ↵Ted Kremenek
dataflow facts and properly merging them. Fixes PR 9076. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124666 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27Teach -Wuninitialized about indirect goto. Fixes PR 9071.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124394 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27Fix whitespace.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124364 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-277bit-ize.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124363 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27Teach -Wuninitialized not to assert when analyzingTed Kremenek
blocks that reference captured variables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124348 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27Teach -Wuninitialized about ObjC fast enumeration loops.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124347 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26Tweak -Wuninitialized-experimental to not emitTed Kremenek
a warning for uses of an uninitialized variable when the use is a void cast, e.g. (void) x. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124278 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25Teach -Wuninitialized-experimental to also warnTed Kremenek
about uninitialized variables captured by blocks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124213 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23Teach -Wuninitialized-experimental about sizeof().Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124076 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20Removing debug printing logic from UninitializedValuesV2.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123944 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20Relax CFG assertions in UninitializedValuesV2 whenTed Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123943 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20Add rudimentary path-sensitivity to UnintializedValuesV2Ted Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123923 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-19Change QualType::getTypePtr() to return a const pointer, then change aJohn McCall
thousand other things which were (generally inadvertantly) relying on that. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123814 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18Teach UninitializedValuesV2 to implicitly reason about C++Ted Kremenek
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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123777 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18Correctly enable test/Sema/unit-variables.c,Ted Kremenek
thus identifying a minor logical flaw in UninitializedValuesV2.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123734 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18Teach UninitializedValuesV2 about "int x = x" andTed Kremenek
also properly handle confluence of loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123733 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16Add AnalysisContext::dumpCFG.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123602 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15Unbreak the MSVC build again: replace bzero by memset.Francois Pichet
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123538 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15Add initial prototype for implementation ofTed Kremenek
-Wuninitialized based on CFG dataflow analysis. WIP. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123512 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11[analyzer] Add 'bool ignorePrefix' parameter to ↵Argyrios Kyrtzidis
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123262 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,Sean Hunt
more accurate, and makes it make sense for it to hold a delegating constructor call. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123084 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08Remove a kludge from analysis based warnings that used to detectChandler Carruth
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123056 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08Add semantic checking that the "thousands grouping"Ted Kremenek
prefix in a printf format string is matched with the appropriate conversion specifier. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123055 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08Add printf format string parsing support for 'Ted Kremenek
prefix to format conversions (POSIX extension). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123054 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07Fix crash in CFGBuilder on invalid code. We still needTed Kremenek
to reject this code, but at least clang doesn't crash anymore. Crash reported in PR 8880. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123017 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-25The -fshort-wchar option causes wchar_t to become unsigned, in addition to beingChris Lattner
16-bits in size. Implement this by splitting WChar into two enums, like we have for char. This fixes a miscompmilation of XULRunner, PR8856. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122558 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-23Rename static analyzer namespace 'GR' to 'ento'.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122492 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22[analyzer] Refactoring: Move stuff into namespace 'GR'.Argyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122423 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17Fix assertion failure in cocoa::deriveNamingConvention()Ted Kremenek
when the selector is the string 'mutable'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122046 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17Move CocoaConventions.[h,cpp] from libCheckerTed Kremenek
to libAnalysis. Similar to Format (format string checking), CocoaConventions has the potential to serve clients other than the static analyzer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122040 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17Rename several methods/functions in the analyzerTed Kremenek
to start with lowercase characters. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122035 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16Start migration of static analyzer to using theTed Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121960 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall
reason this is limited to C++, and it's certainly not limited to temporaries. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04More anonymous struct/union redesign. This one deals with anonymous field ↵Francois Pichet
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120900 91177308-0d34-0410-b5e6-96231b3b80d8