njames93 created this revision.
njames93 added reviewers: aaron.ballman, rsmith.
Herald added subscribers: steakhal, martong.
Herald added a reviewer: shafik.
Herald added a reviewer: NoQ.
Herald added a project: All.
njames93 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This was done as a test for D137302 <https://reviews.llvm.org/D137302> and it 
makes sense to push these changes


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137491

Files:
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Comment.cpp
  clang/lib/AST/Decl.cpp
  clang/lib/AST/Interp/Disasm.cpp
  clang/lib/Analysis/CFG.cpp
  clang/lib/Analysis/RetainSummaryManager.cpp
  clang/lib/Basic/SourceLocation.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Lex/MacroArgs.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
  clang/lib/Tooling/ASTDiff/ASTDiff.cpp
  clang/unittests/Lex/HeaderMapTest.cpp
  clang/unittests/Tooling/ASTSelectionTest.cpp
  clang/unittests/Tooling/Syntax/TreeTest.cpp

Index: clang/unittests/Tooling/Syntax/TreeTest.cpp
===================================================================
--- clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -151,9 +151,9 @@
   // FIXME: mutate and observe no invalidation. Mutations are private for now...
   auto It = Range.begin();
   auto CIt = ConstRange.begin();
-  static_assert(std::is_same<decltype(*It), syntax::Node &>::value,
+  static_assert(std::is_same_v<decltype(*It), syntax::Node &>,
                 "mutable range");
-  static_assert(std::is_same<decltype(*CIt), const syntax::Node &>::value,
+  static_assert(std::is_same_v<decltype(*CIt), const syntax::Node &>,
                 "const range");
 
   for (unsigned I = 0; I < 3; ++I) {
Index: clang/unittests/Tooling/ASTSelectionTest.cpp
===================================================================
--- clang/unittests/Tooling/ASTSelectionTest.cpp
+++ clang/unittests/Tooling/ASTSelectionTest.cpp
@@ -104,7 +104,7 @@
 const SelectedASTNode &checkNode(
     const SelectedASTNode &StmtNode, SourceSelectionKind SelectionKind,
     unsigned NumChildren = 0,
-    std::enable_if_t<std::is_base_of<Stmt, T>::value, T> *StmtOverloadChecker =
+    std::enable_if_t<std::is_base_of_v<Stmt, T>, T> *StmtOverloadChecker =
         nullptr) {
   checkNodeImpl(isa<T>(StmtNode.Node.get<Stmt>()), StmtNode, SelectionKind,
                 NumChildren);
@@ -115,7 +115,7 @@
 const SelectedASTNode &checkNode(
     const SelectedASTNode &DeclNode, SourceSelectionKind SelectionKind,
     unsigned NumChildren = 0, StringRef Name = "",
-    std::enable_if_t<std::is_base_of<Decl, T>::value, T> *DeclOverloadChecker =
+    std::enable_if_t<std::is_base_of_v<Decl, T>, T> *DeclOverloadChecker =
         nullptr) {
   checkNodeImpl(isa<T>(DeclNode.Node.get<Decl>()), DeclNode, SelectionKind,
                 NumChildren);
Index: clang/unittests/Lex/HeaderMapTest.cpp
===================================================================
--- clang/unittests/Lex/HeaderMapTest.cpp
+++ clang/unittests/Lex/HeaderMapTest.cpp
@@ -115,8 +115,7 @@
 TEST(HeaderMapTest, lookupFilenameTruncatedSuffix) {
   typedef HMapFileMock<2, 64 - sizeof(HMapHeader) - 2 * sizeof(HMapBucket)>
       FileTy;
-  static_assert(std::is_standard_layout<FileTy>::value,
-                "Expected standard layout");
+  static_assert(std::is_standard_layout_v<FileTy>, "Expected standard layout");
   static_assert(sizeof(FileTy) == 64, "check the math");
   PaddedFile<FileTy, uint64_t> P;
   auto &File = P.File;
@@ -151,8 +150,7 @@
 TEST(HeaderMapTest, lookupFilenameTruncatedPrefix) {
   typedef HMapFileMock<2, 64 - sizeof(HMapHeader) - 2 * sizeof(HMapBucket)>
       FileTy;
-  static_assert(std::is_standard_layout<FileTy>::value,
-                "Expected standard layout");
+  static_assert(std::is_standard_layout_v<FileTy>, "Expected standard layout");
   static_assert(sizeof(FileTy) == 64, "check the math");
   PaddedFile<FileTy, uint64_t> P;
   auto &File = P.File;
Index: clang/lib/Tooling/ASTDiff/ASTDiff.cpp
===================================================================
--- clang/lib/Tooling/ASTDiff/ASTDiff.cpp
+++ clang/lib/Tooling/ASTDiff/ASTDiff.cpp
@@ -117,12 +117,12 @@
   Impl(SyntaxTree *Parent, Stmt *N, ASTContext &AST);
   template <class T>
   Impl(SyntaxTree *Parent,
-       std::enable_if_t<std::is_base_of<Stmt, T>::value, T> *Node,
+       std::enable_if_t<std::is_base_of_v<Stmt, T>, T> *Node,
        ASTContext &AST)
       : Impl(Parent, dyn_cast<Stmt>(Node), AST) {}
   template <class T>
   Impl(SyntaxTree *Parent,
-       std::enable_if_t<std::is_base_of<Decl, T>::value, T> *Node,
+       std::enable_if_t<std::is_base_of_v<Decl, T>, T> *Node,
        ASTContext &AST)
       : Impl(Parent, dyn_cast<Decl>(Node), AST) {}
 
Index: clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -912,9 +912,9 @@
 
   // Try to do as much compile time checking as possible.
   // FIXME: check for invocable instead of function?
-  static_assert(std::is_function<std::remove_pointer_t<Printer>>::value,
+  static_assert(std::is_function_v<std::remove_pointer_t<Printer>>,
                 "Printer is not a function!");
-  static_assert(std::is_convertible<Printer, RequiredType>::value,
+  static_assert(std::is_convertible_v<Printer, RequiredType>,
                 "Printer doesn't have the required type!");
 
   if (LCtx && !State->get<Trait>().isEmpty()) {
Index: clang/lib/Sema/SemaTemplateDeduction.cpp
===================================================================
--- clang/lib/Sema/SemaTemplateDeduction.cpp
+++ clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -5512,12 +5512,12 @@
 // specialized than primary" check.
 struct GetP2 {
   template <typename T1, typename T2,
-            std::enable_if_t<std::is_same<T1, T2>::value, bool> = true>
+            std::enable_if_t<std::is_same_v<T1, T2>, bool> = true>
   T2 *operator()(T1 *, T2 *P2) {
     return P2;
   }
   template <typename T1, typename T2,
-            std::enable_if_t<!std::is_same<T1, T2>::value, bool> = true>
+            std::enable_if_t<!std::is_same_v<T1, T2>, bool> = true>
   T1 *operator()(T1 *, T2 *) {
     return nullptr;
   }
@@ -5529,7 +5529,7 @@
   TemplateArgumentListAreEqual(ASTContext &Ctx) : Ctx(Ctx) {}
 
   template <typename T1, typename T2,
-            std::enable_if_t<std::is_same<T1, T2>::value, bool> = true>
+            std::enable_if_t<std::is_same_v<T1, T2>, bool> = true>
   bool operator()(T1 *PS1, T2 *PS2) {
     ArrayRef<TemplateArgument> Args1 = PS1->getTemplateArgs().asArray(),
                                Args2 = PS2->getTemplateArgs().asArray();
@@ -5548,7 +5548,7 @@
   }
 
   template <typename T1, typename T2,
-            std::enable_if_t<!std::is_same<T1, T2>::value, bool> = true>
+            std::enable_if_t<!std::is_same_v<T1, T2>, bool> = true>
   bool operator()(T1 *Spec, T2 *Primary) {
     ArrayRef<TemplateArgument> Args1 = Spec->getTemplateArgs().asArray(),
                                Args2 = Primary->getInjectedTemplateArgs();
@@ -5597,7 +5597,7 @@
 getMoreSpecialized(Sema &S, QualType T1, QualType T2, TemplateLikeDecl *P1,
                    PrimaryDel *P2, TemplateDeductionInfo &Info) {
   constexpr bool IsMoreSpecialThanPrimaryCheck =
-      !std::is_same<TemplateLikeDecl, PrimaryDel>::value;
+      !std::is_same_v<TemplateLikeDecl, PrimaryDel>;
 
   bool Better1 = isAtLeastAsSpecializedAs(S, T1, T2, P2, Info);
   if (IsMoreSpecialThanPrimaryCheck && !Better1)
Index: clang/lib/Sema/SemaDeclAttr.cpp
===================================================================
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -202,7 +202,7 @@
 /// A helper function to provide Attribute Location for the Attr types
 /// AND the ParsedAttr.
 template <typename AttrInfo>
-static std::enable_if_t<std::is_base_of<Attr, AttrInfo>::value, SourceLocation>
+static std::enable_if_t<std::is_base_of_v<Attr, AttrInfo>, SourceLocation>
 getAttrLoc(const AttrInfo &AL) {
   return AL.getLocation();
 }
Index: clang/lib/Lex/MacroArgs.cpp
===================================================================
--- clang/lib/Lex/MacroArgs.cpp
+++ clang/lib/Lex/MacroArgs.cpp
@@ -62,7 +62,7 @@
 
   // Copy the actual unexpanded tokens to immediately after the result ptr.
   if (!UnexpArgTokens.empty()) {
-    static_assert(std::is_trivial<Token>::value,
+    static_assert(std::is_trivial_v<Token>,
                   "assume trivial copyability if copying into the "
                   "uninitialized array (as opposed to reusing a cached "
                   "MacroArgs)");
@@ -94,7 +94,7 @@
   // Run the dtor to deallocate the vectors.
   this->~MacroArgs();
   // Release the memory for the object.
-  static_assert(std::is_trivially_destructible<Token>::value,
+  static_assert(std::is_trivially_destructible_v<Token>,
                 "assume trivially destructible and forego destructors");
   free(this);
 
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -199,7 +199,7 @@
 }
 
 template <typename T> static constexpr bool is_uint64_t_convertible() {
-  return !std::is_same<T, uint64_t>::value &&
+  return !std::is_same_v<T, uint64_t> &&
          llvm::is_integral_or_enum<T>::value;
 }
 
Index: clang/lib/Basic/SourceLocation.cpp
===================================================================
--- clang/lib/Basic/SourceLocation.cpp
+++ clang/lib/Basic/SourceLocation.cpp
@@ -42,11 +42,11 @@
 // SourceLocation
 //===----------------------------------------------------------------------===//
 
-static_assert(std::is_trivially_destructible<SourceLocation>::value,
+static_assert(std::is_trivially_destructible_v<SourceLocation>,
               "SourceLocation must be trivially destructible because it is "
               "used in unions");
 
-static_assert(std::is_trivially_destructible<SourceRange>::value,
+static_assert(std::is_trivially_destructible_v<SourceRange>,
               "SourceRange must be trivially destructible because it is "
               "used in unions");
 
Index: clang/lib/Analysis/RetainSummaryManager.cpp
===================================================================
--- clang/lib/Analysis/RetainSummaryManager.cpp
+++ clang/lib/Analysis/RetainSummaryManager.cpp
@@ -32,7 +32,7 @@
 /// rest of varargs.
 template <class T, class P, class... ToCompare>
 constexpr static bool isOneOf() {
-  return std::is_same<T, P>::value || isOneOf<T, ToCompare...>();
+  return std::is_same_v<T, P> || isOneOf<T, ToCompare...>();
 }
 
 namespace {
Index: clang/lib/Analysis/CFG.cpp
===================================================================
--- clang/lib/Analysis/CFG.cpp
+++ clang/lib/Analysis/CFG.cpp
@@ -727,9 +727,9 @@
   // hence strict duck-typing.
   template <typename CallLikeExpr,
             typename = std::enable_if_t<
-                std::is_base_of<CallExpr, CallLikeExpr>::value ||
-                std::is_base_of<CXXConstructExpr, CallLikeExpr>::value ||
-                std::is_base_of<ObjCMessageExpr, CallLikeExpr>::value>>
+                std::is_base_of_v<CallExpr, CallLikeExpr> ||
+                std::is_base_of_v<CXXConstructExpr, CallLikeExpr> ||
+                std::is_base_of_v<ObjCMessageExpr, CallLikeExpr>>>
   void findConstructionContextsForArguments(CallLikeExpr *E) {
     for (unsigned i = 0, e = E->getNumArgs(); i != e; ++i) {
       Expr *Arg = E->getArg(i);
Index: clang/lib/AST/Interp/Disasm.cpp
===================================================================
--- clang/lib/AST/Interp/Disasm.cpp
+++ clang/lib/AST/Interp/Disasm.cpp
@@ -22,7 +22,7 @@
 using namespace clang::interp;
 
 template <typename T> inline T ReadArg(Program &P, CodePtr &OpPC) {
-  if constexpr (std::is_pointer<T>::value) {
+  if constexpr (std::is_pointer_v<T>) {
     uint32_t ID = OpPC.read<uint32_t>();
     return reinterpret_cast<T>(P.getNativePointer(ID));
   } else {
Index: clang/lib/AST/Decl.cpp
===================================================================
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -188,7 +188,7 @@
 /// Does the given declaration have member specialization information,
 /// and if so, is it an explicit specialization?
 template <class T>
-static std::enable_if_t<!std::is_base_of<RedeclarableTemplateDecl, T>::value,
+static std::enable_if_t<!std::is_base_of_v<RedeclarableTemplateDecl, T>,
                         bool>
 isExplicitMemberSpecialization(const T *D) {
   if (const MemberSpecializationInfo *member =
Index: clang/lib/AST/Comment.cpp
===================================================================
--- clang/lib/AST/Comment.cpp
+++ clang/lib/AST/Comment.cpp
@@ -29,7 +29,7 @@
 #undef ABSTRACT_COMMENT
 
 // DeclInfo is also allocated with a BumpPtrAllocator.
-static_assert(std::is_trivially_destructible<DeclInfo>::value,
+static_assert(std::is_trivially_destructible_v<DeclInfo>,
               "DeclInfo should be trivially destructible!");
 
 const char *Comment::getCommentKindName() const {
Index: clang/lib/AST/ASTImporter.cpp
===================================================================
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -200,7 +200,7 @@
     // cast the return value to `T`.
     template <typename T>
     auto import(T *From)
-        -> std::conditional_t<std::is_base_of<Type, T>::value,
+        -> std::conditional_t<std::is_base_of_v<Type, T>,
                               Expected<const T *>, Expected<T *>> {
       auto ToOrErr = Importer.Import(From);
       if (!ToOrErr)
Index: clang/lib/AST/ASTContext.cpp
===================================================================
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -12281,7 +12281,7 @@
 }
 
 template <class T,
-          std::enable_if_t<std::is_base_of<Decl, T>::value, bool> = true>
+          std::enable_if_t<std::is_base_of_v<Decl, T>, bool> = true>
 T *getCommonDecl(T *X, T *Y) {
   return cast_or_null<T>(
       getCommonDecl(const_cast<Decl *>(cast_or_null<Decl>(X)),
@@ -12289,7 +12289,7 @@
 }
 
 template <class T,
-          std::enable_if_t<std::is_base_of<Decl, T>::value, bool> = true>
+          std::enable_if_t<std::is_base_of_v<Decl, T>, bool> = true>
 T *getCommonDeclChecked(T *X, T *Y) {
   return cast<T>(getCommonDecl(const_cast<Decl *>(cast<Decl>(X)),
                                const_cast<Decl *>(cast<Decl>(Y))));
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to