lebedev.ri created this revision.
lebedev.ri added reviewers: rsmith, rtrieu, riccibruno.
lebedev.ri added a project: clang.
While this is NFC - `NumStmtFields` **is** currently `0`, the assert is faulty.

It's not checking that `VisitStmt()` is called when `getIdx()` returns 
`NumStmtFields`.
It is checking that `VisitStmt()` is called *first*, when `getIdx()` returns 
`0`.

I have stumbled into this while changing `NumStmtFields` to `1`.


Repository:
  rC Clang

https://reviews.llvm.org/D59196

Files:
  lib/Serialization/ASTReaderStmt.cpp


Index: lib/Serialization/ASTReaderStmt.cpp
===================================================================
--- lib/Serialization/ASTReaderStmt.cpp
+++ lib/Serialization/ASTReaderStmt.cpp
@@ -147,7 +147,7 @@
 }
 
 void ASTStmtReader::VisitStmt(Stmt *S) {
-  assert(Record.getIdx() == NumStmtFields && "Incorrect statement field 
count");
+  assert(Record.getIdx() == 0 && "Incorrect statement field count");
 }
 
 void ASTStmtReader::VisitNullStmt(NullStmt *S) {


Index: lib/Serialization/ASTReaderStmt.cpp
===================================================================
--- lib/Serialization/ASTReaderStmt.cpp
+++ lib/Serialization/ASTReaderStmt.cpp
@@ -147,7 +147,7 @@
 }
 
 void ASTStmtReader::VisitStmt(Stmt *S) {
-  assert(Record.getIdx() == NumStmtFields && "Incorrect statement field count");
+  assert(Record.getIdx() == 0 && "Incorrect statement field count");
 }
 
 void ASTStmtReader::VisitNullStmt(NullStmt *S) {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to