aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/JSONNodeDumper.cpp
AgeCommit message (Collapse)AuthorFilesLines
2020-06-12[clang] Rename Decl::isHidden() to isUnconditionallyVisible().Martin Boehme1-1/+1
Also invert the sense of the return value. As pointed out by the FIXME that this change resolves, isHidden() wasn't a very accurate name for this function. I haven't yet changed any of the strings that are output in ASTDumper.cpp / JSONNodeDumper.cpp / TextNodeDumper.cpp in response to whether isHidden() is set because a) I'm not sure whether it's actually desired to change these strings (would appreciate feedback on this), and b) In any case, I'd like to get this pure rename out of the way first, without any changes to tests. Changing the strings that are output in the various ...Dumper.cpp files will require changes to quite a few tests, and I'd like to make those in a separate change. Differential Revision: https://reviews.llvm.org/D81392 Reviewed By: rsmith
2020-06-11[clang][NFC] Generate the {Type,ArrayType,UnaryExprOrType,Expression}Traits...Bruno Ricci1-8/+1
...enumerations from TokenKinds.def and use the new macros from TokenKinds.def to remove the hard-coded lists of traits. All the information needed to generate these enumerations is already present in TokenKinds.def. The motivation here is to be able to dump the trait spelling without hard-coding the list in yet another place. Note that this change the order of the enumerators in the enumerations (except that in the TypeTrait enumeration all unary type traits are before all binary type traits, and all binary type traits are before all n-ary type traits). Apart from the aforementioned ordering which is relied upon, after this patch no code in clang or in the various clang tools depend on the specific ordering of the enumerators. No functional changes intended. Differential Revision: https://reviews.llvm.org/D81455 Reviewed By: aaron.ballman
2020-06-05PR46209: properly determine whether a copy assignment operator isRichard Smith1-0/+1
trivial. We previously took a shortcut by assuming that if a subobject had a trivial copy assignment operator (with a few side-conditions), we would always invoke it, and could avoid going through overload resolution. That turns out to not be correct in the presenve of ref-qualifiers (and also won't be the case for copy-assignments with requires-clauses either). Use the same logic for lazy declaration of copy-assignments that we use for all other special member functions. Previously committed as c57f8a3a20540fcf9fbf98c0a73f381ec32fce2a. This now also includes an extension of LLDB's workaround for handling special members without the help of Sema to cover copy assignments.
2020-06-04Revert "PR46209: properly determine whether a copy assignment operator is"Jonas Devlieghere1-1/+0
This reverts commit c57f8a3a20540fcf9fbf98c0a73f381ec32fce2a.
2020-06-04PR46209: properly determine whether a copy assignment operator isRichard Smith1-0/+1
trivial. We previously took a shortcut by assuming that if a subobject had a trivial copy assignment operator (with a few side-conditions), we would always invoke it, and could avoid going through overload resolution. That turns out to not be correct in the presenve of ref-qualifiers (and also won't be the case for copy-assignments with requires-clauses either). Use the same logic for lazy declaration of copy-assignments that we use for all other special member functions.
2020-05-27[clangd] Add access specifier information to hover contentsDaniel Martín1-7/+5
Summary: For https://github.com/clangd/clangd/issues/382 This commit adds access specifier information to the hover contents. For example, the hover information of a class field or member function will now indicate if the field or member is private, public, or protected. This can be particularly useful when a developer is in the implementation file and wants to know if a particular member definition is public or private. Reviewers: kadircet Reviewed By: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D80472
2020-04-23[NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.Puyan Lotfi1-18/+19
This is a code clean up of the PropertyAttributeKind and ObjCPropertyAttributeKind enums in ObjCPropertyDecl and ObjCDeclSpec that are exactly identical. This non-functional change consolidates these enums into one. The changes are to many files across clang (and comments in LLVM) so that everything refers to the new consolidated enum in DeclObjCCommon.h. 2nd Landing Attempt... Differential Revision: https://reviews.llvm.org/D77233
2020-04-23Revert "[NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ↵Puyan Lotfi1-19/+18
ObjCDeclSpec." This reverts commit 2aa044ed088ae41461ad7029c055014df6c60976. Reverting due to bot failure in lldb.
2020-04-22[NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.Puyan Lotfi1-18/+19
This is a code clean up of the PropertyAttributeKind and ObjCPropertyAttributeKind enums in ObjCPropertyDecl and ObjCDeclSpec that are exactly identical. This non-functional change consolidates these enums into one. The changes are to many files across clang (and comments in LLVM) so that everything refers to the new consolidated enum in DeclObjCCommon.h. Differential Revision: https://reviews.llvm.org/D77233
2020-03-10[CodeGen] Emit destructor calls to destruct compound literalsAkira Hatanaka1-1/+10
Fix a bug in IRGen where it wasn't destructing compound literals in C that are ObjC pointer arrays or non-trivial structs. Also diagnose jumps that enter or exit the lifetime of the compound literals. rdar://problem/51867864 Differential Revision: https://reviews.llvm.org/D64464
2020-02-27Avoid SourceManager.h include in RawCommentList.h, add missing incsReid Kleckner1-0/+1
SourceManager.h includes FileManager.h, which is expensive due to dependencies on LLVM FS headers. Remove dead BeforeThanCompare specialization. Sink ASTContext::addComment to cpp file. This reduces the time to compile a file that does nothing but include ASTContext.h from ~3.4s to ~2.8s for me. Saves these includes: 219 - ../clang/include/clang/Basic/SourceManager.h 204 - ../clang/include/clang/Basic/FileSystemOptions.h 204 - ../clang/include/clang/Basic/FileManager.h 165 - ../llvm/include/llvm/Support/VirtualFileSystem.h 164 - ../llvm/include/llvm/Support/SourceMgr.h 164 - ../llvm/include/llvm/Support/SMLoc.h 161 - ../llvm/include/llvm/Support/Path.h 141 - ../llvm/include/llvm/ADT/BitVector.h 128 - ../llvm/include/llvm/Support/MemoryBuffer.h 124 - ../llvm/include/llvm/Support/FileSystem.h 124 - ../llvm/include/llvm/Support/Chrono.h 124 - .../MSVCSTL/include/stack 122 - ../llvm/include/llvm-c/Types.h 122 - ../llvm/include/llvm/Support/NativeFormatting.h 122 - ../llvm/include/llvm/Support/FormatProviders.h 122 - ../llvm/include/llvm/Support/CBindingWrapping.h 122 - .../MSVCSTL/include/xtimec.h 122 - .../MSVCSTL/include/ratio 122 - .../MSVCSTL/include/chrono 121 - ../llvm/include/llvm/Support/FormatVariadicDetails.h 118 - ../llvm/include/llvm/Support/MD5.h 109 - .../MSVCSTL/include/deque 105 - ../llvm/include/llvm/Support/Host.h 105 - ../llvm/include/llvm/Support/Endian.h Reviewed By: aaron.ballman, hans Differential Revision: https://reviews.llvm.org/D75279
2020-02-18[NFC] Remove trailing spaceJim Lin1-1/+1
sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h,td}
2019-12-21[Wdocumentation] Implement \anchorMark de Wever1-0/+3
Differential revision: https://reviews.llvm.org/D69223
2019-12-03Differentiate between the presumed and actual file when dumping the AST to JSONAaron Ballman1-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.
2019-11-21[DeclCXX] Remove unknown external linkage specificationsEhud Katz1-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
2019-11-18Implement __attribute__((objc_direct)), __attribute__((objc_direct_members))Pierre Habouzit1-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
2019-11-15Include the mangled name in -ast-dump=jsonAlex Richardson1-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
2019-10-15Add more information to JSON AST dumping of source locations.Aaron Ballman1-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
2019-10-03Silence static analyzer getAs<RecordType> null dereference warnings. NFCI.Simon Pilgrim1-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
2019-09-24Support for DWARF-5 C++ language tags.Adrian Prantl1-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
2019-09-23Revert "Support for DWARF-5 C++ language tags."Jonas Devlieghere1-6/+0
This reverts commit bf9c8ffb54943c6d77398adbedddf05ef9724007. llvm-svn: 372672
2019-09-23Support for DWARF-5 C++ language tags.Adrian Prantl1-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
2019-09-04Generate parent context id from Decl* instead of DeclContext*.Aaron Ballman1-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
2019-08-29Avoid crash when dumping NULL Type as JSON.Aaron Ballman1-0/+4
Patch by Bert Belder. llvm-svn: 370401
2019-07-30Add typedef declaration information to the JSON AST dump.Aaron Ballman1-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
2019-07-12Dump actual line numbers when dumping the AST to JSON.Aaron Ballman1-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
2019-07-12Dump floating-point values as strings when dumping to JSON.Aaron Ballman1-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
2019-06-24Augment location information when dumping the AST to JSON.Aaron Ballman1-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
2019-06-21Ensure that top-level QualType objects also have a "kind" field when dumping ↵Aaron Ballman1-0/+1
the AST to JSON. llvm-svn: 364078
2019-06-21Print more type node information when dumping the AST to JSON.Aaron Ballman1-0/+20
llvm-svn: 364067
2019-06-21Print information about various type nodes when dumping the AST to JSON.Aaron Ballman1-0/+119
llvm-svn: 364043
2019-06-20Print information about various ObjC expression nodes when dumping the AST ↵Aaron Ballman1-0/+90
to JSON. llvm-svn: 363988
2019-06-20Print additional information about @encode expressions when dumping the AST ↵Aaron Ballman1-0/+4
to JSON. llvm-svn: 363966
2019-06-20Print additional information on dependent scopes when dumping the AST to JSON.Aaron Ballman1-0/+17
llvm-svn: 363965
2019-06-20Dump more information about expressions involving temporaries when dumping ↵Aaron Ballman1-0/+45
the AST to JSON. llvm-svn: 363943
2019-06-20Dump more information about construct expressions (resolved and unresolved) ↵Aaron Ballman1-0/+32
when dumping the AST to JSON. llvm-svn: 363926
2019-06-19Print whether a generic selection expression is result dependent when ↵Aaron Ballman1-0/+5
dumping the AST to JSON. llvm-svn: 363873
2019-06-19Print out the union field being initialized by an InitListExpr when dumping ↵Aaron Ballman1-0/+5
the AST to JSON. llvm-svn: 363869
2019-06-19Dump the value calculated by a constant expression when dumping the AST to JSON.Aaron Ballman1-0/+9
llvm-svn: 363866
2019-06-19Change the way we output templates for JSON AST dumping and dump information ↵Aaron Ballman1-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
2019-06-11For DR712: store on a MemberExpr whether it constitutes an odr-use.Richard Smith1-0/+6
llvm-svn: 363087
2019-06-11For DR712: store on a DeclRefExpr whether it constitutes an odr-use.Richard Smith1-0/+6
Begin restructuring to support the forms of non-odr-use reference permitted by DR712. llvm-svn: 363086
2019-05-30Add Attribute NoThrow as an Exception Specifier TypeErich Keane1-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
2019-05-27When dumping the AST to JSON, dump the type information from a typeid ↵Aaron Ballman1-0/+10
expression with a type operand. llvm-svn: 361769
2019-05-27When dumping the AST to JSON, dump whether a function is variadic or not.Aaron Ballman1-0/+2
llvm-svn: 361768
2019-05-27When dumping the AST to JSON, dump the declared name of a MemberExpr operand.Aaron Ballman1-2/+3
llvm-svn: 361767
2019-05-27When dumping the AST to JSON, dump the argument name to a sizeof pack ↵Aaron Ballman1-0/+4
expression. llvm-svn: 361766
2019-05-24Add JSON dumping tests for ObjC statements; add support for dumping @catch ↵Aaron Ballman1-0/+7
catch-all statements. llvm-svn: 361660
2019-05-24Add support for dumping Objective C AST declaration nodes to JSON.Aaron Ballman1-4/+155
llvm-svn: 361652
2019-05-21[c++20] P0780R2: Support pack-expansion of init-captures.Richard Smith1-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