aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-01 00:32:33 +0000
committerChris Lattner <sabre@nondot.org>2009-03-01 00:32:33 +0000
commit27e5eb3bd869cf0d70aa065775125df407dfd4a3 (patch)
tree435579630badb7e9f795c1893c7483d3f1f7bc3b
parent69b7023b4cd2698ba10608bc60c8b832f876bdfc (diff)
downloadexternal_llvm-27e5eb3bd869cf0d70aa065775125df407dfd4a3.zip
external_llvm-27e5eb3bd869cf0d70aa065775125df407dfd4a3.tar.gz
external_llvm-27e5eb3bd869cf0d70aa065775125df407dfd4a3.tar.bz2
walk type symbol table also, so we get:
type opaque ; type %0 %C = type { %0, %0 } instead of: %C = type { opaque, opaque } when appropriate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65742 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/AsmWriter.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 1e744a9..5f41840 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -332,6 +332,13 @@ namespace {
: TP(tp), NumberedTypes(numberedTypes) {}
void Run(const Module &M) {
+ // Get types from the type symbol table. This gets opaque types referened
+ // only through derived named types.
+ const TypeSymbolTable &ST = M.getTypeSymbolTable();
+ for (TypeSymbolTable::const_iterator TI = ST.begin(), E = ST.end();
+ TI != E; ++TI)
+ IncorporateType(TI->second);
+
// Get types from global variables.
for (Module::const_global_iterator I = M.global_begin(),
E = M.global_end(); I != E; ++I) {
@@ -368,11 +375,12 @@ namespace {
private:
void IncorporateType(const Type *Ty) {
// Check to see if we're already visited this type.
- if (!VisitedTypes.insert(Ty).second || TP.hasTypeName(Ty))
+ if (!VisitedTypes.insert(Ty).second)
return;
// If this is a structure or opaque type, add a name for the type.
- if (isa<StructType>(Ty) || isa<OpaqueType>(Ty)) {
+ if ((isa<StructType>(Ty) || isa<OpaqueType>(Ty))
+ && !TP.hasTypeName(Ty)) {
TP.addTypeName(Ty, "%"+utostr(unsigned(NumberedTypes.size())));
NumberedTypes.push_back(Ty);
}