MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / evaluateMacroInstance

Method evaluateMacroInstance

src/SourceCompile/PreprocessFile.cpp:784–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

782}
783
784std::string PreprocessFile::evaluateMacroInstance(
785 std::string_view macro_instance, PreprocessFile* callingFile,
786 uint32_t callingLine, SpecialInstructions::CheckLoopInstr checkMacroLoop,
787 SpecialInstructions::AsIsUndefinedMacroInstr asisUndefMacro) {
788 std::string result;
789 // SymbolId macroArgs = registerSymbol (macro_instance);
790 SpecialInstructions instructions(
791 SpecialInstructions::Mute, SpecialInstructions::Mark,
792 SpecialInstructions::Filter, checkMacroLoop, asisUndefMacro);
793 PreprocessFile* pp =
794 new PreprocessFile(BadSymbolId, m_compileSourceFile, instructions,
795 m_includer ? m_includer->m_compilationUnit
796 : callingFile->m_compilationUnit,
797 callingFile->m_library, /* includer */ nullptr,
798 /* includerLine */ 0, macro_instance);
799 if (!pp->preprocess()) {
800 result = MacroNotDefined;
801 } else {
802 result = pp->getPreProcessedFileContent();
803 }
804 forgetPreprocessor_(m_includer ? m_includer : callingFile, pp);
805 delete pp;
806 return result;
807}
808
809static std::string_view getFirstNonEmptyToken(
810 const std::vector<std::string>& tokens) {

Callers 6

enterStringMethod · 0.80
enterUndef_directiveMethod · 0.80
enterIfdef_directiveMethod · 0.80
enterIfndef_directiveMethod · 0.80
enterElsif_directiveMethod · 0.80

Calls 2

preprocessMethod · 0.45

Tested by

no test coverage detected