llvm.org GIT mirror llvm / 06a3bdd
Use error_code in Module::materializeAll. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199269 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
2 changed file(s) with 10 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
2121 #include "llvm/IR/Metadata.h"
2222 #include "llvm/Support/CBindingWrapping.h"
2323 #include "llvm/Support/DataTypes.h"
24 #include "llvm/Support/system_error.h"
2425
2526 namespace llvm {
2627
449450 /// materialized lazily. If !isDematerializable(), this method is a noop.
450451 void Dematerialize(GlobalValue *GV);
451452
452 /// MaterializeAll - Make sure all GlobalValues in this Module are fully read.
453 /// If the module is corrupt, this returns true and fills in the optional
454 /// string with information about the problem. If successful, this returns
455 /// false.
456 bool MaterializeAll(std::string *ErrInfo = 0);
453 /// Make sure all GlobalValues in this Module are fully read.
454 error_code materializeAll();
457455
458456 /// MaterializeAllPermanently - Make sure all GlobalValues in this Module are
459457 /// fully read and clear the Materializer. If the module is corrupt, this
376376 return Materializer->Dematerialize(GV);
377377 }
378378
379 bool Module::MaterializeAll(std::string *ErrInfo) {
379 error_code Module::materializeAll() {
380380 if (!Materializer)
381 return false;
382 error_code EC = Materializer->MaterializeModule(this);
383 if (!EC)
384 return false;
385 if (ErrInfo)
386 *ErrInfo = EC.message();
387 return true;
381 return error_code::success();
382 return Materializer->MaterializeModule(this);
388383 }
389384
390385 bool Module::MaterializeAllPermanently(std::string *ErrInfo) {
391 if (MaterializeAll(ErrInfo))
386 if (error_code EC = materializeAll()) {
387 if (ErrInfo)
388 *ErrInfo = EC.message();
392389 return true;
390 }
393391 Materializer.reset();
394392 return false;
395393 }