aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis
AgeCommit message (Collapse)Author
2011-10-29Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it willRichard Smith
implicitly perform an lvalue-to-rvalue conversion if used on an lvalue expression. Also improve the documentation of Expr::Evaluate* to indicate which of them will accept expressions with side-effects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143263 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-27Teach format string analysis that "%zu" means size_t.Hans Wennborg
The code had it backwards, thinking size_t was signed, and using that for "%zd". Also let the analysis get the types for (u)intmax_t while we are at it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143099 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25Tweak printf format string parsing to accept 'hh' conversion specifier to ↵Ted Kremenek
accept any char, not just signed char. Fixes <rdar://problem/10303638>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142908 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25Add source-level dominators analysis. Patch by Guoping Long!Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142885 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24Actually rename the file AnalysisContext.cpp -> AnalysisDeclContext.cppChandler Carruth
to match the CMakeLists.txt change in r142782; this should fix the CMake build. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142784 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24Rename AnalysisContext to AnalysisDeclContext. Not only is this name more ↵Ted Kremenek
accurate, but it frees up the name AnalysisContext for other uses. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142782 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-23[analyzer] Remove LocationContext creation methods from AnalysisManager, and ↵Ted Kremenek
change clients to use AnalysisContext instead. WIP to remove/reduce ExprEngine's usage of AnalysisManager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142739 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-22Refactor ThreadSafety to use PostOrderCFGView instead of its own copy (of ↵Ted Kremenek
TopologicallySortedCFG). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142714 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-22Pull TopologicallySortedCFG out of LiveVariables into its own analysis: ↵Ted Kremenek
PostOrderCFGView. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142713 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21Added support for thread safety attributes on destructors.DeLesley Hutchins
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142685 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21Thread safety analysis refactoring: invalid lock expressions.DeLesley Hutchins
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142666 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21Thread safety analysis: add support for attributes on constructors.DeLesley Hutchins
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142665 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21Refactoring and code cleanup.DeLesley Hutchins
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142654 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18More metaprogramming with builtin types.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142433 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18Suggest %zu for size_t args to printf.Hans Wennborg
For PR11152. Make PrintSpecifier::fixType() suggest "%zu" for size_t, etc. rather than looking at the underlying type and suggesting "%llu" or other platform-specific length modifiers. Applies to C99 and C++11. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142342 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17Substitute for arguments in method calls -- functionalityDeLesley Hutchins
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142267 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17Substitute for arguments in method calls -- refactoringDeLesley Hutchins
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142260 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17Add a new placeholder type to represent "unbridged"John McCall
casts in ARC. No semantic analysis yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142208 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-14Provide half floating point support as a storage only type.Anton Korobeynikov
Lack of half FP was a regression compared to llvm-gcc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142016 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-14Refactor static analyzer to use simpler interface to constant expression ↵Richard Smith
evaluation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141983 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-13Tweak -Wuninitialized's handling of 'int x = x' to report that as the root ↵Ted Kremenek
cause of an uninitialized variable IFF there are other uses of that uninitialized variable. Fixes <rdar://problem/9259237>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141881 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07Remove AnalysisContext::getLiveVariables(), and introduce a templatized ↵Ted Kremenek
mechanism to lazily create analyses that are attached to AnalysisContext objects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141425 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07ProgramPoint cleanup after the previous commit r141408 (remove the copy ↵Anna Zaks
constructor, mark withTag const). Move getProgramPoint() utility from CoreEngine.cpp into ProgramPoint. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141414 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07Fix infinite loop in -Wuninitialized reported in PR 11069.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141345 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-06[static analyzer] Fix crash in LiveVariables and Environment::getSVal() when ↵Ted Kremenek
analyzing C++ pointer-to-member calls. Fixes <rdar://problem/10243398>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141312 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-02Fix another major performance regression in LiveVariables by not ↵Ted Kremenek
canonicalizing the underlying ImmutableSets on every analyzed statement (just at merges). Fixes <rdar://problem/10087538>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140958 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-02Fix LiveVariables analysis bug with MaterializeTemporaryExpr and fix ↵Ted Kremenek
handling in ExprEngine. Fixes <rdar://problem/10201666>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140956 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-01Tweak the interface for analyzing the CF conventions for a nameJohn McCall
to take a FunctionDecl* instead of an llvm::StringRef. Eventually we might push more logic in there, like using slightly different conventions for C++ methods. Also, fix a bug where 'copy' and 'create' were being caught in non-camel-cased strings. We want copyFoo and CopyFoo and XCopy but not Xcopy or xcopy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140911 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-23Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140407 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-23Switch assert(0/false) llvm_unreachable.David Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-20Test commitDeLesley Hutchins
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140149 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19[analyzer] Constify a method.Anna Zaks
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140091 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-16Fix massive LiveVariables regression (due to LiveVariables rewrite) by ↵Ted Kremenek
addressing two performance problems: - Speed of "merge()", which merged data flow facts. This was doing a set canonicalization on every insertion, which was super slow. To fix this, we use ImmutableSetRef. - Visit CFGBlocks in reverse postorder. This is a huge speedup, as on some test cases the algorithm would take many iterations to converge. This contains a bunch of copy-paste from UninitializedValues.cpp and ThreadSafety.cpp. The idea was to get something working first, and then refactor the common logic for all three files into a separate analysis/library entry point. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139968 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-16Thread safety: Adding FIXMEs and a couple cleanupsCaitlin Sadowski
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139894 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-15Thread safety: completeing the implementation of shared/exclusive locks ↵Caitlin Sadowski
required attributes git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139804 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-15Thread safety: refactoring various out of scope warnings to use the same ↵Caitlin Sadowski
inteface. This eliminates a lot of unnecessary duplicated code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139801 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-14Thread safety: adding additional documentation to the main thread safety ↵Caitlin Sadowski
interface, and making the destructor for the thread safety handler pure virtual git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139722 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-14Thread safety: adding test cases for unparseable lock expressions and ↵Caitlin Sadowski
expanding the handling of these expressions git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139720 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13Add a bit to the CFGBlock to track when it contains a no-returnChandler Carruth
CFGElement. This will allow greatly simplifying the logic in -Wreturn-type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139593 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13Consolidate the logic for building a no-return CFG block into a singleChandler Carruth
location with a single comment rather than scattering it in three places. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139592 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13Enhance the CFG construction to detect no-return destructors forChandler Carruth
temporary objects and local variables. When detected, these split the block, marking the new one as having only the exit block as a successor. This prevents a large number of false positives in warnings sensitive to no-return constructs such as -Wreturn-type, and fixes the remainder of PR10063 along with several variations of this bug that had not been reported. The test cases are extended across the board to cover these patterns. This also checks in a stress test for these types of CFGs. The stress test declares some 32k variables, a mixture of no-return and normal destructors. Previously, this resulted in roughly 2500 CFG blocks, but didn't model any of the no-return destructors. With this patch, it results in over 33k blocks, many of them now unreachable. The nice thing about how the analyzer is set up? This causes *no* regression in performance of building the CFG. It actually in some cases makes it faster, as best I can benchmark. The analysis for -Wreturn-type (and any other that cares about no-return code paths) is technically slower now as it has to look at many more candidate blocks, but it computes the correct answer. I have more test cases to follow, I think they all work now. Also I have further work that should dramatically simplify analyses in the presence of no-return. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139586 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12Thread safety: small formatting changeCaitlin Sadowski
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139548 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10Silence "end of non-void function" warnings with llvm_unreachable and add an ↵Benjamin Kramer
assert. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139474 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-10Extend the Stmt AST to make it easier to look through label, default,Chandler Carruth
and case statements. Use this to make the logic in the CFG builder more robust at finding the actual statements within a compound statement, even when there are many layers of labels obscuring it. Also extend the test cases for a large chunk of PR10063. Still more work to do here though. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139437 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-09Thread safety: removing unnecessary import and reordering import listCaitlin Sadowski
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139426 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-09Thread safety: removing unnecessary importCaitlin Sadowski
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139425 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-09Thread safety: This patch deals with previously unhandled cases when ↵Caitlin Sadowski
building lock expressions. We now resolve this expressions, avoid crashing when encountering cast expressions, and have a diagnostic for unresolved lock expressions git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139370 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-09Thread Safety: Moving the analysis to a new fileCaitlin Sadowski
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139369 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-02-Wuninitialized: fix insidious bug resulting from interplay of blocks and ↵Ted Kremenek
dead code. Fixes <rdar://problem/10060250>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139027 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-28Warn on missing [super finalize] calls.Nico Weber
This matches gcc's logic. Second half of PR10661. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138730 91177308-0d34-0410-b5e6-96231b3b80d8