|
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init |
|
| #
888673b6 |
| 15-Jul-2022 |
Jonas Devlieghere <[email protected]> |
Revert "[clang] Implement ElaboratedType sugaring for types written bare"
This reverts commit 7c51f02effdbd0d5e12bfd26f9c3b2ab5687c93f because it stills breaks the LLDB tests. This was re-landed wi
Revert "[clang] Implement ElaboratedType sugaring for types written bare"
This reverts commit 7c51f02effdbd0d5e12bfd26f9c3b2ab5687c93f because it stills breaks the LLDB tests. This was re-landed without addressing the issue or even agreement on how to address the issue. More details and discussion in https://reviews.llvm.org/D112374.
show more ...
|
|
Revision tags: llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1 |
|
| #
7c51f02e |
| 11-Oct-2021 |
Matheus Izvekov <[email protected]> |
[clang] Implement ElaboratedType sugaring for types written bare
Without this patch, clang will not wrap in an ElaboratedType node types written without a keyword and nested name qualifier, which go
[clang] Implement ElaboratedType sugaring for types written bare
Without this patch, clang will not wrap in an ElaboratedType node types written without a keyword and nested name qualifier, which goes against the intent that we should produce an AST which retains enough details to recover how things are written.
The lack of this sugar is incompatible with the intent of the type printer default policy, which is to print types as written, but to fall back and print them fully qualified when they are desugared.
An ElaboratedTypeLoc without keyword / NNS uses no storage by itself, but still requires pointer alignment due to pre-existing bug in the TypeLoc buffer handling.
---
Troubleshooting list to deal with any breakage seen with this patch:
1) The most likely effect one would see by this patch is a change in how a type is printed. The type printer will, by design and default, print types as written. There are customization options there, but not that many, and they mainly apply to how to print a type that we somehow failed to track how it was written. This patch fixes a problem where we failed to distinguish between a type that was written without any elaborated-type qualifiers, such as a 'struct'/'class' tags and name spacifiers such as 'std::', and one that has been stripped of any 'metadata' that identifies such, the so called canonical types. Example: ``` namespace foo { struct A {}; A a; }; ``` If one were to print the type of `foo::a`, prior to this patch, this would result in `foo::A`. This is how the type printer would have, by default, printed the canonical type of A as well. As soon as you add any name qualifiers to A, the type printer would suddenly start accurately printing the type as written. This patch will make it print it accurately even when written without qualifiers, so we will just print `A` for the initial example, as the user did not really write that `foo::` namespace qualifier.
2) This patch could expose a bug in some AST matcher. Matching types is harder to get right when there is sugar involved. For example, if you want to match a type against being a pointer to some type A, then you have to account for getting a type that is sugar for a pointer to A, or being a pointer to sugar to A, or both! Usually you would get the second part wrong, and this would work for a very simple test where you don't use any name qualifiers, but you would discover is broken when you do. The usual fix is to either use the matcher which strips sugar, which is annoying to use as for example if you match an N level pointer, you have to put N+1 such matchers in there, beginning to end and between all those levels. But in a lot of cases, if the property you want to match is present in the canonical type, it's easier and faster to just match on that... This goes with what is said in 1), if you want to match against the name of a type, and you want the name string to be something stable, perhaps matching on the name of the canonical type is the better choice.
3) This patch could exposed a bug in how you get the source range of some TypeLoc. For some reason, a lot of code is using getLocalSourceRange(), which only looks at the given TypeLoc node. This patch introduces a new, and more common TypeLoc node which contains no source locations on itself. This is not an inovation here, and some other, more rare TypeLoc nodes could also have this property, but if you use getLocalSourceRange on them, it's not going to return any valid locations, because it doesn't have any. The right fix here is to always use getSourceRange() or getBeginLoc/getEndLoc which will dive into the inner TypeLoc to get the source range if it doesn't find it on the top level one. You can use getLocalSourceRange if you are really into micro-optimizations and you have some outside knowledge that the TypeLocs you are dealing with will always include some source location.
4) Exposed a bug somewhere in the use of the normal clang type class API, where you have some type, you want to see if that type is some particular kind, you try a `dyn_cast` such as `dyn_cast<TypedefType>` and that fails because now you have an ElaboratedType which has a TypeDefType inside of it, which is what you wanted to match. Again, like 2), this would usually have been tested poorly with some simple tests with no qualifications, and would have been broken had there been any other kind of type sugar, be it an ElaboratedType or a TemplateSpecializationType or a SubstTemplateParmType. The usual fix here is to use `getAs` instead of `dyn_cast`, which will look deeper into the type. Or use `getAsAdjusted` when dealing with TypeLocs. For some reason the API is inconsistent there and on TypeLocs getAs behaves like a dyn_cast.
5) It could be a bug in this patch perhaps.
Let me know if you need any help!
Signed-off-by: Matheus Izvekov <[email protected]>
Differential Revision: https://reviews.llvm.org/D112374
show more ...
|
| #
3968936b |
| 13-Jul-2022 |
Jonas Devlieghere <[email protected]> |
Revert "[clang] Implement ElaboratedType sugaring for types written bare"
This reverts commit bdc6974f92304f4ed542241b9b89ba58ba6b20aa because it breaks all the LLDB tests that import the std module
Revert "[clang] Implement ElaboratedType sugaring for types written bare"
This reverts commit bdc6974f92304f4ed542241b9b89ba58ba6b20aa because it breaks all the LLDB tests that import the std module.
import-std-module/array.TestArrayFromStdModule.py import-std-module/deque-basic.TestDequeFromStdModule.py import-std-module/deque-dbg-info-content.TestDbgInfoContentDequeFromStdModule.py import-std-module/forward_list.TestForwardListFromStdModule.py import-std-module/forward_list-dbg-info-content.TestDbgInfoContentForwardListFromStdModule.py import-std-module/list.TestListFromStdModule.py import-std-module/list-dbg-info-content.TestDbgInfoContentListFromStdModule.py import-std-module/queue.TestQueueFromStdModule.py import-std-module/stack.TestStackFromStdModule.py import-std-module/vector.TestVectorFromStdModule.py import-std-module/vector-bool.TestVectorBoolFromStdModule.py import-std-module/vector-dbg-info-content.TestDbgInfoContentVectorFromStdModule.py import-std-module/vector-of-vectors.TestVectorOfVectorsFromStdModule.py
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/45301/
show more ...
|
| #
bdc6974f |
| 11-Oct-2021 |
Matheus Izvekov <[email protected]> |
[clang] Implement ElaboratedType sugaring for types written bare
Without this patch, clang will not wrap in an ElaboratedType node types written without a keyword and nested name qualifier, which go
[clang] Implement ElaboratedType sugaring for types written bare
Without this patch, clang will not wrap in an ElaboratedType node types written without a keyword and nested name qualifier, which goes against the intent that we should produce an AST which retains enough details to recover how things are written.
The lack of this sugar is incompatible with the intent of the type printer default policy, which is to print types as written, but to fall back and print them fully qualified when they are desugared.
An ElaboratedTypeLoc without keyword / NNS uses no storage by itself, but still requires pointer alignment due to pre-existing bug in the TypeLoc buffer handling.
Signed-off-by: Matheus Izvekov <[email protected]>
Differential Revision: https://reviews.llvm.org/D112374
show more ...
|
|
Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1 |
|
| #
518d955f |
| 29-Apr-2021 |
Duncan P. N. Exon Smith <[email protected]> |
Support: Stop using F_{None,Text,Append} compatibility synonyms, NFC
Stop using the compatibility spellings of `OF_{None,Text,Append}` left behind by 1f67a3cba9b09636c56e2109d8a35ae96dc15782. A foll
Support: Stop using F_{None,Text,Append} compatibility synonyms, NFC
Stop using the compatibility spellings of `OF_{None,Text,Append}` left behind by 1f67a3cba9b09636c56e2109d8a35ae96dc15782. A follow-up will remove them.
Differential Revision: https://reviews.llvm.org/D101650
show more ...
|
| #
50b523cb |
| 26-Apr-2021 |
Stephen Kelly <[email protected]> |
[AST] Fix DeclarationNameInfo introspection
Some AST classes return `const DeclarationNameInfo &` instead of returning by value (eg CXXDependentScopeMemberExpr).
|
| #
a9676feb |
| 20-Apr-2021 |
Stephen Kelly <[email protected]> |
[AST] Add DeclarationNameInfo to node introspection
Differential Revision: https://reviews.llvm.org/D101049
|
| #
21ce124e |
| 15-Apr-2021 |
Stephen Kelly <[email protected]> |
[AST] Add NestedNameSpecifierLoc accessors to node introspection
Differential Revision: https://reviews.llvm.org/D100712
|
| #
db75db85 |
| 18-Apr-2021 |
Nathan James <[email protected]> |
[Introspection] Dont emit json if unchanged.
Saves running the generate inc script in the, somewhat common, case where the json file doesn't need changing.
Reviewed By: steveire
Differential Revis
[Introspection] Dont emit json if unchanged.
Saves running the generate inc script in the, somewhat common, case where the json file doesn't need changing.
Reviewed By: steveire
Differential Revision: https://reviews.llvm.org/D100719
show more ...
|
| #
a0898f0c |
| 18-Apr-2021 |
Nathan James <[email protected]> |
[AST][Introspection][NFC] Remove unnecessary temporary strings.
|
|
Revision tags: llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4 |
|
| #
dd68942f |
| 24-Mar-2021 |
Stephen Kelly <[email protected]> |
[AST] Add TypeLoc support to node introspection
Extend the matchers gathering API for types to record template parameters. The TypeLoc type hierarchy has some types which are templates used in CRTP
[AST] Add TypeLoc support to node introspection
Extend the matchers gathering API for types to record template parameters. The TypeLoc type hierarchy has some types which are templates used in CRTP such as PointerLikeTypeLoc. Record the inherited template and template arguments of types inheriting those CRTP types in the ClassInheritance map. Because the name inherited from is now computed, the value type in that map changes from StringRef to std::string. This also causes the toJSON override signature used to serialize that map to change.
Remove the logic for skipping over empty ClassData instances. Several classes such as TypeOfExprTypeLoc inherit a CRTP class which provides interesting locations though the derived class does not. Record it as a class to make the locations it inherits available.
Record the typeSourceInfo accessors too as they provide access to TypeLocs in many classes.
The existing unit tests use UnorderedElementsAre to compare the introspection result with the expected result. Our current implementation of google mock (in gmock-generated-matchers.h) is limited to support for comparing a container of 10 elements. As we are now returning more than 10 results for one of the introspection tests, change it to instead compare against an ordered vector of pairs.
Because a macro is used to generate API strings and API calls, disable clang-format in blocks of expected results. Otherwise clang-format would insert whitespaces which would then be compared against the introspected strings and fail the test.
Introduce a recursion guard in the generated code. The TypeLoc class has IgnoreParens() API which by default returns itself, so it would otherwise recurse infinitely.
Differential Revision: https://reviews.llvm.org/D100516
show more ...
|
| #
c960c383 |
| 25-Mar-2021 |
Stephen Kelly <[email protected]> |
NFC: Remove condition to simplify code
The run method is only called if there is a match with a binding.
|
| #
f347f0e0 |
| 17-Mar-2021 |
Stephen Kelly <[email protected]> |
[AST] Add introspection support for more base nodes
Fix the logic of detecting pseudo-virtual getBeginLoc etc on Stmt and Decl subclasses.
Adjust the test infrastructure to filter out invalid sourc
[AST] Add introspection support for more base nodes
Fix the logic of detecting pseudo-virtual getBeginLoc etc on Stmt and Decl subclasses.
Adjust the test infrastructure to filter out invalid source locations. This makes the tests more clear about which nodes have which locations.
Differential Revision: https://reviews.llvm.org/D99231
show more ...
|
| #
4c65dfc8 |
| 17-Mar-2021 |
Stephen Kelly <[email protected]> |
[AST] Add introspection support for Decls
The test code has lots of interesting locations which are not yet introspected, but those will come later:
http://ce.steveire.com/z/3T90hR
Differential R
[AST] Add introspection support for Decls
The test code has lots of interesting locations which are not yet introspected, but those will come later:
http://ce.steveire.com/z/3T90hR
Differential Revision: https://reviews.llvm.org/D98775
show more ...
|
| #
188405bc |
| 17-Mar-2021 |
Stephen Kelly <[email protected]> |
[AST] Ensure that an empty json file is generated if compile errors
Differential Revision: https://reviews.llvm.org/D98827
|
| #
19740652 |
| 14-Mar-2021 |
Stephen Kelly <[email protected]> |
[AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their public accessors which return SourceLocation or SourceRange.
Use the JSON
[AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their public accessors which return SourceLocation or SourceRange.
Use the JSON file to generate a C++ API and implementation for accessing the source locations and method names for accessing them for a given AST node.
This new API can be used to implement 'srcloc' output in clang-query:
http://ce.steveire.com/z/m_kTIo
The JSON file can also be used to generate bindings for other languages, such as Python and Javascript:
https://steveire.wordpress.com/2019/04/30/the-future-of-ast-matching
In this first version of this feature, only the accessors for Stmt classes are generated, not Decls, TypeLocs etc. Those can be added after this change is reviewed, as this change is mostly about infrastructure of these code generators.
Also in this version, the platforms/cmake configurations are excluded as much as possible so that support can be added iteratively. Currently a break on any platform causes a revert of the entire feature. This way, the `OR WIN32` can be removed in a future commit and if it breaks the buildbots, only that commit gets reverted, making the entire process easier to manage.
Differential Revision: https://reviews.llvm.org/D93164
show more ...
|
| #
91abaa1f |
| 14-Mar-2021 |
Stephen Kelly <[email protected]> |
[AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their public accessors which return SourceLocation or SourceRange.
Use the JSON
[AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their public accessors which return SourceLocation or SourceRange.
Use the JSON file to generate a C++ API and implementation for accessing the source locations and method names for accessing them for a given AST node.
This new API can be used to implement 'srcloc' output in clang-query:
http://ce.steveire.com/z/m_kTIo
The JSON file can also be used to generate bindings for other languages, such as Python and Javascript:
https://steveire.wordpress.com/2019/04/30/the-future-of-ast-matching
In this first version of this feature, only the accessors for Stmt classes are generated, not Decls, TypeLocs etc. Those can be added after this change is reviewed, as this change is mostly about infrastructure of these code generators.
Also in this version, the platforms/cmake configurations are excluded as much as possible so that support can be added iteratively. Currently a break on any platform causes a revert of the entire feature. This way, the `OR WIN32` can be removed in a future commit and if it breaks the buildbots, only that commit gets reverted, making the entire process easier to manage.
Differential Revision: https://reviews.llvm.org/D93164
show more ...
|
| #
477e4b97 |
| 14-Mar-2021 |
Stephen Kelly <[email protected]> |
[AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their public accessors which return SourceLocation or SourceRange.
Use the JSON
[AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their public accessors which return SourceLocation or SourceRange.
Use the JSON file to generate a C++ API and implementation for accessing the source locations and method names for accessing them for a given AST node.
This new API can be used to implement 'srcloc' output in clang-query:
http://ce.steveire.com/z/m_kTIo
The JSON file can also be used to generate bindings for other languages, such as Python and Javascript:
https://steveire.wordpress.com/2019/04/30/the-future-of-ast-matching
In this first version of this feature, only the accessors for Stmt classes are generated, not Decls, TypeLocs etc. Those can be added after this change is reviewed, as this change is mostly about infrastructure of these code generators.
Also in this version, the platforms/cmake configurations are excluded as much as possible so that support can be added iteratively. Currently a break on any platform causes a revert of the entire feature. This way, the `OR WIN32` can be removed in a future commit and if it breaks the buildbots, only that commit gets reverted, making the entire process easier to manage.
Differential Revision: https://reviews.llvm.org/D93164
show more ...
|
| #
cefe7111 |
| 14-Mar-2021 |
Stephen Kelly <[email protected]> |
Fix license headers
|
|
Revision tags: llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2 |
|
| #
77f7d2be |
| 12-Dec-2020 |
Stephen Kelly <[email protected]> |
[AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their public accessors which return SourceLocation or SourceRange.
Use the JSON
[AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their public accessors which return SourceLocation or SourceRange.
Use the JSON file to generate a C++ API and implementation for accessing the source locations and method names for accessing them for a given AST node.
This new API can be used to implement 'srcloc' output in clang-query:
http://ce.steveire.com/z/m_kTIo
In this first version of this feature, only the accessors for Stmt classes are generated, not Decls, TypeLocs etc. Those can be added after this change is reviewed, as this change is mostly about infrastructure of these code generators.
Differential Revision: https://reviews.llvm.org/D93164
show more ...
|
| #
d627a27d |
| 12-Dec-2020 |
Stephen Kelly <[email protected]> |
[AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their public accessors which return SourceLocation or SourceRange.
Use the JSON
[AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their public accessors which return SourceLocation or SourceRange.
Use the JSON file to generate a C++ API and implementation for accessing the source locations and method names for accessing them for a given AST node.
This new API can be used to implement 'srcloc' output in clang-query:
http://ce.steveire.com/z/m_kTIo
In this first version of this feature, only the accessors for Stmt classes are generated, not Decls, TypeLocs etc. Those can be added after this change is reviewed, as this change is mostly about infrastructure of these code generators.
Differential Revision: https://reviews.llvm.org/D93164
show more ...
|