File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,10 @@ def _fix_atomic_specifiers_once(
168168
169169 assert isinstance (parent , c_ast .TypeDecl )
170170 assert grandparent is not None
171+ if node .type .coord is None :
172+ # Preserve the declarator coord for _Atomic(T) so TypeDecl doesn't lose
173+ # its location when we replace the wrapper Typename.
174+ node .type .coord = parent .coord
171175 cast (Any , grandparent ).type = node .type
172176 if "_Atomic" not in node .type .quals :
173177 node .type .quals .append ("_Atomic" )
Original file line number Diff line number Diff line change @@ -249,6 +249,13 @@ def test_coords(self):
249249 }"""
250250 self .assert_coord (self .parse (t6 ).ext [0 ].decl .type .args .params [1 ], 3 , 17 )
251251
252+ # Coord for _Atomic type decls
253+ t7 = """
254+ typedef _Atomic(char) atomic_char;
255+ """
256+ self .assert_coord (self .parse (t7 ).ext [0 ], 2 , 31 )
257+ self .assert_coord (self .parse (t7 ).ext [0 ].type , 2 , 31 )
258+
252259 def test_forloop_coord (self ):
253260 t = """\
254261 void foo() {
You can’t perform that action at this time.
0 commit comments