Skip to content

Commit 5936500

Browse files
committed
Avoid mangling name for tpl class member. Fix rust-lang#68
1 parent 2034f77 commit 5936500

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/clang.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl Cursor {
5656
}
5757

5858
pub fn mangling(&self) -> String {
59-
unsafe {
59+
unsafe {
6060
String_ { x: clang_Cursor_getMangling(self.x) }.to_string()
6161
}
6262
}
@@ -136,6 +136,14 @@ impl Cursor {
136136
self.specialized().is_valid()
137137
}
138138

139+
pub fn is_in_template(&self) -> bool {
140+
if self.is_toplevel() {
141+
return false;
142+
}
143+
let parent = self.semantic_parent();
144+
parent.is_template() || parent.is_in_template()
145+
}
146+
139147
pub fn is_valid(&self) -> bool {
140148
unsafe {
141149
clang_isInvalid(self.kind()) == 0

src/ir/function.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ fn get_abi(cc: Enum_CXCallingConv) -> abi::Abi {
7575
}
7676

7777
pub fn cursor_mangling(cursor: &clang::Cursor) -> Option<String> {
78+
if cursor.is_in_template() {
79+
return None;
80+
}
81+
7882
let mut mangling = cursor.mangling();
7983

8084
// Try to undo backend linkage munging (prepended _, generally)

0 commit comments

Comments
 (0)