From eb45aa0b2e42a669f8fa91fb3c99d8754e5d884c Mon Sep 17 00:00:00 2001
From: Richard Smith
Date: Fri, 9 Dec 2011 03:40:28 +0000
Subject: [PATCH] Document the updated behaviour of __builtin_constant_p
introduced in r146236.
llvm-svn: 146241
---
clang/docs/InternalsManual.html | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/clang/docs/InternalsManual.html b/clang/docs/InternalsManual.html
index c22b1e8d912d..46041c4711d2 100644
--- a/clang/docs/InternalsManual.html
+++ b/clang/docs/InternalsManual.html
@@ -1692,7 +1692,10 @@ interacts with constant evaluation:
any evaluatable subexpression to be accepted as an integer constant
expression.
__builtin_constant_p: This returns true (as a integer
- constant expression) if the operand is any evaluatable constant. As a
+ constant expression) if the operand evaluates to either a numeric value
+ (that is, not a pointer cast to integral type) of integral, enumeration,
+ floating or complex type, or if it evaluates to the address of the first
+ character of a string literal (possibly cast to some other type). As a
special case, if __builtin_constant_p is the (potentially
parenthesized) condition of a conditional operator expression ("?:"), only
the true side of the conditional operator is considered, and it is evaluated
@@ -1707,7 +1710,9 @@ interacts with constant evaluation:
floating-point literal.
__builtin_abs,copysign,..: These are constant folded as
general constant expressions.
-__builtin_strlen and strlen: These are constant folded as integer constant expressions if the argument is a string literal.
+__builtin_strlen and strlen: These are
+ constant folded as integer constant expressions if the argument is a string
+ literal.