[libcxx-commits] [clang] [libcxx] [lldb] [clang]: implement std::meta::is_type (PR #211653)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 23 12:55:07 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions ,h,cpp -- clang/include/clang/AST/Reflection.h clang/lib/AST/ByteCode/Reflect.h clang/test/AST/ast-dump-APValue-reflection.cpp clang/test/CodeGenCXX/reflection-emit-meta-info-itanium.cpp clang/test/PCH/reflection.cpp clang/test/PCH/reflection_include.h clang/test/Sema/reflection-meta-info.fail.cpp clang/test/Sema/reflection-meta-info.pass.cpp clang/test/SemaCXX/builtin-meta-is-type.cpp libcxx/include/meta libcxx/test/std/language.support/support.limits/support.limits.general/meta.version.compile.pass.cpp libcxx/test/std/meta/is_type.compile.pass.cpp clang/include/clang/AST/APValue.h clang/include/clang/AST/ASTContext.h clang/include/clang/AST/ExprCXX.h clang/include/clang/AST/TypeBase.h clang/include/clang/Basic/TargetInfo.h clang/include/clang/Serialization/ASTBitCodes.h clang/lib/AST/APValue.cpp clang/lib/AST/ASTContext.cpp clang/lib/AST/ASTImporter.cpp clang/lib/AST/ByteCode/Compiler.cpp clang/lib/AST/ByteCode/Compiler.h clang/lib/AST/ByteCode/Context.cpp clang/lib/AST/ByteCode/Descriptor.cpp clang/lib/AST/ByteCode/Disasm.cpp clang/lib/AST/ByteCode/Interp.cpp clang/lib/AST/ByteCode/Interp.h clang/lib/AST/ByteCode/InterpBuiltin.cpp clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp clang/lib/AST/ByteCode/InterpStack.h clang/lib/AST/ByteCode/InterpState.cpp clang/lib/AST/ByteCode/PrimType.cpp clang/lib/AST/ByteCode/PrimType.h clang/lib/AST/ByteCode/Program.cpp clang/lib/AST/ByteCode/Program.h clang/lib/AST/ExprCXX.cpp clang/lib/AST/ExprConstant.cpp clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/MicrosoftMangle.cpp clang/lib/AST/NSAPI.cpp clang/lib/AST/StmtPrinter.cpp clang/lib/AST/TextNodeDumper.cpp clang/lib/AST/Type.cpp clang/lib/AST/TypeLoc.cpp clang/lib/Basic/TargetInfo.cpp clang/lib/CodeGen/CGDebugInfo.cpp clang/lib/CodeGen/CGExprConstant.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/CodeGen/CodeGenTypes.cpp clang/lib/CodeGen/ItaniumCXXABI.cpp clang/lib/CodeGen/QualTypeMapper.cpp clang/lib/Frontend/InitPreprocessor.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaOverload.cpp clang/lib/Sema/SemaTemplate.cpp clang/lib/Sema/TreeTransform.h clang/lib/Serialization/ASTCommon.cpp clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTReaderStmt.cpp clang/lib/Serialization/ASTWriterStmt.cpp clang/lib/UnifiedSymbolResolution/USRGeneration.cpp clang/test/CodeGenCXX/reflection-mangle-itanium.cpp clang/test/SemaCXX/consteval-builtin.cpp clang/tools/libclang/CIndex.cpp clang/unittests/AST/ASTImporterTest.cpp clang/utils/TableGen/ClangBuiltinsEmitter.cpp libcxx/include/version libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp clang/test/CodeGenCXX/reflection-emit-meta-info-ms.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 90d7771f6..5626d6efe 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -17256,7 +17256,8 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
     APValue Reflection;
     if (!EvaluateReflection(E->getArg(0), Reflection, Info))
       return false;
-    return Success(Reflection.getReflectionOperandKind() == ReflectionKind::Type, E);
+    return Success(
+        Reflection.getReflectionOperandKind() == ReflectionKind::Type, E);
   }
 
   case Builtin::BI__builtin_ctz:
diff --git a/libcxx/include/meta b/libcxx/include/meta
index b0954ea86..b65e0b4fd 100644
--- a/libcxx/include/meta
+++ b/libcxx/include/meta
@@ -25,9 +25,7 @@ namespace meta {
 using info = decltype(^^int);
 
 #  if __has_builtin(__builtin_meta_is_type)
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI consteval bool is_type(info __r) {
-  return __builtin_meta_is_type(__r);
-}
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI consteval bool is_type(info __r) { return __builtin_meta_is_type(__r); }
 #  endif
 
 } // namespace meta
diff --git a/libcxx/test/std/meta/is_type.compile.pass.cpp b/libcxx/test/std/meta/is_type.compile.pass.cpp
index 9cfec64b7..282a287a0 100644
--- a/libcxx/test/std/meta/is_type.compile.pass.cpp
+++ b/libcxx/test/std/meta/is_type.compile.pass.cpp
@@ -9,7 +9,6 @@
 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
 // ADDITIONAL_COMPILE_FLAGS(clang): -Xclang -freflection
 
-
 // consteval bool is_type(info);
 
 #include <meta>
@@ -47,5 +46,4 @@ static_assert(std::meta::is_type(^^long double));
 static_assert(std::meta::is_type(^^void));
 static_assert(std::meta::is_type(^^decltype(nullptr)));
 
-
 #endif

``````````

</details>


https://github.com/llvm/llvm-project/pull/211653


More information about the libcxx-commits mailing list