Esempio n. 1
0
        bool
        Find_Impl (ExecutionContextScope *exe_scope,
                   const char *key,
                   ResultSet &results) override
        {
            bool result = false;
            
            Target* target = exe_scope->CalculateTarget().get();
            if (target)
            {
                if (auto clang_modules_decl_vendor = target->GetClangModulesDeclVendor())
                {
                    std::vector <clang::NamedDecl*> decls;
                    ConstString key_cs(key);
                    
                    if (clang_modules_decl_vendor->FindDecls(key_cs, false, UINT32_MAX, decls) > 0 &&
                        !decls.empty())
                    {
                        CompilerType module_type = ClangASTContext::GetTypeForDecl(decls.front());
                        result = true;
                        std::unique_ptr<Language::TypeScavenger::Result> result(new ObjCScavengerResult(module_type));
                        results.insert(std::move(result));
                    }
                }
            }
            
            if (!result)
            {
                Process* process = exe_scope->CalculateProcess().get();
                if (process)
                {
                    const bool create_on_demand = false;
                    auto objc_runtime = process->GetObjCLanguageRuntime(create_on_demand);
                    if (objc_runtime)
                    {
                        auto decl_vendor = objc_runtime->GetDeclVendor();
                        if (decl_vendor)
                        {
                            std::vector<clang::NamedDecl *> decls;
                            ConstString name(key);
                            decl_vendor->FindDecls(name, true, UINT32_MAX, decls);
                            for (auto decl : decls)
                            {
                                if (decl)
                                {
                                    if (CompilerType candidate = ClangASTContext::GetTypeForDecl(decl))
                                    {
                                        result = true;
                                        std::unique_ptr<Language::TypeScavenger::Result> result(new ObjCScavengerResult(candidate));
                                        results.insert(std::move(result));
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return result;
        }
Esempio n. 2
0
    ResultSet* Result::makeResultSet (POSFactory* posFactory) {
	ResultSet* ret = new ResultSet(posFactory);
	delete *ret->begin();
	ret->erase(ret->begin());
	ret->insert(ret->begin(), duplicate(ret, ret->begin()));
	return ret;
    }
Esempio n. 3
0
    ResultSet* ResultSet::clone () {
	ResultSet* ret = new ResultSet(posFactory);
	delete *ret->begin();
	ret->erase(ret->begin());
	for (ResultSetIterator it = begin() ; it != end(); it++)
	    ret->insert(ret->begin(), (*it)->duplicate(ret, ret->end()));
	return ret;
    }
Esempio n. 4
0
	void AddResult(const char* pName, int units, int64_t nTime1, int64_t nTime2, const char* pNotes)
	{
		Result result;

		result.msName   = pName;
		result.mUnits   = units;
		result.mTime1   = nTime1;
		result.mTime1NS = ConvertStopwatchUnits((EA::StdC::Stopwatch::Units)units, nTime1, EA::StdC::Stopwatch::kUnitsNanoseconds);
		result.mTime2   = nTime2;
		result.mTime2NS = ConvertStopwatchUnits((EA::StdC::Stopwatch::Units)units, nTime2, EA::StdC::Stopwatch::kUnitsNanoseconds);

		if(pNotes)
			result.msNotes = pNotes;

		gResultSet.insert(result);
	}
Esempio n. 5
0
 bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
                ResultSet &results) override {
   bool result = false;
   
   Target *target = exe_scope->CalculateTarget().get();
   if (target) {
     const auto &images(target->GetImages());
     SymbolContext null_sc;
     ConstString cs_key(key);
     llvm::DenseSet<SymbolFile*> searched_sym_files;
     TypeList matches;
     images.FindTypes(null_sc,
                      cs_key,
                      false,
                      UINT32_MAX,
                      searched_sym_files,
                      matches);
     for (const auto& match : matches.Types()) {
       if (match.get()) {
         CompilerType compiler_type(match->GetFullCompilerType());
         LanguageType lang_type(compiler_type.GetMinimumLanguage());
         // other plugins will find types for other languages - here we only do C and C++
         if (!Language::LanguageIsC(lang_type) && !Language::LanguageIsCPlusPlus(lang_type))
           continue;
         if (compiler_type.IsTypedefType())
           compiler_type = compiler_type.GetTypedefedType();
         std::unique_ptr<Language::TypeScavenger::Result> scavengeresult(
                                                                 new CPlusPlusTypeScavengerResult(compiler_type));
         results.insert(std::move(scavengeresult));
         result = true;
       }
     }
   }
   
   return result;
 }