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

Hyrum Wright via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 28 11:04:22 PST 2018


Author: hwright
Date: Fri Dec 28 11:04:21 2018
New Revision: 350133

URL: http://llvm.org/viewvc/llvm-project?rev=350133&view=rev
Log:
[clang-tidy] Export the abseil duration inverse lookup function, NFC

This allows other tools to use this function.

Modified:
    clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp
    clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h

Modified: clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp?rev=350133&r1=350132&r2=350133&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp Fri Dec 28 11:04:21 2018
@@ -37,8 +37,7 @@ truncateIfIntegral(const FloatingLiteral
   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>

Modified: clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h?rev=350133&r1=350132&r2=350133&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h (original)
+++ clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h Fri Dec 28 11:04:21 2018
@@ -63,6 +63,12 @@ simplifyDurationFactoryArg(const ast_mat
 /// 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(




More information about the cfe-commits mailing list