How to implement a clangMatcher that can idenitfy enums, const decls in a codebase with absolute includes like LLVM?

I am trying to identify hard coded values in the LLVM codebase (which often occurs in the form of function construcutor initializers or as a const int decaration) and decided to use a Clang Matcher for the same. I followed the docs and studies clang AST to write the following code :

#include "clang/Frontend/FrontendActions.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/CommandLine.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"

using namespace clang::tooling;
using namespace llvm;
using namespace clang;
using namespace clang::ast_matchers;

static llvm::cl::OptionCategory MyToolCategory("my-tool options");

DeclarationMatcher KnobMatcher = declaratorDecl(hasTypeLoc(loc(asString("const int")))).bind("knobVar");

class KnobPrinter : public MatchFinder::MatchCallback {
public :
  virtual void run(const MatchFinder::MatchResult &Result) {
    ASTContext *Context = Result.Context;
    const VarDecl *FS = Result.Nodes.getNodeAs<VarDecl>("knobVar");
    // We do not want to convert header files!
    if (!FS || !Context->getSourceManager().isWrittenInMainFile(FS->getLocation()))
      return;
    llvm::outs() << "Potential knob discovered at " << FS->getLocation().printToString(Context->getSourceManager()) << "\n";
    llvm::outs() << "Name: " << FS->getNameAsString() << "\n";
    llvm::outs() << "Type: " << FS->getType().getAsString() << "\n";
    llvm::outs() << "QualType: " << FS->getType().getQualifiers().getAsString() << "\n";
  }
};

int main(int argc, const char **argv) {
  auto ExpectedParser = CommonOptionsParser::create(argc, argv, MyToolCategory);
  if (!ExpectedParser) {
    llvm::errs() << ExpectedParser.takeError();
    return 1;
  }
  CommonOptionsParser& OptionsParser = ExpectedParser.get();
  ClangTool Tool(OptionsParser.getCompilations(),
                 OptionsParser.getSourcePathList());

  KnobPrinter Printer;
  MatchFinder Finder;
  Finder.addMatcher(KnobMatcher, &Printer);

  return Tool.run(newFrontendActionFactory(&Finder).get());
}

I put this in clang-tools-extra and it builds and works find for projects with relative includes. But when I try it out on LLVM itself, it is not able to work and gives an error that the include statement was not found.

Can someone please guide me as to what exactly needs to be changed in the code or perhaps there is a different solution for this ?

I talked with a fellow dev. The only solution to this is to explicitly specify the include files for the code file you wish to give input to the tool. So something like

./binary /path/to/file – -I /path/to/project/includes -I /path/to/system/includes (where files lie stddef.h etc are stored)