r368990 - Replace llvm::integer_sequence and friends with the C++14 standard version

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 15 03:56:05 PDT 2019


Author: d0k
Date: Thu Aug 15 03:56:05 2019
New Revision: 368990

URL: http://llvm.org/viewvc/llvm-project?rev=368990&view=rev
Log:
Replace llvm::integer_sequence and friends with the C++14 standard version

The implementation in libc++ takes O(1) compile time, ours was O(n).

Modified:
    cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
    cfe/trunk/include/clang/Sema/Sema.h
    cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
    cfe/trunk/lib/CodeGen/EHScopeStack.h

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=368990&r1=368989&r2=368990&view=diff
==============================================================================
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Thu Aug 15 03:56:05 2019
@@ -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))...};
   }
 

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=368990&r1=368989&r2=368990&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu Aug 15 03:56:05 2019
@@ -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;
     }
   };

Modified: cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h?rev=368990&r1=368989&r2=368990&view=diff
==============================================================================
--- cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h (original)
+++ cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h Thu Aug 15 03:56:05 2019
@@ -47,7 +47,7 @@ template <typename RuleType, typename...
 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,
 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 Requir
                 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 Requir
     void visitRefactoringOptions(RefactoringOptionVisitor &Visitor) override {
       internal::visitRefactoringOptions(
           Visitor, Requirements,
-          llvm::index_sequence_for<RequirementTypes...>());
+          std::index_sequence_for<RequirementTypes...>());
     }
   private:
     std::tuple<RequirementTypes...> Requirements;

Modified: cfe/trunk/lib/CodeGen/EHScopeStack.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/EHScopeStack.h?rev=368990&r1=368989&r2=368990&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/EHScopeStack.h (original)
+++ cfe/trunk/lib/CodeGen/EHScopeStack.h Thu Aug 15 03:56:05 2019
@@ -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:




More information about the cfe-commits mailing list