MCPcopy Create free account
hub / github.com/KDAB/codebrowser / MacroDefined

Method MacroDefined

generator/preprocessorcallback.cpp:171–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171void 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
191void PreprocessorCallback::MacroUndefined(const clang::Token& MacroNameTok, PreprocessorCallback::MyMacroDefinition MD
192#if CLANG_VERSION_MAJOR >= 5

Callers

nothing calls this directly

Calls 4

TwineClass · 0.85
registerMacroMethod · 0.80
addTagMethod · 0.80
shouldProcessMethod · 0.45

Tested by

no test coverage detected