[clang] c960c38 - NFC: Remove condition to simplify code
Stephen Kelly via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 14 15:38:46 PDT 2021
Author: Stephen Kelly
Date: 2021-04-14T23:38:04+01:00
New Revision: c960c3836c6a28ba8f8c0b21db0474bf7d674a18
URL: https://github.com/llvm/llvm-project/commit/c960c3836c6a28ba8f8c0b21db0474bf7d674a18
DIFF: https://github.com/llvm/llvm-project/commit/c960c3836c6a28ba8f8c0b21db0474bf7d674a18.diff
LOG: NFC: Remove condition to simplify code
The run method is only called if there is a match with a binding.
Added:
Modified:
clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.cpp
Removed:
################################################################################
diff --git a/clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.cpp b/clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.cpp
index 5121740cd7c3..a19114a06064 100644
--- a/clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.cpp
+++ b/clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.cpp
@@ -157,29 +157,28 @@ CaptureMethods(std::string TypeString, const clang::CXXRecordDecl *ASTClass,
void ASTSrcLocProcessor::run(const MatchFinder::MatchResult &Result) {
- if (const auto *ASTClass =
- Result.Nodes.getNodeAs<clang::CXXRecordDecl>("className")) {
+ const auto *ASTClass =
+ Result.Nodes.getNodeAs<clang::CXXRecordDecl>("className");
- StringRef ClassName = ASTClass->getName();
+ StringRef ClassName = ASTClass->getName();
- ClassData CD;
+ ClassData CD;
- const auto *NodeClade =
- Result.Nodes.getNodeAs<clang::CXXRecordDecl>("nodeClade");
- StringRef CladeName = NodeClade->getName();
+ const auto *NodeClade =
+ Result.Nodes.getNodeAs<clang::CXXRecordDecl>("nodeClade");
+ StringRef CladeName = NodeClade->getName();
- if (const auto *DerivedFrom =
- Result.Nodes.getNodeAs<clang::CXXRecordDecl>("derivedFrom"))
- ClassInheritance[ClassName] = DerivedFrom->getName();
+ if (const auto *DerivedFrom =
+ Result.Nodes.getNodeAs<clang::CXXRecordDecl>("derivedFrom"))
+ ClassInheritance[ClassName] = DerivedFrom->getName();
- CD.ASTClassLocations =
- CaptureMethods("class clang::SourceLocation", ASTClass, Result);
- CD.ASTClassRanges =
- CaptureMethods("class clang::SourceRange", ASTClass, Result);
+ CD.ASTClassLocations =
+ CaptureMethods("class clang::SourceLocation", ASTClass, Result);
+ CD.ASTClassRanges =
+ CaptureMethods("class clang::SourceRange", ASTClass, Result);
- if (!CD.isEmpty()) {
- ClassEntries[ClassName] = CD;
- ClassesInClade[CladeName].push_back(ClassName);
- }
+ if (!CD.isEmpty()) {
+ ClassEntries[ClassName] = CD;
+ ClassesInClade[CladeName].push_back(ClassName);
}
}
More information about the cfe-commits
mailing list