Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/include/llvm/Analysis/InlineAdvisor.h
Show First 20 Lines • Show All 296 Lines • ▼ Show 20 Lines | typedef InlineAdvisor *(*AdvisorFactory)(Module &M, | ||||
InlineContext IC); | InlineContext IC); | ||||
PluginInlineAdvisorAnalysis(AdvisorFactory Factory) : Factory(Factory) { | PluginInlineAdvisorAnalysis(AdvisorFactory Factory) : Factory(Factory) { | ||||
HasBeenRegistered = true; | HasBeenRegistered = true; | ||||
assert(Factory != nullptr && | assert(Factory != nullptr && | ||||
"The plugin advisor factory should not be a null pointer."); | "The plugin advisor factory should not be a null pointer."); | ||||
} | } | ||||
// This is needed for unit tests where plugins may be deregistered. | |||||
// Otherwise the static varaible will stay true and if createAdvisor | |||||
// is called it will try to load a non-registered advisor and crash. | |||||
~PluginInlineAdvisorAnalysis() { HasBeenRegistered = false; } | |||||
struct Result { | struct Result { | ||||
AdvisorFactory Factory; | AdvisorFactory Factory; | ||||
}; | }; | ||||
Result run(Module &M, ModuleAnalysisManager &MAM) { return {Factory}; } | Result run(Module &M, ModuleAnalysisManager &MAM) { return {Factory}; } | ||||
Result getResult() { return {Factory}; } | Result getResult() { return {Factory}; } | ||||
private: | private: | ||||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |