[clang] [clang] Sema::isSimpleTypeSpecifier return true for _Bool in c99 (PR #72204)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 13 20:07:59 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Carl Peto (carlos4242)

<details>
<summary>Changes</summary>

Currently returns false for _Bool, regardless of C dialect.

Fixes #<!-- -->72203.

I'm unsure how to add a unit test for this?

I am open to suggestions!

@<!-- -->AaronBallman

---
Full diff: https://github.com/llvm/llvm-project/pull/72204.diff


1 Files Affected:

- (modified) clang/lib/Sema/SemaDecl.cpp (+3) 


``````````diff
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 3876eb501083acb..da40b9a1a1b21b9 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -153,6 +153,9 @@ bool Sema::isSimpleTypeSpecifier(tok::TokenKind Kind) const {
   case tok::kw___auto_type:
     return true;
 
+  case tok::kw__Bool:
+    return getLangOpts().C99;
+
   case tok::annot_typename:
   case tok::kw_char16_t:
   case tok::kw_char32_t:

``````````

</details>


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


More information about the cfe-commits mailing list