The assertion added earlier was overly strict. We need to strip the pointer
casts (as when constructing the GV). Correct the types (Function or Variable).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271750
91177308-0d34-0410-b5e6-
96231b3b80d8
TranslationUnitDecl *TUDecl = CGM.getContext().getTranslationUnitDecl();
DeclContext *DC = TranslationUnitDecl::castToDeclContext(TUDecl);
- assert((isa<llvm::Function>(C) || isa<llvm::GlobalValue>(C)) &&
- "expected Function or GlobalValue");
+ assert((isa<llvm::Function>(C->stripPointerCasts()) ||
+ isa<llvm::GlobalVariable>(C->stripPointerCasts())) &&
+ "expected Function or GlobalVariable");
const NamedDecl *ND = nullptr;
for (const auto &Result : DC->lookup(&II))