Skip to content

Remove lookupSymbol() and have all callers use SymbolInfo::lookup() instead #62552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 14, 2022

Conversation

grynspan
Copy link
Contributor

This PR removes the free function lookupSymbol() and modifies its callers to use SymbolInfo::lookup() instead.

In a previous PR, I refactored lookupSymbol() to call through to SymbolInfo::lookup() which itself returned an llvm::Optional<SymbolInfo>, which lookupSymbol() unpacks and copies into an out-param. As discussed in the review for that PR, we might as well remove the stub function and update callers to just use the underlying function.

@grynspan grynspan force-pushed the jgrynspan/remove-lookupSymbol branch from 06c1f85 to 0de9d58 Compare December 13, 2022 15:17
@grynspan
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@al45tair al45tair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I do have reservations about auto (I don't like that it hides the type at the call site, which makes the code much harder to read because now you have to find the declaration to understand what e.g. getFilename() might refer to), but I think I'd also accept that using it is idiomatic C++ these days and I'm doubtless guilty of using it myself in places where later on I might wish I hadn't.

@grynspan
Copy link
Contributor Author

LGTM. I do have reservations about auto (I don't like that it hides the type at the call site, which makes the code much harder to read because now you have to find the declaration to understand what e.g. getFilename() might refer to), but I think I'd also accept that using it is idiomatic C++ these days and I'm doubtless guilty of using it myself in places where later on I might wish I hadn't.

I've got another PR coming up to enable getFilename() on Windows, and it requires some refactoring anyway to avoid use-after-free scenarios, so I'll revisit my use of auto in that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants