@@ -49,20 +49,34 @@ CodeGenTBAA::getTBAAInfo(QualType QTy) {
49
49
}
50
50
51
51
// For now, just emit a very minimal tree.
52
- const Type *CanonicalTy = Context.getCanonicalType (Ty);
53
- if (const BuiltinType *BTy = dyn_cast<BuiltinType>(CanonicalTy)) {
52
+ if (const BuiltinType *BTy = dyn_cast<BuiltinType>(Ty)) {
54
53
switch (BTy->getKind ()) {
54
+ // Charactar types are special and can alias anything.
55
55
case BuiltinType::Char_U:
56
56
case BuiltinType::Char_S:
57
57
case BuiltinType::UChar:
58
58
case BuiltinType::SChar:
59
- // Charactar types are special.
60
59
return Char;
60
+
61
+ // Unsigned types can alias their corresponding signed types.
62
+ case BuiltinType::UShort:
63
+ return getTBAAInfo (Context.ShortTy );
64
+ case BuiltinType::UInt:
65
+ return getTBAAInfo (Context.IntTy );
66
+ case BuiltinType::ULong:
67
+ return getTBAAInfo (Context.LongTy );
68
+ case BuiltinType::ULongLong:
69
+ return getTBAAInfo (Context.LongLongTy );
70
+ case BuiltinType::UInt128:
71
+ return getTBAAInfo (Context.Int128Ty );
72
+
73
+ // Other builtin types.
61
74
default :
62
75
return MetadataCache[Ty] =
63
76
getTBAAInfoForNamedType (BTy->getName (Features), Char);
64
77
}
65
78
}
66
79
67
- return MetadataCache[Ty] = getTBAAInfoForNamedType (" TBAA.other" , Char);
80
+ // For now, handle any other kind of type conservatively.
81
+ return MetadataCache[Ty] = Char;
68
82
}
0 commit comments