本文整理汇总了C++中FunctionSet::end方法的典型用法代码示例。如果您正苦于以下问题:C++ FunctionSet::end方法的具体用法?C++ FunctionSet::end怎么用?C++ FunctionSet::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionSet
的用法示例。
在下文中一共展示了FunctionSet::end方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addCalledFunctions
/// Add the functions called by a function to the function set
/// \param func
/// The function for which all called functions will be added
/// \param funcSet
/// The set of currently called functions
/// \param funcList
/// The list of all functions
/// \return
/// True if all functions are found in the funcList, false otherwise.
bool HlslLinker::addCalledFunctions( GlslFunction *func, FunctionSet& funcSet, std::vector<GlslFunction*> &funcList )
{
const std::set<std::string> &cf = func->getCalledFunctions();
for (std::set<std::string>::const_iterator cit=cf.begin(); cit != cf.end(); cit++)
{
std::vector<GlslFunction*>::iterator it = funcList.begin();
//This might be better as a more efficient search
while (it != funcList.end())
{
if ( *cit == (*it)->getMangledName())
break;
it++;
}
//check to see if it really exists
if ( it == funcList.end())
{
infoSink.info << "Failed to find function '" << *cit <<"'\n";
return false;
}
//add the function (if it's not there already) and recurse
if (std::find (funcSet.begin(), funcSet.end(), *it) == funcSet.end())
funcSet.push_back (*it);
addCalledFunctions( *it, funcSet, funcList);
}
return true;
}
示例2:
bool
query_function_entry(void *addr)
{
FunctionSet::iterator it = function_entries.find(addr);
if (it == function_entries.end()) return false;
else return true;
}
示例3: sprintf
void
dump_reachable_functions()
{
char buffer[1024];
FunctionSet::iterator i = function_entries.begin();
for (; i != function_entries.end();) {
Function *f = (*i).second;
++i;
const char *name;
if (!f->isvisible && !(f->call_count > 1) && !is_possible_fn(f->address)) continue;
if (f->comment) {
name = f->comment->c_str();
}
else {
// inferred functions must be at least 16 bytes long
if (i != function_entries.end()) {
Function *nextf = (*i).second;
if (f->call_count == 0 &&
(((unsigned long) nextf->address) -
((unsigned long) f->address)) < 16) {
long offset = offset_for_fn(f->address);
if (offset == 0) {
// if f->address lies within a valid code range, its
// offset will be non-zero. if offset is zero, the
// address cannot be a valid function start.
continue;
}
if (!range_contains_control_flow((char *) f->address + offset,
((char *) nextf->address +
offset)))
continue;
}
}
sprintf(buffer,"stripped_%p", f->address);
name = buffer;
}
dump_function_entry(f->address, name);
}
}
示例4: printf
void
entries_in_range(void *start, void *end, vector<void *> &result)
{
#ifdef DEBUG_ENTRIES_IN_RANGE
printf("function entries for range [%p, %p]\n", start, end);
#endif
FunctionSet::iterator it = function_entries.find(start);
for (; it != function_entries.end(); it++) {
void *addr = (*it).first;
if (addr > end) return;
#ifdef DEBUG_ENTRIES_IN_RANGE
printf(" %p\n", addr);
#endif
result.push_back(addr);
}
}
示例5: string
void
add_function_entry(void *addr, const string *comment, bool isvisible,
int call_count)
{
FunctionSet::iterator it = function_entries.find(addr);
if (it == function_entries.end()) {
new_function_entry(addr, comment ? new string(*comment) : NULL,
isvisible, call_count);
} else {
Function *f = (*it).second;
if (comment) {
f->AppendComment(comment);
} else if (f->comment) {
f->isvisible = true;
}
f->call_count += call_count;
}
}
示例6: buildUniformsAndLibFunctions
void HlslLinker::buildUniformsAndLibFunctions(const FunctionSet& calledFunctions, std::vector<GlslSymbol*>& constants, std::set<TOperator>& libFunctions)
{
for (FunctionSet::const_iterator it = calledFunctions.begin(); it != calledFunctions.end(); ++it) {
const std::vector<GlslSymbol*> &symbols = (*it)->getSymbols();
unsigned n_symbols = symbols.size();
for (unsigned i = 0; i != n_symbols; ++i) {
GlslSymbol* s = symbols[i];
if (s->getQualifier() == EqtUniform || s->getQualifier() == EqtMutableUniform)
constants.push_back(s);
}
//take each referenced library function, and add it to the set
const std::set<TOperator> &referencedFunctions = (*it)->getLibFunctions();
libFunctions.insert( referencedFunctions.begin(), referencedFunctions.end());
}
// std::unique only removes contiguous duplicates, so vector must be sorted to remove them all
std::sort(constants.begin(), constants.end(), GlslSymbolSorter());
// Remove duplicates
constants.resize(std::unique(constants.begin(), constants.end()) - constants.begin());
}
示例7: contains_function_entry
bool contains_function_entry(void *address)
{
FunctionSet::iterator it = function_entries.find(address);
if (it != function_entries.end()) return true;
else return false;
}
示例8: link
bool HlslLinker::link(HlslCrossCompiler* compiler, const char* entryFunc, bool usePrecision)
{
std::vector<GlslFunction*> globalList;
std::vector<GlslFunction*> functionList;
std::string entryPoint;
GlslFunction* funcMain = NULL;
FunctionSet calledFunctions;
std::set<TOperator> libFunctions;
std::map<std::string,GlslSymbol*> globalSymMap;
std::map<std::string,GlslStruct*> structMap;
if (!compiler)
{
infoSink.info << "No shader compiler provided\n";
return false;
}
EShLanguage lang = compiler->getLanguage();
if (!entryFunc)
{
infoSink.info << "No shader entry function provided\n";
return false;
}
entryPoint = GetEntryName (entryFunc);
//build the list of functions
HlslCrossCompiler *comp = static_cast<HlslCrossCompiler*>(compiler);
std::vector<GlslFunction*> &fl = comp->functionList;
for ( std::vector<GlslFunction*>::iterator fit = fl.begin(); fit < fl.end(); fit++)
{
if ( (*fit)->getName() == "__global__")
globalList.push_back( *fit);
else
functionList.push_back( *fit);
if ((*fit)->getName() == entryPoint)
{
if (funcMain)
{
infoSink.info << kShaderTypeNames[lang] << " entry function cannot be overloaded\n";
return false;
}
funcMain = *fit;
}
}
// check to ensure that we found the entry function
if (!funcMain)
{
infoSink.info << "Failed to find entry function: '" << entryPoint <<"'\n";
return false;
}
//add all the called functions to the list
calledFunctions.push_back (funcMain);
if (!addCalledFunctions (funcMain, calledFunctions, functionList))
{
infoSink.info << "Failed to resolve all called functions in the " << kShaderTypeNames[lang] << " shader\n";
}
//iterate over the functions, building a global list of structure declaractions and symbols
// assume a single compilation unit for expediency (eliminates name clashes, as type checking
// withing a single compilation unit has been performed)
for (FunctionSet::iterator it=calledFunctions.begin(); it != calledFunctions.end(); it++)
{
//get each symbol and each structure, and add them to the map
// checking that any previous entries are equivalent
const std::vector<GlslSymbol*> &symList = (*it)->getSymbols();
for (std::vector<GlslSymbol*>::const_iterator cit = symList.begin(); cit < symList.end(); cit++)
{
if ( (*cit)->getIsGlobal())
{
//should check for already added ones here
globalSymMap[(*cit)->getName()] = *cit;
}
}
//take each referenced library function, and add it to the set
const std::set<TOperator> &libSet = (*it)->getLibFunctions();
libFunctions.insert( libSet.begin(), libSet.end());
}
// The following code is what is used to generate the actual shader and "main"
// function. The process is to take all the components collected above, and
// write them to the appropriate code stream. Finally, a main function is
// generated that calls the specified entrypoint. That main function uses
// semantics on the arguments and return values to connect items appropriately.
//
// Write Library Functions & required extensions
std::string shaderExtensions, shaderLibFunctions;
if (!libFunctions.empty())
{
//.........这里部分代码省略.........