diff options
author | Rahul Joshi <rjoshi@nvidia.com> | 2024-09-07 05:13:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-07 05:13:54 -0700 |
commit | 0ceffd362bf01769fa310103b11af9cdc12e2f5b (patch) | |
tree | 66256decdacaabf851f8fde0da6f2c947c2d26ba /llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp | |
parent | 6df12912964caf118c0c8019d7ec681e6ad8bf5c (diff) | |
download | llvm-0ceffd362bf01769fa310103b11af9cdc12e2f5b.zip llvm-0ceffd362bf01769fa310103b11af9cdc12e2f5b.tar.gz llvm-0ceffd362bf01769fa310103b11af9cdc12e2f5b.tar.bz2 |
[TableGen] Add PrintError family overload that take a print function (#107333)
Add PrintError and family overload that accepts a print function. This
avoids constructing potentially long strings for passing into these
print functions.
Diffstat (limited to 'llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp')
-rw-r--r-- | llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp index df3f72ff..9a31d4f 100644 --- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp @@ -1603,14 +1603,11 @@ static TreePatternNode &getOperandNum(unsigned OpNo, TreePatternNode &N, OpNo -= NumResults; if (OpNo >= N.getNumChildren()) { - std::string S; - raw_string_ostream OS(S); - OS << "Invalid operand number in type constraint " << (OpNo + NumResults) - << " "; - N.print(OS); - PrintFatalError(S); + PrintFatalError([&N, OpNo, NumResults](raw_ostream &OS) { + OS << "Invalid operand number in type constraint " << (OpNo + NumResults); + N.print(OS); + }); } - return N.getChild(OpNo); } |