// Write a module hierarchy to the given output stream. bool Module::output(llvm::raw_fd_ostream &OS, int Indent) { // If this is not the nameless root module, start a module definition. if (Name.size() != 0) { OS.indent(Indent); OS << "module " << Name << " {\n"; Indent += 2; } // Output submodules. for (std::vector<Module *>::iterator I = SubModules.begin(), E = SubModules.end(); I != E; ++I) { if (!(*I)->output(OS, Indent)) return false; } // Output header files. for (std::vector<std::string>::iterator I = HeaderFileNames.begin(), E = HeaderFileNames.end(); I != E; ++I) { OS.indent(Indent); OS << "header \"" << *I << "\"\n"; } // If this module has header files, output export directive. if (HeaderFileNames.size() != 0) { OS.indent(Indent); OS << "export *\n"; } // If this is not the nameless root module, close the module definition. if (Name.size() != 0) { Indent -= 2; OS.indent(Indent); OS << "}\n"; } return true; }
// Write a module hierarchy to the given output stream. bool Module::output(llvm::raw_fd_ostream &OS, int Indent) { // If this is not the nameless root module, start a module definition. if (Name.size() != 0) { OS.indent(Indent); OS << "module " << Name << " {\n"; Indent += 2; } // Output submodules. for (auto I = SubModules.begin(), E = SubModules.end(); I != E; ++I) { if (!(*I)->output(OS, Indent)) return false; } // Output header files. for (auto I = HeaderFileNames.begin(), E = HeaderFileNames.end(); I != E; ++I) { OS.indent(Indent); if (IsProblem || strstr((*I).c_str(), ".inl")) OS << "exclude header \"" << *I << "\"\n"; else OS << "header \"" << *I << "\"\n"; } // If this module has header files, output export directive. if (HeaderFileNames.size() != 0) { OS.indent(Indent); OS << "export *\n"; } // If this is not the nameless root module, close the module definition. if (Name.size() != 0) { Indent -= 2; OS.indent(Indent); OS << "}\n"; } return true; }