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

Locate declRefs that are used in a macro correctly #75

Closed samanpa closed 1 year ago

samanpa commented 1 year ago

Describe your changes This PR addresses a limitation where the usage of variable in a macro is not always attributed to the right file.

Given the example below foo.h

#define PASTE(x, y ) x ## y

foo.cpp

#include "foo.h"
#include <cerrno>

int zee()
{
  return PASTE(err, no);
}

clangmetatool should detect that foo.cpp uses cerrno.

Signed-off-by: Kojo Adams kadams85@bloomberg.net