diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-02-25 18:34:45 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-02-25 18:34:45 +0000 |
| commit | b23cc7191f6afb26c987e75220740e02e68b880d (patch) | |
| tree | f1b24cc15fc951c9badbd4d747af203264e80157 | |
| parent | 6f92e2294abc8822f7ff4a09ca129f6a773f6be4 (diff) | |
| download | bcm5719-llvm-b23cc7191f6afb26c987e75220740e02e68b880d.tar.gz bcm5719-llvm-b23cc7191f6afb26c987e75220740e02e68b880d.zip | |
Added hack to transfer function logic to handle the case where a DeclRefExpr
wrapping an EnumConstantDecl evaluates to an integer type that has a different
signedness than the APSInt stored in the EnumConstantDecl. Will file a Bugzilla
report.
llvm-svn: 47548
| -rw-r--r-- | clang/Analysis/ValueState.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/Analysis/ValueState.cpp b/clang/Analysis/ValueState.cpp index 7cd89fdd7e2..3cbcd88d25b 100644 --- a/clang/Analysis/ValueState.cpp +++ b/clang/Analysis/ValueState.cpp @@ -236,7 +236,15 @@ RVal ValueStateManager::GetRVal(ValueState St, Expr* E, bool* hasVal) { // already has persistent storage? We do this because we // are comparing states using pointer equality. Perhaps there is // a better way, since APInts are fairly lightweight. - return nonlval::ConcreteInt(ValMgr.getValue(ED->getInitVal())); + llvm::APSInt X = ED->getInitVal(); + + // FIXME: This is a hack. The APSInt inside the EnumConstantDecl + // might not match the signedness of the DeclRefExpr. We hack + // a workaround here. Should be fixed elsewhere. + if (E->getType()->isUnsignedIntegerType() != X.isUnsigned()) + X.setIsUnsigned(!X.isUnsigned()); + + return nonlval::ConcreteInt(ValMgr.getValue(X)); } else if (FunctionDecl* FD = dyn_cast<FunctionDecl>(D)) return lval::FuncVal(FD); |

