New crash in codegen?

Testcase:

struct MpegEncContext;
typedef struct MpegEncContext {int pb;} MpegEncContext;
static void x(void) {MpegEncContext s; s.pb;}

Crashes for me in codegen on trunk, but I'm not sure if it's just my
own build...

/home/eli/llvm/tools/clangclean/CodeGen/CodeGenTypes.cpp:423: unsigned
int clang::CodeGen::CodeGenTypes::getLLVMFieldNo(const
clang::FieldDecl*): Assertion `I != FieldInfo.end() && "Unable to find
field info"' failed.

-Eli

This isn't your build, this is a regression from my patch last night. The basic problem here is that codegen isn't being informed of the decl for 'struct MpegEncContext'. Instead, it is informed about the decl for MpegEncContext (a typedef) only.

We need to rethink how the parser/sema and the clients communicate, probably by extending ASTConsumer. How critical is this to you? Steve convinced me to implement support for 2-token lookahead, would it be ok to defer this for a couple days?

-Chris

Well, this crashes on a lot of real code, since it's not exactly a
rare construct. That said, I'm not using clang for anything serious,
so it's hard to say it's very important...

Is there some sort of easy hack that could make this work for the moment?

-Eli
-Eli

We need to rethink how the parser/sema and the clients communicate,
probably by extending ASTConsumer. How critical is this to you?
Steve convinced me to implement support for 2-token lookahead, would
it be ok to defer this for a couple days?

Well, this crashes on a lot of real code, since it's not exactly a
rare construct. That said, I'm not using clang for anything serious,
so it's hard to say it's very important...

Gotcha, will fix.

Is there some sort of easy hack that could make this work for the moment?

I'm working on it, stay tuned :slight_smile:

-Chris

This should work now, please let me know if you hit any other problems, thanks!

-Chris