summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] Remove unused function. No functional change intended.Benjamin Kramer2015-03-241-11/+0
| | | | llvm-svn: 233060
* [Analyzer] Don't inherit from FoldingSet.Benjamin Kramer2015-03-221-4/+4
| | | | | | That's not really necessary here. NFCI. llvm-svn: 232921
* Remove many superfluous SmallString::str() calls.Yaron Keren2015-03-181-3/+3
| | | | | | | | | | | | | | | Now that SmallString is a first-class citizen, most SmallString::str() calls are not required. This patch removes a whole bunch of them, yet there are lots more. There are two use cases where str() is really needed: 1) To use one of StringRef member functions which is not available in SmallString. 2) To convert to std::string, as StringRef implicitly converts while SmallString do not. We may wish to change this, but it may introduce ambiguity. llvm-svn: 232622
* [analyzer] Sort path diagnostics with array_pod_sort.Benjamin Kramer2015-03-141-5/+9
| | | | | | | | | | | | | | | They're expensive to compare and we won't sort many of them so std::sort doesn't give any benefits and causes code bloat. Func fact: clang -O3 didn't even bother to inline libc++'s std::sort here. While there validate the predicate a bit harder, the sort is unstable and we don't want to introduce any non-determinism. I had to spell out the function pointer type because GCC 4.7 still fails to convert the lambda to a function pointer :( No intended functionality change. llvm-svn: 232263
* Make helper functions static. NFC.Benjamin Kramer2015-03-091-1/+1
| | | | | | Found by -Wmissing-prototypes. llvm-svn: 231668
* [analyzer] Individual configuration options can be specified for checkers.Gabor Horvath2015-03-041-8/+51
| | | | | | | | | | Reviewed by: Anna Zaks Original patch by: Aleksei Sidorin Differential Revision: http://reviews.llvm.org/D7905 llvm-svn: 231266
* Prefer SmallVector::append/insert over push_back loops. Clang edition.Benjamin Kramer2015-02-171-5/+2
| | | | | | Same functionality, but hoists the vector growth out of the loop. llvm-svn: 229508
* Analyzer: Replace a set of particularly ugly faux variadics.Benjamin Kramer2015-02-151-8/+0
| | | | llvm-svn: 229325
* [Static Analyzer] The name of the checker that reports a bug is addedGabor Horvath2015-02-091-1/+3
| | | | | | | | | | | to the plist output. This check_name field does not guaranteed to be the same as the name of the checker in the future. Reviewer: Anna Zaks Differential Revision: http://reviews.llvm.org/D6841 llvm-svn: 228624
* Update APIs that return a pair of iterators to return an iterator_range instead.Benjamin Kramer2015-02-063-31/+29
| | | | | | Convert uses of those APIs into ranged for loops. NFC. llvm-svn: 228404
* [analyzer] Relax an assertion in VisitLvalArraySubscriptExprAnna Zaks2015-02-051-1/+3
| | | | | | | | | | | | The analyzer thinks that ArraySubscriptExpr cannot be an r-value (ever). However, it can be in some corner cases. Specifically, C forbids expressions of unqualified void type from being l-values. Note, the analyzer will keep modeling the subscript expr as an l-value. The analyzer should be treating void* as a char array (https://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Pointer-Arith.html). llvm-svn: 228249
* Fix layering violation: include/clang/Basic/PlistSupport.h should not includeRichard Smith2015-01-281-11/+11
| | | | | | files from include/clang/Lex. Clean up module map. llvm-svn: 227361
* Test commit, no changes.Pavel Labath2015-01-201-1/+1
| | | | llvm-svn: 226552
* [cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.pyChandler Carruth2015-01-141-1/+1
| | | | | | | | | | Sorry for the noise, I managed to miss a bunch of recent regressions of include orderings here. This should actually sort all the includes for Clang. Again, no functionality changed, this is just a mechanical cleanup that I try to run periodically to keep the #include lines as regular as possible across the project. llvm-svn: 225979
* Update for LLVM API change to make Small(Ptr)Set::insert return ↵David Blaikie2014-11-191-1/+1
| | | | | | pair<iterator, bool> as per the C++ standard's associative container concept. llvm-svn: 222335
* clang-format a recent commit I madeDavid Blaikie2014-11-191-1/+1
| | | | llvm-svn: 222317
* Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.David Blaikie2014-11-192-13/+12
| | | | llvm-svn: 222306
* Remove some redundant virtual specifiers on overriden functions.David Blaikie2014-11-141-1/+1
| | | | llvm-svn: 222024
* [c++1z] N4295: fold-expressions.Richard Smith2014-11-081-0/+1
| | | | | | | | | | | | | | | | This is a new form of expression of the form: (expr op ... op expr) where one of the exprs is a parameter pack. It expands into (expr1 op (expr2onwards op ... op expr)) (and likewise if the pack is on the right). The non-pack operand can be omitted; in that case, an empty pack gives a fallback value or an error, depending on the operator. llvm-svn: 221573
* Add the initial TypoExpr AST node for delayed typo correction.Kaelyn Takata2014-10-271-0/+1
| | | | llvm-svn: 220692
* Reduce double set lookups. NFC.Benjamin Kramer2014-10-101-7/+2
| | | | llvm-svn: 219504
* Fix for bug http://llvm.org/PR17427.Alexey Bataev2014-10-091-1/+1
| | | | | | | | Assertion failed: "Computed __func__ length differs from type!" Reworked PredefinedExpr representation with internal StringLiteral field for function declaration. Differential Revision: http://reviews.llvm.org/D5365 llvm-svn: 219393
* [OPENMP] 'omp teams' directive basic support.Alexey Bataev2014-10-091-0/+1
| | | | | | Includes parsing and semantic analysis for 'omp teams' directive support from OpenMP 4.0. Adds additional analysis to 'omp target' directive with 'omp teams' directive. llvm-svn: 219385
* Revert "[OPENMP] 'omp teams' directive basic support. Includes parsing and ↵Renato Golin2014-10-081-1/+0
| | | | | | | | | semantic analysis for 'omp teams' directive support from OpenMP 4.0. Adds additional analysis to 'omp target' directive with 'omp teams' directive." This reverts commit r219197 because it broke ARM self-hosting buildbots with segmentation fault errors in many tests. llvm-svn: 219289
* [OPENMP] 'omp teams' directive basic support.Alexey Bataev2014-10-071-0/+1
| | | | | | Includes parsing and semantic analysis for 'omp teams' directive support from OpenMP 4.0. Adds additional analysis to 'omp target' directive with 'omp teams' directive. llvm-svn: 219197
* [analyzer] Refactor and cleanup IsCompleteTypeAnna Zaks2014-10-032-25/+3
| | | | | | | | | | There are three copies of IsCompleteType(...) functions in CSA and all of them are incomplete (I experienced crashes in some CSA's test cases). I have replaced these function calls with Type::isIncompleteType() calls. A patch by Aleksei Sidorin! llvm-svn: 219026
* [OPENMP] Parsing/Sema of directive omp parallel for simdAlexander Musman2014-09-231-0/+1
| | | | llvm-svn: 218299
* [OPENMP] Initial parsing/sema analysis of 'target' directive.Alexey Bataev2014-09-191-0/+1
| | | | llvm-svn: 218110
* Parsing/Sema of directive omp for simdAlexander Musman2014-09-181-0/+1
| | | | llvm-svn: 218029
* Remove a use of raw pointer ownership (then non-ownership) in ↵David Blaikie2014-09-051-2/+3
| | | | | | | | | TrimmedGraph::popNextReportGraph (just cleaning up unique_ptr stuff by finding interesting 'reset' calls at the moment) llvm-svn: 217210
* unique_ptrify ExplodedGraph::trimDavid Blaikie2014-09-052-4/+4
| | | | llvm-svn: 217208
* unique_ptrify the result of ConstraintManagerCreator and StoreManagerCreatorDavid Blaikie2014-09-043-8/+9
| | | | llvm-svn: 217206
* unique_ptrify BugReporter::visitorsDavid Blaikie2014-09-042-74/+53
| | | | llvm-svn: 217205
* unique_ptrify PathDiagnosticConsumer::HandlePathDiagnosticDavid Blaikie2014-08-292-7/+6
| | | | | | | FoldingSet, another intrusive data structure that could use some unique_ptr love on its interfaces. Eventually. llvm-svn: 216764
* unique_ptrify thep passing of BugReports to BugReportEquivClassDavid Blaikie2014-08-291-4/+3
| | | | | | | | I suspect llvm::ilist should take elements by unique_ptr, since it does take ownership of the element (by stitching it into the linked list) - one day. llvm-svn: 216761
* unique_ptrify PathDiagnostic::setEndOfPath's argumentDavid Blaikie2014-08-291-4/+4
| | | | | | | | | | | | | | Again, if shared ownership is the right model here (I assume it is, given graph algorithms & such) this could be tidied up (the 'release' call removed in favor of something safer) by having IntrunsiveRefCntPointer constructible from a unique_ptr. (& honestly I'd probably favor taking a page out of shared_ptr's book, allowing implicit construction from a unique_ptr rvalue, and only allow explicit from a raw pointer - currently IntrusiveRefCntPointer can implicitly own from a raw pointer, which seems unsafe) llvm-svn: 216752
* unique_ptr-ify PathDiagnosticPiece ownershipDavid Blaikie2014-08-292-19/+15
| | | | llvm-svn: 216751
* Add support for the static analyzer to synthesize function implementations ↵Ted Kremenek2014-08-272-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from external model files. Currently the analyzer lazily models some functions using 'BodyFarm', which constructs a fake function implementation that the analyzer can simulate that approximates the semantics of the function when it is called. BodyFarm does this by constructing the AST for such definitions on-the-fly. One strength of BodyFarm is that all symbols and types referenced by synthesized function bodies are contextual adapted to the containing translation unit. The downside is that these ASTs are hardcoded in Clang's own source code. A more scalable model is to allow these models to be defined as source code in separate "model" files and have the analyzer use those definitions lazily when a function body is needed. Among other things, it will allow more customization of the analyzer for specific APIs and platforms. This patch provides the initial infrastructure for this feature. It extends BodyFarm to use an abstract API 'CodeInjector' that can be used to synthesize function bodies. That 'CodeInjector' is implemented using a new 'ModelInjector' in libFrontend, which lazily parses a model file and injects the ASTs into the current translation unit. Models are currently found by specifying a 'model-path' as an analyzer option; if no path is specified the CodeInjector is not used, thus defaulting to the current behavior in the analyzer. Models currently contain a single function definition, and can be found by finding the file <function name>.model. This is an initial starting point for something more rich, but it bootstraps this feature for future evolution. This patch was contributed by Gábor Horváth as part of his Google Summer of Code project. Some notes: - This introduces the notion of a "model file" into FrontendAction and the Preprocessor. This nomenclature is specific to the static analyzer, but possibly could be generalized. Essentially these are sources pulled in exogenously from the principal translation. Preprocessor gets a 'InitializeForModelFile' and 'FinalizeForModelFile' which could possibly be hoisted out of Preprocessor if Preprocessor exposed a new API to change the PragmaHandlers and some other internal pieces. This can be revisited. FrontendAction gets a 'isModelParsingAction()' predicate function used to allow a new FrontendAction to recycle the Preprocessor and ASTContext. This name could probably be made something more general (i.e., not tied to 'model files') at the expense of losing the intent of why it exists. This can be revisited. - This is a moderate sized patch; it has gone through some amount of offline code review. Most of the changes to the non-analyzer parts are fairly small, and would make little sense without the analyzer changes. - Most of the analyzer changes are plumbing, with the interesting behavior being introduced by ModelInjector.cpp and ModelConsumer.cpp. - The new functionality introduced by this change is off-by-default. It requires an analyzer config option to enable. llvm-svn: 216550
* Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or ↵Craig Topper2014-08-271-1/+1
| | | | | | just letting them be implicitly created. llvm-svn: 216528
* Update for llvm api change.Rafael Espindola2014-08-251-4/+4
| | | | llvm-svn: 216397
* Header guard canonicalization, clang part.Benjamin Kramer2014-08-132-4/+4
| | | | | | Modifications made by clang-tidy with minor tweaks. llvm-svn: 215557
* Work around missing handling of temporaries bound to default arguments.Manuel Klimek2014-08-131-6/+15
| | | | | | | | | | | Yet more problems due to the missing CXXBindTemporaryExpr in the CFG for default arguments. Unfortunately we cannot just switch off inserting temporaries for the corresponding default arguments, as that breaks existing tests (test/SemaCXX/return-noreturn.cpp:245). llvm-svn: 215554
* Work around default parameter problem in the static analyzer.Manuel Klimek2014-08-111-4/+7
| | | | | | | | | | | | | | | | | In cases like: struct C { ~C(); } void f(C c = C()); void t() { f(); } We currently do not add the CXXBindTemporaryExpr for the temporary (the code mentions that as the default parameter expressions are owned by the declaration, we'd otherwise add the same expression multiple times), but we add the temporary destructor pointing to the CXXBindTemporaryExpr. We need to fix that before we can re-enable the assertion. llvm-svn: 215357
* Simplify ownership of ExplodedGraph in the CoreEngine by removing unique_ptr ↵David Blaikie2014-08-081-25/+25
| | | | | | | | | | | | indirection. Summary: I was going to fix the use of raw pointer ownership in "takeGraph" when I realized that function was unused and the whole ExplodedGraph could just be owned by value without the std::unique_ptr indirection at all. Reviewers: jordan_rose Differential Revision: http://reviews.llvm.org/D4833 llvm-svn: 215257
* Re-applying r214962.Manuel Klimek2014-08-072-10/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes to the original patch: - model the CFG for temporary destructors in conditional operators so that the destructors of the true and false branch are always exclusive. This is necessary because we must not have impossible paths for the path based analysis to work. - add multiple regression tests with ternary operators Original description: Fix modelling of non-lifetime-extended temporary destructors in the analyzer. Changes to the CFG: When creating the CFG for temporary destructors, we create a structure that mirrors the branch structure of the conditionally executed temporary constructors in a full expression. The branches we create use a CXXBindTemporaryExpr as terminator which corresponds to the temporary constructor which must have been executed to enter the destruction branch. 2. Changes to the Analyzer: When we visit a CXXBindTemporaryExpr we mark the CXXBindTemporaryExpr as executed in the state; when we reach a branch that contains the corresponding CXXBindTemporaryExpr as terminator, we branch out depending on whether the corresponding CXXBindTemporaryExpr was marked as executed. llvm-svn: 215096
* Revert "Fix modelling of non-lifetime-extended temporary destructors in the ↵Rui Ueyama2014-08-062-110/+10
| | | | | | | | | | | | | | | | | | | | analyzer." This reverts commit r214962 because after the change the following code doesn't compile with -Wreturn-type -Werror. #include <cstdlib> class NoReturn { public: ~NoReturn() __attribute__((noreturn)) { exit(1); } }; int check() { true ? NoReturn() : NoReturn(); } llvm-svn: 214998
* Remove unnecessary semicolon.Manuel Klimek2014-08-061-1/+1
| | | | llvm-svn: 214970
* Fix modelling of non-lifetime-extended temporary destructors in the analyzer.Manuel Klimek2014-08-062-10/+110
| | | | | | | | | | | | | | | | | | | 1. Changes to the CFG: When creating the CFG for temporary destructors, we create a structure that mirrors the branch structure of the conditionally executed temporary constructors in a full expression. The branches we create use a CXXBindTemporaryExpr as terminator which corresponds to the temporary constructor which must have been executed to enter the destruction branch. 2. Changes to the Analyzer: When we visit a CXXBindTemporaryExpr we mark the CXXBindTemporaryExpr as executed in the state; when we reach a branch that contains the corresponding CXXBindTemporaryExpr as terminator, we branch out depending on whether the corresponding CXXBindTemporaryExpr was marked as executed. llvm-svn: 214962
* [OPENMP] Initial parsing and sema analysis for 'atomic' directive.Alexey Bataev2014-07-221-0/+1
| | | | llvm-svn: 213639
* [OPENMP] Initial parsing and sema analysis for 'ordered' directive.Alexey Bataev2014-07-221-0/+1
| | | | llvm-svn: 213616
OpenPOWER on IntegriCloud