summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.Galina Kistanova2017-06-031-0/+1
| | | | llvm-svn: 304644
* DeadStoresChecker: Don't warn about dead stores into volatile variablesStephan Bergmann2016-06-241-0/+2
| | | | llvm-svn: 273689
* [analyzer] DeadStoresChecker: Treat locals captured by reference in C++ ↵Devin Coughlin2015-11-201-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | lambdas as escaped. The analyzer currently reports dead store false positives when a local variable is captured by reference in a C++ lambda. For example: int local = 0; auto lambda = [&local]() { local++; }; local = 7; // False Positive: Value stored to 'local' is never read lambda(); In this case, the assignment setting `local` to 7 is not a dead store because the called lambda will later read that assigned value. This commit silences this source of false positives by treating locals captured by reference in C++ lambdas as escaped, similarly to how the DeadStoresChecker deals with locals whose address is taken. rdar://problem/22165179 llvm-svn: 253630
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* [analyzer] Apply whitespace cleanups by Honggyu Kim.Ted Kremenek2015-09-081-22/+22
| | | | llvm-svn: 246978
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-2/+2
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-2/+2
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
* [C++11] Use 'nullptr'. StaticAnalyzer edition.Craig Topper2014-05-271-2/+2
| | | | llvm-svn: 209642
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-151-2/+2
| | | | | | class. llvm-svn: 203999
* [C++11] Replacing DeclStmt iterators decl_begin() and decl_end() with ↵Aaron Ballman2014-03-141-4/+2
| | | | | | iterator_range decls(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203947
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-2/+2
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* Expose the name of the checker producing each diagnostic message.Alexander Kornienko2014-02-111-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In clang-tidy we'd like to know the name of the checker producing each diagnostic message. PathDiagnostic has BugType and Category fields, which are both arbitrary human-readable strings, but we need to know the exact name of the checker in the form that can be used in the CheckersControlList option to enable/disable the specific checker. This patch adds the CheckName field to the CheckerBase class, and sets it in the CheckerManager::registerChecker() method, which gets them from the CheckerRegistry. Checkers that implement multiple checks have to store the names of each check in the respective registerXXXChecker method. Reviewers: jordan_rose, krememek Reviewed By: jordan_rose CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2557 llvm-svn: 201186
* Teach DeadStoresChecker about attribute objc_precise_lifetime.Ted Kremenek2014-01-151-3/+6
| | | | llvm-svn: 199277
* Replacing calls to getAttr with calls to hasAttr for clarity. No functional ↵Aaron Ballman2013-12-191-2/+2
| | | | | | change intended -- this only replaces Boolean uses of getAttr. llvm-svn: 197648
* Use pop_back_val() instead of both back() and pop_back().Robert Wilhelm2013-08-231-3/+2
| | | | | | No functionality change intended. llvm-svn: 189112
* Remove unused, awkward CFGStmtVisitor and subclasses.Jordan Rose2013-05-151-20/+17
| | | | | | | | | | | | | | | | | This class is a StmtVisitor that distinguishes between block-level and non-block-level statements in a CFG. However, it does so using a hard-coded idea of which statements might be block-level, which probably isn't accurate anymore. The only implementer of the CFGStmtVisitor hierarchy was the analyzer's DeadStoresChecker, and the analyzer creates a linearized CFG anyway (every non-trivial statement is a block-level statement). This also allows us to remove the block-expr map ("BlkExprMap"), which mapped statements to positions in the CFG. Apart from having a helper type that really should have just been Optional<unsigned>, it was only being used to ask /if/ a particular expression was block-level, for traversal purposes in CFGStmtVisitor. llvm-svn: 181945
* [analyzer] Teach DeadStoreChecker to look though BO_Comma and disregard the LHS.Anna Zaks2013-04-251-4/+10
| | | | llvm-svn: 180579
* Disable dead stores checker for template instantations. Fixes ↵Ted Kremenek2013-02-181-0/+9
| | | | | | <rdar://problem/13213575>. llvm-svn: 175425
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't ↵Benjamin Kramer2012-12-011-0/+1
| | | | | | | | | pull in all the generated Attr code. Required to pull some functions out of line, but this shouldn't have a perf impact. No functionality change. llvm-svn: 169092
* Trim #includes.Ted Kremenek2012-10-301-8/+6
| | | | llvm-svn: 167002
* Tweak DeadStoresChecker to not warn about dead stores to variables thatTed Kremenek2012-09-061-3/+55
| | | | | | | | | are used in EH code. Right now the CFG doesn't support exceptions well, so we need this hack to avoid bogus dead store warnings. Fixes <rdar://problem/12147586> llvm-svn: 163353
* Look through chains of 'x = y = z' when employing silencing heuristics in ↵Ted Kremenek2012-04-041-8/+30
| | | | | | | | the DeadStoresChecker. Fixes <rdar://problem/11185138>. llvm-svn: 154040
* Include the "issue context" (e.g. function or method) where a static ↵Ted Kremenek2012-04-041-1/+1
| | | | | | | | analyzer issue occurred in the plist output. Fixes <rdar://problem/11004527> llvm-svn: 154030
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | llvm-svn: 149798
* Move a method from IdentifierTable.h out of line and remove the SmallString ↵Benjamin Kramer2012-02-041-0/+1
| | | | | | | | include. Fix all the transitive include users. llvm-svn: 149783
* Remove unnecessary default cases in switches over enums.David Blaikie2012-01-171-3/+0
| | | | | | This allows -Wswitch-enum to find switches that need updating when these enums are modified. llvm-svn: 148281
* DeadStoresChecker: when whitelisting dead initializations with constants, lookRichard Smith2011-12-061-1/+1
| | | | | | | for a foldable constant rather than an IR-level constant. This is still far too liberal, but is a step in the right direction. llvm-svn: 145990
* Rename AnalysisContext to AnalysisDeclContext. Not only is this name more ↵Ted Kremenek2011-10-241-3/+3
| | | | | | accurate, but it frees up the name AnalysisContext for other uses. llvm-svn: 142782
* Change operator<< for raw_ostream and NamedDecl to take a reference instead ↵Benjamin Kramer2011-10-141-2/+2
| | | | | | | | of a pointer. Passing a pointer was a bad idea as it collides with the overload for void*. llvm-svn: 141971
* Remove AnalysisContext::getLiveVariables(), and introduce a templatized ↵Ted Kremenek2011-10-071-1/+1
| | | | | | mechanism to lazily create analyses that are attached to AnalysisContext objects. llvm-svn: 141425
* [analyzer] Refactor PathDiagnosticLocation: Make ↵Anna Zaks2011-09-201-8/+15
| | | | | | | | PathDiagnosticLocation(SourceLocation...) private. Most of the effort here goes to making BugReport refer to a PathDiagnosticLocation instead of FullSourceLocation. (Another step closer to the goal of having Diagnostics which can recover from invalid SourceLocations.) llvm-svn: 140182
* [analyzer] Replace calls to getNameAsString() with StringRef equivalents.Jordy Rose2011-08-211-9/+8
| | | | llvm-svn: 138215
* Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer ↵Ted Kremenek2011-08-121-17/+17
| | | | | | and libStaticAnalyzer[*]. It was highly inconsistent, and very ugly to look at. llvm-svn: 137537
* [analyzer] Overhaul how the static analyzer expects CFGs by forcing CFGs to ↵Ted Kremenek2011-07-281-32/+30
| | | | | | | | | | | | be linearized only when used by the static analyzer. This required a rewrite of LiveVariables, and exposed a ton of subtle bugs. The motivation of this large change is to drastically simplify the logic in ExprEngine going forward. Some fallout is that the output of some BugReporterVisitors is not as accurate as before; those will need to be fixed over time. There is also some possible performance regression as RemoveDeadBindings will be called frequently; this can also be improved over time. llvm-svn: 136419
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-1/+1
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Automatic Reference Counting.John McCall2011-06-151-3/+3
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* [analyzer] Rename CheckerV2 -> Checker.Argyrios Kyrtzidis2011-03-011-2/+2
| | | | llvm-svn: 126726
* [analyzer] Remove unused checker stuff from AnalysisConsumer and some unused ↵Argyrios Kyrtzidis2011-02-281-1/+0
| | | | | | headers. llvm-svn: 126690
* [analyzer] Use the new registration mechanism on the ↵Argyrios Kyrtzidis2011-02-171-6/+25
| | | | | | | | | | | | | non-path-sensitive-checkers: DeadStoresChecker ObjCMethSigsChecker ObjCUnusedIvarsChecker SizeofPointerChecker ObjCDeallocChecker SecuritySyntaxChecker llvm-svn: 125779
* Don't emit a dead store for '++' operations unless it occurs with a return ↵Ted Kremenek2011-02-121-6/+5
| | | | | | | | statement. We've never seen any other cases that were real bugs. Fixes <rdar://problem/6962292>. llvm-svn: 125419
* Don't report dead stores on unreachable code paths. Fixes ↵Ted Kremenek2011-02-111-5/+61
| | | | | | <rdar://problem/8405222>. llvm-svn: 125415
* Split 'include/clang/StaticAnalyzer' into ↵Ted Kremenek2011-02-101-2/+2
| | | | | | | | 'include/clang/StaticAnalyzer/Core' and 'include/clang/StaticAnalyzer/Checkers'. This layout matches lib/StaticAnalyzer, which corresponds to two StaticAnalyzer libraries. llvm-svn: 125251
* Rename 'CheckDeadStores.cpp' to 'DeadStoresChecker.cpp'.Ted Kremenek2011-01-131-0/+289
llvm-svn: 123395
OpenPOWER on IntegriCloud