projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Simplify some getNode calls.
[oota-llvm.git]
/
tools
/
llvm-nm
/
llvm-nm.cpp
diff --git
a/tools/llvm-nm/llvm-nm.cpp
b/tools/llvm-nm/llvm-nm.cpp
index c4aa7baf43ea229442248218587d86fc57dc31bb..008c2e0431fca956121cc8abd9584a420a592f3f 100644
(file)
--- a/
tools/llvm-nm/llvm-nm.cpp
+++ b/
tools/llvm-nm/llvm-nm.cpp
@@
-2,13
+2,13
@@
//
// The LLVM Compiler Infrastructure
//
//
// The LLVM Compiler Infrastructure
//
-// This file
was developed by the LLVM research group and is distributed under
-//
the University of Illinois Open Source
License. See LICENSE.TXT for details.
+// This file
is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This program is a utility that works like traditional Unix "nm",
//
//===----------------------------------------------------------------------===//
//
// This program is a utility that works like traditional Unix "nm",
-// that is, it prints out the names of symbols in a b
yte
code file,
+// that is, it prints out the names of symbols in a b
it
code file,
// along with some information about each symbol.
//
// This "nm" does not print symbols' addresses. It supports many of
// along with some information about each symbol.
//
// This "nm" does not print symbols' addresses. It supports many of
@@
-43,7
+43,7
@@
namespace {
cl::aliasopt(OutputFormat));
cl::list<std::string>
cl::aliasopt(OutputFormat));
cl::list<std::string>
- InputFilenames(cl::Positional, cl::desc("<input b
yte
code files>"),
+ InputFilenames(cl::Positional, cl::desc("<input b
it
code files>"),
cl::ZeroOrMore);
cl::opt<bool> UndefinedOnly("undefined-only",
cl::ZeroOrMore);
cl::opt<bool> UndefinedOnly("undefined-only",
@@
-68,14
+68,20
@@
namespace {
}
static char TypeCharForSymbol(GlobalValue &GV) {
}
static char TypeCharForSymbol(GlobalValue &GV) {
- if (GV.isDeclaration())
return 'U';
+ if (GV.isDeclaration()) return 'U';
if (GV.hasLinkOnceLinkage()) return 'C';
if (GV.hasLinkOnceLinkage()) return 'C';
+ if (GV.hasCommonLinkage()) return 'C';
if (GV.hasWeakLinkage()) return 'W';
if (GV.hasWeakLinkage()) return 'W';
- if (isa<Function>(GV) && GV.hasInternalLinkage()) return 't';
+ if (isa<Function>(GV) && GV.hasInternalLinkage())
return 't';
if (isa<Function>(GV)) return 'T';
if (isa<Function>(GV)) return 'T';
- if (isa<GlobalVariable>(GV) && GV.hasInternalLinkage()) return 'd';
+ if (isa<GlobalVariable>(GV) && GV.hasInternalLinkage())
return 'd';
if (isa<GlobalVariable>(GV)) return 'D';
if (isa<GlobalVariable>(GV)) return 'D';
- return '?';
+ if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(&GV)) {
+ const GlobalValue *AliasedGV = GA->getAliasedGlobal();
+ if (isa<Function>(AliasedGV)) return 'T';
+ if (isa<GlobalVariable>(AliasedGV)) return 'D';
+ }
+ return '?';
}
static void DumpSymbolNameForGlobalValue(GlobalValue &GV) {
}
static void DumpSymbolNameForGlobalValue(GlobalValue &GV) {
@@
-115,7
+121,10
@@
static void DumpSymbolNamesFromModule(Module *M) {
<< " Size Line Section\n";
}
std::for_each (M->begin (), M->end (), DumpSymbolNameForGlobalValue);
<< " Size Line Section\n";
}
std::for_each (M->begin (), M->end (), DumpSymbolNameForGlobalValue);
- std::for_each (M->global_begin (), M->global_end (), DumpSymbolNameForGlobalValue);
+ std::for_each (M->global_begin (), M->global_end (),
+ DumpSymbolNameForGlobalValue);
+ std::for_each (M->alias_begin (), M->alias_end (),
+ DumpSymbolNameForGlobalValue);
}
static void DumpSymbolNamesFromFile(std::string &Filename) {
}
static void DumpSymbolNamesFromFile(std::string &Filename) {
@@
-124,7
+133,7
@@
static void DumpSymbolNamesFromFile(std::string &Filename) {
// Note: Currently we do not support reading an archive from stdin.
if (Filename == "-" || aPath.isBitcodeFile()) {
std::auto_ptr<MemoryBuffer> Buffer(
// Note: Currently we do not support reading an archive from stdin.
if (Filename == "-" || aPath.isBitcodeFile()) {
std::auto_ptr<MemoryBuffer> Buffer(
- MemoryBuffer::getFileOrSTDIN(
&Filename[0], Filename.size()
));
+ MemoryBuffer::getFileOrSTDIN(
Filename, &ErrorMessage
));
Module *Result = 0;
if (Buffer.get())
Result = ParseBitcodeFile(Buffer.get(), &ErrorMessage);
Module *Result = 0;
if (Buffer.get())
Result = ParseBitcodeFile(Buffer.get(), &ErrorMessage);
@@
-157,7
+166,7
@@
static void DumpSymbolNamesFromFile(std::string &Filename) {
int main(int argc, char **argv) {
llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
int main(int argc, char **argv) {
llvm_shutdown_obj X; // Call llvm_shutdown() on exit.
- cl::ParseCommandLineOptions(argc, argv, "
llvm symbol table dumper\n");
+ cl::ParseCommandLineOptions(argc, argv, "llvm symbol table dumper\n");
sys::PrintStackTraceOnErrorSignal();
ToolName = argv[0];
sys::PrintStackTraceOnErrorSignal();
ToolName = argv[0];