[cfe-dev] Can we assert-fail earlier when reading bad PCH files?

Vedant Kumar via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 2 09:42:59 PST 2015


Hi,

I've noticed that the compiler assert-fails pretty far down the call stack when reading out-of-date PCH files. Can we assert-fail a bit earlier?

For example, we could change ASTReader::ReadControlBlock to do this:


2267	switch ((ControlRecordTypes)Stream.readRecord(Entry.ID, Record, &Blob)) {
2268	case METADATA: {
2269      assert(Record.size() >= 8 && "malformed control block in module"); // New


Currently we hit an 'index out of bound' assertion in SmallVector when reading stale PCH files.

I can send a patch in if this seems worthwhile.

vedant


More information about the cfe-dev mailing list