@@ -76,13 +76,16 @@ clang_getCursorSpelling cursor =
7676 --
7777 -- where @__builtin_va_list@ is a \"predefined typedef\".
7878 -- See <https://clang.llvm.org/docs/LanguageExtensions.html#variadic-function-builtins>.
79- | isNullPtr (fileOf expansion) ->
79+ | isNullPtr (fileOf expansion) -> do
8080 return $ ClangBuiltin nameSpelling
8181
8282 -- If the expansion location and the spelling location /of the name/
8383 -- are different, this means that the name is constructed using a
8484 -- macro. This must therefore have been done by the user.
85- | locationOf expansion /= locationOf spelling ->
85+ --
86+ -- NOTE: It's critical that we compare the file here too, in order
87+ -- for the line/column (and offset) information to be meaningful.
88+ | expansion /= spelling -> do
8689 return $ UserProvided nameSpelling
8790
8891 -- Otherwise, check the token at the expansion location. If it
@@ -96,6 +99,3 @@ clang_getCursorSpelling cursor =
9699
97100 fileOf :: (CXFile , CUInt , CUInt , CUInt ) -> CXFile
98101 fileOf (file, _col, _line, _offset) = file
99-
100- locationOf :: (CXFile , CUInt , CUInt , CUInt ) -> (CUInt , CUInt )
101- locationOf (_file, col, line, _offset) = (col, line)
0 commit comments