r305774 - [analyzer] Teach CloneDetection about Qt Meta-Object Compiler to filter auto generated files
Leslie Zhai via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 19 23:44:47 PDT 2017
Author: xiangzhai
Date: Tue Jun 20 01:44:46 2017
New Revision: 305774
URL: http://llvm.org/viewvc/llvm-project?rev=305774&view=rev
Log:
[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
Modified:
cfe/trunk/include/clang/Analysis/CloneDetection.h
cfe/trunk/lib/Analysis/CloneDetection.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/CloneChecker.cpp
Modified: cfe/trunk/include/clang/Analysis/CloneDetection.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CloneDetection.h?rev=305774&r1=305773&r2=305774&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/CloneDetection.h (original)
+++ cfe/trunk/include/clang/Analysis/CloneDetection.h Tue Jun 20 01:44:46 2017
@@ -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() + "$)");
Modified: cfe/trunk/lib/Analysis/CloneDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CloneDetection.cpp?rev=305774&r1=305773&r2=305774&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CloneDetection.cpp (original)
+++ cfe/trunk/lib/Analysis/CloneDetection.cpp Tue Jun 20 01:44:46 2017
@@ -366,7 +366,7 @@ void OnlyLargestCloneConstraint::constra
}
}
-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))
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CloneChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CloneChecker.cpp?rev=305774&r1=305773&r2=305774&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CloneChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CloneChecker.cpp Tue Jun 20 01:44:46 2017
@@ -82,7 +82,7 @@ void CloneChecker::checkEndOfTranslation
std::vector<CloneDetector::CloneGroup> AllCloneGroups;
Detector.findClones(AllCloneGroups,
- AutoGeneratedCloneConstraint(IgnoredFilesPattern),
+ FilenamePatternConstraint(IgnoredFilesPattern),
RecursiveCloneTypeIIConstraint(),
MinComplexityConstraint(MinComplexity),
MinGroupSizeConstraint(2), OnlyLargestCloneConstraint());
More information about the cfe-commits
mailing list