[clang-tidy] Export the abseil duration inverse lookup function, NFC

This allows other tools to use this function.

llvm-svn: 350133
This commit is contained in:
Hyrum Wright 2018-12-28 19:04:21 +00:00
parent 1c6dbd6921
commit 4ce05801c7
2 changed files with 7 additions and 2 deletions

View File

@ -37,8 +37,7 @@ truncateIfIntegral(const FloatingLiteral &FloatLiteral) {
return llvm::None;
}
/// Given a `Scale` return the inverse functions for it.
static const std::pair<llvm::StringRef, llvm::StringRef> &
const std::pair<llvm::StringRef, llvm::StringRef> &
getInverseForScale(DurationScale Scale) {
static const llvm::IndexedMap<std::pair<llvm::StringRef, llvm::StringRef>,
DurationScale2IndexFunctor>

View File

@ -63,6 +63,12 @@ simplifyDurationFactoryArg(const ast_matchers::MatchFinder::MatchResult &Result,
/// return its `DurationScale`, or `None` if a match is not found.
llvm::Optional<DurationScale> getScaleForInverse(llvm::StringRef Name);
/// Given a `Scale` return the fully qualified inverse functions for it.
/// The first returned value is the inverse for `double`, and the second
/// returned value is the inverse for `int64`.
const std::pair<llvm::StringRef, llvm::StringRef> &
getInverseForScale(DurationScale Scale);
/// Assuming `Node` has type `double` or `int` representing a time interval of
/// `Scale`, return the expression to make it a suitable `Duration`.
std::string rewriteExprFromNumberToDuration(