Fixes the compiler not acknowledging preprocessor and include statements.

This commit is contained in:
Erki 2021-02-24 21:49:50 +02:00
parent e30d779c30
commit 2df47d4bc5

View File

@ -31,11 +31,6 @@ StatementMatcher UnaryArithmeticMatcher =
StatementMatcher CompoundMatcher =
compoundStmt().bind("compound_stmt");
bool isInMainFile(const MatchFinder::MatchResult &result, const SourceLocation &loc)
{
return result.Context->getSourceManager().isWrittenInMainFile(loc);
}
template<typename TOp>
StringRef getOpcode(const TOp *op)
{
@ -78,9 +73,6 @@ void OperationFinder::_processAssignment(const clang::ast_matchers::MatchFinder:
assert(op);
if (!isInMainFile(result, op->getBeginLoc()))
return;
const auto& loc = op->getBeginLoc();
const auto& source_manager = *result.SourceManager;
@ -101,9 +93,6 @@ void OperationFinder::_processArithmetic(const MatchFinder::MatchResult& result)
assert(op);
if (!isInMainFile(result, op->getBeginLoc()))
return;
const auto& loc = op->getBeginLoc();
const auto& source_manager = *result.SourceManager;
@ -128,9 +117,6 @@ void OperationFinder::_processCompoundStmt(const clang::ast_matchers::MatchFinde
if (!op || !op->isCompoundAssignmentOp())
return;
if (!isInMainFile(result, op->getBeginLoc()))
return;
const auto& loc = op->getBeginLoc();
const auto& source_manager = *result.SourceManager;
@ -152,9 +138,6 @@ void OperationFinder::_processUnaryArithmetic(const MatchFinder::MatchResult &re
assert(op);
assert(lhs);
if (!isInMainFile(result, lhs->getBeginLoc()))
return;
const auto& loc = lhs->getBeginLoc();
const auto& source_manager = *result.SourceManager;