@@ -1728,13 +1728,14 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D,
1728
1728
}
1729
1729
1730
1730
// / Returns true if it is expected that the macro is ignored.
1731
- static bool shouldIgnoreMacro (StringRef name, const clang::MacroInfo *macro) {
1731
+ static bool shouldIgnoreMacro (StringRef name, const clang::MacroInfo *macro,
1732
+ clang::Preprocessor &PP) {
1732
1733
// Ignore include guards. Try not to ignore definitions of useful constants,
1733
1734
// which may end up looking like include guards.
1734
1735
if (macro->isUsedForHeaderGuard () && macro->getNumTokens () == 1 ) {
1735
1736
auto tok = macro->tokens ()[0 ];
1736
- if (tok.isLiteral ()
1737
- && StringRef (tok. getLiteralData (), tok. getLength ()) == " 1 " )
1737
+ if (tok.is (clang::tok::numeric_constant) && tok. getLength () == 1 &&
1738
+ PP. getSpellingOfSingleCharacterNumericConstant ( tok) == ' 1 ' )
1738
1739
return true ;
1739
1740
}
1740
1741
@@ -1760,14 +1761,15 @@ static bool shouldIgnoreMacro(StringRef name, const clang::MacroInfo *macro) {
1760
1761
1761
1762
bool ClangImporter::shouldIgnoreMacro (StringRef Name,
1762
1763
const clang::MacroInfo *Macro) {
1763
- return ::shouldIgnoreMacro (Name, Macro);
1764
+ return ::shouldIgnoreMacro (Name, Macro, Impl. getClangPreprocessor () );
1764
1765
}
1765
1766
1766
1767
Identifier
1767
1768
NameImporter::importMacroName (const clang::IdentifierInfo *clangIdentifier,
1768
1769
const clang::MacroInfo *macro) {
1769
1770
// If we're supposed to ignore this macro, return an empty identifier.
1770
- if (::shouldIgnoreMacro (clangIdentifier->getName (), macro))
1771
+ if (::shouldIgnoreMacro (clangIdentifier->getName (), macro,
1772
+ getClangPreprocessor ()))
1771
1773
return Identifier ();
1772
1774
1773
1775
// No transformation is applied to the name.
0 commit comments