Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: lib/IR/Module.cpp

Issue 770853002: Fix error reporting in the PNaCl bitcode reader. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix nits. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 //===-- Module.cpp - Implement the Module class ---------------------------===// 1 //===-- Module.cpp - Implement the Module class ---------------------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file implements the Module class for the IR library. 10 // This file implements the Module class for the IR library.
11 // 11 //
12 //===----------------------------------------------------------------------===// 12 //===----------------------------------------------------------------------===//
13 13
14 #include "llvm/IR/Module.h" 14 #include "llvm/IR/Module.h"
15 #include "SymbolTableListTraitsImpl.h" 15 #include "SymbolTableListTraitsImpl.h"
16 #include "llvm/ADT/DenseSet.h" 16 #include "llvm/ADT/DenseSet.h"
17 #include "llvm/ADT/STLExtras.h" 17 #include "llvm/ADT/STLExtras.h"
18 #include "llvm/ADT/SmallString.h" 18 #include "llvm/ADT/SmallString.h"
19 #include "llvm/ADT/StringExtras.h" 19 #include "llvm/ADT/StringExtras.h"
20 #include "llvm/IR/Constants.h" 20 #include "llvm/IR/Constants.h"
21 #include "llvm/IR/DerivedTypes.h" 21 #include "llvm/IR/DerivedTypes.h"
22 #include "llvm/IR/GVMaterializer.h" 22 #include "llvm/IR/GVMaterializer.h"
23 #include "llvm/IR/InstrTypes.h" 23 #include "llvm/IR/InstrTypes.h"
24 #include "llvm/IR/LLVMContext.h" 24 #include "llvm/IR/LLVMContext.h"
25 #include "llvm/IR/LeakDetector.h" 25 #include "llvm/IR/LeakDetector.h"
26 #include "llvm/Support/Dwarf.h" 26 #include "llvm/Support/Dwarf.h"
27 #include "llvm/Support/Path.h" 27 #include "llvm/Support/Path.h"
28 #include "llvm/Support/RandomNumberGenerator.h" 28 #include "llvm/Support/RandomNumberGenerator.h"
29 #include "llvm/Support/raw_ostream.h"
29 #include <algorithm> 30 #include <algorithm>
30 #include <cstdarg> 31 #include <cstdarg>
31 #include <cstdlib> 32 #include <cstdlib>
32 using namespace llvm; 33 using namespace llvm;
33 34
34 //===----------------------------------------------------------------------===// 35 //===----------------------------------------------------------------------===//
35 // Methods to implement the globals and functions lists. 36 // Methods to implement the globals and functions lists.
36 // 37 //
37 38
38 // Explicit instantiations of SymbolTableListTraits since some of the methods 39 // Explicit instantiations of SymbolTableListTraits since some of the methods
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 bool Module::isDematerializable(const GlobalValue *GV) const { 388 bool Module::isDematerializable(const GlobalValue *GV) const {
388 if (Materializer) 389 if (Materializer)
389 return Materializer->isDematerializable(GV); 390 return Materializer->isDematerializable(GV);
390 return false; 391 return false;
391 } 392 }
392 393
393 bool Module::Materialize(GlobalValue *GV, std::string *ErrInfo) { 394 bool Module::Materialize(GlobalValue *GV, std::string *ErrInfo) {
394 if (!Materializer) 395 if (!Materializer)
395 return false; 396 return false;
396 397
398 errs() << "-> Module::Materialize\n";
jvoung (off chromium) 2014/12/01 23:23:50 I assume these are for debugging -- can these be r
Karl 2014/12/03 18:32:10 Reverted and removed from CL.
397 std::error_code EC = Materializer->Materialize(GV); 399 std::error_code EC = Materializer->Materialize(GV);
400 errs() << "<- Module::Materialize\n";
398 if (!EC) 401 if (!EC)
399 return false; 402 return false;
400 if (ErrInfo) 403 if (ErrInfo)
401 *ErrInfo = EC.message(); 404 *ErrInfo = EC.message();
402 return true; 405 return true;
403 } 406 }
404 407
405 void Module::Dematerialize(GlobalValue *GV) { 408 void Module::Dematerialize(GlobalValue *GV) {
406 if (Materializer) 409 if (Materializer)
407 return Materializer->Dematerialize(GV); 410 return Materializer->Dematerialize(GV);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 return cast<ConstantInt>(Val)->getZExtValue(); 457 return cast<ConstantInt>(Val)->getZExtValue();
455 } 458 }
456 459
457 Comdat *Module::getOrInsertComdat(StringRef Name) { 460 Comdat *Module::getOrInsertComdat(StringRef Name) {
458 Comdat C; 461 Comdat C;
459 StringMapEntry<Comdat> &Entry = 462 StringMapEntry<Comdat> &Entry =
460 ComdatSymTab.GetOrCreateValue(Name, std::move(C)); 463 ComdatSymTab.GetOrCreateValue(Name, std::move(C));
461 Entry.second.Name = &Entry; 464 Entry.second.Name = &Entry;
462 return &Entry.second; 465 return &Entry.second;
463 } 466 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698