12 #include "clang/AST/ASTContext.h" 20 SourceLocation AmpLocation = Var.getLocation();
22 if (!Token.is(tok::unknown))
23 AmpLocation = Lexer::getLocForEndOfToken(Token.getLocation(), 0,
24 Context.getSourceManager(),
25 Context.getLangOpts());
26 return FixItHint::CreateInsertion(AmpLocation,
"&");
30 return FixItHint::CreateInsertion(Var.getTypeSpecStartLoc(),
"const ");
Token getPreviousToken(const ASTContext &Context, SourceLocation Location, bool SkipComments)
Returns previous token or tok::unknown if not found.
FixItHint changeVarDeclToConst(const VarDecl &Var)
Creates fix to make VarDecl const qualified.
FixItHint changeVarDeclToReference(const VarDecl &Var, ASTContext &Context)
Creates fix to make VarDecl a reference by adding &.