bloomberg / clangmetatool

A framework for reusing code in Clang tools
https://bloomberg.github.io/clangmetatool/
Apache License 2.0
121 stars 25 forks source link

Add expandRangeIfValid function to allow safer source expansion #67

Closed dbeer1 closed 2 years ago

dbeer1 commented 2 years ago

Issue number of the reported bug or feature request: ENG2STAAR-3302

Describe your changes Added the SourceUtil::expandRangeIfValid function, that is essentially a combination of SourceUtil::expandRange and SourceUtil::isPartialMacro. That is, the new function will find the most expanded version of a range while being careful about partial macro expansions. This allows one to retrieve the source for this range without worrying about it containing extra tokens or even being split between two locations.

Testing performed Added new test file.