summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHyrum Wright <hwright@google.com>2018-12-28 19:04:21 +0000
committerHyrum Wright <hwright@google.com>2018-12-28 19:04:21 +0000
commit4ce05801c75ea5123434fd2a919c83974c8904e6 (patch)
tree77ea8e1ce8cbd37c2c53fdbfdf3d5066ca3beea2
parent1c6dbd69211faa8a84fa165ccabd07a2f519ddb5 (diff)
downloadbcm5719-llvm-4ce05801c75ea5123434fd2a919c83974c8904e6.tar.gz
bcm5719-llvm-4ce05801c75ea5123434fd2a919c83974c8904e6.zip
[clang-tidy] Export the abseil duration inverse lookup function, NFC
This allows other tools to use this function. llvm-svn: 350133
-rw-r--r--clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp3
-rw-r--r--clang-tools-extra/clang-tidy/abseil/DurationRewriter.h6
2 files changed, 7 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp
index a7254779936..8bf4c0d8428 100644
--- a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp
+++ b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp
@@ -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>
diff --git a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.h b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.h
index 339511f9ac5..d0004d1c09c 100644
--- a/clang-tools-extra/clang-tidy/abseil/DurationRewriter.h
+++ b/clang-tools-extra/clang-tidy/abseil/DurationRewriter.h
@@ -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(
OpenPOWER on IntegriCloud