diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-06-04 07:09:13 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-06-04 07:09:13 +0000 |
commit | c4a0e57c082e567e81ad3609a32ee492d41f03f9 (patch) | |
tree | 428ab02726ff8a8ba8f4b090ce864826591ce639 /lib | |
parent | 136068f571d7f47bf1c2ab9417a874b0829bc670 (diff) | |
download | klee-c4a0e57c082e567e81ad3609a32ee492d41f03f9.tar.gz |
Change ConstantExpr::{alloc,create} to return a ref<ConstantExpr>
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72853 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Expr/Parser.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/Expr/Parser.cpp b/lib/Expr/Parser.cpp index 3bbe3334..1808ca7b 100644 --- a/lib/Expr/Parser.cpp +++ b/lib/Expr/Parser.cpp @@ -49,8 +49,26 @@ namespace { } }; + class ExprResult { + bool IsValid; + ExprHandle Value; + + public: + ExprResult() : IsValid(false) {} + ExprResult(ExprHandle _Value) : IsValid(true), Value(_Value) {} + ExprResult(ref<ConstantExpr> _Value) : IsValid(true), Value(_Value.get()) {} + ExprResult(bool _IsValid, ExprHandle _Value) : IsValid(_IsValid), Value(_Value) {} + + bool isValid() { + return IsValid; + } + ExprHandle get() { + assert(IsValid && "get() on invalid ParseResult!"); + return Value; + } + }; + typedef ParseResult<Decl*> DeclResult; - typedef ParseResult<ExprHandle> ExprResult; typedef ParseResult<Expr::Width> TypeResult; typedef ParseResult<VersionHandle> VersionResult; |