Print "null" for ISL objects that are nullptr

Use it to print "null" if a MemoryAccess's access relation is not
available instead of printing nothing.

Suggested-by: Johannes Doerfert
llvm-svn: 255466
This commit is contained in:
Michael Kruse 2015-12-13 19:35:26 +00:00
parent a902ba6f1e
commit b8d2644732
2 changed files with 3 additions and 2 deletions

View File

@ -747,8 +747,7 @@ void MemoryAccess::print(raw_ostream &OS) const {
}
OS << "[Reduction Type: " << getReductionType() << "] ";
OS << "[Scalar: " << isImplicit() << "]\n";
if (AccessRelation)
OS.indent(16) << getOriginalAccessRelationStr() << ";\n";
OS.indent(16) << getOriginalAccessRelationStr() << ";\n";
if (hasNewAccessRelation())
OS.indent(11) << "new: " << getNewAccessRelationStr() << ";\n";
}

View File

@ -70,6 +70,8 @@ template <typename ISLTy, typename ISL_CTX_GETTER, typename ISL_PRINTER>
static inline std::string stringFromIslObjInternal(__isl_keep ISLTy *isl_obj,
ISL_CTX_GETTER ctx_getter_fn,
ISL_PRINTER printer_fn) {
if (!isl_obj)
return "null";
isl_ctx *ctx = ctx_getter_fn(isl_obj);
isl_printer *p = isl_printer_to_str(ctx);
printer_fn(p, isl_obj);