summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeslie Zhai <lesliezhai@llvm.org.cn>2017-06-20 06:44:46 +0000
committerLeslie Zhai <lesliezhai@llvm.org.cn>2017-06-20 06:44:46 +0000
commit104b6feb10801a57651bb01b553e289b065e6a9a (patch)
tree2389a70fbd2a624d87db8db9d2272420adc770c4
parent4dfcec6b62629e9d20d38dd8f8a7bc5f60a1aa8a (diff)
downloadbcm5719-llvm-104b6feb10801a57651bb01b553e289b065e6a9a.tar.gz
bcm5719-llvm-104b6feb10801a57651bb01b553e289b065e6a9a.zip
[analyzer] Teach CloneDetection about Qt Meta-Object Compiler to filter auto generated files
Reviewers: v.g.vassilev, teemperor Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D34353 llvm-svn: 305774
-rw-r--r--clang/include/clang/Analysis/CloneDetection.h4
-rw-r--r--clang/lib/Analysis/CloneDetection.cpp2
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/CloneChecker.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/clang/include/clang/Analysis/CloneDetection.h b/clang/include/clang/Analysis/CloneDetection.h
index 3398a1f40af..1ca3514e69b 100644
--- a/clang/include/clang/Analysis/CloneDetection.h
+++ b/clang/include/clang/Analysis/CloneDetection.h
@@ -321,11 +321,11 @@ struct OnlyLargestCloneConstraint {
void constrain(std::vector<CloneDetector::CloneGroup> &Result);
};
-struct AutoGeneratedCloneConstraint {
+struct FilenamePatternConstraint {
StringRef IgnoredFilesPattern;
std::shared_ptr<llvm::Regex> IgnoredFilesRegex;
- AutoGeneratedCloneConstraint(StringRef IgnoredFilesPattern)
+ FilenamePatternConstraint(StringRef IgnoredFilesPattern)
: IgnoredFilesPattern(IgnoredFilesPattern) {
IgnoredFilesRegex = std::make_shared<llvm::Regex>("^(" +
IgnoredFilesPattern.str() + "$)");
diff --git a/clang/lib/Analysis/CloneDetection.cpp b/clang/lib/Analysis/CloneDetection.cpp
index 3b44fab9d74..e86293a1dd0 100644
--- a/clang/lib/Analysis/CloneDetection.cpp
+++ b/clang/lib/Analysis/CloneDetection.cpp
@@ -366,7 +366,7 @@ void OnlyLargestCloneConstraint::constrain(
}
}
-bool AutoGeneratedCloneConstraint::isAutoGenerated(const CloneDetector::CloneGroup &Group) {
+bool FilenamePatternConstraint::isAutoGenerated(const CloneDetector::CloneGroup &Group) {
std::string Error;
if (IgnoredFilesPattern.empty() || Group.empty() ||
!IgnoredFilesRegex->isValid(Error))
diff --git a/clang/lib/StaticAnalyzer/Checkers/CloneChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/CloneChecker.cpp
index d0898adf49f..83955c586b6 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CloneChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CloneChecker.cpp
@@ -82,7 +82,7 @@ void CloneChecker::checkEndOfTranslationUnit(const TranslationUnitDecl *TU,
std::vector<CloneDetector::CloneGroup> AllCloneGroups;
Detector.findClones(AllCloneGroups,
- AutoGeneratedCloneConstraint(IgnoredFilesPattern),
+ FilenamePatternConstraint(IgnoredFilesPattern),
RecursiveCloneTypeIIConstraint(),
MinComplexityConstraint(MinComplexity),
MinGroupSizeConstraint(2), OnlyLargestCloneConstraint());
OpenPOWER on IntegriCloud