Hello, I'm writing my first clang-tidy check.  Basically I'm working on a
project where I'm forced to use systems hungarian notation.  I was trying
to get the applicable typedef from a vardecl (e.g. uin32_t)

I've started off with a simple matcher:
void AfrhungarianvariablesCheck::registerMatchers(MatchFinder *Finder)
{
    Finder->addMatcher(varDecl().bind("var"), this);
}

And I've been poking around what it finds with things like:
auto MatchedKind    = MatchedDecl->getKind();
auto MatchedType    = MatchedDecl->getType();
auto MatchedTypeRef = *MatchedType;
auto MatchedTypePtr = MatchedType.getTypePtr();
MatchedDecl->dump();

It'd be nice to have something like:
switch (type_of_var){
  case int8_t:
    prefix = "c";
    break;
  case int16_t:
    prefix = "s";
    break;
etc.
}

I'm mostly from an embedded C background, so a lot of the various tools to
work with clang are a bit new to me (gdb, Clang AST, C++, etc).  but I
think a lot of this will be very useful to me in the future.

Also, I found a sort of getting started talk for clang-tidy in the videos
from code:dive (https://www.youtube.com/watch?v=-QsiqIU8z7E), but the
camera was never pointed at the screen.  Is there anything similar with
better camera work?
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to