Fix crash on XCore on unused inline in EmitTargetMetadata
authorNigel Perks <nigelp@xmos.com>
Wed, 24 Jun 2020 19:20:29 +0000 (12:20 -0700)
committerErich Keane <erich.keane@intel.com>
Wed, 24 Jun 2020 19:48:17 +0000 (12:48 -0700)
commitdc3f8913d2ad33b1129ea488393e12cc88061aff
tree5a6c0d6c7920a4ac757fd801b6c9138ff41f4774
parent395920a6149323a17813b384caf6bdb883fd767e
Fix crash on XCore on unused inline in EmitTargetMetadata

EmitTargetMetadata passed to emitTargetMD a null pointer as returned
from GetGlobalValue, for an unused inline function which has been
removed from the module at that point.

A FIXME in CodeGenModule.cpp commented that the calling code in
EmitTargetMetadata should be moved into the one target that needs it
(XCore). A review comment agreed. So the calling loop has been moved
into the XCore subclass. The check for null is done in that loop.

Differential Revision: https://reviews.llvm.org/D77068
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/CodeGen/TargetInfo.h
clang/test/CodeGen/xcore-unused-inline.c [new file with mode: 0644]