Simplify assertion message to avoid confusion.

llvm-svn: 72731
This commit is contained in:
Devang Patel 2009-06-02 17:26:29 +00:00
parent fc968ef687
commit 9643e4f985
1 changed files with 15 additions and 17 deletions

View File

@ -226,23 +226,21 @@ AnalysisType &Pass::getAnalysis(Function &F) {
template<typename AnalysisType> template<typename AnalysisType>
AnalysisType &Pass::getAnalysisID(const PassInfo *PI, Function &F) { AnalysisType &Pass::getAnalysisID(const PassInfo *PI, Function &F) {
assert(PI && "getAnalysis for unregistered pass!"); assert(PI && "getAnalysis for unregistered pass!");
assert(Resolver&&"Pass has not been inserted into a PassManager object!"); assert(Resolver && "Pass has not been inserted into a PassManager object!");
// PI *must* appear in AnalysisImpls. Because the number of passes used // PI *must* appear in AnalysisImpls. Because the number of passes used
// should be a small number, we just do a linear search over a (dense) // should be a small number, we just do a linear search over a (dense)
// vector. // vector.
Pass *ResultPass = Resolver->findImplPass(this, PI, F); Pass *ResultPass = Resolver->findImplPass(this, PI, F);
assert (ResultPass && assert (ResultPass && "Unable to find requested analysis info");
"getAnalysis*() called on an analysis that was not "
"'required' by pass!"); // Because the AnalysisType may not be a subclass of pass (for
// AnalysisGroups), we must use dynamic_cast here to potentially adjust the
// Because the AnalysisType may not be a subclass of pass (for // return pointer (because the class may multiply inherit, once from pass,
// AnalysisGroups), we must use dynamic_cast here to potentially adjust the // once from AnalysisType).
// return pointer (because the class may multiply inherit, once from pass, //
// once from AnalysisType). AnalysisType *Result = dynamic_cast<AnalysisType*>(ResultPass);
// assert(Result && "Pass does not implement interface required!");
AnalysisType *Result = dynamic_cast<AnalysisType*>(ResultPass); return *Result;
assert(Result && "Pass does not implement interface required!");
return *Result;
} }
} // End llvm namespace } // End llvm namespace