| 169 | } |
| 170 | |
| 171 | void PreprocessorCallback::MacroDefined(const clang::Token& MacroNameTok, const clang::MacroDirective *MD) |
| 172 | { |
| 173 | clang::SourceLocation loc = MacroNameTok.getLocation(); |
| 174 | if (!loc.isValid() || !loc.isFileID()) |
| 175 | return; |
| 176 | |
| 177 | clang::SourceManager &sm = annotator.getSourceMgr(); |
| 178 | clang::FileID FID = sm.getFileID(loc); |
| 179 | if (!annotator.shouldProcess(FID)) |
| 180 | return; |
| 181 | |
| 182 | std::string ref = llvm::Twine("_M/", MacroNameTok.getIdentifierInfo()->getName()).str(); |
| 183 | |
| 184 | if (sm.getMainFileID() != FID) { |
| 185 | annotator.registerMacro(ref, MacroNameTok.getLocation(), Annotator::Declaration); |
| 186 | } |
| 187 | |
| 188 | annotator.generator(FID).addTag("dfn", "class=\"macro\" id=\""% ref %"\" data-ref=\"" % ref % "\"", sm.getFileOffset(loc), MacroNameTok.getLength()); |
| 189 | } |
| 190 | |
| 191 | void PreprocessorCallback::MacroUndefined(const clang::Token& MacroNameTok, PreprocessorCallback::MyMacroDefinition MD |
| 192 | #if CLANG_VERSION_MAJOR >= 5 |
nothing calls this directly
no test coverage detected