Skip to content

Is it possible to determine whether a SyntaxNode or Token originates from the source text or is expanded from macros? #1172

Answered by MikePopoloski
roife asked this question in Q&A
Discussion options

You must be logged in to vote

You cannot obtain a non-preprocessed SyntaxTree; it's not possible to parse SystemVerilog without first expanding macros.

You can check whether any particular token comes from a macro or not by looking at its SourceLocation and using SourceManager::isMacroLoc to check.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by roife
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants