Cope with clang 4.0's rename of getNumArgs()

Sorry, this one I couldn't do in a perfectly elegant way ;)
This commit is contained in:
Chris Kitching
2017-10-15 10:38:24 +01:00
parent 22a5e2330d
commit 9ccb966e2b
+8 -1
View File
@@ -3102,7 +3102,14 @@ public:
const MacroDefinition &MD, SourceRange Range,
const MacroArgs *Args) override {
if (_sm->isWrittenInMainFile(MacroNameTok.getLocation())) {
for (unsigned int i = 0; Args && i < MD.getMacroInfo()->getNumArgs(); i++) {
// The getNumArgs function was rather unhelpfully renamed in clang 4.0. Its semantics
// remain unchanged.
#if LLVM_VERSION_MAJOR > 3
#define GET_NUM_ARGS() getNumParams()
#else
#define GET_NUM_ARGS() getNumArgs()
#endif
for (unsigned int i = 0; Args && i < MD.getMacroInfo()->GET_NUM_ARGS(); i++) {
std::vector<Token> toks;
// Code below is a kind of stolen from 'MacroArgs::getPreExpArgument'
// to workaround the 'const' MacroArgs passed into this hook.