Get AST Nodes of objective-C class without resolving dependencies2019 Community Moderator ElectionIgnore missing headers with clang AST parserCreating an abstract class in Objective-CRefactoring to move a private field from one class to its helper class?Using Objective-C Metadata to Generate Class Dependency Graph(clang) How to parse macros themselves, getting an ast where possible?What's the right way to match #includes (or #defines) using Clang's libtooling?Objective-C Class Swapping at runtimeGet full source of multiple macro definitions using clang libtoolingGet class information from ObjCPropertyDeclAdding nodes to Clang's ASTUninstantiated function/class template ast is not generated by clang
Turning a hard to access nut?
Difficulty understanding group delay concept
Pre-Employment Background Check With Consent For Future Checks
If I cast the Enlarge/Reduce spell on an arrow, what weapon could it count as?
How are passwords stolen from companies if they only store hashes?
Print a physical multiplication table
Have any astronauts/cosmonauts died in space?
10 year ban after applying for a UK student visa
Air travel with refrigerated insulin
Imaginary part of expression too difficult to calculate
Why is this tree refusing to shed its dead leaves?
How to test the sharpness of a knife?
Animating wave motion in water
Would mining huge amounts of resources on the Moon change its orbit?
Why doesn't the fusion process of the sun speed up?
Why I don't get the wanted width of tcbox?
How to find the largest number(s) in a list of elements, possibly non-unique?
Why doesn't the chatan sign the ketubah?
Do native speakers use "ultima" and "proxima" frequently in spoken English?
Justification failure in beamer enumerate list
What is the tangent at a sharp point on a curve?
Homology of the fiber
TDE Master Key Rotation
Should a narrator ever describe things based on a characters view instead of fact?
Get AST Nodes of objective-C class without resolving dependencies
2019 Community Moderator ElectionIgnore missing headers with clang AST parserCreating an abstract class in Objective-CRefactoring to move a private field from one class to its helper class?Using Objective-C Metadata to Generate Class Dependency Graph(clang) How to parse macros themselves, getting an ast where possible?What's the right way to match #includes (or #defines) using Clang's libtooling?Objective-C Class Swapping at runtimeGet full source of multiple macro definitions using clang libtoolingGet class information from ObjCPropertyDeclAdding nodes to Clang's ASTUninstantiated function/class template ast is not generated by clang
I am trying to create a refactoring tool that would allow me to get a syntax tree from an objective-c class so that I can change the structure of the class and output a different version of it that matches my criteria. I am looking at Clang's Libtooling to generate an AST and then take it from there, the issue I'm having is that I need to somehow make sure I provice all paths to all possible headers that are being imported from this source, and that's something I'd like to avoid.
I am wondering if there is a way to generate the AST for a class without having to for example provide paths for the framework containing the class definitions of the properties that the class I wanna refactor hold.
Ideally I would be able to get nodes in raw text of my source file containing things like properties, functions, etc... this way I'd be able to traverse that tree and change its structure to later on regenerate my source in the desired way.
objective-c clang llvm-clang automated-refactoring libtooling
add a comment |
I am trying to create a refactoring tool that would allow me to get a syntax tree from an objective-c class so that I can change the structure of the class and output a different version of it that matches my criteria. I am looking at Clang's Libtooling to generate an AST and then take it from there, the issue I'm having is that I need to somehow make sure I provice all paths to all possible headers that are being imported from this source, and that's something I'd like to avoid.
I am wondering if there is a way to generate the AST for a class without having to for example provide paths for the framework containing the class definitions of the properties that the class I wanna refactor hold.
Ideally I would be able to get nodes in raw text of my source file containing things like properties, functions, etc... this way I'd be able to traverse that tree and change its structure to later on regenerate my source in the desired way.
objective-c clang llvm-clang automated-refactoring libtooling
How about using AST Matcher + replacement ?
– boq
Mar 9 at 0:50
this is what I've tried so far, but I run into issues when using this strategy since the compiler fails to resolve the dependencies, so I was wondering if there is a way I can get the AST for the current source file without having to provide knowledge to the compiler about the sub-properties contained in my class, specially since I just need to restructure the tree, and regenerate the code. I'm hoping there is a parameter that will allow me to get the AST without much complication. Any ideas @boq?
– Andrespch
Mar 9 at 10:06
not really... the interesting question to me is why Clang failed parsing your headers. Maybe this post is useful ? stackoverflow.com/a/45239905/5520012
– boq
Mar 9 at 12:48
Thanks @boq, it does feel like that that I need, unfortunately, I can't seem to find a way to access that API from the class I'm usingClangTool. I'm trying to guide myself using this tutorial clang.llvm.org/docs/LibASTMatchersTutorial.html but it hadn't been very helpful so far!
– Andrespch
Mar 12 at 16:43
add a comment |
I am trying to create a refactoring tool that would allow me to get a syntax tree from an objective-c class so that I can change the structure of the class and output a different version of it that matches my criteria. I am looking at Clang's Libtooling to generate an AST and then take it from there, the issue I'm having is that I need to somehow make sure I provice all paths to all possible headers that are being imported from this source, and that's something I'd like to avoid.
I am wondering if there is a way to generate the AST for a class without having to for example provide paths for the framework containing the class definitions of the properties that the class I wanna refactor hold.
Ideally I would be able to get nodes in raw text of my source file containing things like properties, functions, etc... this way I'd be able to traverse that tree and change its structure to later on regenerate my source in the desired way.
objective-c clang llvm-clang automated-refactoring libtooling
I am trying to create a refactoring tool that would allow me to get a syntax tree from an objective-c class so that I can change the structure of the class and output a different version of it that matches my criteria. I am looking at Clang's Libtooling to generate an AST and then take it from there, the issue I'm having is that I need to somehow make sure I provice all paths to all possible headers that are being imported from this source, and that's something I'd like to avoid.
I am wondering if there is a way to generate the AST for a class without having to for example provide paths for the framework containing the class definitions of the properties that the class I wanna refactor hold.
Ideally I would be able to get nodes in raw text of my source file containing things like properties, functions, etc... this way I'd be able to traverse that tree and change its structure to later on regenerate my source in the desired way.
objective-c clang llvm-clang automated-refactoring libtooling
objective-c clang llvm-clang automated-refactoring libtooling
edited Mar 8 at 18:59
Josh Caswell
59.2k12131177
59.2k12131177
asked Mar 7 at 18:28
AndrespchAndrespch
205116
205116
How about using AST Matcher + replacement ?
– boq
Mar 9 at 0:50
this is what I've tried so far, but I run into issues when using this strategy since the compiler fails to resolve the dependencies, so I was wondering if there is a way I can get the AST for the current source file without having to provide knowledge to the compiler about the sub-properties contained in my class, specially since I just need to restructure the tree, and regenerate the code. I'm hoping there is a parameter that will allow me to get the AST without much complication. Any ideas @boq?
– Andrespch
Mar 9 at 10:06
not really... the interesting question to me is why Clang failed parsing your headers. Maybe this post is useful ? stackoverflow.com/a/45239905/5520012
– boq
Mar 9 at 12:48
Thanks @boq, it does feel like that that I need, unfortunately, I can't seem to find a way to access that API from the class I'm usingClangTool. I'm trying to guide myself using this tutorial clang.llvm.org/docs/LibASTMatchersTutorial.html but it hadn't been very helpful so far!
– Andrespch
Mar 12 at 16:43
add a comment |
How about using AST Matcher + replacement ?
– boq
Mar 9 at 0:50
this is what I've tried so far, but I run into issues when using this strategy since the compiler fails to resolve the dependencies, so I was wondering if there is a way I can get the AST for the current source file without having to provide knowledge to the compiler about the sub-properties contained in my class, specially since I just need to restructure the tree, and regenerate the code. I'm hoping there is a parameter that will allow me to get the AST without much complication. Any ideas @boq?
– Andrespch
Mar 9 at 10:06
not really... the interesting question to me is why Clang failed parsing your headers. Maybe this post is useful ? stackoverflow.com/a/45239905/5520012
– boq
Mar 9 at 12:48
Thanks @boq, it does feel like that that I need, unfortunately, I can't seem to find a way to access that API from the class I'm usingClangTool. I'm trying to guide myself using this tutorial clang.llvm.org/docs/LibASTMatchersTutorial.html but it hadn't been very helpful so far!
– Andrespch
Mar 12 at 16:43
How about using AST Matcher + replacement ?
– boq
Mar 9 at 0:50
How about using AST Matcher + replacement ?
– boq
Mar 9 at 0:50
this is what I've tried so far, but I run into issues when using this strategy since the compiler fails to resolve the dependencies, so I was wondering if there is a way I can get the AST for the current source file without having to provide knowledge to the compiler about the sub-properties contained in my class, specially since I just need to restructure the tree, and regenerate the code. I'm hoping there is a parameter that will allow me to get the AST without much complication. Any ideas @boq?
– Andrespch
Mar 9 at 10:06
this is what I've tried so far, but I run into issues when using this strategy since the compiler fails to resolve the dependencies, so I was wondering if there is a way I can get the AST for the current source file without having to provide knowledge to the compiler about the sub-properties contained in my class, specially since I just need to restructure the tree, and regenerate the code. I'm hoping there is a parameter that will allow me to get the AST without much complication. Any ideas @boq?
– Andrespch
Mar 9 at 10:06
not really... the interesting question to me is why Clang failed parsing your headers. Maybe this post is useful ? stackoverflow.com/a/45239905/5520012
– boq
Mar 9 at 12:48
not really... the interesting question to me is why Clang failed parsing your headers. Maybe this post is useful ? stackoverflow.com/a/45239905/5520012
– boq
Mar 9 at 12:48
Thanks @boq, it does feel like that that I need, unfortunately, I can't seem to find a way to access that API from the class I'm using
ClangTool. I'm trying to guide myself using this tutorial clang.llvm.org/docs/LibASTMatchersTutorial.html but it hadn't been very helpful so far!– Andrespch
Mar 12 at 16:43
Thanks @boq, it does feel like that that I need, unfortunately, I can't seem to find a way to access that API from the class I'm using
ClangTool. I'm trying to guide myself using this tutorial clang.llvm.org/docs/LibASTMatchersTutorial.html but it hadn't been very helpful so far!– Andrespch
Mar 12 at 16:43
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55050555%2fget-ast-nodes-of-objective-c-class-without-resolving-dependencies%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55050555%2fget-ast-nodes-of-objective-c-class-without-resolving-dependencies%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
How about using AST Matcher + replacement ?
– boq
Mar 9 at 0:50
this is what I've tried so far, but I run into issues when using this strategy since the compiler fails to resolve the dependencies, so I was wondering if there is a way I can get the AST for the current source file without having to provide knowledge to the compiler about the sub-properties contained in my class, specially since I just need to restructure the tree, and regenerate the code. I'm hoping there is a parameter that will allow me to get the AST without much complication. Any ideas @boq?
– Andrespch
Mar 9 at 10:06
not really... the interesting question to me is why Clang failed parsing your headers. Maybe this post is useful ? stackoverflow.com/a/45239905/5520012
– boq
Mar 9 at 12:48
Thanks @boq, it does feel like that that I need, unfortunately, I can't seem to find a way to access that API from the class I'm using
ClangTool. I'm trying to guide myself using this tutorial clang.llvm.org/docs/LibASTMatchersTutorial.html but it hadn't been very helpful so far!– Andrespch
Mar 12 at 16:43