@@ -1515,7 +1515,8 @@ void CStringChecker::evalCopyCommon(CheckerContext &C, const CallEvent &Call,
15151515 // conjure a return value for later.
15161516 if (lastElement.isUnknown ())
15171517 lastElement = C.getSValBuilder ().conjureSymbolVal (
1518- nullptr , Call.getOriginExpr (), LCtx, C.blockCount ());
1518+ nullptr , Call.getCFGElementRef (), LCtx,
1519+ Call.getOriginExpr ()->getType (), C.blockCount ());
15191520
15201521 // The byte after the last byte copied is the return value.
15211522 state = state->BindExpr (Call.getOriginExpr (), LCtx, lastElement);
@@ -1665,8 +1666,9 @@ void CStringChecker::evalMemcmp(CheckerContext &C, const CallEvent &Call,
16651666 State = CheckBufferAccess (C, State, Left, Size, AccessKind::read, CK);
16661667 if (State) {
16671668 // The return value is the comparison result, which we don't know.
1668- SVal CmpV = Builder.conjureSymbolVal (nullptr , Call.getOriginExpr (), LCtx,
1669- C.blockCount ());
1669+ SVal CmpV = Builder.conjureSymbolVal (
1670+ nullptr , Call.getCFGElementRef (), LCtx,
1671+ Call.getOriginExpr ()->getType (), C.blockCount ());
16701672 State = State->BindExpr (Call.getOriginExpr (), LCtx, CmpV);
16711673 C.addTransition (State);
16721674 }
@@ -1770,7 +1772,8 @@ void CStringChecker::evalstrLengthCommon(CheckerContext &C,
17701772 // All we know is the return value is the min of the string length
17711773 // and the limit. This is better than nothing.
17721774 result = C.getSValBuilder ().conjureSymbolVal (
1773- nullptr , Call.getOriginExpr (), LCtx, C.blockCount ());
1775+ nullptr , Call.getCFGElementRef (), LCtx,
1776+ Call.getOriginExpr ()->getType (), C.blockCount ());
17741777 NonLoc resultNL = result.castAs <NonLoc>();
17751778
17761779 if (strLengthNL) {
@@ -1794,7 +1797,8 @@ void CStringChecker::evalstrLengthCommon(CheckerContext &C,
17941797 // value, so it can be used in constraints, at least.
17951798 if (result.isUnknown ()) {
17961799 result = C.getSValBuilder ().conjureSymbolVal (
1797- nullptr , Call.getOriginExpr (), LCtx, C.blockCount ());
1800+ nullptr , Call.getCFGElementRef (), LCtx,
1801+ Call.getOriginExpr ()->getType (), C.blockCount ());
17981802 }
17991803 }
18001804
@@ -2261,8 +2265,9 @@ void CStringChecker::evalStrcpyCommon(CheckerContext &C, const CallEvent &Call,
22612265 // If this is a stpcpy-style copy, but we were unable to check for a buffer
22622266 // overflow, we still need a result. Conjure a return value.
22632267 if (ReturnEnd && Result.isUnknown ()) {
2264- Result = svalBuilder.conjureSymbolVal (nullptr , Call.getOriginExpr (), LCtx,
2265- C.blockCount ());
2268+ Result = svalBuilder.conjureSymbolVal (
2269+ nullptr , Call.getCFGElementRef (), LCtx,
2270+ Call.getOriginExpr ()->getType (), C.blockCount ());
22662271 }
22672272 }
22682273 // Set the return value.
@@ -2361,8 +2366,9 @@ void CStringChecker::evalStrcmpCommon(CheckerContext &C, const CallEvent &Call,
23612366 const StringLiteral *RightStrLiteral =
23622367 getCStringLiteral (C, state, Right.Expression , RightVal);
23632368 bool canComputeResult = false ;
2364- SVal resultVal = svalBuilder.conjureSymbolVal (nullptr , Call.getOriginExpr (),
2365- LCtx, C.blockCount ());
2369+ SVal resultVal = svalBuilder.conjureSymbolVal (
2370+ nullptr , Call.getCFGElementRef (), LCtx, Call.getOriginExpr ()->getType (),
2371+ C.blockCount ());
23662372
23672373 if (LeftStrLiteral && RightStrLiteral) {
23682374 StringRef LeftStrRef = LeftStrLiteral->getString ();
@@ -2469,14 +2475,15 @@ void CStringChecker::evalStrsep(CheckerContext &C,
24692475 // further along in the same string, or NULL if there are no more tokens.
24702476 State =
24712477 State->bindLoc (*SearchStrLoc,
2472- SVB.conjureSymbolVal (getTag (), Call.getOriginExpr (),
2478+ SVB.conjureSymbolVal (getTag (), Call.getCFGElementRef (),
24732479 LCtx, CharPtrTy, C.blockCount ()),
24742480 LCtx);
24752481 } else {
24762482 assert (SearchStrVal.isUnknown ());
24772483 // Conjure a symbolic value. It's the best we can do.
2478- Result = SVB.conjureSymbolVal (nullptr , Call.getOriginExpr (), LCtx,
2479- C.blockCount ());
2484+ Result =
2485+ SVB.conjureSymbolVal (nullptr , Call.getCFGElementRef (), LCtx,
2486+ Call.getOriginExpr ()->getType (), C.blockCount ());
24802487 }
24812488
24822489 // Set the return value, and finish.
@@ -2520,7 +2527,8 @@ void CStringChecker::evalStdCopyCommon(CheckerContext &C,
25202527 SValBuilder &SVB = C.getSValBuilder ();
25212528
25222529 SVal ResultVal =
2523- SVB.conjureSymbolVal (nullptr , Call.getOriginExpr (), LCtx, C.blockCount ());
2530+ SVB.conjureSymbolVal (nullptr , Call.getCFGElementRef (), LCtx,
2531+ Call.getOriginExpr ()->getType (), C.blockCount ());
25242532 State = State->BindExpr (Call.getOriginExpr (), LCtx, ResultVal);
25252533
25262534 C.addTransition (State);
0 commit comments