bloomberg / clangmetatool

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

Fix macro propagation #25

Closed liangti closed 5 years ago

liangti commented 5 years ago

This PR is for fixing issue of constant propagation unresolved in function-like macro. Using operator < to compare two source locations may be the issue since its going to compare ID of two source locations which contains not only line number and column number, but also bits for isMacro and isFileID. If two source locations are in same file and are both not macro it is fine. But if one is macro and the other one is not, it may cause issue. (I have a test for that below).

@ruoso @burz @traveltissues

liangti commented 5 years ago

Directly using method in SourceManager

@burz @vaibhav-y

envp commented 5 years ago

Great find! Looks good to me. Paging @ruoso