]> granicus.if.org Git - clang/commitdiff
Replace llvm::integer_sequence and friends with the C++14 standard version
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 15 Aug 2019 10:56:05 +0000 (10:56 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 15 Aug 2019 10:56:05 +0000 (10:56 +0000)
The implementation in libc++ takes O(1) compile time, ours was O(n).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368990 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/ASTMatchers/ASTMatchersInternal.h
include/clang/Sema/Sema.h
include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
lib/CodeGen/EHScopeStack.h

index 46e47a3100b59ac0557e64318be2bac96e94819d..ae7b9e7c3ee5e5f5eaa49e9e16facdb71a1d2a5a 100644 (file)
@@ -1334,14 +1334,14 @@ public:
   template <typename T> operator Matcher<T>() const {
     return DynTypedMatcher::constructVariadic(
                Op, ast_type_traits::ASTNodeKind::getFromNodeKind<T>(),
-               getMatchers<T>(llvm::index_sequence_for<Ps...>()))
+               getMatchers<T>(std::index_sequence_for<Ps...>()))
         .template unconditionalConvertTo<T>();
   }
 
 private:
   // Helper method to unpack the tuple into a vector.
   template <typename T, std::size_t... Is>
-  std::vector<DynTypedMatcher> getMatchers(llvm::index_sequence<Is...>) const {
+  std::vector<DynTypedMatcher> getMatchers(std::index_sequence<Is...>) const {
     return {Matcher<T>(std::get<Is>(Params))...};
   }
 
index 4be2e5cdb96c639de01d335da66b80765038991c..2dbb045be25c95da3ce299635095ecb314c0d3d3 100644 (file)
@@ -1621,7 +1621,7 @@ public:
 
     template <std::size_t... Is>
     void emit(const SemaDiagnosticBuilder &DB,
-              llvm::index_sequence<Is...>) const {
+              std::index_sequence<Is...>) const {
       // Apply all tuple elements to the builder in order.
       bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
       (void)Dummy;
@@ -1635,7 +1635,7 @@ public:
 
     void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
       const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
-      emit(DB, llvm::index_sequence_for<Ts...>());
+      emit(DB, std::index_sequence_for<Ts...>());
       DB << T;
     }
   };
index aaa9e50faa9a01e7ec1628edb2a8cf9fd79d885b..fb373fcf5029a52e9ad8fa55f8dc30ad27fc15fb 100644 (file)
@@ -47,7 +47,7 @@ template <typename RuleType, typename... RequirementTypes, size_t... Is>
 void invokeRuleAfterValidatingRequirements(
     RefactoringResultConsumer &Consumer, RefactoringRuleContext &Context,
     const std::tuple<RequirementTypes...> &Requirements,
-    llvm::index_sequence<Is...>) {
+    std::index_sequence<Is...>) {
   // Check if the requirements we're interested in can be evaluated.
   auto Values =
       std::make_tuple(std::get<Is>(Requirements).evaluate(Context)...);
@@ -87,7 +87,7 @@ template <typename... RequirementTypes, size_t... Is>
 void visitRefactoringOptions(
     RefactoringOptionVisitor &Visitor,
     const std::tuple<RequirementTypes...> &Requirements,
-    llvm::index_sequence<Is...>) {
+    std::index_sequence<Is...>) {
   visitRefactoringOptionsImpl(Visitor, std::get<Is>(Requirements)...);
 }
 
@@ -131,7 +131,7 @@ createRefactoringActionRule(const RequirementTypes &... Requirements) {
                 RefactoringRuleContext &Context) override {
       internal::invokeRuleAfterValidatingRequirements<RuleType>(
           Consumer, Context, Requirements,
-          llvm::index_sequence_for<RequirementTypes...>());
+          std::index_sequence_for<RequirementTypes...>());
     }
 
     bool hasSelectionRequirement() override {
@@ -142,7 +142,7 @@ createRefactoringActionRule(const RequirementTypes &... Requirements) {
     void visitRefactoringOptions(RefactoringOptionVisitor &Visitor) override {
       internal::visitRefactoringOptions(
           Visitor, Requirements,
-          llvm::index_sequence_for<RequirementTypes...>());
+          std::index_sequence_for<RequirementTypes...>());
     }
   private:
     std::tuple<RequirementTypes...> Requirements;
index 3b0db35d982baf14b4e40b2dad9b0a04c8cc000a..0ed67aabcd6219b3e7d52fe990d5a9e873a78871 100644 (file)
@@ -199,14 +199,14 @@ public:
     SavedTuple Saved;
 
     template <std::size_t... Is>
-    T restore(CodeGenFunction &CGF, llvm::index_sequence<Is...>) {
+    T restore(CodeGenFunction &CGF, std::index_sequence<Is...>) {
       // It's important that the restores are emitted in order. The braced init
       // list guarantees that.
       return T{DominatingValue<As>::restore(CGF, std::get<Is>(Saved))...};
     }
 
     void Emit(CodeGenFunction &CGF, Flags flags) override {
-      restore(CGF, llvm::index_sequence_for<As...>()).Emit(CGF, flags);
+      restore(CGF, std::index_sequence_for<As...>()).Emit(CGF, flags);
     }
 
   public: