-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LLVM 19: Build failures #142
Comments
Looks like in llvm/llvm-project#91393, IWYU also tripped over this. |
Yep, it was replaced, but I don't see how can we get to the location of the type name as |
cc @sdkrystian
…On Tue, May 28, 2024 at 4:32 AM Martin Liška ***@***.***> wrote:
Yep, it was replaced, but I don't see how can we get to the location of
the *type name* as getTemplateArgsAsWritten returns something that
describes the template arguments. Please let me know once you have a hint,
thanks.
—
Reply to this email directly, view it on GitHub
<#142 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN5IX5XNEHTJARL5ID5BVTZERTLDAVCNFSM6AAAAABH5JPUMOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZUHE4TCNBSGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Looks like (maybe)
`ClassTemplateSpecializationDecl::getTemplateArgsAsWritten` returns a
[`const ASTTemplateArgumentListInfo*`](
https://clang.llvm.org/doxygen/structclang_1_1ASTTemplateArgumentListInfo.html)
which has a `getTemplateArgs` method that returns a [`const
TemplateArgumentLoc *`](
https://clang.llvm.org/doxygen/classclang_1_1TemplateArgumentLoc.html)
which has a `getTypeSourceInfo` method that finally returns a
`TypeSourceInfo *`. Or are you referring to the return type of a function?
On Tue, May 28, 2024 at 8:21 PM Nick Desaulniers ***@***.***>
wrote:
… cc @sdkrystian
On Tue, May 28, 2024 at 4:32 AM Martin Liška ***@***.***>
wrote:
> Yep, it was replaced, but I don't see how can we get to the location of
> the *type name* as getTemplateArgsAsWritten returns something that
> describes the template arguments. Please let me know once you have a hint,
> thanks.
>
> —
> Reply to this email directly, view it on GitHub
> <#142 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAN5IX5XNEHTJARL5ID5BVTZERTLDAVCNFSM6AAAAABH5JPUMOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZUHE4TCNBSGI>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
@marxin @nickdesaulniers the Also, I think the existing code contains a subtile bug: it assumes |
Thanks for the suggestions. With the following changes applied: diff --git a/clang_delta/CommonRenameClassRewriteVisitor.h b/clang_delta/CommonRenameClassRewriteVisitor.h
index f2daeb2..ecbe4f1 100644
--- a/clang_delta/CommonRenameClassRewriteVisitor.h
+++ b/clang_delta/CommonRenameClassRewriteVisitor.h
@@ -144,7 +144,7 @@ bool CommonRenameClassRewriteVisitor<T>::
std::string Name;
if (getNewName(CXXRD, Name)) {
- const TypeSourceInfo *TyInfo = D->getTypeAsWritten();
+ const TypeSourceInfo *TyInfo = D->getTemplateArgsAsWritten()->getTemplateArgs()->getTypeSourceInfo();
if (!TyInfo)
return true;
TypeLoc TyLoc = TyInfo->getTypeLoc();
diff --git a/clang_delta/RemoveNamespace.cpp b/clang_delta/RemoveNamespace.cpp
index b31c00e..8650c49 100644
--- a/clang_delta/RemoveNamespace.cpp
+++ b/clang_delta/RemoveNamespace.cpp
@@ -439,7 +439,7 @@ bool RemoveNamespaceRewriteVisitor::VisitClassTemplatePartialSpecializationDecl(
std::string Name;
if (ConsumerInstance->getNewName(CXXRD, Name)) {
- const TypeSourceInfo *TyInfo = D->getTypeAsWritten();
+ const TypeSourceInfo *TyInfo = D->getTemplateArgsAsWritten()->getTemplateArgs()->getTypeSourceInfo();
if (!TyInfo)
return true;
TypeLoc TyLoc = TyInfo->getTypeLoc(); I've got the following failing tests:
Here it seems the renaming happens only for the original struct, not the later one.
And here it seems the location really points to the first template argument (rather than to the
This one is similar to the first failing test-case. |
|
@sdkrystian Thanks for the PR! |
The following needs to be ported to the latest LLVM tip:
Can @nickdesaulniers or @strimo378 help me, please?
The text was updated successfully, but these errors were encountered: