forked from OSchip/llvm-project
				
			Now, named mdnode llvm.dbg.cu keeps track of all compile units in a module. Update DebugInfoFinder to collect compile units from llvm.dbg.cu.
llvm-svn: 139147
This commit is contained in:
		
							parent
							
								
									cd0d826001
								
							
						
					
					
						commit
						5ea5d7965b
					
				| 
						 | 
					@ -905,6 +905,10 @@ DIVariable llvm::cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// processModule - Process entire module and collect debug info.
 | 
					/// processModule - Process entire module and collect debug info.
 | 
				
			||||||
void DebugInfoFinder::processModule(Module &M) {
 | 
					void DebugInfoFinder::processModule(Module &M) {
 | 
				
			||||||
 | 
					  if (NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu"))
 | 
				
			||||||
 | 
					    for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i)
 | 
				
			||||||
 | 
					      addCompileUnit(DICompileUnit(CU_Nodes->getOperand(i)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
 | 
					  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
 | 
				
			||||||
    for (Function::iterator FI = (*I).begin(), FE = (*I).end(); FI != FE; ++FI)
 | 
					    for (Function::iterator FI = (*I).begin(), FE = (*I).end(); FI != FE; ++FI)
 | 
				
			||||||
      for (BasicBlock::iterator BI = (*FI).begin(), BE = (*FI).end(); BI != BE;
 | 
					      for (BasicBlock::iterator BI = (*FI).begin(), BE = (*FI).end(); BI != BE;
 | 
				
			||||||
| 
						 | 
					@ -934,7 +938,8 @@ void DebugInfoFinder::processModule(Module &M) {
 | 
				
			||||||
    for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
 | 
					    for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
 | 
				
			||||||
      DIGlobalVariable DIG(cast<MDNode>(NMD->getOperand(i)));
 | 
					      DIGlobalVariable DIG(cast<MDNode>(NMD->getOperand(i)));
 | 
				
			||||||
      if (addGlobalVariable(DIG)) {
 | 
					      if (addGlobalVariable(DIG)) {
 | 
				
			||||||
        addCompileUnit(DIG.getCompileUnit());
 | 
					        if (DIG.getVersion() <= LLVMDebugVersion10)
 | 
				
			||||||
 | 
					          addCompileUnit(DIG.getCompileUnit());
 | 
				
			||||||
        processType(DIG.getType());
 | 
					        processType(DIG.getType());
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -962,8 +967,8 @@ void DebugInfoFinder::processLocation(DILocation Loc) {
 | 
				
			||||||
void DebugInfoFinder::processType(DIType DT) {
 | 
					void DebugInfoFinder::processType(DIType DT) {
 | 
				
			||||||
  if (!addType(DT))
 | 
					  if (!addType(DT))
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
 | 
					  if (DT.getVersion() <= LLVMDebugVersion10)
 | 
				
			||||||
  addCompileUnit(DT.getCompileUnit());
 | 
					    addCompileUnit(DT.getCompileUnit());
 | 
				
			||||||
  if (DT.isCompositeType()) {
 | 
					  if (DT.isCompositeType()) {
 | 
				
			||||||
    DICompositeType DCT(DT);
 | 
					    DICompositeType DCT(DT);
 | 
				
			||||||
    processType(DCT.getTypeDerivedFrom());
 | 
					    processType(DCT.getTypeDerivedFrom());
 | 
				
			||||||
| 
						 | 
					@ -994,7 +999,8 @@ void DebugInfoFinder::processLexicalBlock(DILexicalBlock LB) {
 | 
				
			||||||
void DebugInfoFinder::processSubprogram(DISubprogram SP) {
 | 
					void DebugInfoFinder::processSubprogram(DISubprogram SP) {
 | 
				
			||||||
  if (!addSubprogram(SP))
 | 
					  if (!addSubprogram(SP))
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  addCompileUnit(SP.getCompileUnit());
 | 
					  if (SP.getVersion() <= LLVMDebugVersion10)
 | 
				
			||||||
 | 
					    addCompileUnit(SP.getCompileUnit());
 | 
				
			||||||
  processType(SP.getType());
 | 
					  processType(SP.getType());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1009,8 +1015,8 @@ void DebugInfoFinder::processDeclare(DbgDeclareInst *DDI) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!NodesSeen.insert(DV))
 | 
					  if (!NodesSeen.insert(DV))
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
 | 
					  if (DIVariable(N).getVersion() <= LLVMDebugVersion10)
 | 
				
			||||||
  addCompileUnit(DIVariable(N).getCompileUnit());
 | 
					    addCompileUnit(DIVariable(N).getCompileUnit());
 | 
				
			||||||
  processType(DIVariable(N).getType());
 | 
					  processType(DIVariable(N).getType());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue