aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis/AnalysisDeclContext.cpp
AgeCommit message (Collapse)AuthorFilesLines
2012-11-03[analyzer] add LocationContext::inTopFrame() helper.Anna Zaks1-0/+4
llvm-svn: 167351
2012-09-24Add clarifying comment.Ted Kremenek1-0/+2
llvm-svn: 164557
2012-09-21Implement faux-body-synthesis of well-known functions in the static analyzer ↵Ted Kremenek1-6/+25
when their implementations are unavailable. Start by simulating dispatch_sync(). This change is largely a bunch of plumbing around something very simple. We use AnalysisDeclContext to conjure up a fake function body (using the current ASTContext) when one does not exist. This is controlled under the analyzer-config option "faux-bodies", which is off by default. The plumbing in this patch is largely to pass the necessary machinery around. CallEvent needs the AnalysisDeclContextManager to get the function definition, as one may get conjured up lazily. BugReporter and PathDiagnosticLocation needed to be relaxed to handle invalid locations, as the conjured body has no real source locations. We do some primitive recovery in diagnostic generation to generate some reasonable locations (for arrows and events), but it can be improved. llvm-svn: 164339
2012-09-05[analyzer] Always include destructors in the analysis CFG.Jordan Rose1-2/+4
While destructors will continue to not be inlined (unless the analyzer config option 'c++-inlining' is set to 'destructors'), leaving them out of the CFG is an incomplete model of the behavior of an object, and can cause false positive warnings (like PR13751, now working). Destructors for temporaries are still not on by default, since (a) we haven't actually checked this code to be sure it's fully correct (in particular, we probably need to be very careful with regard to lifetime-extension when a temporary is bound to a reference, C++11 [class.temporary]p5), and (b) ExprEngine doesn't actually do anything when it sees a temporary destructor in the CFG -- not even invalidate the object region. To enable temporary destructors, set the 'cfg-temporary-dtors' analyzer config option to '1'. The old -cfg-add-implicit-dtors cc1 option, which controlled all implicit destructors, has been removed. llvm-svn: 163264
2012-07-26[analyzer] Don't crash on implicit statements inside initializers.Jordan Rose1-1/+9
Our BugReporter knows how to deal with implicit statements: it looks in the ParentMap until it finds a parent with a valid location. However, since initializers are not in the body of a constructor, their sub-expressions are not in the ParentMap. That was easy enough to fix in AnalysisDeclContext. ...and then even once THAT was fixed, there's still an extra funny case of Objective-C object pointer fields under ARC, which are initialized with a top-level ImplicitValueInitExpr. To catch these cases, PathDiagnosticLocation will now fall back to the start of the current function if it can't find any other valid SourceLocations. This isn't great, but it's miles better than a crash. (All of this is only relevant when constructors and destructors are being inlined, i.e. under -cfg-add-initializers and -cfg-add-implicit-dtors.) llvm-svn: 160810
2012-07-04Drop the ASTContext.h include from DeclFriend.h and DeclTemplate.h.Benjamin Kramer1-0/+1
llvm-svn: 159723
2012-06-01static analyzer: add inlining support for directly called blocks.Ted Kremenek1-14/+27
llvm-svn: 157833
2012-04-28[analyzer] Remove references to idx::TranslationUnit. Index is dead, ↵Jordy Rose1-8/+3
cross-TU inlining never panned out. llvm-svn: 155751
2012-03-11Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie1-1/+1
(Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
2012-03-10Replace a map of boolean values with a set.Benjamin Kramer1-14/+8
No functionality change. llvm-svn: 152494
2012-03-10Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall1-11/+7
track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
2012-03-01Move llvm/ADT/SaveAndRestore.h -> llvm/Support/SaveAndRestore.h.Argyrios Kyrtzidis1-1/+1
Needs llvm update. llvm-svn: 151829
2012-02-27Move "clang/Analysis/Support/SaveAndRestore.h" to "llvm/ADT/SaveAndRestore.h"Argyrios Kyrtzidis1-1/+1
to make it more widely available. Depends on llvm commit r151564 llvm-svn: 151566
2011-12-22Colorize and condense CFG pretty-printing.Ted Kremenek1-2/+2
llvm-svn: 147203
2011-12-22Enhance AnalysisDeclContext::getReferencedBlockVars() to understand ↵Ted Kremenek1-1/+11
PseudoObjExprs. It turns out that the information collected by this method is a super set of the captured variables in BlockDecl. llvm-svn: 147122
2011-11-14[analyzer] teach AnalysisDeclContext::getSelfDecl() about blocks that ↵Ted Kremenek1-0/+9
capture the 'self' variable of the enclosing ObjC method decl. Fixes <rdar://problem/10380300>. llvm-svn: 144556
2011-10-24Actually rename the file AnalysisContext.cpp -> AnalysisDeclContext.cppChandler Carruth1-0/+454
to match the CMakeLists.txt change in r142782; this should fix the CMake build. llvm-svn: 142784