本文整理汇总了C++中module::const_global_iterator::hasExternalLinkage方法的典型用法代码示例。如果您正苦于以下问题:C++ const_global_iterator::hasExternalLinkage方法的具体用法?C++ const_global_iterator::hasExternalLinkage怎么用?C++ const_global_iterator::hasExternalLinkage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module::const_global_iterator
的用法示例。
在下文中一共展示了const_global_iterator::hasExternalLinkage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void PIC16AsmPrinter::EmitExternsAndGlobals (Module &M) {
// Emit declarations for external functions.
O << "section.0" <<"\n";
for (Module::iterator I = M.begin(), E = M.end(); I != E; I++) {
std::string Name = Mang->getValueName(I);
if (Name.compare("abort") == 0)
continue;
if (I->isDeclaration()) {
O << "\textern " <<Name << "\n";
O << "\textern " << Name << ".retval\n";
O << "\textern " << Name << ".args\n";
}
else if (I->hasExternalLinkage()) {
O << "\tglobal " << Name << "\n";
O << "\tglobal " << Name << ".retval\n";
O << "\tglobal " << Name << ".args\n";
}
}
// Emit header file to include declaration of library functions
O << "\t#include C16IntrinsicCalls.INC\n";
// Emit declarations for external globals.
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
I != E; I++) {
// Any variables reaching here with ".auto." in its name is a local scope
// variable and should not be printed in global data section.
std::string Name = Mang->getValueName(I);
if (isLocalName (Name))
continue;
if (I->isDeclaration())
O << "\textern "<< Name << "\n";
else if (I->hasCommonLinkage() || I->hasExternalLinkage())
O << "\tglobal "<< Name << "\n";
}
}