]> granicus.if.org Git - clang/commitdiff
CodeGen: correct assertion
authorSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 3 Jun 2016 23:26:30 +0000 (23:26 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 3 Jun 2016 23:26:30 +0000 (23:26 +0000)
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

lib/CodeGen/CGBlocks.cpp

index 3105046cff583acdd7450b52da752bc1a95f33a9..5a41f361d9acfeeaca9c61dd1efdb95abee93560 100644 (file)
@@ -2294,8 +2294,9 @@ static void configureBlocksRuntimeObject(CodeGenModule &CGM,
     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))