forked from OSchip/llvm-project
				
			
							parent
							
								
									0d2d871e80
								
							
						
					
					
						commit
						3ac483bc89
					
				| 
						 | 
					@ -94,8 +94,7 @@ namespace {  // Anonymous namespace for class
 | 
				
			||||||
    bool doFinalization(Module &M) {
 | 
					    bool doFinalization(Module &M) {
 | 
				
			||||||
      // Scan through, checking all of the external function's linkage now...
 | 
					      // Scan through, checking all of the external function's linkage now...
 | 
				
			||||||
      for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
 | 
					      for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
 | 
				
			||||||
        if (I->isExternal() && I->hasInternalLinkage())
 | 
					        visitGlobalValue(*I);
 | 
				
			||||||
          CheckFailed("Function Declaration has Internal Linkage!", I);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
 | 
					      for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
 | 
				
			||||||
        if (I->isExternal() && I->hasInternalLinkage())
 | 
					        if (I->isExternal() && I->hasInternalLinkage())
 | 
				
			||||||
| 
						 | 
					@ -122,8 +121,10 @@ namespace {  // Anonymous namespace for class
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Verification methods...
 | 
					    // Verification methods...
 | 
				
			||||||
    void verifySymbolTable(SymbolTable &ST);
 | 
					    void verifySymbolTable(SymbolTable &ST);
 | 
				
			||||||
 | 
					    void visitGlobalValue(GlobalValue &GV);
 | 
				
			||||||
    void visitFunction(Function &F);
 | 
					    void visitFunction(Function &F);
 | 
				
			||||||
    void visitBasicBlock(BasicBlock &BB);
 | 
					    void visitBasicBlock(BasicBlock &BB);
 | 
				
			||||||
    void visitPHINode(PHINode &PN);
 | 
					    void visitPHINode(PHINode &PN);
 | 
				
			||||||
| 
						 | 
					@ -171,6 +172,19 @@ namespace {  // Anonymous namespace for class
 | 
				
			||||||
  do { if (!(C)) { CheckFailed(M, V1, V2, V3, V4); return; } } while (0)
 | 
					  do { if (!(C)) { CheckFailed(M, V1, V2, V3, V4); return; } } while (0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Verifier::visitGlobalValue(GlobalValue &GV) {
 | 
				
			||||||
 | 
					  Assert1(!GV.isExternal() || GV.hasExternalLinkage(),
 | 
				
			||||||
 | 
					          "Global value has Internal Linkage!", &GV);
 | 
				
			||||||
 | 
					  Assert1(!GV.hasAppendingLinkage() || isa<GlobalVariable>(GV),
 | 
				
			||||||
 | 
					          "Only global variables can have appending linkage!", &GV);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (GV.hasAppendingLinkage()) {
 | 
				
			||||||
 | 
					    GlobalVariable &GVar = cast<GlobalVariable>(GV);
 | 
				
			||||||
 | 
					    Assert1(isa<ArrayType>(GVar.getType()->getElementType()),
 | 
				
			||||||
 | 
					            "Only global arrays can have appending linkage!", &GV);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// verifySymbolTable - Verify that a function or module symbol table is ok
 | 
					// verifySymbolTable - Verify that a function or module symbol table is ok
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
void Verifier::verifySymbolTable(SymbolTable &ST) {
 | 
					void Verifier::verifySymbolTable(SymbolTable &ST) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue