summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Teach Wreturn-type, Wunreachable-code, and alpha.deadcode.UnreachableCode to ↵Nico Weber2018-02-131-1/+2
| | | | | | | | | treat __assume(0) like __builtin_unreachable. Fixes PR29134. https://reviews.llvm.org/D43221 llvm-svn: 325052
* [StaticAnalyzer] Fix false positives for unreachable code in macros.Daniel Marjamaki2017-08-021-1/+1
| | | | | | | | | | | | | Example: #define MACRO(C) if (C) { static int x; .. } void foo() { MACRO(0); } Differential Revision: https://reviews.llvm.org/D36141 llvm-svn: 309799
* alpha.core.UnreachableCode - don't warn about unreachable code inside macroDaniel Marjamaki2016-10-181-0/+8
| | | | | | | | In macros, 'do {...} while (0)' is often used. Don't warn about the condition 0 when it is unreachable. Differential Revision: https://reviews.llvm.org/D25606 llvm-svn: 284477
* [StaticAnalyzer] Fix false positives for vardecls that are technically ↵Daniel Marjamaki2016-09-281-2/+4
| | | | | | | | | | | | | | | unreachable but they are needed. Example: switch (x) { int a; // <- This is unreachable but needed case 1: a = ... Differential Revision: https://reviews.llvm.org/D24905 llvm-svn: 282574
* Avoid overly large SmallPtrSet/SmallSetMatthias Braun2016-01-301-5/+1
| | | | | | | | | These sets perform linear searching in small mode so it is never a good idea to use SmallSize/N bigger than 32. Differential Revision: http://reviews.llvm.org/D16705 llvm-svn: 259284
* Refactor: Simplify boolean conditional return statements in ↵Alexander Kornienko2015-12-281-6/+3
| | | | | | | | | | | | | | | | lib/StaticAnalyzer/Checkers Summary: Use clang-tidy to simplify boolean conditional return values Reviewers: dcoughlin, krememek Subscribers: krememek, cfe-commits Patch by Richard Thomson! Differential Revision: http://reviews.llvm.org/D10021 llvm-svn: 256491
* [analyzer] Apply whitespace cleanups by Honggyu Kim.Ted Kremenek2015-09-081-2/+2
| | | | llvm-svn: 246978
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | 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
* [C++11] Use 'nullptr'. StaticAnalyzer edition.Craig Topper2014-05-271-6/+6
| | | | llvm-svn: 209642
* [analyzer] check for now possibly null predecessor edge.Ted Kremenek2014-02-271-0/+5
| | | | llvm-svn: 202434
* Expose the name of the checker producing each diagnostic message.Alexander Kornienko2014-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fixing a compile error that recently started happening for me in MSVC 2013. ↵Aaron Ballman2013-12-291-1/+1
| | | | | | CFGTerminator has an explicit conversion to bool operator that we can make use of instead of using == 0. llvm-svn: 198175
* Rename isBuiltinCall() to getBuiltinCallee()Alp Toker2013-12-281-1/+1
| | | | | | | | This better describes what the function does. Cleanup only. llvm-svn: 198127
* [analyzer] Don't run unreachable code checker on inlined functions.Jordan Rose2013-08-191-0/+3
| | | | | | | | | This is still an alpha checker, but we use it in certain tests to make sure something is not being executed. This should fix the buildbots. llvm-svn: 188682
* Remove the CFGElement "Invalid" state.David Blaikie2013-02-231-4/+4
| | | | | | | | | | | | | Use Optional<CFG*> where invalid states were needed previously. In the one case where that's not possible (beginAutomaticObjDtorsInsert) just use a dummy CFGAutomaticObjDtor. Thanks for the help from Jordan Rose & discussion/feedback from Ted Kremenek and Doug Gregor. Post commit code review feedback on r175796 by Ted Kremenek. llvm-svn: 175938
* Replace ProgramPoint llvm::cast support to be well-defined.David Blaikie2013-02-211-1/+1
| | | | | | See r175462 for another example/more details. llvm-svn: 175812
* Replace CFGElement llvm::cast support to be well-defined.David Blaikie2013-02-211-4/+4
| | | | | | See r175462 for another example/more details. llvm-svn: 175796
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-5/+5
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Include the "issue context" (e.g. function or method) where a static ↵Ted Kremenek2012-04-041-2/+2
| | | | | | | | analyzer issue occurred in the plist output. Fixes <rdar://problem/11004527> llvm-svn: 154030
* Analyzer: Store BugReports directly in a ilist instead of adding another ↵Benjamin Kramer2012-04-011-1/+1
| | | | | | layer of inderection with std::list llvm-svn: 153847
* [analyzer] Tweak the UnreachableCode checker to not warning about ↵Ted Kremenek2012-02-291-0/+8
| | | | | | unreachable default blocks. Patch by Cyril Roelandt! llvm-svn: 151709
* Further tweak -Wurneachable-code and templates by allowing the warning to run onTed Kremenek2011-12-011-2/+12
| | | | | | | | | explicit template specializations (which represent actual functions somebody wrote). Along the way, refactor some other code which similarly cares about whether or not they are looking at a template instantiation. llvm-svn: 145547
* Constant expression evaluation: support for evaluation of structs and unions ofRichard Smith2011-11-101-3/+1
| | | | | | | literal types, as well as derived-to-base casts for lvalues and derived-to-virtual-base casts. llvm-svn: 144265
* Rename AnalysisContext to AnalysisDeclContext. Not only is this name more ↵Ted Kremenek2011-10-241-1/+1
| | | | | | accurate, but it frees up the name AnalysisContext for other uses. llvm-svn: 142782
* [analyzer] Refactor PathDiagnosticLocation: Make ↵Anna Zaks2011-09-201-4/+7
| | | | | | | | 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] Overhaul how the static analyzer expects CFGs by forcing CFGs to ↵Ted Kremenek2011-07-281-6/+12
| | | | | | | | | | | | 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
* Add support for the OpenCL vec_step operator, by generalising andPeter Collingbourne2011-03-111-1/+1
| | | | | | | extending the existing support for sizeof and alignof. Original patch by Guy Benyei. llvm-svn: 127475
* In preparation for fixing PR 6884, rework CFGElement to have getAs<> return ↵Ted Kremenek2011-03-011-4/+4
| | | | | | | | | pointers instead of fresh CFGElements. - Also, consoldiate getDtorKind() and getKind() into one "kind". - Add empty getDestructorDecl() method to CFGImplicitDtor. llvm-svn: 126738
* [analyzer] Rename CheckerV2 -> Checker.Argyrios Kyrtzidis2011-03-011-2/+2
| | | | llvm-svn: 126726
* [analyzer] Migrate UnreachableCodeChecker to CheckerV2.Argyrios Kyrtzidis2011-02-231-32/+26
| | | | llvm-svn: 126308
* [analyzer] Pass CheckerManager to the registration functions.Argyrios Kyrtzidis2011-02-171-1/+6
| | | | llvm-svn: 125777
* [analyzer] Use the new registration mechanism on some of the experimental ↵Argyrios Kyrtzidis2011-02-151-2/+2
| | | | | | | | | | | | | | | checks. These are: CStringChecker ChrootChecker MallocChecker PthreadLockChecker StreamChecker UnreachableCodeChecker MallocChecker creates implicit dependencies between checkers and needs to be handled differently. llvm-svn: 125598
* Split 'include/clang/StaticAnalyzer' into ↵Ted Kremenek2011-02-101-5/+5
| | | | | | | | 'include/clang/StaticAnalyzer/Core' and 'include/clang/StaticAnalyzer/Checkers'. This layout matches lib/StaticAnalyzer, which corresponds to two StaticAnalyzer libraries. llvm-svn: 125251
* [analyzer] lib/StaticAnalyzer/Checkers/ExprEngineExperimentalChecks.h -> ↵Argyrios Kyrtzidis2011-02-081-1/+1
| | | | | | lib/StaticAnalyzer/Checkers/ExperimentalChecks.h llvm-svn: 125122
* Chris Lattner has strong opinions about directoryTed Kremenek2010-12-231-0/+223
layout. :) Rename the 'EntoSA' directories to 'StaticAnalyzer'. Internally we will still use the 'ento' namespace for the analyzer engine (unless there are further sabre rattlings...). llvm-svn: 122514
OpenPOWER on IntegriCloud