void ClangInternalState::compare(const std::string& name) { assert(name == m_Name && "Different names!?"); m_DiffPair.reset(new ClangInternalState(m_ASTContext, m_Preprocessor, m_Module, m_CodeGen, name)); std::string differences = ""; // Ignore the builtins typedef llvm::SmallVector<const char*, 1024> Builtins; Builtins builtinNames; m_ASTContext.BuiltinInfo.GetBuiltinNames(builtinNames); for (Builtins::iterator I = builtinNames.begin(); I != builtinNames.end();) { if (llvm::StringRef(*I).startswith("__builtin")) I = builtinNames.erase(I); else ++I; } builtinNames.push_back(".*__builtin.*"); if (differentContent(m_LookupTablesFile, m_DiffPair->m_LookupTablesFile, differences, &builtinNames)) { llvm::errs() << "Differences in the lookup tables\n"; llvm::errs() << differences << "\n"; differences = ""; } if (differentContent(m_IncludedFilesFile, m_DiffPair->m_IncludedFilesFile, differences)) { llvm::errs() << "Differences in the included files\n"; llvm::errs() << differences << "\n"; differences = ""; } if (differentContent(m_ASTFile, m_DiffPair->m_ASTFile, differences)) { llvm::errs() << "Differences in the AST \n"; llvm::errs() << differences << "\n"; differences = ""; } if (m_Module) { assert(m_CodeGen && "Must have CodeGen set"); // We want to skip the intrinsics builtinNames.clear(); for (llvm::Module::const_iterator I = m_Module->begin(), E = m_Module->end(); I != E; ++I) if (I->isIntrinsic()) builtinNames.push_back(I->getName().data()); if (differentContent(m_LLVMModuleFile, m_DiffPair->m_LLVMModuleFile, differences, &builtinNames)) { llvm::errs() << "Differences in the llvm Module \n"; llvm::errs() << differences << "\n"; differences = ""; } } if (differentContent(m_MacrosFile, m_DiffPair->m_MacrosFile, differences)){ llvm::errs() << "Differences in the Macro Definitions \n"; llvm::errs() << differences << "\n"; differences = ""; } }
void ClangInternalState::compare(ClangInternalState& other) { std::string differences = ""; // Ignore the builtins typedef llvm::SmallVector<const char*, 1024> Builtins; Builtins builtinNames; m_ASTContext.BuiltinInfo.GetBuiltinNames(builtinNames); for (Builtins::iterator I = builtinNames.begin(); I != builtinNames.end();) { if (llvm::StringRef(*I).startswith("__builtin")) I = builtinNames.erase(I); else ++I; } builtinNames.push_back(".*__builtin.*"); if (differentContent(m_LookupTablesFile, other.m_LookupTablesFile, differences, &builtinNames)) { llvm::errs() << "Differences in the lookup tables\n"; llvm::errs() << differences << "\n"; differences = ""; } if (differentContent(m_IncludedFilesFile, other.m_IncludedFilesFile, differences)) { llvm::errs() << "Differences in the included files\n"; llvm::errs() << differences << "\n"; differences = ""; } if (differentContent(m_ASTFile, other.m_ASTFile, differences)) { llvm::errs() << "Differences in the AST \n"; llvm::errs() << differences << "\n"; differences = ""; } if (differentContent(m_LLVMModuleFile, other.m_LLVMModuleFile, differences)){ llvm::errs() << "Differences in the llvm Module \n"; llvm::errs() << differences << "\n"; differences = ""; } if (differentContent(m_MacrosFile, other.m_MacrosFile, differences)){ llvm::errs() << "Differences in the Macro Definitions \n"; llvm::errs() << differences << "\n"; differences = ""; } }