summaryrefslogtreecommitdiffstats
path: root/clang/utils
Commit message (Collapse)AuthorAgeFilesLines
* [OpenCL] Microoptimize OCL2Qual a bitBenjamin Kramer2019-08-241-9/+11
| | | | | | Still not optimal, but makes clang 25k smaller. llvm-svn: 369846
* Retire llvm::less_ptr. llvm::deref is much more flexible.Benjamin Kramer2019-08-221-2/+2
| | | | llvm-svn: 369675
* [OpenCL] Add const, volatile and pointer builtin handlingSven van Haastregt2019-08-201-2/+36
| | | | | | | | | | | | | | Const, volatile, and pointer types were previously available, but not working. This patch adds handling for OpenCL builtin functions. Add TableGen definitions for some atomic and asynchronous builtins to make use of the new functionality. Patch by Pierre Gondois and Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D63442 llvm-svn: 369373
* [OpenCL] Add generic type handling for builtin functionsSven van Haastregt2019-08-191-103/+326
| | | | | | | | | | | | | | | | | | Generic types are an abstraction of type sets. It mimics the way functions are defined in the OpenCL specification. For example, floatN can abstract all the vector sizes of the float type. This allows to * stick more closely to the specification, which uses generic types; * factorize definitions of functions with numerous prototypes in the tablegen file; and * reduce the memory impact of functions with many overloads. Patch by Pierre Gondois and Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D65456 llvm-svn: 369253
* [Clang] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-142-26/+26
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368942
* [analyzer] exploded-graph-rewriter: Implement displaying Store pointers.Artem Dergachev2019-08-131-0/+4
| | | | | | | | | They're useful when trying to understand what's going on inside your LazyCompoundValues. Differential Revision: https://reviews.llvm.org/D65427 llvm-svn: 368769
* [analyzer] exploded-graph-rewriter: Implement manual graph trimming.Artem Dergachev2019-08-131-0/+54
| | | | | | | | | | | | | | | | | | | When -trim-egraph is unavailable (say, when you're debugging a crash on a real-world code that takes too long to reduce), it makes sense to view the untrimmed graph up to the crashing node's predecessor, then dump the ID (or a pointer) of the node in the attached debugger, and then trim the dumped graph in order to keep only paths from the root to the node. The newly added --to flag does exactly that: $ exploded-graph-rewriter.py ExprEngine.dot --to 0x12229acd0 Multiple nodes can be specified. Stable IDs of nodes can be used instead of pointers. Differential Revision: https://reviews.llvm.org/D65345 llvm-svn: 368768
* [analyzer] exploded-graph-rewriter: NFC: Refactor explorers into trimmers.Artem Dergachev2019-08-131-26/+33
| | | | | | | | | | | | | | | | | | | | | | | Explorers aren't the right abstraction. For the purposes of displaying svg files we don't care in which order do we explore the nodes. We may care about this for other analyses, but we're not there yet. The function of cutting out chunks of the graph is performed poorly by the explorers, because querying predecessors/successors on the explored nodes yields original successors/predecessors even if they aren't being explored. Introduce a new entity, "trimmers", that do one thing but to it right: cut out chunks of the graph. Trimmers mutate the graph, so stale edges aren't even visible to their consumers in the pipeline. Additionally, trimmers are intrinsically composable: multiple trimmers can be applied to the graph sequentially. Refactor the single-path explorer into the single-path trimmer. Rename the test file for consistency. Differential Revision: https://reviews.llvm.org/D65344 llvm-svn: 368767
* [analyzer] exploded-graph-rewriter: Open the converted graph immediately.Artem Dergachev2019-08-131-7/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | Change the default behavior: the tool no longer dumps the rewritten .dot file to stdout, but instead it automatically converts it into an .html file (which essentially wraps an .svg file) and immediately opens it with the default web browser. This means that the tool should now be fairly easy to use: $ exploded-graph-rewriter.py /tmp/ExprEngine.dot The benefits of wrapping the .svg file into an .html file are: - It'll open in a web browser, which is the intended behavior. An .svg file would be open with an image viewer/editor instead. - It avoids the white background around the otherwise dark svg area in dark mode. The feature can be turned off by passing a flag '--rewrite-only'. The LIT substitution is updated to enforce the old mode because we don't want web browsers opening on our buildbots. Differential Revision: https://reviews.llvm.org/D65250 llvm-svn: 368766
* Improve MSVC visualizations so the parser shows where we are in the codeMike Spertus2019-08-061-0/+46
| | | | | | Also provide a visualizer for lambda introducers llvm-svn: 368029
* Improve MSVC visualizers for DeclSpec and TemplateNameMike Spertus2019-07-291-2/+79
| | | | | | | | DeclSpec now shows the TypeRep, ExprRep, or DeclRep as appropriate TemplateName decodes and displays the StorageType A few minor refinements to other types llvm-svn: 367199
* Add lifetime categories attributesMatthias Gehre2019-07-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first part of work announced in "[RFC] Adding lifetime analysis to clang" [0], i.e. the addition of the [[gsl::Owner(T)]] and [[gsl::Pointer(T)]] attributes, which will enable user-defined types to participate in the lifetime analysis (which will be part of the next PR). The type `T` here is called "DerefType" in the paper, and denotes the type that an Owner owns and a Pointer points to. E.g. `std::vector<int>` should be annotated with `[[gsl::Owner(int)]]` and a `std::vector<int>::iterator` with `[[gsl::Pointer(int)]]`. [0] http://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63954 llvm-svn: 367040
* Revert "NFC: utils/perf-training: Python 3 compatibility for lit.cfg"Azharuddin Mohammed2019-07-241-1/+1
| | | | | | | | | This reverts commit 9178b10163f758cbf8a5290ea6a827990427ddc0 (r365969). We are back to using Python2 and this is failing. This should instead be made to be compatible with both Python 2 and 3. llvm-svn: 366953
* [OpenCL] Make TableGen'd builtin tables and helper functions staticTom Stellard2019-07-151-3/+3
| | | | | | | | | | | | | | Reviewers: Pierre, Anastasia Reviewed By: Anastasia Subscribers: yaxunl, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64608 llvm-svn: 366143
* Template-related improvements to Visual Studio visualizersMike Spertus2019-07-131-7/+48
| | | | llvm-svn: 366007
* This reverts commit 632a36bfcfc8273c1861f04ff6758d863c47c784.Sylvestre Ledru2019-07-131-0/+1
| | | | | | | | | | | | Some targets such as Python 2.7.16 still use VERSION in their builds. Without VERSION defined, the source code has syntax errors. Reverting as it will probably break many other things. Noticed by Sterling Augustine llvm-svn: 365992
* NFC: utils/perf-training: Python 3 compatibility for lit.cfgAlex Lorenz2019-07-121-1/+1
| | | | | | The output of subprocess.check_output is now bytes. We need to decode it. llvm-svn: 365969
* Remove __VERSION__Sylvestre Ledru2019-07-121-1/+0
| | | | | | | | | | | | | | | | | | | | Summary: It has been introduced in 2011 for gcc compat: https://github.com/llvm-mirror/clang/commit/ad1a4c6e89594e704775ddb6b036ac982fd68cad it is probably time to remove it Reviewers: rnk, dexonsmith Reviewed By: rnk Subscribers: dschuff, aheejin, fedor.sergeev, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64062 llvm-svn: 365962
* [analyzer] exploded-graph-rewriter: Improve source location dumps.Artem Dergachev2019-07-121-26/+38
| | | | | | | | - Correctly display macro expansion and spelling locations. - Use the same procedure to display location context call site locations. - Display statement IDs for program points. llvm-svn: 365861
* [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
OpenPOWER on IntegriCloud