Use mangled name as unique id for C structs as well.
Some structs could be included without extern "C" guards. If the same struct is included in a C++ source file and a C source file, it's unique type name will be mangled in one and its name in the other. To work around this inconsistency, mangle their names regardless of context. Bug: 69568963 Test: tests/test.py Change-Id: Ie285c4691dbaa58389a041fee5116ccbfc7985ce
This commit is contained in:
@@ -156,14 +156,10 @@ std::string RecordDeclWrapper::GetMangledRTTI(
|
||||
std::string ABIWrapper::GetTypeUniqueId(const clang::TagDecl *tag_decl) {
|
||||
clang::QualType qual_type =
|
||||
tag_decl->getTypeForDecl()->getCanonicalTypeInternal();
|
||||
// We need to mangle type names for C++ contexts.
|
||||
if (!tag_decl->isExternCContext() && ast_contextp_->getLangOpts().CPlusPlus) {
|
||||
llvm::SmallString<256> uid;
|
||||
llvm::raw_svector_ostream out(uid);
|
||||
mangle_contextp_->mangleCXXRTTIName(qual_type, out);
|
||||
return uid.str();
|
||||
}
|
||||
return ABIWrapper::QualTypeToString(qual_type);
|
||||
llvm::SmallString<256> uid;
|
||||
llvm::raw_svector_ostream out(uid);
|
||||
mangle_contextp_->mangleCXXRTTIName(qual_type, out);
|
||||
return uid.str();
|
||||
}
|
||||
|
||||
// CreateBasicNamedAndTypedDecl creates a BasicNamedAndTypedDecl : that'll
|
||||
|
||||
@@ -204,7 +204,7 @@ record_types {
|
||||
is_anonymous: true
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Hello::(anonymous)::(anonymous)"
|
||||
unique_id: "_ZTSN5HelloUt1_Ut_E"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -238,7 +238,7 @@ record_types {
|
||||
is_anonymous: true
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Hello::(anonymous)"
|
||||
unique_id: "_ZTSN5HelloUt1_E"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -289,7 +289,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Hello"
|
||||
unique_id: "_ZTS5Hello"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
@@ -204,7 +204,7 @@ record_types {
|
||||
is_anonymous: true
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Hello::(anonymous)::(anonymous)"
|
||||
unique_id: "_ZTSN5HelloUt1_Ut_E"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -238,7 +238,7 @@ record_types {
|
||||
is_anonymous: true
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Hello::(anonymous)"
|
||||
unique_id: "_ZTSN5HelloUt1_E"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -289,7 +289,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Hello"
|
||||
unique_id: "_ZTS5Hello"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
@@ -16,7 +16,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cinner"
|
||||
unique_id: "_ZTS6Cinner"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -43,7 +43,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cstruct"
|
||||
unique_id: "_ZTS7Cstruct"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
@@ -16,7 +16,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cinner"
|
||||
unique_id: "_ZTS6Cinner"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -43,7 +43,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cstruct"
|
||||
unique_id: "_ZTS7Cstruct"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
@@ -16,7 +16,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cinner"
|
||||
unique_id: "_ZTS6Cinner"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -43,7 +43,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cstruct"
|
||||
unique_id: "_ZTS7Cstruct"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
@@ -16,7 +16,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cinner"
|
||||
unique_id: "_ZTS6Cinner"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -43,7 +43,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cstruct"
|
||||
unique_id: "_ZTS7Cstruct"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
@@ -16,7 +16,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cinner"
|
||||
unique_id: "_ZTS6Cinner"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -43,7 +43,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cstruct"
|
||||
unique_id: "_ZTS7Cstruct"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
@@ -16,7 +16,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cinner"
|
||||
unique_id: "_ZTS6Cinner"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -43,7 +43,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cstruct"
|
||||
unique_id: "_ZTS7Cstruct"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
@@ -16,7 +16,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cinner"
|
||||
unique_id: "_ZTS6Cinner"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -43,7 +43,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cstruct"
|
||||
unique_id: "_ZTS7Cstruct"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
@@ -16,7 +16,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cinner"
|
||||
unique_id: "_ZTS6Cinner"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -43,7 +43,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cstruct"
|
||||
unique_id: "_ZTS7Cstruct"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
@@ -16,7 +16,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cinner"
|
||||
unique_id: "_ZTS6Cinner"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -43,7 +43,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cstruct"
|
||||
unique_id: "_ZTS7Cstruct"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
@@ -16,7 +16,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cinner"
|
||||
unique_id: "_ZTS6Cinner"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -43,7 +43,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cstruct"
|
||||
unique_id: "_ZTS7Cstruct"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
@@ -16,7 +16,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cinner"
|
||||
unique_id: "_ZTS6Cinner"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -43,7 +43,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cstruct"
|
||||
unique_id: "_ZTS7Cstruct"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
@@ -16,7 +16,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cinner"
|
||||
unique_id: "_ZTS6Cinner"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
@@ -43,7 +43,7 @@ record_types {
|
||||
access: public_access
|
||||
record_kind: struct_kind
|
||||
tag_info {
|
||||
unique_id: "Cstruct"
|
||||
unique_id: "_ZTS7Cstruct"
|
||||
}
|
||||
}
|
||||
record_types {
|
||||
|
||||
Reference in New Issue
Block a user