r271750 - CodeGen: correct assertion

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 16:26:31 PDT 2016


Author: compnerd
Date: Fri Jun  3 18:26:30 2016
New Revision: 271750

URL: http://llvm.org/viewvc/llvm-project?rev=271750&view=rev
Log:
CodeGen: correct assertion

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).

Modified:
    cfe/trunk/lib/CodeGen/CGBlocks.cpp

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=271750&r1=271749&r2=271750&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Fri Jun  3 18:26:30 2016
@@ -2294,8 +2294,9 @@ static void configureBlocksRuntimeObject
     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))




More information about the cfe-commits mailing list