summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] AnalysisConsumer: print fully-qualified function name while ↵Yury Gribov2016-02-031-1/+1
| | | | | | | | | | | displaying progress -analyzer-display progress option prints only function names which may be ambiguous. This patch forces AnalysisConsumer to print fully-qualified function names. Patch by Alex Sidorin! Differential Revision: http://reviews.llvm.org/D16804 llvm-svn: 259646
* AnalysisConsumer: use canonical decl for both lookup and store ofYury Gribov2016-01-111-4/+5
| | | | | | | | | | | | | | | | visited decls. Due to redeclarations, the function may have different declarations used in CallExpr and in the definition. However, we need to use a unique declaration for both store and lookup in VisitedCallees. This patch fixes issues with analysis in topological order. A simple test is included. Patch by Alex Sidorin! Differential Revision: http://reviews.llvm.org/D15410 llvm-svn: 257318
* Remove DataRecursiveASTVisitor; it no longer serves any purpose, since it's ↵Richard Smith2015-11-241-2/+2
| | | | | | just an alias for RecursiveASTVisitor. llvm-svn: 253949
* [analyzer] Skip checking blocks in dependent contexts.Devin Coughlin2015-11-181-1/+5
| | | | | | | | | | | Since we don't check functions in dependent contexts, we should skip blocks in those contexts as well. This avoids an assertion failure when the DeadStoresChecker attempts to evaluate an array subscript expression with a dependent name type. rdar://problem/23564220 llvm-svn: 253516
* 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: Fix a crasher in UbigraphVizIsmail Pazarbasi2015-09-181-2/+3
| | | | | | | | | | | | | | | Summary: Name `Out` refers to the parameter. It is moved into the member `Out` in ctor-init. Dereferencing null pointer will crash clang, if user passes '-analyzer-viz-egraph-ubigraph' argument. Reviewers: zaks.anna, krememek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D12119 llvm-svn: 248050
* [analyzer] Apply whitespace cleanups by Honggyu Kim.Ted Kremenek2015-09-081-5/+5
| | | | llvm-svn: 246978
* Do not crash when static analysis encounters a FunctionDecl that has a ↵Aaron Ballman2015-08-201-2/+2
| | | | | | delayed template parse of its body. llvm-svn: 245616
* [static analyzer] Analyzer is skipping forward declared C/C++ functionsAnna Zaks2015-06-261-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | A patch by Karthik Bhat! This patch fixes a regression introduced by r224398. Prior to r224398 we were able to analyze the following code in test-include.c and report a null deref in this case. But post r224398 this analysis is being skipped. E.g. // test-include.c #include "test-include.h" void test(int * data) { data = 0; *data = 1; } // test-include.h void test(int * data); This patch uses the function body (instead of its declaration) as the location of the function when deciding if the Decl should be analyzed with path-sensitive analysis. (Prior to r224398, the call graph was guaranteed to have a definition when available.) llvm-svn: 240800
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-5/+4
| | | | | | | | | | | | | | | | | | | | 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
* Teach raw_ostream to accept SmallString.Yaron Keren2015-03-101-1/+1
| | | | | | | | | | | | | | Saves adding .str() call to any raw_ostream << SmallString usage and a small step towards making .str() consistent in the ADTs by removing one of the SmallString::str() use cases, discussion at http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141013/240026.html I'll update the Phabricator patch http://reviews.llvm.org/D6372 for review of the Twine SmallString support, it's more complex than this one. llvm-svn: 231763
* [analyzer] Don't skip analyzing the functions in preprocessed files.Anna Zaks2015-02-051-1/+1
| | | | | | | The change in main file detection ended up disabling the path-sensitive analysis of functions within preprocessed files. llvm-svn: 228246
* [cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.pyChandler Carruth2015-01-141-3/+3
| | | | | | | | | | 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
* [llvm-api-change] Use findProgramByName.Michael J. Spencer2014-11-041-1/+3
| | | | llvm-svn: 221222
* unique_ptrify AnalysisConsumer.cpp::CreateUbiVizDavid Blaikie2014-09-051-4/+4
| | | | llvm-svn: 217212
* unique_ptrify clang::ento::createCheckerManagerDavid Blaikie2014-08-291-12/+6
| | | | llvm-svn: 216765
* Add an option to silence all analyzer warnings.Anna Zaks2014-08-291-1/+6
| | | | | | | | | | | | People have been incorrectly using "-analyzer-disable-checker" to silence analyzer warnings on a file, when analyzing a project. Add the "-analyzer-disable-all-checks" option, which would allow the suppression and suggest it as part of the error message for "-analyzer-disable-checker". The idea here is to compose this with "--analyze" so that users can selectively opt out specific files from static analysis. llvm-svn: 216763
* Add support for the static analyzer to synthesize function implementations ↵Ted Kremenek2014-08-271-9/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Recommit 213307: unique_ptr-ify ownership of ASTConsumers (reverted in r213325)David Blaikie2014-08-101-2/+2
| | | | | | | | After post-commit review and community discussion, this seems like a reasonable direction to continue, making ownership semantics explicit in the source using the type system. llvm-svn: 215323
* Remove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ↵David Blaikie2014-07-191-8/+7
| | | | | | | | | | | ".reset()" It's also possible to just write "= nullptr", but there's some question of whether that's as readable, so I leave it up to authors to pick which they prefer for now. If we want to discuss standardizing on one or the other, we can do that at some point in the future. llvm-svn: 213439
* Revert "unique_ptr-ify ownership of ASTConsumers"David Blaikie2014-07-171-2/+2
| | | | | | | | | This reverts commit r213307. Reverting to have some on-list discussion/confirmation about the ongoing direction of smart pointer usage in the LLVM project. llvm-svn: 213325
* unique_ptr-ify ownership of ASTConsumersDavid Blaikie2014-07-171-2/+2
| | | | | | | | | (after fixing a bug in MultiplexConsumer I noticed the ownership of the nested consumers was implemented with raw pointers - so this fixes that... and follows the source back to its origin pushing unique_ptr ownership up through there too) llvm-svn: 213307
* Track IntrusiveRefCntPtr::get() changes from LLVM r212366Alp Toker2014-07-051-1/+1
| | | | llvm-svn: 212369
* [C++11] Use 'nullptr'. StaticAnalyzer edition.Craig Topper2014-05-271-11/+12
| | | | llvm-svn: 209642
* Don't pass llvm::DenseSet<> by value.Alexander Kornienko2014-04-231-4/+4
| | | | | | | | | | | | | | Summary: Fixes massive performance problems on large translation units. Reviewers: jordan_rose Reviewed By: jordan_rose Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3471 llvm-svn: 206999
* [Modules] Fix potential ODR violations by sinking the DEBUG_TYPEChandler Carruth2014-04-221-2/+2
| | | | | | | | | | definition below all of the header #include lines, clang edition. If you want more details about this, you can see some of the commits to Debug.h in LLVM recently. This is just the clang section of a cleanup I've done for all uses of DEBUG_TYPE in LLVM. llvm-svn: 206849
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-151-10/+10
| | | | | | class. llvm-svn: 203999
* [C++11] Replace OwningPtr include with <memory>.Ahmed Charles2014-03-091-1/+1
| | | | llvm-svn: 203389
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-5/+5
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* Change OwningPtr::take() to OwningPtr::release().Ahmed Charles2014-03-071-1/+1
| | | | | | This is a precursor to moving to std::unique_ptr. llvm-svn: 203275
* Added an inserter for ArrayRef<SourceRange>.Alexander Kornienko2014-03-061-12/+4
| | | | | | | | | | | | | | Summary: Added an inserter for ArrayRef<SourceRange>, as it is already needed in at least two places (static analyzer and clang-tidy). Reviewers: jordan_rose CC: cfe-commits, gribozavr Differential Revision: http://llvm-reviews.chandlerc.com/D2984 llvm-svn: 203117
* Switch all uses of LLVM_OVERRIDE to just use 'override' directly.Craig Topper2014-03-021-1/+1
| | | | llvm-svn: 202625
* Allow specifying a custom PathDiagnosticConsumer for use with the static ↵Alexander Kornienko2014-02-031-19/+27
| | | | | | | | | | | | | | | | | analyzer. Summary: Make objects returned by CreateAnalysisConsumer expose an interface, that allows providing a custom PathDiagnosticConsumer, so that users can have raw data in a form easily usable from the code (unlike plist/HTML in a file). Reviewers: jordan_rose, krememek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2556 llvm-svn: 200710
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-1/+1
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* Make clang::ento::CreateAnalysisConsumer a part of a public interface of the ↵Alexander Kornienko2014-01-031-1/+1
| | | | | | | | | | | | | | | | | | static analyzer. Summary: This allows for a better alternative to the FrontendAction hack used in clang-tidy in order to get static analyzer's ASTConsumer. Reviewers: jordan_rose, krememek Reviewed By: jordan_rose CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2505 llvm-svn: 198426
* Fix another misuse of getCustomDiagID()Alp Toker2013-12-231-25/+13
| | | | | | There's no need to escape strings and generate new DiagIDs for each message. llvm-svn: 197915
* [analyzer] Use DataRecursiveASTVisitor for the AnalysisConsumer.Argyrios Kyrtzidis2013-12-201-2/+2
| | | | llvm-svn: 197767
* Split isFromMainFile into two functions.Eli Friedman2013-08-221-1/+1
| | | | | | | | | Basically, isInMainFile considers line markers, and isWrittenInMainFile doesn't. Distinguishing between the two is useful when dealing with files which are preprocessed files or rewritten with -frewrite-includes (so we don't, for example, print useless warnings). llvm-svn: 188968
* [analyzer] Merge TextPathDiagnostics and ClangDiagPathDiagConsumer.Jordan Rose2013-08-161-19/+55
| | | | | | | | | | | | | | | | | | | | This once again restores notes to following their associated warnings in -analyzer-output=text mode. (This is still only intended for use as a debugging aid.) One twist is that the warning locations in "regular" analysis output modes (plist, multi-file-plist, html, and plist-html) are reported at a different location on the command line than in the output file, since the command line has no path context. This commit makes -analyzer-output=text behave like a normal output format, which means that the *command line output will be different* in -analyzer-text mode. Again, since -analyzer-text is a debugging aid and lo-fi stand-in for a regular output mode, this change makes sense. Along the way, remove a few pieces of stale code related to the path diagnostic consumers. llvm-svn: 188514
* Use llvm::sys::fs::createTemporaryFile.Rafael Espindola2013-07-051-1/+1
| | | | llvm-svn: 185717
* We only create one file, no need to delete a directory.Rafael Espindola2013-06-261-8/+7
| | | | llvm-svn: 184949
* Remove unused include.Rafael Espindola2013-06-261-1/+0
| | | | llvm-svn: 184922
* Remove more uses of llvm::sys::Path.Rafael Espindola2013-06-261-26/+13
| | | | llvm-svn: 184921
* Use the sys::ExecuteAndWait that takes StringRefs.Rafael Espindola2013-06-131-2/+2
| | | | | | Also don't depend on Program.h including PathV1.h. llvm-svn: 183935
* Update for llvm change.Rafael Espindola2013-06-131-2/+3
| | | | llvm-svn: 183930
* Use the global functions instead of the Program methods.Rafael Espindola2013-06-121-2/+2
| | | | llvm-svn: 183861
* [analyzer] Change inlining policy to inline small functions when reanalyzing ↵Anna Zaks2013-03-261-14/+11
| | | | | | | | ObjC methods as top level. This allows us to better reason about(inline) small wrapper functions. llvm-svn: 178063
* [analyzer] Fix typo.Anna Zaks2013-02-071-1/+1
| | | | llvm-svn: 174679
* [analyzer] Print Inline mode with -analyzer-display-progress.Anna Zaks2013-02-021-4/+15
| | | | llvm-svn: 174244
OpenPOWER on IntegriCloud