[llvm] [TableGen] Use SmallVectors for preprocessor include stack. NFC. (PR #121571)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 3 09:35:51 PST 2025


================
@@ -656,17 +654,13 @@ tgtok::TokKind TGLexer::LexExclaim() {
 bool TGLexer::prepExitInclude(bool IncludeStackMustBeEmpty) {
   // Report an error, if preprocessor control stack for the current
   // file is not empty.
-  if (!PrepIncludeStack.back()->empty()) {
+  if (!PrepIncludeStack.back().empty()) {
     prepReportPreprocessorStackError();
 
     return false;
   }
 
   // Pop the preprocessing controls from the include stack.
-  if (PrepIncludeStack.empty()) {
----------------
jayfoad wrote:

I don't think any valid input could cause the stack to be empty here, so this should just be an assertion, but `.back()` should already assert for us.

https://github.com/llvm/llvm-project/pull/121571


More information about the llvm-commits mailing list