Skip to content

Commit

Permalink
Merge pull request #1077 from Shishpan/trunkFix
Browse files Browse the repository at this point in the history
Fix for LLVM trunk
  • Loading branch information
dbabokin committed Jul 29, 2015
2 parents 2c4c79d + 90c6e01 commit ab0e8bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 12 additions & 1 deletion ctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,22 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym,
llvm::DICompositeType diSubprogramType_n =
static_cast<llvm::DICompositeType>(diSubprogramType);
int flags = llvm::DIDescriptor::FlagPrototyped;
#else /* LLVM 3.7+ */
#elif ISPC_LLVM_VERSION == ISPC_LLVM_3_7 /* LLVM 3.7 */
Assert(llvm::isa<llvm::DICompositeTypeBase>(diSubprogramType));
llvm::DISubroutineType *diSubprogramType_n =
llvm::cast<llvm::DISubroutineType>(getDICompositeType(diSubprogramType));
int flags = llvm::DINode::FlagPrototyped;
#else /* LLVM 3.8+ */
Assert(llvm::isa<llvm::DICompositeType>(diSubprogramType));
llvm::DICompositeType *C = llvm::dyn_cast_or_null<llvm::DICompositeType>(diSubprogramType);
if (!C){
llvm::DITypeIdentifierMap EmptyMap;
C = llvm::dyn_cast_or_null<llvm::DICompositeType>(llvm::dyn_cast_or_null<llvm::DIDerivedType>(diSubprogramType)->getBaseType().resolve(EmptyMap));
} //restored function getDICompositeType() from 3.7 which absents in 3.8
llvm::DISubroutineType *diSubprogramType_n =
llvm::cast<llvm::DISubroutineType>(C);
int flags = llvm::DINode::FlagPrototyped;

#endif

std::string mangledName = llvmFunction->getName();
Expand Down
4 changes: 3 additions & 1 deletion ispc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,9 @@ Target::Target(const char *arch, const char *cpu, const char *isa, bool pic, boo
std::string dl_string;
#if ISPC_LLVM_VERSION == ISPC_LLVM_3_6
dl_string = m_targetMachine->getSubtargetImpl()->getDataLayout()->getStringRepresentation();
#else // LLVM 3.5- or LLVM 3.7+
#elif ISPC_LLVM_VERSION >= ISPC_LLVM_3_8 // LLVM 3.8+
dl_string = m_targetMachine->createDataLayout().getStringRepresentation();
#else // LLVM 3.5- or LLVM 3.7
dl_string = m_targetMachine->getDataLayout()->getStringRepresentation();
#endif
// 2. Adjust for generic
Expand Down

0 comments on commit ab0e8bb

Please sign in to comment.