@@ -138,7 +138,7 @@ const Scope = struct {
138
138
}
139
139
140
140
/// Given the desired name, return a name that does not shadow anything from outer scopes.
141
- /// Inserts the returned name into the scope.
141
+ /// Does not insert the returned name into the scope.
142
142
/// Will allow `name` to be one of the preprocessed decl or macro names, but will not
143
143
/// choose a mangled name that matches one of those.
144
144
fn makeMangledName (scope : * Root , name : []const u8 ) ! []const u8 {
@@ -4328,9 +4328,12 @@ fn transPreprocessorEntities(c: *Context, unit: *ZigClangASTUnit) Error!void {
4328
4328
const begin_loc = ZigClangMacroDefinitionRecord_getSourceRange_getBegin (macro );
4329
4329
4330
4330
const name = try c .str (raw_name );
4331
+ // TODO https://github.com/ziglang/zig/issues/3756
4332
+ // TODO https://github.com/ziglang/zig/issues/1802
4333
+ const mangled_name = try scope .makeMangledName (name );
4331
4334
4332
4335
const begin_c = ZigClangSourceManager_getCharacterData (c .source_manager , begin_loc );
4333
- ctok .tokenizeCMacro (c , begin_loc , name , & tok_list , begin_c ) catch | err | switch (err ) {
4336
+ ctok .tokenizeCMacro (c , begin_loc , mangled_name , & tok_list , begin_c ) catch | err | switch (err ) {
4334
4337
error .OutOfMemory = > | e | return e ,
4335
4338
else = > {
4336
4339
continue ;
@@ -4357,9 +4360,6 @@ fn transPreprocessorEntities(c: *Context, unit: *ZigClangASTUnit) Error!void {
4357
4360
else = > {},
4358
4361
}
4359
4362
4360
- // TODO https://github.com/ziglang/zig/issues/3756
4361
- // TODO https://github.com/ziglang/zig/issues/1802
4362
- const mangled_name = try scope .makeMangledName (name );
4363
4363
const macro_fn = if (tok_it .peek ().? .id == .Fn ) blk : {
4364
4364
_ = tok_it .next ();
4365
4365
break :blk true ;
0 commit comments