]> granicus.if.org Git - clang/commitdiff
[analyzer] Teach CloneDetection about Qt Meta-Object Compiler to filter auto generate...
authorLeslie Zhai <lesliezhai@llvm.org.cn>
Tue, 20 Jun 2017 06:44:46 +0000 (06:44 +0000)
committerLeslie Zhai <lesliezhai@llvm.org.cn>
Tue, 20 Jun 2017 06:44:46 +0000 (06:44 +0000)
Reviewers: v.g.vassilev, teemperor

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D34353

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305774 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/CloneDetection.h
lib/Analysis/CloneDetection.cpp
lib/StaticAnalyzer/Checkers/CloneChecker.cpp

index 3398a1f40af5b3ca939ad96b54dd6f5489f0a771..1ca3514e69b0ff1b028ff3202d00f9df9d49f29e 100644 (file)
@@ -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() + "$)");
index 3b44fab9d74ad4972b8f09bdb8376218717a8703..e86293a1dd0b7883609af01ad5b879e874fe2ca2 100644 (file)
@@ -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))
index d0898adf49fb633f1b466d5c9ad6810b84d0758f..83955c586b688824fc5cccc4483cf2687e4bb7d0 100644 (file)
@@ -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());