Codegen/llvm.cpp
/// processModule - Process entire module and collect debug info.
Process entire module and collect debug info.
Process entire module and collect debug info .
void DebugInfoFinder::processModule(const llvm::Module &M) {
    InitializeTypeMap(M);
    if (llvm::NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu")) {
        for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
            llvm::DICompileUnit CU(CU_Nodes->getOperand(i));
            addCompileUnit(CU);
            llvm::DIArray GVs = CU.getGlobalVariables();
            for (unsigned i = 0, e = GVs.getNumElements(); i != e; ++i) {
                llvm::DIGlobalVariable DIG(GVs.getElement(i));
                if (addGlobalVariable(DIG)) {
                    processScope(DIG.getContext());
                    processType(DIG.getType().resolve(TypeIdentifierMap));
                }
            }
            llvm::DIArray SPs = CU.getSubprograms();
            for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i)
                processSubprogram(llvm::DISubprogram(SPs.getElement(i)));
            llvm::DIArray EnumTypes = CU.getEnumTypes();
            for (unsigned i = 0, e = EnumTypes.getNumElements(); i != e; ++i)
                processType(llvm::DIType(EnumTypes.getElement(i)));
            llvm::DIArray RetainedTypes = CU.getRetainedTypes();
            for (unsigned i = 0, e = RetainedTypes.getNumElements(); i != e; ++i)
                processType(llvm::DIType(RetainedTypes.getElement(i)));
            llvm::DIArray Imports = CU.getImportedEntities();
            for (unsigned i = 0, e = Imports.getNumElements(); i != e; ++i) {
                llvm::DIImportedEntity Import = llvm::DIImportedEntity(Imports.getElement(i));
                llvm::DIDescriptor Entity = Import.getEntity().resolve(TypeIdentifierMap);
                if (Entity.isType())
                    processType(llvm::DIType(Entity));
                else if (Entity.isSubprogram())
                    processSubprogram(llvm::DISubprogram(Entity));
                else if (Entity.isNameSpace())
                    processScope(llvm::DINameSpace(Entity).getContext());
            }
        }
    }
}
void DebugInfoFinder :: processModule ( const llvm :: Module & M ) { InitializeTypeMap ( M ) ; if ( llvm :: NamedMDNode * CU_Nodes = M . getNamedMetadata ( " " ) ) { for ( unsigned i = 0 , e = CU_Nodes -> getNumOperands ( ) ; i != e ; ++ i ) { llvm :: DICompileUnit CU ( CU_Nodes -> getOperand ( i ) ) ; addCompileUnit ( CU ) ; llvm :: DIArray GVs = CU . getGlobalVariables ( ) ; for ( unsigned i = 0 , e = GVs . getNumElements ( ) ; i != e ; ++ i ) { llvm :: DIGlobalVariable DIG ( GVs . getElement ( i ) ) ; if ( addGlobalVariable ( DIG ) ) { processScope ( DIG . getContext ( ) ) ; processType ( DIG . getType ( ) . resolve ( TypeIdentifierMap ) ) ; } } llvm :: DIArray SPs = CU . getSubprograms ( ) ; for ( unsigned i = 0 , e = SPs . getNumElements ( ) ; i != e ; ++ i ) processSubprogram ( llvm :: DISubprogram ( SPs . getElement ( i ) ) ) ; llvm :: DIArray EnumTypes = CU . getEnumTypes ( ) ; for ( unsigned i = 0 , e = EnumTypes . getNumElements ( ) ; i != e ; ++ i ) processType ( llvm :: DIType ( EnumTypes . getElement ( i ) ) ) ; llvm :: DIArray RetainedTypes = CU . getRetainedTypes ( ) ; for ( unsigned i = 0 , e = RetainedTypes . getNumElements ( ) ; i != e ; ++ i ) processType ( llvm :: DIType ( RetainedTypes . getElement ( i ) ) ) ; llvm :: DIArray Imports = CU . getImportedEntities ( ) ; for ( unsigned i = 0 , e = Imports . getNumElements ( ) ; i != e ; ++ i ) { llvm :: DIImportedEntity Import = llvm :: DIImportedEntity ( Imports . getElement ( i ) ) ; llvm :: DIDescriptor Entity = Import . getEntity ( ) . resolve ( TypeIdentifierMap ) ; if ( Entity . isType ( ) ) processType ( llvm :: DIType ( Entity ) ) ; else if ( Entity . isSubprogram ( ) ) processSubprogram ( llvm :: DISubprogram ( Entity ) ) ; else if ( Entity . isNameSpace ( ) ) processScope ( llvm :: DINameSpace ( Entity ) . getContext ( ) ) ; } } } }
processModule - Process entire module and collect debug info.
processModule - Process entire module and collect debug info .