[PATCH] D136416: [AST] Support Bool type in va_arg

Qfrost via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 20 20:54:37 PDT 2022


Qfrost911 created this revision.
Qfrost911 added reviewers: aaron.ballman, shafik.
Herald added a project: All.
Qfrost911 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

  void test(int place_holder, ...)
  {
  	va_list args;
  	va_start(args, place_holder);
  	bool unicode = va_arg(args, bool);
  }

Currently, if the second argument is "Bool", it will be casted to "int".

This patch add support for Bool type


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136416

Files:
  clang/lib/AST/ASTContext.cpp


Index: clang/lib/AST/ASTContext.cpp
===================================================================
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -11010,6 +11010,8 @@
     return SatFractTy;
   case BuiltinType::SatULongFract:
     return SatLongFractTy;
+  case BuiltinType::Bool:
+    return BoolTy;
   default:
     assert(
         (T->hasSignedIntegerRepresentation() || T->isSignedFixedPointType()) &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136416.469462.patch
Type: text/x-patch
Size: 435 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221021/8eca0868/attachment.bin>


More information about the cfe-commits mailing list