| 145 | } |
| 146 | |
| 147 | void MacroDefined(const Token& macroNameTok, const MacroDirective* md) override |
| 148 | { |
| 149 | const auto loc = md->getLocation(); |
| 150 | if(not mSm.isWrittenInMainFile(loc)) { |
| 151 | return; |
| 152 | } |
| 153 | |
| 154 | auto name = mPP.getSpelling(macroNameTok); |
| 155 | |
| 156 | if(not name.starts_with("INSIGHTS_"sv)) { |
| 157 | return; |
| 158 | } |
| 159 | |
| 160 | mIncludes.emplace_back(loc, StrCat("#define "sv, name, "\n"sv)); |
| 161 | } |
| 162 | }; |
| 163 | |
| 164 | class CppInsightASTConsumer final : public ASTConsumer |