[Libreoffice-commits] core.git: compilerplugins/clang
Stephan Bergmann
sbergman at redhat.com
Wed Dec 20 17:13:28 UTC 2017
compilerplugins/clang/salcall.cxx | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
New commits:
commit 50f35e5b65bf69d7b3f2b703c5367574db165196
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Dec 20 13:15:08 2017 +0100
Fix for compilerplugins/clang/test/salcall.cxx with clang-cl
Change-Id: I6e58b6bf0d10297ed3ac20de25c1eea42c9f2334
Reviewed-on: https://gerrit.libreoffice.org/46844
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/compilerplugins/clang/salcall.cxx b/compilerplugins/clang/salcall.cxx
index 3ff786d2ee87..2c33008ae276 100644
--- a/compilerplugins/clang/salcall.cxx
+++ b/compilerplugins/clang/salcall.cxx
@@ -498,6 +498,9 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
}
}
+#if defined _WIN32
+ auto const macroExpansion = SM.getExpansionLoc(endLoc);
+#endif
endLoc = SM.getSpellingLoc(endLoc);
// Ctors/dtors/conversion functions don't have a return type, start searching for "SAL_CALL"
@@ -515,7 +518,17 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
#endif
startLoc = SM.getSpellingLoc(startLoc);
-#if !defined _WIN32
+#if defined _WIN32
+ if (macroRange.isValid()
+ && !compat::isPointWithin(SM, startLoc, macroRange.getBegin(), macroRange.getEnd()))
+ {
+ // endLoc is within a macro body but startLoc is not; two source ranges, first is from
+ // startLoc to the macro invocation, second is the leading part of the corresponding
+ // macro definition's replacement text:
+ ranges.emplace_back(startLoc, macroExpansion);
+ startLoc = macroRange.getBegin();
+ }
+#else
// When the SAL_CALL macro expands to nothing, it may even precede the function
// declaration's source range, so go back one token (unless the declaration is known to
// start with a token that must precede a possible "SAL_CALL", like "virtual" or
More information about the Libreoffice-commits
mailing list