title: clang ASTMatcher without expanded from macro
body: <p>I am doing a clang ASTMatcher to find the locations where isnan is defined in my source code. I am trying to understand why there are three matches eventhough I have restricted to match only in the main file. Please find a sample source code below:</p>
  
  <pre><code>#include &lt;math.h&gt;
  int main()
  {
      if(isnan(0.0)){     
      }
  }
  </code></pre>
  
  <p>When I do clang-query match I am getting the below output:</p>
  
  <pre><code>clang-query&gt; match declRefExpr(isExpansionInMainFile())
  
  Match #1:
  
  /home/clang-llvm/code/test.cpp:6:5: note: "root" binds here
          if(isnan(0.0)){         
             ^~~~~~~~~~
  /usr/include/math.h:299:9: note: expanded from macro 'isnan'
        ? __isnanf (x)                                                          \
          ^~~~~~~~
  
  Match #2:
  
  /home/clang-llvm/code/test.cpp:6:5: note: "root" binds here
          if(isnan(0.0)){         
             ^~~~~~~~~~
  /usr/include/math.h:301:9: note: expanded from macro 'isnan'
        ? __isnan (x) : __isnanl (x))
          ^~~~~~~
  
  Match #3:
  
  /home/clang-llvm/code/test.cpp:6:5: note: "root" binds here
          if(isnan(0.0)){         
             ^~~~~~~~~~
  /usr/include/math.h:301:23: note: expanded from macro 'isnan'
        ? __isnan (x) : __isnanl (x))
                        ^~~~~~~~
  3 matches.
  </code></pre>
  
  <p>Is there anyway to restrict the match only for the source code and not the macro?</p>
  
  <p>I would appreciate any help.</p>