summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/JSONNodeDumper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Wdocumentation] Implement \anchorMark de Wever2019-12-211-0/+3
| | | | Differential revision: https://reviews.llvm.org/D69223
* Differentiate between the presumed and actual file when dumping the AST to JSONAaron Ballman2019-12-031-3/+10
| | | | | | | | | | Currently, when dumping the AST to JSON, the presumed file is what is included when dumping a source location. This patch changes the behavior to instead dump the actual file, and only dump a presumed file name when it differs from the actual file. This also corrects an issue with the test script generator that would prevent it from working on Windows due to file permissions issues.
* [DeclCXX] Remove unknown external linkage specificationsEhud Katz2019-11-211-6/+0
| | | | | | | | | | | | | | | | Partial revert of r372681 "Support for DWARF-5 C++ language tags". The change introduced new external linkage languages ("C++11" and "C++14") which not supported in C++. It also changed the definition of the existing enum to use the DWARF constants. The problem is that "LinkageSpecDeclBits.Language" (the field that reserves this enum) is actually defined as 3 bits length (bitfield), which cannot contain the new DWARF constants. Defining the enum as integer literals is more appropriate for maintaining valid values. Differential Revision: https://reviews.llvm.org/D69935
* Implement __attribute__((objc_direct)), __attribute__((objc_direct_members))Pierre Habouzit2019-11-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __attribute__((objc_direct)) is an attribute on methods declaration, and __attribute__((objc_direct_members)) on implementation, categories or extensions. A `direct` property specifier is added (@property(direct) type name) These attributes / specifiers cause the method to have no associated Objective-C metadata (for the property or the method itself), and the calling convention to be a direct C function call. The symbol for the method has enforced hidden visibility and such direct calls are hence unreachable cross image. An explicit C function must be made if so desired to wrap them. The implicit `self` and `_cmd` arguments are preserved, however to maintain compatibility with the usual `objc_msgSend` semantics, 3 fundamental precautions are taken: 1) for instance methods, `self` is nil-checked. On arm64 backends this typically adds a single instruction (cbz x0, <closest-ret>) to the codegen, for the vast majority of the cases when the return type is a scalar. 2) for class methods, because the class may not be realized/initialized yet, a call to `[self self]` is emitted. When the proper deployment target is used, this is optimized to `objc_opt_self(self)`. However, long term we might want to emit something better that the optimizer can reason about. When inlining kicks in, these calls aren't optimized away as the optimizer has no idea that a single call is really necessary. 3) the calling convention for the `_cmd` argument is changed: the caller leaves the second argument to the call undefined, and the selector is loaded inside the body when it's referenced only. As far as error reporting goes, the compiler refuses: - making any overloads direct, - making an overload of a direct method, - implementations marked as direct when the declaration in the interface isn't (the other way around is allowed, as the direct attribute is inherited from the declaration), - marking methods required for protocol conformance as direct, - messaging an unqualified `id` with a direct method, - forming any @selector() expression with only direct selectors. As warnings: - any inconsistency of direct-related calling convention when @selector() or messaging is used, - forming any @selector() expression with a possibly direct selector. Lastly an `objc_direct_members` attribute is added that can decorate `@implementation` blocks and causes methods only declared there (and in no `@interface`) to be automatically direct. When decorating an `@interface` then all methods and properties declared in this block are marked direct. Radar-ID: rdar://problem/2684889 Differential Revision: https://reviews.llvm.org/D69991 Reviewed-By: John McCall
* Include the mangled name in -ast-dump=jsonAlex Richardson2019-11-151-1/+5
| | | | | | | | | | | | | | | | | | | | I am planning to use this feature to make update_cc_test_checks.py less fragile by obtaining the mangled names directly from -ast-dump=json. Currently, it uses c-index-test which ignores the -triple=, etc. arguments that are in the RUN: line and therefore does not generate checks for some targets. The AST dump tests were updated using the following command: `python $LLVM_BINDIR/gen_ast_dump_json_test.py --update --source $LLVM_SRC/clang/test/AST/*-json.*` Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: rsmith, MaskRay, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69564
* Add more information to JSON AST dumping of source locations.Aaron Ballman2019-10-151-0/+24
| | | | | | This adds information about the offset within the source file to the given source location as well as information about the include file a location is from. These pieces of information allow for more efficient post-processing of JSON AST dumps. llvm-svn: 374921
* Silence static analyzer getAs<RecordType> null dereference warnings. NFCI.Simon Pilgrim2019-10-031-1/+1
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<RecordType> directly and if not assert will fire for us. llvm-svn: 373584
* Support for DWARF-5 C++ language tags.Adrian Prantl2019-09-241-0/+6
| | | | | | | | | | | | This patch provides support for DW_LANG_C_plus_plus_11, DW_LANG_C_plus_plus_14 tags in the Clang C++ frontend. Patch by Sourabh Singh Tomar! Differential Revision: https://reviews.llvm.org/D67613 Reapplies r372663 after adapting a failing test in the LLDB testsuite. llvm-svn: 372681
* Revert "Support for DWARF-5 C++ language tags."Jonas Devlieghere2019-09-231-6/+0
| | | | | | This reverts commit bf9c8ffb54943c6d77398adbedddf05ef9724007. llvm-svn: 372672
* Support for DWARF-5 C++ language tags.Adrian Prantl2019-09-231-0/+6
| | | | | | | | | | This patch provides support for DW_LANG_C_plus_plus_11, DW_LANG_C_plus_plus_14 tags in the Clang C++ frontend. Patch by Sourabh Singh Tomar! Differential Revision: https://reviews.llvm.org/D67613 llvm-svn: 372663
* Generate parent context id from Decl* instead of DeclContext*.Aaron Ballman2019-09-041-3/+8
| | | | | | | | | | | | | Because of multiple inheritance, a DeclContext pointer does not produce the same pointer representation as a Decl pointer that references the same AST Node. When dumping the parentDeclContextId field of a node, convert the pointer to Decl* first, so the id can be used to find the AST node it references. Patch by Bert Belder. llvm-svn: 370970
* Avoid crash when dumping NULL Type as JSON.Aaron Ballman2019-08-291-0/+4
| | | | | | Patch by Bert Belder. llvm-svn: 370401
* Add typedef declaration information to the JSON AST dump.Aaron Ballman2019-07-301-0/+2
| | | | | | When dumping a desugared QualType and the type is a type alias, also print out the id for the type alias declaration. llvm-svn: 367312
* Dump actual line numbers when dumping the AST to JSON.Aaron Ballman2019-07-121-10/+19
| | | | | | The "line" attribute is now the physical line within the source file for the location. A "presumedLine" attribute is printed when the presumed line number does not match the given source line number. We continue to not print repeated line information in subsequent source locations, but we track presumed and actual lines separately. llvm-svn: 365919
* Dump floating-point values as strings when dumping to JSON.Aaron Ballman2019-07-121-1/+3
| | | | | | This fixes a bug where we would have an invalid JSON attribute (e.g., "value": inf). It also increases the precision of the values because they're not represented as approximate doubles with the host architecture's floating-point model. llvm-svn: 365900
* Augment location information when dumping the AST to JSON.Aaron Ballman2019-06-241-33/+44
| | | | | | Rather than create JSON objects for source locations and ranges, we instead stream them out directly. This allows us to elide duplicate information (without JSON field reordering causing an issue) like file names and line numbers, similar to the text dump. This also adds token length information when dumping the source location. llvm-svn: 364226
* Ensure that top-level QualType objects also have a "kind" field when dumping ↵Aaron Ballman2019-06-211-0/+1
| | | | | | the AST to JSON. llvm-svn: 364078
* Print more type node information when dumping the AST to JSON.Aaron Ballman2019-06-211-0/+20
| | | | llvm-svn: 364067
* Print information about various type nodes when dumping the AST to JSON.Aaron Ballman2019-06-211-0/+119
| | | | llvm-svn: 364043
* Print information about various ObjC expression nodes when dumping the AST ↵Aaron Ballman2019-06-201-0/+90
| | | | | | to JSON. llvm-svn: 363988
* Print additional information about @encode expressions when dumping the AST ↵Aaron Ballman2019-06-201-0/+4
| | | | | | to JSON. llvm-svn: 363966
* Print additional information on dependent scopes when dumping the AST to JSON.Aaron Ballman2019-06-201-0/+17
| | | | llvm-svn: 363965
* Dump more information about expressions involving temporaries when dumping ↵Aaron Ballman2019-06-201-0/+45
| | | | | | the AST to JSON. llvm-svn: 363943
* Dump more information about construct expressions (resolved and unresolved) ↵Aaron Ballman2019-06-201-0/+32
| | | | | | when dumping the AST to JSON. llvm-svn: 363926
* Print whether a generic selection expression is result dependent when ↵Aaron Ballman2019-06-191-0/+5
| | | | | | dumping the AST to JSON. llvm-svn: 363873
* Print out the union field being initialized by an InitListExpr when dumping ↵Aaron Ballman2019-06-191-0/+5
| | | | | | the AST to JSON. llvm-svn: 363869
* Dump the value calculated by a constant expression when dumping the AST to JSON.Aaron Ballman2019-06-191-0/+9
| | | | llvm-svn: 363866
* Change the way we output templates for JSON AST dumping and dump information ↵Aaron Ballman2019-06-191-0/+67
| | | | | | | | about template arguments. Previously, we attempted to write out template parameters and specializations to their own array, but due to the architecture of the ASTNodeTraverser, this meant that other nodes were not being written out. This now follows the same behavior as the regular AST dumper and puts all the (correct) information into the "inner" array. When we correct the AST node traverser itself, we can revisit splitting this information into separate arrays again. llvm-svn: 363819
* For DR712: store on a MemberExpr whether it constitutes an odr-use.Richard Smith2019-06-111-0/+6
| | | | llvm-svn: 363087
* For DR712: store on a DeclRefExpr whether it constitutes an odr-use.Richard Smith2019-06-111-0/+6
| | | | | | | Begin restructuring to support the forms of non-odr-use reference permitted by DR712. llvm-svn: 363086
* Add Attribute NoThrow as an Exception Specifier TypeErich Keane2019-05-301-1/+3
| | | | | | | | | | | | | | | In response to https://bugs.llvm.org/show_bug.cgi?id=33235, it became clear that the current mechanism of hacking through checks for the exception specification of a function gets confused really quickly when there are alternate exception specifiers. This patch introcues EST_NoThrow, which is the equivilent of EST_noexcept when caused by EST_noThrow. The existing implementation is left in place to cover functions with no FunctionProtoType. Differential Revision: https://reviews.llvm.org/D62435 llvm-svn: 362119
* When dumping the AST to JSON, dump the type information from a typeid ↵Aaron Ballman2019-05-271-0/+10
| | | | | | expression with a type operand. llvm-svn: 361769
* When dumping the AST to JSON, dump whether a function is variadic or not.Aaron Ballman2019-05-271-0/+2
| | | | llvm-svn: 361768
* When dumping the AST to JSON, dump the declared name of a MemberExpr operand.Aaron Ballman2019-05-271-2/+3
| | | | llvm-svn: 361767
* When dumping the AST to JSON, dump the argument name to a sizeof pack ↵Aaron Ballman2019-05-271-0/+4
| | | | | | expression. llvm-svn: 361766
* Add JSON dumping tests for ObjC statements; add support for dumping @catch ↵Aaron Ballman2019-05-241-0/+7
| | | | | | catch-all statements. llvm-svn: 361660
* Add support for dumping Objective C AST declaration nodes to JSON.Aaron Ballman2019-05-241-4/+155
| | | | llvm-svn: 361652
* [c++20] P0780R2: Support pack-expansion of init-captures.Richard Smith2019-05-211-0/+1
| | | | | | | | | | | This permits an init-capture to introduce a new pack: template<typename ...T> auto x = [...a = T()] { /* a is a pack */ }; To support this, the mechanism for allowing ParmVarDecls to be packs has been extended to support arbitrary local VarDecls. llvm-svn: 361300
* Add support for dumping AST comment nodes to JSON.Aaron Ballman2019-05-211-1/+139
| | | | llvm-svn: 361265
* Add more tests for AST JSON output; NFC.Aaron Ballman2019-05-201-1/+3
| | | | | | This adds tests for dumping expressions in C. It also updates a comment to note an issue to be fixed with printing character literals discovered as part of this testing. llvm-svn: 361193
* Dump macro expansion information as needed when outputting the AST to JSON.Aaron Ballman2019-05-201-3/+25
| | | | llvm-svn: 361172
* Introduce the ability to dump the AST to JSON.Aaron Ballman2019-05-131-0/+781
This adds the -ast-dump=json cc1 flag (in addition to -ast-dump=default, which is the default if no dump format is specified), as well as some initial AST dumping functionality and tests. llvm-svn: 360622
OpenPOWER on IntegriCloud