summaryrefslogtreecommitdiffstats
path: root/include/clang/AST/APValue.h
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2019-03-06 10:26:19 +0000
committerHans Wennborg <hans@hanshq.net>2019-03-06 10:26:19 +0000
commitd47768c5aa75c418c8e6ba96b1c05f8582b30702 (patch)
tree971120bcaeba1db2bfeba132fb1c3be81f97c4fc /include/clang/AST/APValue.h
parent45032a803d969a57c2161bfd14a75da71862b84b (diff)
Inline asm constraints: allow ICE-like pointers for the "n" constraint (PR40890)
Apparently GCC allows this, and there's code relying on it (see bug). The idea is to allow expression that would have been allowed if they were cast to int. So I based the code on how such a cast would be done (the CK_PointerToIntegral case in IntExprEvaluator::VisitCastExpr()). Differential Revision: https://reviews.llvm.org/D58821 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355491 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/APValue.h')
-rw-r--r--include/clang/AST/APValue.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/clang/AST/APValue.h b/include/clang/AST/APValue.h
index 5d26a11177..de5546f9fd 100644
--- a/include/clang/AST/APValue.h
+++ b/include/clang/AST/APValue.h
@@ -262,6 +262,12 @@ public:
return const_cast<APValue*>(this)->getInt();
}
+ /// Try to convert this value to an integral constant. This works if it's an
+ /// integer, null pointer, or offset from a null pointer. Returns true on
+ /// success.
+ bool toIntegralConstant(APSInt &Result, QualType SrcTy,
+ const ASTContext &Ctx) const;
+
APFloat &getFloat() {
assert(isFloat() && "Invalid accessor");
return *(APFloat*)(char*)Data.buffer;