You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clangd allows extracting a selection where a type is used that is defined in the scope of the enclosing function, making the type undefined in the extracted function.
voidfoo() {
using MyType = int;
[[MyType x = 42;
MyType y = x;]]
}
voidextracted() {
MyType x = 42;
MyType y = x;
}
voidfoo() {
using MyType = int;
extracted();
}
Clangd 17 at commit 852fe30b687e
I think this could be implemented by using a RecursiveASTVisitor to find all TypeDecls of the enclosing function and comparing those to the referenced Types within the selected region. If there exists a type that is declared in the enclosing function, but outside the selection, and that type is used within the selection, then don't extract.
The text was updated successfully, but these errors were encountered:
5chmidti
changed the title
Extract function can extract code that contains types that are defined in the enclosing functions scope
Extract function can extract code containing types defined in the enclosing functions scope
Jul 22, 2023
Clangd allows extracting a selection where a type is used that is defined in the scope of the enclosing function, making the type undefined in the extracted function.
Clangd 17 at commit 852fe30b687e
I think this could be implemented by using a
RecursiveASTVisitor
to find allTypeDecl
s of the enclosing function and comparing those to the referencedType
s within the selected region. If there exists a type that is declared in the enclosing function, but outside the selection, and that type is used within the selection, then don't extract.The text was updated successfully, but these errors were encountered: