summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-05-18 14:25:38 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-05-18 14:25:38 +0200
commita7551b34adf847777de976fdaa3a3432448eea3b (patch)
treefe7f0e995e8afcff04390a674a62b6cc6824d816 /compilerplugins
parent64e5915b7a2c07c740aae25a4a6d00a306e704e4 (diff)
Rewrite in macro arguments
Change-Id: I6ae619edac26fe06d1f86f139b7cf71ce31146d4
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/comparisonwithconstant.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/compilerplugins/clang/comparisonwithconstant.cxx b/compilerplugins/clang/comparisonwithconstant.cxx
index b55a73e05c17..1c7daf5c3c4f 100644
--- a/compilerplugins/clang/comparisonwithconstant.cxx
+++ b/compilerplugins/clang/comparisonwithconstant.cxx
@@ -150,6 +150,11 @@ std::string ComparisonWithConstant::getExprAsString(SourceRange range)
}
SourceRange ComparisonWithConstant::ignoreMacroExpansions(SourceRange range) {
+ while (compiler.getSourceManager().isMacroArgExpansion(range.getBegin())) {
+ range.setBegin(
+ compiler.getSourceManager().getImmediateMacroCallerLoc(
+ range.getBegin()));
+ }
if (range.getBegin().isMacroID()) {
SourceLocation loc;
if (Lexer::isAtStartOfMacroExpansion(
@@ -159,6 +164,11 @@ SourceRange ComparisonWithConstant::ignoreMacroExpansions(SourceRange range) {
range.setBegin(loc);
}
}
+ while (compiler.getSourceManager().isMacroArgExpansion(range.getEnd())) {
+ range.setEnd(
+ compiler.getSourceManager().getImmediateMacroCallerLoc(
+ range.getEnd()));
+ }
if (range.getEnd().isMacroID()) {
SourceLocation loc;
if (Lexer::isAtEndOfMacroExpansion(