Using clang-tidy checks to work on multiple files

92 Views Asked by At

I'm registering new checks in clang-tidy. I was able to create a new check and tried to run it on multiple files. My check verifies if a variable defined in first file is getting redefined in other file as well. If it does then it should throw an error. The check is unable to capture this redeclaration . I read that clang-tidy doesn't support Cross Translation Unit analysis (meaning it will run the check separately on each file).

test1.cpp

#include <cstdint>
namespace ns1
{
 static std::int32_t globalvariable = 0;
}

test2.cpp

#include <cstdint>
namespace ns1
{
 static std::int32_t globalvariable = 0;// Non-compliant- identifier reused
 // in ns1 namespace in test1.cpp
}

What are ways to workaround this problem?

0

There are 0 best solutions below