[PATCH] D147771: [NFC] add check for potentially dereferencing null return value
Bing Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 10 23:43:11 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG213b73589415: [NFC] add check for potentially dereferencing null return value (authored by yubing).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147771/new/
https://reviews.llvm.org/D147771
Files:
llvm/utils/TableGen/DAGISelMatcherGen.cpp
Index: llvm/utils/TableGen/DAGISelMatcherGen.cpp
===================================================================
--- llvm/utils/TableGen/DAGISelMatcherGen.cpp
+++ llvm/utils/TableGen/DAGISelMatcherGen.cpp
@@ -603,16 +603,17 @@
// 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147771.512347.patch
Type: text/x-patch
Size: 1458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230411/a7881557/attachment.bin>
More information about the llvm-commits
mailing list