Add hidden flag to exclude aliases from output.

llvm-svn: 164158
This commit is contained in:
Jan Sjödin 2012-09-18 18:47:58 +00:00
parent 99c2acbb05
commit 4d0c299f39
2 changed files with 31 additions and 2 deletions

View File

@ -0,0 +1,25 @@
; RUN: llvm-as < %s > %t
; RUN: llvm-nm -without-aliases < %t | FileCheck %s
; RUN: llvm-nm < %t | FileCheck --check-prefix=WITH %s
; CHECK-NOT: T a0bar
; CHECK-NOT: T a0foo
; CHECK: T bar
; CHECK: T foo
; WITH: T a0bar
; WITH: T a0foo
; WITH: T bar
; WITH: T foo
@a0foo = alias void ()* @foo
define void @foo() {
ret void
}
@a0bar = alias void ()* @bar
define void @bar() {
ret void
}

View File

@ -110,6 +110,9 @@ namespace {
cl::opt<bool> SizeSort("size-sort", cl::desc("Sort symbols by size"));
cl::opt<bool> WithoutAliases("without-aliases", cl::Hidden,
cl::desc("Exclude aliases from output"));
bool PrintAddress = true;
bool MultipleFiles = false;
@ -275,8 +278,9 @@ static void DumpSymbolNamesFromModule(Module *M) {
std::for_each (M->begin(), M->end(), DumpSymbolNameForGlobalValue);
std::for_each (M->global_begin(), M->global_end(),
DumpSymbolNameForGlobalValue);
std::for_each (M->alias_begin(), M->alias_end(),
DumpSymbolNameForGlobalValue);
if (!WithoutAliases)
std::for_each (M->alias_begin(), M->alias_end(),
DumpSymbolNameForGlobalValue);
SortAndPrintSymbolList();
}