summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/literalalternative.cxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2013-03-21 16:42:10 +0100
committerLuboš Luňák <l.lunak@suse.cz>2013-03-28 18:01:00 +0100
commit153a69cad2efdb38f7da50bcd25158d127a944f4 (patch)
tree3ae6a544f73bd0821b47d0763f45a7f62812c35a /compilerplugins/clang/literalalternative.cxx
parent9ab15ecc4f162cd6d8ce305f0d7ac064c1e1704c (diff)
pass around CompilerInstance rather than ASTContext
It's possible to get the latter from the former, and the former is useful for other things too (access to the preprocessor, for example). Change-Id: I708d709129fd3a35bf7c63da4de09c2e696b382d
Diffstat (limited to 'compilerplugins/clang/literalalternative.cxx')
-rw-r--r--compilerplugins/clang/literalalternative.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/compilerplugins/clang/literalalternative.cxx b/compilerplugins/clang/literalalternative.cxx
index e90b688ae259..06ba80304979 100644
--- a/compilerplugins/clang/literalalternative.cxx
+++ b/compilerplugins/clang/literalalternative.cxx
@@ -21,9 +21,9 @@ class LiteralAlternative:
public RecursiveASTVisitor<LiteralAlternative>, public loplugin::Plugin
{
public:
- explicit LiteralAlternative(ASTContext & context): Plugin(context) {}
+ explicit LiteralAlternative(CompilerInstance & compiler): Plugin(compiler) {}
- virtual void run() { TraverseDecl(context.getTranslationUnitDecl()); }
+ virtual void run() { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
bool VisitCallExpr(CallExpr * expr);
};
@@ -65,7 +65,7 @@ bool LiteralAlternative::VisitCallExpr(CallExpr * expr) {
// better to handle that at the level of non-expanded macros instead,
// but I have not found out how to do that yet anyway):
APSInt res;
- if (expr->getArg(1)->isIntegerConstantExpr(res, context)) {
+ if (expr->getArg(1)->isIntegerConstantExpr(res, compiler.getASTContext())) {
Expr const * arg0 = expr->getArg(0)->IgnoreParenImpCasts();
StringLiteral const * lit = dyn_cast<StringLiteral>(arg0);
bool match = false;
@@ -82,7 +82,7 @@ bool LiteralAlternative::VisitCallExpr(CallExpr * expr) {
subs->getBase()->IgnoreParenImpCasts());
match = lit != nullptr
&& subs->getIdx()->isIntegerConstantExpr(
- res, context)
+ res, compiler.getASTContext())
&& res == 0;
}
}