[cfe-dev] Combining floatLiteral() Node Matcher with isExpansionInFileMatching() Narrowing Matcher provides unexpected results
Stephen Kelly via cfe-dev
cfe-dev at lists.llvm.org
Wed Jan 9 15:01:01 PST 2019
On 09/01/2019 14:15, FarSight Studios via cfe-dev wrote:
> Hi,
>
> Combining floatLiteral() Node Matcher with isExpansionInFileMatching()
> Narrowing Matcher provides unexpected results.
> The following matcher:
> floatLiteral(isExpansionInFileMatching("include/math.h"))
> does not matches "M_E" which is defined in "math.h"
>
> #include <math.h>
>
> int consts(int n){
> double varX = M_E;
> return varX;
> }
>
> It matches a single unrelated node:
> FloatingLiteral 0x562c409bdaa8 </usr/include/math.h:1184:47> 'float'
> 0.000000e+00
>
> Am I doing something wrong?
M_E is a macro and that macro is expanded in your
double varX = M_E;
line. The expansion is not in math.h. The expansion is in the main file.
http://ec2-18-191-7-3.us-east-2.compute.amazonaws.com:10240/z/qRMj-W
By the way, we have a llvm channel on the cpplang slack
(https://cpplang.slack.com). That is a more suitable venue for your
questions. This is the development mailing list.
Thanks,
Stephen.
More information about the cfe-dev
mailing list