Fix libclang segfaults for undefined classes

libclang synced from https://github.com/xdress/clang/commit/42a03caec23de044db49bf75ef8285e1401c576f.