summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTDumper.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [AST] Store "UsesADL" information in CallExpr.Eric Fiselier2018-12-121-0/+6
| | | | | | | | | | | | | | | | | | | | | Summary: Currently the Clang AST doesn't store information about how the callee of a CallExpr was found. Specifically if it was found using ADL. However, this information is invaluable to tooling. Consider a tool which renames usages of a function. If the originally CallExpr was formed using ADL, then the tooling may need to additionally qualify the replacement. Without information about how the callee was found, the tooling is left scratching it's head. Additionally, we want to be able to match ADL calls as quickly as possible, which means avoiding computing the answer on the fly. This patch changes `CallExpr` to store whether it's callee was found using ADL. It does not change the size of any AST nodes. Reviewers: fowles, rsmith, klimek, shafik Reviewed By: rsmith Subscribers: aaron.ballman, riccibruno, calabrese, titus, cfe-commits Differential Revision: https://reviews.llvm.org/D55534 llvm-svn: 348977
* Revert "[OpenCL] Add generic AS to 'this' pointer"Mikael Nilsson2018-12-121-4/+3
| | | | | | Reverting because the patch broke lldb. llvm-svn: 348931
* [OpenCL] Add generic AS to 'this' pointerMikael Nilsson2018-12-121-3/+4
| | | | | | | | | | Address spaces are cast into generic before invoking the constructor. Added support for a trailing Qualifiers object in FunctionProtoType. Differential Revision: https://reviews.llvm.org/D54862 llvm-svn: 348927
* Revert "Change InitListExpr dump to label and pointer"Stephen Kelly2018-12-101-5/+4
| | | | | | This reverts commit r348794. llvm-svn: 348799
* Fix nitsStephen Kelly2018-12-101-8/+7
| | | | llvm-svn: 348798
* Re-order content of template parameter dumpsStephen Kelly2018-12-101-17/+26
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55393 llvm-svn: 348797
* Re-order content in OMPDeclareReductionDecl dumpStephen Kelly2018-12-101-3/+7
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55395 llvm-svn: 348795
* Change InitListExpr dump to label and pointerStephen Kelly2018-12-101-4/+5
| | | | | | | | | | | | Summary: Don't add a child just for the label. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55495 llvm-svn: 348794
* NFC: Rename TemplateDecl dump utilitiesStephen Kelly2018-12-091-18/+17
| | | | | | | | | | There is a clang::TemplateDecl AST type, so a method called VisitTemplateDecl looks like it should 'override' the method from the base visitor, but it does not because of the extra parameters it takes. In reality, these methods are utilities, so name them like utilities. llvm-svn: 348720
* NFC: Move dump of individual comment nodes to NodeDumperStephen Kelly2018-12-091-152/+2
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55190 llvm-svn: 348719
* Revert "Introduce optional labels to dumpStmt"Stephen Kelly2018-12-091-15/+6
| | | | | | This reverts commit 933402caa09963792058198578522a95f013c69c. llvm-svn: 348718
* Introduce optional labels to dumpStmtStephen Kelly2018-12-091-6/+15
| | | | | | | | If the label is present, it is added as a child, with the statement a child of the label. This preserves behavior of the InitListExpr dump output. llvm-svn: 348717
* Inline hasNodes into only callerStephen Kelly2018-12-091-13/+8
| | | | | | It is easier to refactor with fewer utility methods. llvm-svn: 348716
* Inline dumpFullComment into callersStephen Kelly2018-12-091-10/+7
| | | | | | | It causes confusion over whether it or dumpComment is the more important. It is easier to refactor with fewer utility methods. llvm-svn: 348715
* Re-order content from InitListExprStephen Kelly2018-12-091-4/+4
| | | | | | | | | | | | | | Summary: This causes no change in the output of ast-dump-stmt.cpp due to the way child nodes are printed with a delay. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55398 llvm-svn: 348714
* NFC: Move VisitExpr code to dumpStmtStephen Kelly2018-12-061-89/+38
| | | | | | | | | | | | | | | | Summary: The call is duplicated in the handlers of all Expr subclasses. This change makes it easy to split statement handling out to TextNodeDumper. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55339 llvm-svn: 348546
* NFC: Move VisitStmt code to dumpStmtStephen Kelly2018-12-061-23/+6
| | | | | | | | | | | | Summary: This call is duplicated in Visits of all direct subclasses of Stmt. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55338 llvm-svn: 348545
* NFC: Extract TextNodeDumper classStephen Kelly2018-12-051-253/+119
| | | | | | | | | | | | | | | Summary: Start by moving some utilities to it. It will eventually house dumping of individual nodes (after indentation etc has already been accounted for). Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55189 llvm-svn: 348412
* NFC: Extract TextTreeStructure classStephen Kelly2018-12-051-145/+6
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55188 llvm-svn: 348410
* NFC: Inline handling of DependentSizedArrayTypeStephen Kelly2018-12-051-1/+7
| | | | | | | | | | | | | | | | Summary: Re-order handling of getElementType and getBracketsRange. It is necessary to perform all printing before any traversal to child nodes. This causes no change in the output of ast-dump-array.cpp due to the way child nodes are printed with a delay. This new order of the code is also the order that produces the expected output anyway. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55257 llvm-svn: 348409
* NFC: Simplify dumpStmt child handlingStephen Kelly2018-12-031-8/+3
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55068 llvm-svn: 348189
* Replace FullComment member being visited with parameterStephen Kelly2018-12-021-37/+49
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55070 llvm-svn: 348101
* Remove unecessary methodsStephen Kelly2018-12-021-10/+0
| | | | | | The base class calls VisitExpr llvm-svn: 348099
* Revert "NFC: Fix case of CommentVisitor::Visit methods"Stephen Kelly2018-11-291-21/+21
| | | | | | This reverts commit 0859c80137ac5fb3c86e7802cb8c5ef56f921cce. llvm-svn: 347905
* NFC: Fix case of CommentVisitor::Visit methodsStephen Kelly2018-11-291-21/+21
| | | | | | | This difference is very visible because it is used with other Visitor classes together. llvm-svn: 347901
* NFC: Move ColorScope to global scopeStephen Kelly2018-11-291-56/+58
| | | | llvm-svn: 347900
* NFC: Constify ShowColorsStephen Kelly2018-11-291-1/+1
| | | | llvm-svn: 347899
* [AST] Only store the needed data in WhileStmtBruno Ricci2018-10-301-0/+7
| | | | | | | | | | | | Don't store the data for the condition variable if not needed. This cuts the size of WhileStmt by up to a pointer. The order of the children is kept the same. Differential Revision: https://reviews.llvm.org/D53715 Reviewed By: rjmccall llvm-svn: 345597
* [AST] Only store the needed data in SwitchStmtBruno Ricci2018-10-291-0/+9
| | | | | | | | | | | | | | | | Don't store the data for the init statement and condition variable if not needed. This cuts the size of SwitchStmt by up to 2 pointers. The order of the children is intentionally kept the same. Also use the newly available space in the bit-fields of Stmt to store the bit representing whether all enums have been covered instead of using a PointerIntPair. Differential Revision: https://reviews.llvm.org/D53714 Reviewed By: rjmccall llvm-svn: 345510
* [AST] Don't store data for GNU range case statement if not neededBruno Ricci2018-10-281-0/+7
| | | | | | | | | | | | | | | | Don't store the data for case statements of the form LHS ... RHS if not needed. This cuts the size of CaseStmt by 1 pointer + 1 SourceLocation in the common case. Also use the newly available space in the bit-fields of Stmt to store the keyword location of SwitchCase and move the small accessor SwitchCase::getSubStmt to the header. Differential Revision: https://reviews.llvm.org/D53609 Reviewed By: rjmccall llvm-svn: 345472
* [AST] Only store the needed data in IfStmtBruno Ricci2018-10-271-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | Only store the needed data in IfStmt. This cuts the size of IfStmt by up to 3 pointers + 1 SourceLocation. The order of the children is intentionally kept the same even though it would be more convenient to put the optional trailing objects last. Additionally use the newly available space in the bit-fields of Stmt to store the location of the "if". The result of this is that for the common case of an if statement of the form: if (some_cond) some_statement the size of IfStmt is brought down to 8 bytes + 2 pointers, instead of 8 bytes + 5 pointers + 2 SourceLocation. Differential Revision: https://reviews.llvm.org/D53607 Reviewed By: rjmccall llvm-svn: 345464
* [AST] Refactor PredefinedExprBruno Ricci2018-10-271-1/+1
| | | | | | | | | | | | | | | | | | Make the following changes to PredefinedExpr: 1. Move PredefinedExpr below StringLiteral so that it can use its definition. 2. Rename IdentType to IdentKind to be more in line with clang's conventions, and propagate the change to its users. 3. Move the location and the IdentKind into the newly available space of the bit-fields of Stmt. 4. Only store the function name when needed. When parsing all of Boost, of the 1357 PredefinedExpr 919 have no function name. Differential Revision: https://reviews.llvm.org/D53605 Reviewed By: rjmccall llvm-svn: 345460
* PR26547: alignof should return ABI alignment, not preferred alignmentRichard Smith2018-10-261-0/+3
| | | | | | | | | | | | Summary: - Add `UETT_PreferredAlignOf` to account for the difference between `__alignof` and `alignof` - `AlignOfType` now returns ABI alignment instead of preferred alignment iff clang-abi-compat > 7, and one uses _Alignof or alignof Patch by Nicole Mazzuca! Differential Revision: https://reviews.llvm.org/D53207 llvm-svn: 345419
* [OPENMP] Add support for OMP5 requires directive + unified_address clauseKelvin Li2018-09-261-0/+21
| | | | | | | | | Add support for OMP5.0 requires directive and unified_address clause. Patches to follow will include support for additional clauses. Differential Revision: https://reviews.llvm.org/D52359 llvm-svn: 343063
* Consistently create a new declaration when merging a pre-existing butRichard Smith2018-09-121-0/+9
| | | | | | | | | | | | | | | | hidden definition with a would-be-parsed redefinition. This permits a bunch of cleanups. In particular, we no longer need to take merged definitions into account when checking declaration visibility, only when checking definition visibility, which makes certain visibility checks take linear instead of quadratic time. We could also now remove the UPD_DECL_EXPORTED update record and track on each declaration whether it was demoted from a definition (as we already do for variables), but I'm not doing that in this patch to keep the changes here simpler. llvm-svn: 342018
* Add space to TemplateArgument dumpRichard Trieu2018-08-211-1/+1
| | | | | | | Add a missing space when dumping a template argument which is a template expansion. Found during debugging so no test. llvm-svn: 340357
* Port getLocEnd -> getEndLocStephen Kelly2018-08-091-1/+1
| | | | | | | | | | Reviewers: teemperor! Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50351 llvm-svn: 339386
* Port getLocStart -> getBeginLocStephen Kelly2018-08-091-1/+1
| | | | | | | | | | Reviewers: teemperor! Subscribers: jholewinski, whisperity, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50350 llvm-svn: 339385
* Remove trailing spaceFangrui Song2018-07-301-1/+1
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
* [AST] Sink 'part of explicit cast' down into ImplicitCastExprRoman Lebedev2018-07-271-1/+5
| | | | | | | | | | | | | | | | | | | | | | | Summary: As discussed in IRC with @rsmith, it is slightly not good to keep that in the `CastExpr` itself: Given the explicit cast, which is represented in AST as an `ExplicitCastExpr` + `ImplicitCastExpr`'s, only the `ImplicitCastExpr`'s will be marked as `PartOfExplicitCast`, but not the `ExplicitCastExpr` itself. Thus, it is only ever `true` for `ImplicitCastExpr`'s, so we don't need to write/read/dump it for `ExplicitCastExpr`'s. We don't need to worry that we write the `PartOfExplicitCast` in PCH after `CastExpr::path_iterator`, since the `ExprImplicitCastAbbrev` is only used when the `NumBaseSpecs == 0`, i.e. there is no 'path'. Reviewers: rsmith, rjmccall, erichkeane, aaron.ballman Reviewed By: rsmith, erichkeane Subscribers: vsk, cfe-commits, rsmith Tags: #clang Differential Revision: https://reviews.llvm.org/D49838 llvm-svn: 338108
* [Sema] Mark implicitly-inserted ICE's as being part of explicit cast (PR38166)Roman Lebedev2018-07-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As discussed in [[ https://bugs.llvm.org/show_bug.cgi?id=38166 | PR38166 ]], we need to be able to distinqush whether the cast we are visiting is actually a cast, or part of an `ExplicitCast`. There are at least four ways to get there: 1. Introduce a new `CastKind`, and use it instead of `IntegralCast` if we are in `ExplicitCast`. Would work, but does not scale - what if we will need more of these cast kinds? 2. Introduce a flag in `CastExprBits`, whether this cast is part of `ExplicitCast` or not. Would work, but it isn't immediately clear where it needs to be set. 2. Fix `ScalarExprEmitter::VisitCastExpr()` to visit these `NoOp` casts. As pointed out by @rsmith, CodeGenFunction::EmitMaterializeTemporaryExpr calls skipRValueSubobjectAdjustments, which steps over the CK_NoOp cast`, which explains why we currently don't visit those. This is probably impossible, as @efriedma points out, that is intentional as per `[class.temporary]` in the standard 3. And the simplest one, just record which NoOp casts we skip. It just kinda works as-is afterwards. But, the approach with a flag is the least intrusive one, and is probably the best one overall. Reviewers: rsmith, rjmccall, majnemer, efriedma Reviewed By: rsmith Subscribers: cfe-commits, aaron.ballman, vsk, llvm-commits, rsmith Differential Revision: https://reviews.llvm.org/D49508 llvm-svn: 337815
* [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point LiteralsLeonard Chan2018-06-201-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This diff includes the logic for setting the precision bits for each primary fixed point type in the target info and logic for initializing a fixed point literal. Fixed point literals are declared using the suffixes ``` hr: short _Fract uhr: unsigned short _Fract r: _Fract ur: unsigned _Fract lr: long _Fract ulr: unsigned long _Fract hk: short _Accum uhk: unsigned short _Accum k: _Accum uk: unsigned _Accum ``` Errors are also thrown for illegal literal values ``` unsigned short _Accum u_short_accum = 256.0uhk; // expected-error{{the integral part of this literal is too large for this unsigned _Accum type}} ``` Differential Revision: https://reviews.llvm.org/D46915 llvm-svn: 335148
* Revert rC330794 and some dependent tiny bug fixes Faisal Vali2018-04-261-7/+0
| | | | | | | | | | | | | | See Richard's humbling feedback here: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226482.html http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226486.html Wish I'd had the patience to solicit the feedback prior to committing :) Sorry for the noise guys. Thank you Richard for being the steward that clang deserves! llvm-svn: 330888
* [c++2a] [concepts] Add rudimentary parsing support for template concept ↵Faisal Vali2018-04-251-0/+7
| | | | | | | | | | | | | | declarations This patch is a tweak of changyu's patch: https://reviews.llvm.org/D40381. It differs in that the recognition of the 'concept' token is moved into the machinery that recognizes declaration-specifiers - this allows us to leverage the attribute handling machinery more seamlessly. See the test file to get a sense of the basic parsing that this patch supports. There is much more work to be done before concepts are usable... Thanks Changyu! llvm-svn: 330794
* Clean carriage returns from lib/ and include/. NFC.Malcolm Parsons2018-04-161-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Clean carriage returns from lib/ and include/. NFC. (I have to make this change locally in order for `git diff` to show sane output after I edit a file, so I might as well ask for it to be committed. I don't have commit privs myself.) (Without this patch, `git rebase`ing any change involving SemaDeclCXX.cpp is a real nightmare. :( So while I have no right to ask for this to be committed, geez would it make my workflow easier if it were.) Here's the command I used to reformat things. (Requires bash and OSX/FreeBSD sed.) git grep -l $'\r' lib include | xargs sed -i -e $'s/\r//' find lib include -name '*-e' -delete Reviewers: malcolm.parsons Reviewed By: malcolm.parsons Subscribers: emaste, krytarowski, cfe-commits Differential Revision: https://reviews.llvm.org/D45591 Patch by Arthur O'Dwyer. llvm-svn: 330112
* Implement C++ DR727, which permits explicit specializations at class scope.Richard Smith2018-03-161-1/+1
| | | | | | | | | More generally, this permits a template to be specialized in any scope in which it could be defined, so this also supersedes DR44 and DR374 (the latter of which we previously only implemented in C++11 mode onwards due to unclarity as to whether it was a DR). llvm-svn: 327705
* Ensure code complete with !LoadExternal sees all local decls.Sam McCall2018-01-161-5/+4
| | | | | | | | | | | | | | | | | | | | | Summary: noload_lookups() was too lazy: in addition to avoiding external decls, it avoided populating the lazy lookup structure for internal decls. This is the right behavior for the existing callsite in ASTDumper, but I think it's not a very useful default, so we populate it by default. While here: - remove an unused test file accidentally added in r322371. - remove lookups_begin()/lookups_end() in favor of lookups().begin(), which is more common and more efficient. Reviewers: ilya-biryukov Subscribers: cfe-commits, rsmith Differential Revision: https://reviews.llvm.org/D42077 llvm-svn: 322548
* Track in the AST whether the operand to a UnaryOperator can overflow and ↵Aaron Ballman2018-01-091-6/+8
| | | | | | then use that logic when evaluating constant expressions and emitting codegen. llvm-svn: 322074
* Add AST dumping support for _Generic expressions.Richard Smith2018-01-051-0/+32
| | | | llvm-svn: 321899
* Re-commit r321223, which adds a printing policy to the ASTDumper.Aaron Ballman2017-12-211-16/+30
| | | | | | | | This allows you to dump C++ code that spells bool instead of _Bool, leaves off the elaborated type specifiers when printing struct or class names, and other C-isms. Fixes the -Wreorder issue and fixes the ast-dump-color.cpp test. llvm-svn: 321310
OpenPOWER on IntegriCloud