summaryrefslogtreecommitdiffstats
path: root/clang/utils
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] exploded-graph-rewriter: Fix filenames in program point.Artem Dergachev2019-07-111-2/+3
| | | | | | Fix a typo in JSON field name. llvm-svn: 365827
* [analyzer] exploded-graph-rewriter: Implement a topology-only mode.Artem Dergachev2019-07-081-8/+13
| | | | | | | | | | In this mode the rewriter will only rewrite program points and omit program states. Useful for understanding the rough topology of the graph. Differential Revision: https://reviews.llvm.org/D64264 llvm-svn: 365410
* [analyzer] exploded-graph-rewriter: Implement a single-path mode.Artem Dergachev2019-07-081-3/+41
| | | | | | | | | | Instead of rewriting the whole graph, rewrite the leftmost path in the graph. Useful for trimmed graphs that are still too large to display due to multiple equivalent reports mixed into them. Differential Revision: https://reviews.llvm.org/D64263 llvm-svn: 365409
* Improve MSVC visualization of annot_template_id tokensMike Spertus2019-07-051-9/+62
| | | | | | | | | Now shows the actual annotated template. E.g., {annot_template_id (A<int, double>)} Also a few miscellaneous fixes to visualizers of other types llvm-svn: 365248
* [analyzer] exploded-graph-rewriter: Implement a black-and-white color scheme.Artem Dergachev2019-07-031-11/+18
| | | | | | | | For accessibility! Differential Revision: https://reviews.llvm.org/D64153 llvm-svn: 365085
* [analyzer] exploded-graph-rewriter: Implement bug nodes and sink nodes.Artem Dergachev2019-07-031-0/+8
| | | | | | | | | | | Add a label to nodes that have a bug report attached or on which the analysis was generally interrupted. Fix printing has_report and implement printing is_sink in the graph dumper. Differential Revision: https://reviews.llvm.org/D64110 llvm-svn: 364992
* [analyzer] exploded-graph-rewriter: NFC: Add more comments.Artem Dergachev2019-07-031-3/+25
| | | | llvm-svn: 364991
* [analyzer] exploded-graph-rewriter: Collapse very long statement pretty-prints.Artem Dergachev2019-07-031-3/+20
| | | | | | | | | | When printing various statements that include braces (compound statements, lambda expressions, statement-expressions, etc.), replace the code between braces with '...'. Differential Revision: https://reviews.llvm.org/D64104 llvm-svn: 364990
* [analyzer] exploded-graph-rewriter: Implement checker messages.Artem Dergachev2019-07-031-9/+104
| | | | | | | | They are displayed as raw lines and diffed via difflib on a per-checker basis. Differential Revision: https://reviews.llvm.org/D64100 llvm-svn: 364989
* [analyzer] exploded-graph-rewriter: Implement a dark color scheme.Artem Dergachev2019-07-021-11/+26
| | | | | | | | Addresses a popular request. Activated via --dark. Differential Revision: https://reviews.llvm.org/D64056 llvm-svn: 364882
* [analyzer] exploded-graph-rewriter: Improve program point dumps.Artem Dergachev2019-07-021-7/+26
| | | | | | | | | | | | - Take advantage of the stmt_point_kind. - Dump block IDs for BlockEntrance nodes. - Don't dump huge compound statements on PurgeDeadSymbols nodes. - Rename Edge to BlockEdge for consistency. - Tweak colors. Differential Revision: https://reviews.llvm.org/D64051 llvm-svn: 364881
* [analyzer] exploded-graph-rewriter: Add support for objects under construction.Artem Dergachev2019-07-021-22/+52
| | | | | | | | This trait is Environment-like, so there was a chance to re-use a lot of code. Differential Revision: https://reviews.llvm.org/D64047 llvm-svn: 364880
* [analyzer] exploded-graph-rewriter: Add support for dynamic types.Artem Dergachev2019-07-011-17/+25
| | | | | | | | | Slightly cleanup emission of horizontal lines and unhardcode the title for generic maps. Differential Revision: https://reviews.llvm.org/D64041 llvm-svn: 364865
* [analyzer] exploded-graph-rewriter: Implement program point tags.Artem Dergachev2019-07-011-0/+6
| | | | | | | | Keep them on a separate line for more visibility. Differential Revision: https://reviews.llvm.org/D63965 llvm-svn: 364864
* Various tweaks to MSVC natvis visualizersMike Spertus2019-06-301-14/+40
| | | | | | | | | Make more consistent use of na format. Improve visualization of deduction guides. Add visualizer for explicit specifier (including conditionally explicit) Fix some typos llvm-svn: 364724
* [analyzer] exploded-graph-rewriter: Prettier location context dumps.Artem Dergachev2019-06-261-1/+2
| | | | | | Make them span wider. llvm-svn: 364365
* [analyzer] print() JSONify: Create pointersCsaba Dabis2019-06-251-2/+4
| | | | | | | | | | | | | | | | | Summary: - Reviewers: NoQ Reviewed By: NoQ Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63726 llvm-svn: 364271
* [analyzer] exploded-graph-rewriter: Fix escaping for bitwise-or.Artem Dergachev2019-06-251-1/+2
| | | | | | | '|' is a special character in graphviz, so it needs to be properly escaped and unescaped. llvm-svn: 364269
* [analyzer] exploded-graph-rewriter: Add support for range constraints.Artem Dergachev2019-06-251-2/+63
| | | | | | | | | | | | Diff support included. A cheap solution is implemented that treats range constraints as "some sort of key-value map", so it's going to be trivial to add support for other such maps later, such as dynamic type info. Differential Revision: https://reviews.llvm.org/D63685 llvm-svn: 364268
* [analyzer] NFC: exploded-graph-rewriter: Extract some code into functions.Artem Dergachev2019-06-251-19/+22
| | | | | | Differential Revision: https://reviews.llvm.org/D63684 llvm-svn: 364267
* MSVC visualizers for type aliasesMike Spertus2019-06-231-0/+51
| | | | | | | For example, the following TypeAliasTemplateDecl now displays in the autos window as template<class T> using type_identity_t = type_identity<T>::type; llvm-svn: 364145
* Natural MSVC visualization of constructorsMike Spertus2019-06-221-1/+6
| | | | | | | E.g., Allow MSVC to visualize a CXXConstructorDecl like Constructor { Y(type_identity_t<T>)} llvm-svn: 364138
* P0840R2: support for [[no_unique_address]] attributeRichard Smith2019-06-201-12/+26
| | | | | | | | | | | | | | | | | Summary: Add support for the C++2a [[no_unique_address]] attribute for targets using the Itanium C++ ABI. This depends on D63371. Reviewers: rjmccall, aaron.ballman Subscribers: dschuff, aheejin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63451 llvm-svn: 363976
* [analyzer] exploded-graph-rewriter: Implement a --diff mode.Artem Dergachev2019-06-191-61/+218
| | | | | | | | | | | | | | | | | | | | | In this mode the tool would avoid duplicating the contents of the program state on every node, replacing them with a diff-like dump of changes that happened on that node. This is useful because most of the time we only interested in whether the effect of the statement was modeled correctly. A diffed graph would also be much faster to load and navigate, being much smaller than the original graph. The diffs are computed "semantically" as opposed to plain text diffs. I.e., the diff algorithm is hand-crafted separately for every state trait, taking the underlying data structures into account. This is especially nice for Environment because textual diffs would have been terrible. On the other hand, it requires some boilerplate to implement. Differential Revision: https://reviews.llvm.org/D62761 llvm-svn: 363898
* [analyzer] exploded-graph-rewriter: Fix escaping StringRegions.Artem Dergachev2019-06-191-0/+1
| | | | | | | | | | | Quotes around StringRegions are now escaped and unescaped correctly, producing valid JSON. Additionally, add a forgotten escape for Store values. Differential Revision: https://reviews.llvm.org/D63519 llvm-svn: 363897
* Various improvements to Clang MSVC VisualizerMike Spertus2019-06-171-32/+149
| | | | | | | | This change adds/improves MSVC visualizers for many Clang types, including array types, trailing return types in function, deduction guides, a fix for OpaquePtr, etc. It also replaces all of the view(deref) with the "na" formatter, which is a better built-in natvis technique for doing the same thing. Differential Revision: https://reviews.llvm.org/D63039 llvm-svn: 363574
* [analyzer] exploded-graph-rewriter: Add the missing license header!Artem Dergachev2019-06-051-0/+9
| | | | llvm-svn: 362575
* [OpenCL] Declare builtin functions using TableGenSven van Haastregt2019-06-034-0/+328
| | | | | | | | | | | | | | | | | | | | | | | This patch adds a `-fdeclare-opencl-builtins` command line option to the clang frontend. This enables clang to verify OpenCL C builtin function declarations using a fast StringMatcher lookup, instead of including the opencl-c.h file with the `-finclude-default-header` option. This avoids the large parse time penalty of the header file. This commit only adds the basic infrastructure and some of the OpenCL builtins. It does not cover all builtins defined by the various OpenCL specifications. As such, it is not a replacement for `-finclude-default-header` yet. RFC: http://lists.llvm.org/pipermail/cfe-dev/2018-November/060041.html Co-authored-by: Pierre Gondois Co-authored-by: Joey Gouly Co-authored-by: Sven van Haastregt Differential Revision: https://reviews.llvm.org/D60763 llvm-svn: 362371
* [analyzer] exploded-graph-rewriter: Initial commit.Artem Dergachev2019-06-021-0/+398
| | | | | | | | | | | This is a utility to improve readability and generally manipulate GraphViz dumps of the analysis graph. Such dumps are often huge and not only hard to read, but also often hang the viewer apps with their mere size. Such script should significantly improve debugging experience. Differential Revision: https://reviews.llvm.org/D62638 llvm-svn: 362340
* Add script to update OpenMP -ast-dump test expectations, and use it toRichard Smith2019-06-021-0/+79
| | | | | | | | | regenerate the test expectations. (Only two tests change, as a result of no longer matching the 0x in a pointer; the other tests were already excluding that.) llvm-svn: 362316
* Add the `objc_class_stub` attribute.John McCall2019-05-301-31/+34
| | | | | | | | | | | | | | | | | | | | | | | | | Swift requires certain classes to be not just initialized lazily on first use, but actually allocated lazily using information that is only available at runtime. This is incompatible with ObjC class initialization, or at least not efficiently compatible, because there is no meaningful class symbol that can be put in a class-ref variable at load time. This leaves ObjC code unable to access such classes, which is undesirable. objc_class_stub says that class references should be resolved by calling a new ObjC runtime function with a pointer to a new "class stub" structure. Non-ObjC compilers (like Swift) can simply emit this structure when ObjC interop is required for a class that cannot be statically allocated, then apply this attribute to the `@interface` in the generated ObjC header for the class. This attribute can be thought of as a generalization of the existing `objc_runtime_visible` attribute which permits more efficient class resolution as well as supporting the additon of categories to the class. Subclassing these classes from ObjC is currently not allowed. Patch by Slava Pestov! llvm-svn: 362054
* [analyzer] SATestBuild.py: Use driver for analyzing single-file tests.Artem Dergachev2019-05-292-23/+6
| | | | | | | | Don't bother coming up with a -cc1 run-line ourselves. This, in particular, gets rid of a macOS-specific code path. llvm-svn: 362009
* [analyzer] List checker/plugin options in 3 categories: released, alpha, ↵Kristof Umann2019-05-231-0/+18
| | | | | | | | | | | | developer Same patch as D62093, but for checker/plugin options, the only difference being that options for alpha checkers are implicitly marked as alpha. Differential Revision: https://reviews.llvm.org/D62093 llvm-svn: 361566
* [analyzer] Hide developer-only checker/package options by defaultKristof Umann2019-05-231-32/+37
| | | | | | | | | These options are now only visible under -analyzer-checker-option-help-developer. Differential Revision: https://reviews.llvm.org/D61839 llvm-svn: 361561
* Clang-formatting the header in advance of other planned changes; NFC.Aaron Ballman2019-05-221-21/+37
| | | | llvm-svn: 361378
* Make clang/utils/creduce-clang-crash.py executableReid Kleckner2019-05-011-0/+0
| | | | llvm-svn: 359722
* [analyzer] Don't display implementation checkers under ↵Kristof Umann2019-05-011-2/+18
| | | | | | | | | | | | | | | | | | | | | | | -analyzer-checker-help, but do under the new flag -analyzer-checker-help-hidden During my work on analyzer dependencies, I created a great amount of new checkers that emitted no diagnostics at all, and were purely modeling some function or another. However, the user shouldn't really disable/enable these by hand, hence this patch, which hides these by default. I intentionally chose not to hide alpha checkers, because they have a scary enough name, in my opinion, to cause no surprise when they emit false positives or cause crashes. The patch introduces the Hidden bit into the TableGen files (you may remember it before I removed it in D53995), and checkers that are either marked as hidden, or are in a package that is marked hidden won't be displayed under -analyzer-checker-help. -analyzer-checker-help-hidden, a new flag meant for developers only, displays the full list. Differential Revision: https://reviews.llvm.org/D60925 llvm-svn: 359720
* creduce-clang-crash: add -F flag to grep to avoid interpreting string as regexAmy Huang2019-04-251-1/+1
| | | | llvm-svn: 359216
* Use llvm::stable_sortFangrui Song2019-04-241-6/+2
| | | | llvm-svn: 359098
* Fixes in creduce-clang-crash.py for clang crash message parsing and reading ↵Amy Huang2019-04-241-4/+9
| | | | | | the command from the repro script. llvm-svn: 359054
* [analyzer][NFC] Reimplement checker optionsKristof Umann2019-04-191-4/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TL;DR: * Add checker and package options to the TableGen files * Added a new class called CmdLineOption, and both Package and Checker recieved a list<CmdLineOption> field. * Added every existing checker and package option to Checkers.td. * The CheckerRegistry class * Received some comments to most of it's inline classes * Received the CmdLineOption and PackageInfo inline classes, a list of CmdLineOption was added to CheckerInfo and PackageInfo * Added addCheckerOption and addPackageOption * Added a new field called Packages, used in addPackageOptions, filled up in addPackage Detailed description: In the last couple months, a lot of effort was put into tightening the analyzer's command line interface. The main issue is that it's spectacularly easy to mess up a lenghty enough invocation of the analyzer, and the user was given no warnings or errors at all in that case. We can divide the effort of resolving this into several chapters: * Non-checker analyzer configurations: Gather every analyzer configuration into a dedicated file. Emit errors for non-existent configurations or incorrect values. Be able to list these configurations. Tighten AnalyzerOptions interface to disallow making such a mistake in the future. * Fix the "Checker Naming Bug" by reimplementing checker dependencies: When cplusplus.InnerPointer was enabled, it implicitly registered unix.Malloc, which implicitly registered some sort of a modeling checker from the CStringChecker family. This resulted in all of these checker objects recieving the name "cplusplus.InnerPointer", making AnalyzerOptions asking for the wrong checker options from the command line: cplusplus.InnerPointer:Optimisic istead of unix.Malloc:Optimistic. This was resolved by making CheckerRegistry responsible for checker dependency handling, instead of checkers themselves. * Checker options: (this patch included!) Same as the first item, but for checkers. (+ minor fixes here and there, and everything else that is yet to come) There were several issues regarding checker options, that non-checker configurations didn't suffer from: checker plugins are loaded runtime, and they could add new checkers and new options, meaning that unlike for non-checker configurations, we can't collect every checker option purely by generating code. Also, as seen from the "Checker Naming Bug" issue raised above, they are very rarely used in practice, and all sorts of skeletons fell out of the closet while working on this project. They were extremely problematic for users as well, purely because of how long they were. Consider the following monster of a checker option: alpha.cplusplus.UninitializedObject:CheckPointeeInitialization=false While we were able to verify whether the checker itself (the part before the colon) existed, any errors past that point were unreported, easily resulting in 7+ hours of analyses going to waste. This patch, similarly to how dependencies were reimplemented, uses TableGen to register checker options into Checkers.td, so that Checkers.inc now contains entries for both checker and package options. Using the preprocessor, Checkers.inc is converted into code in CheckerRegistry, adding every builtin (checkers and packages that have an entry in the Checkers.td file) checker and package option to the registry. The new addPackageOption and addCheckerOption functions expose the same functionality to statically-linked non-builtin and plugin checkers and packages as well. Emitting errors for incorrect user input, being able to list these options, and some other functionalies will land in later patches. Differential Revision: https://reviews.llvm.org/D57855 llvm-svn: 358752
* Remove --show-includes flag in crash reduce scriptAmy Huang2019-04-171-0/+4
| | | | llvm-svn: 358590
* Various fixes and additions to creduce-clang-crash.pyGeorge Burgess IV2019-03-291-171/+334
| | | | | | | | | | | | | | | | Some more additions to the script - mainly reducing the clang args after the creduce run by removing them one by one and seeing if the crash reproduces. Other things: - remove the --crash flag when "fatal error" occurs - fixed to read stack trace functions from the top - run creduce on a copy of the original file Patch by Amy Huang! Differential Revision: https://reviews.llvm.org/D59725 llvm-svn: 357290
* creduce-clang-crash.py: preprocess file + reduce commandlineGeorge Burgess IV2019-03-211-72/+194
| | | | | | | | | | | | | | | | | | This CL causes our creduce-clang-crash.py util to: - try to preprocess the file before reducing - try to remove some command line arguments - now require a llvm bin directory, since the generated crash script doesn't have an absolute path for clang It also marks it as executable, since I forgot to do that in the last commit. :) Patch by Amy Huang! Differential Revision: https://reviews.llvm.org/D59440 llvm-svn: 356636
* Add a creduce script for clang crashesGeorge Burgess IV2019-03-121-0/+118
| | | | | | | | | | | | This CL adds a script that calls C-Reduce on an input file and given the clang crash script, which is used to generate an interestingness test for C-Reduce. Patch by Amy Huang! Differential Revision: https://reviews.llvm.org/D59118 llvm-svn: 355944
* Use llvm::is_contained. NFCFangrui Song2019-02-101-2/+2
| | | | llvm-svn: 353635
* [analyzer] [testing] Inside CmpRuns.py output also print the filename of the ↵George Karpenkov2019-02-051-1/+22
| | | | | | | | first item in the path Differential Revision: https://reviews.llvm.org/D57783 llvm-svn: 353228
* [ASTDump] Rename methods which are conceptually VisitsStephen Kelly2019-01-301-3/+3
| | | | | | | This is consistent with the TextNodeDumper, and is the appropriate name for the traverser class which will be extracted. llvm-svn: 352657
* [analyzer] Reimplement dependencies between checkersKristof Umann2019-01-261-16/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, up until now, the fact that certain checkers depended on one another was known, but how these actually unfolded was hidden deep within the implementation. For example, many checkers (like RetainCount, Malloc or CString) modelled a certain functionality, and exposed certain reportable bug types to the user. For example, while MallocChecker models many many different types of memory handling, the actual "unix.MallocChecker" checker the user was exposed to was merely and option to this modeling part. Other than this being an ugly mess, this issue made resolving the checker naming issue almost impossible. (The checker naming issue being that if a checker registered more than one checker within its registry function, both checker object recieved the same name) Also, if the user explicitly disabled a checker that was a dependency of another that _was_ explicitly enabled, it implicitly, without "telling" the user, reenabled it. Clearly, changing this to a well structured, declarative form, where the handling of dependencies are done on a higher level is very much preferred. This patch, among the detailed things later, makes checkers declare their dependencies within the TableGen file Checkers.td, and exposes the same functionality to plugins and statically linked non-generated checkers through CheckerRegistry::addDependency. CheckerRegistry now resolves these dependencies, makes sure that checkers are added to CheckerManager in the correct order, and makes sure that if a dependency is disabled, so will be every checker that depends on it. In detail: * Add a new field to the Checker class in CheckerBase.td called Dependencies, which is a list of Checkers. * Move unix checkers before cplusplus, as there is no forward declaration in tblgen :/ * Add the following new checkers: - StackAddrEscapeBase - StackAddrEscapeBase - CStringModeling - DynamicMemoryModeling (base of the MallocChecker family) - IteratorModeling (base of the IteratorChecker family) - ValistBase - SecuritySyntaxChecker (base of bcmp, bcopy, etc...) - NSOrCFErrorDerefChecker (base of NSErrorChecker and CFErrorChecker) - IvarInvalidationModeling (base of IvarInvalidation checker family) - RetainCountBase (base of RetainCount and OSObjectRetainCount) * Clear up and registry functions in MallocChecker, happily remove old FIXMEs. * Add a new addDependency function to CheckerRegistry. * Neatly format RUN lines in files I looked at while debugging. Big thanks to Artem Degrachev for all the guidance through this project! Differential Revision: https://reviews.llvm.org/D54438 llvm-svn: 352287
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1912-48/+36
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
OpenPOWER on IntegriCloud