[llvm] 213b735 - [NFC] add check for potentially dereferencing null return value
Bing1 Yu via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 10 23:42:58 PDT 2023
Author: Bing1 Yu
Date: 2023-04-11T14:42:47+08:00
New Revision: 213b7358941514e36f21c79e07b1b810893f9271
URL: https://github.com/llvm/llvm-project/commit/213b7358941514e36f21c79e07b1b810893f9271
DIFF: https://github.com/llvm/llvm-project/commit/213b7358941514e36f21c79e07b1b810893f9271.diff
LOG: [NFC] add check for potentially dereferencing null return value
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D147771
Added:
Modified:
llvm/utils/TableGen/DAGISelMatcherGen.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/DAGISelMatcherGen.cpp b/llvm/utils/TableGen/DAGISelMatcherGen.cpp
index 999253529008..59e2ecb20c88 100644
--- a/llvm/utils/TableGen/DAGISelMatcherGen.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherGen.cpp
@@ -603,16 +603,17 @@ bool MatcherGen::EmitMatcherCode(unsigned Variant) {
// Get the slot we recorded the value in from the name on the node.
unsigned RecNodeEntry = MatchedComplexPatterns[i].second;
- const ComplexPattern &CP = *N->getComplexPatternInfo(CGP);
+ const ComplexPattern *CP = N->getComplexPatternInfo(CGP);
+ assert(CP && "Not a valid ComplexPattern!");
// Emit a CheckComplexPat operation, which does the match (aborting if it
// fails) and pushes the matched operands onto the recorded nodes list.
- AddMatcher(new CheckComplexPatMatcher(CP, RecNodeEntry,
- N->getName(), NextRecordedOperandNo));
+ AddMatcher(new CheckComplexPatMatcher(*CP, RecNodeEntry, N->getName(),
+ NextRecordedOperandNo));
// Record the right number of operands.
- NextRecordedOperandNo += CP.getNumOperands();
- if (CP.hasProperty(SDNPHasChain)) {
+ NextRecordedOperandNo += CP->getNumOperands();
+ if (CP->hasProperty(SDNPHasChain)) {
// If the complex pattern has a chain, then we need to keep track of the
// fact that we just recorded a chain input. The chain input will be
// matched as the last operand of the predicate if it was successful.
More information about the llvm-commits
mailing list