forked from OSchip/llvm-project
Revert "[clang][dataflow] Don't crash when caller args are missing storage locations"
https://lab.llvm.org/buildbot/#/builders/74/builds/12713
This reverts commit 43b298ea12
.
This commit is contained in:
parent
b65471d715
commit
26089d4da4
|
@ -140,6 +140,8 @@ public:
|
|||
/// The body of the callee must not reference globals.
|
||||
///
|
||||
/// The arguments of `Call` must map 1:1 to the callee's parameters.
|
||||
///
|
||||
/// Each argument of `Call` must already have a `StorageLocation`.
|
||||
Environment pushCall(const CallExpr *Call) const;
|
||||
Environment pushCall(const CXXConstructExpr *Call) const;
|
||||
|
||||
|
|
|
@ -253,8 +253,7 @@ void Environment::pushCallInternal(const FunctionDecl *FuncDecl,
|
|||
|
||||
const Expr *Arg = Args[ArgIndex];
|
||||
auto *ArgLoc = getStorageLocation(*Arg, SkipPast::Reference);
|
||||
if (ArgLoc == nullptr)
|
||||
continue;
|
||||
assert(ArgLoc != nullptr);
|
||||
|
||||
const VarDecl *Param = *ParamIt;
|
||||
auto &Loc = createStorageLocation(*Param);
|
||||
|
|
|
@ -4229,27 +4229,6 @@ TEST(TransferTest, ContextSensitiveReturnArg) {
|
|||
/*.BuiltinTransferOptions=*/{/*.ContextSensitive=*/true}});
|
||||
}
|
||||
|
||||
TEST(TransferTest, ContextSensitiveReturnInt) {
|
||||
std::string Code = R"(
|
||||
int identity(int x) { return x; }
|
||||
|
||||
void target() {
|
||||
int y = identity(42);
|
||||
// [[p]]
|
||||
}
|
||||
)";
|
||||
runDataflow(Code,
|
||||
[](llvm::ArrayRef<
|
||||
std::pair<std::string, DataflowAnalysisState<NoopLattice>>>
|
||||
Results,
|
||||
ASTContext &ASTCtx) {
|
||||
ASSERT_THAT(Results, ElementsAre(Pair("p", _)));
|
||||
// This just tests that the analysis doesn't crash.
|
||||
},
|
||||
{/*.ApplyBuiltinTransfer=*/true,
|
||||
/*.BuiltinTransferOptions=*/{/*.ContextSensitive=*/true}});
|
||||
}
|
||||
|
||||
TEST(TransferTest, ContextSensitiveMethodLiteral) {
|
||||
std::string Code = R"(
|
||||
class MyClass {
|
||||
|
|
Loading…
Reference in New Issue