You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The comment will not be assigned to GetPointer(), because it will be associated with the position of ABC (libclang returns un-preprocessed macros from get_tokens, as though they were ordinary identifiers).
We could force it to return the nearest comment with location equal or less than the declaration location if Sorted.find() becomes:
def find(self, key):
i = bisect.bisect_left(self.keys, key+1)
if i<=0 or i>=len(self.keys):
return None
return self[i-1]
But this would multiply allocate a comment to any uncommented functions below it. The following works by removing the values as we find them:
def find(self, key):
i = bisect.bisect_right(self.keys, key)
if i<=0 or i>len(self.keys):
return None
self.keys.pop(i-1)
result=self.pop(i-1)
return result
But this won't work because we don't process the nodes in order, so some comments will be mismatched.
The text was updated successfully, but these errors were encountered:
If there's a macro expanded in front of a function definition, class Sorted fails to find the appropriate comment. For example:
The comment will not be assigned to GetPointer(), because it will be associated with the position of ABC (libclang returns un-preprocessed macros from get_tokens, as though they were ordinary identifiers).
We could force it to return the nearest comment with location equal or less than the declaration location if Sorted.find() becomes:
But this would multiply allocate a comment to any uncommented functions below it. The following works by removing the values as we find them:
But this won't work because we don't process the nodes in order, so some comments will be mismatched.
The text was updated successfully, but these errors were encountered: