Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29395 from smuzaffar/clang-tiday-unittest
added unit test to check for clang-tidy changes
- Loading branch information
Showing
4 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
class BaseClass { | ||
public: | ||
BaseClass(int x) { | ||
m_x = x; | ||
ch = 0; | ||
}; | ||
virtual ~BaseClass(); | ||
virtual int someMethod(); | ||
|
||
protected: | ||
int m_x; | ||
char* ch; | ||
}; | ||
|
||
BaseClass::~BaseClass() { | ||
if (ch != 0) { | ||
delete ch; | ||
ch = 0; | ||
} | ||
} | ||
int BaseClass::someMethod() { return m_x; } | ||
|
||
class DrivedClass : public BaseClass { | ||
public: | ||
DrivedClass(int x) : BaseClass(x){}; | ||
virtual ~DrivedClass(); | ||
virtual int someMethod(); | ||
}; | ||
|
||
DrivedClass::~DrivedClass() {} | ||
int DrivedClass::someMethod() { return m_x * 2; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
MainSourceFile: 'Utilities/ReleaseScripts/test/test-clang-tidy.cc' | ||
Diagnostics: | ||
- DiagnosticName: modernize-use-nullptr | ||
DiagnosticMessage: | ||
Message: use nullptr | ||
FilePath: 'Utilities/ReleaseScripts/test/test-clang-tidy.cc' | ||
FileOffset: 69 | ||
Replacements: | ||
- FilePath: 'Utilities/ReleaseScripts/test/test-clang-tidy.cc' | ||
Offset: 69 | ||
Length: 1 | ||
ReplacementText: nullptr | ||
- DiagnosticName: modernize-use-nullptr | ||
DiagnosticMessage: | ||
Message: use nullptr | ||
FilePath: 'Utilities/ReleaseScripts/test/test-clang-tidy.cc' | ||
FileOffset: 206 | ||
Replacements: | ||
- FilePath: 'Utilities/ReleaseScripts/test/test-clang-tidy.cc' | ||
Offset: 206 | ||
Length: 1 | ||
ReplacementText: nullptr | ||
- DiagnosticName: modernize-use-nullptr | ||
DiagnosticMessage: | ||
Message: use nullptr | ||
FilePath: 'Utilities/ReleaseScripts/test/test-clang-tidy.cc' | ||
FileOffset: 235 | ||
Replacements: | ||
- FilePath: 'Utilities/ReleaseScripts/test/test-clang-tidy.cc' | ||
Offset: 235 | ||
Length: 1 | ||
ReplacementText: nullptr | ||
- DiagnosticName: modernize-use-override | ||
DiagnosticMessage: | ||
Message: 'prefer using ''override'' or (rarely) ''final'' instead of ''virtual''' | ||
FilePath: 'Utilities/ReleaseScripts/test/test-clang-tidy.cc' | ||
FileOffset: 385 | ||
Replacements: | ||
- FilePath: 'Utilities/ReleaseScripts/test/test-clang-tidy.cc' | ||
Offset: 377 | ||
Length: 8 | ||
ReplacementText: '' | ||
- FilePath: 'Utilities/ReleaseScripts/test/test-clang-tidy.cc' | ||
Offset: 399 | ||
Length: 0 | ||
ReplacementText: ' override' | ||
- DiagnosticName: modernize-use-override | ||
DiagnosticMessage: | ||
Message: 'prefer using ''override'' or (rarely) ''final'' instead of ''virtual''' | ||
FilePath: 'Utilities/ReleaseScripts/test/test-clang-tidy.cc' | ||
FileOffset: 415 | ||
Replacements: | ||
- FilePath: 'Utilities/ReleaseScripts/test/test-clang-tidy.cc' | ||
Offset: 403 | ||
Length: 8 | ||
ReplacementText: '' | ||
- FilePath: 'Utilities/ReleaseScripts/test/test-clang-tidy.cc' | ||
Offset: 427 | ||
Length: 0 | ||
ReplacementText: ' override' | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash -ex | ||
clang-tidy -export-fixes $CMSSW_BASE/test-clang-tidy.cc.yaml -header-filter "$CMSSW_BASE/src/.*" $CMSSW_BASE/src/Utilities/ReleaseScripts/test/test-clang-tidy.cc | ||
sed -i -e "s|$CMSSW_BASE/src/||" $CMSSW_BASE/test-clang-tidy.cc.yaml | ||
diff -u $CMSSW_BASE/test-clang-tidy.cc.yaml $CMSSW_BASE/src/Utilities/ReleaseScripts/test/test-clang-tidy.cc.yaml | ||
rm -f $CMSSW_BASE/test-clang-tidy.cc.yaml |