2017-01-17 03:11:41 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef MustReturnFromCallerChecker_h__
|
|
|
|
#define MustReturnFromCallerChecker_h__
|
|
|
|
|
|
|
|
#include "RecurseGuard.h"
|
|
|
|
#include "StmtToBlockMap.h"
|
2017-10-20 20:11:50 +03:00
|
|
|
#include "Utils.h"
|
|
|
|
#include "plugin.h"
|
2017-01-17 03:11:41 +03:00
|
|
|
|
|
|
|
class MustReturnFromCallerChecker : public BaseCheck {
|
|
|
|
public:
|
|
|
|
MustReturnFromCallerChecker(StringRef CheckName,
|
|
|
|
ContextType *Context = nullptr)
|
2017-10-20 20:11:50 +03:00
|
|
|
: BaseCheck(CheckName, Context) {}
|
|
|
|
void registerMatchers(MatchFinder *AstMatcher) override;
|
2017-01-17 03:11:41 +03:00
|
|
|
void check(const MatchFinder::MatchResult &Result) override;
|
2017-10-20 20:11:50 +03:00
|
|
|
|
2017-01-17 03:11:41 +03:00
|
|
|
private:
|
|
|
|
bool immediatelyReturns(RecurseGuard<const CFGBlock *> Block,
|
2017-10-20 20:11:50 +03:00
|
|
|
ASTContext *TheContext, size_t FromIdx);
|
2017-01-17 03:11:41 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|