/// Returns the storage location assigned to the `this` pointee in the
/// environment or null if the `this` pointee has no assigned storage location
/// in the environment.
- StorageLocation *getThisPointeeStorageLocation() const;
+ AggregateStorageLocation *getThisPointeeStorageLocation() const;
/// Returns the return value of the current function. This can be null if:
/// - The function has a void return type
StorageLocation *ReturnLoc = nullptr;
// The storage location of the `this` pointee. Should only be null if the
// function being analyzed is only a function and not a method.
- StorageLocation *ThisPointeeLoc = nullptr;
+ AggregateStorageLocation *ThisPointeeLoc = nullptr;
// Maps from program declarations and statements to storage locations that are
// assigned to them. Unlike the maps in `DataflowAnalysisContext`, these
// FIXME: Initialize the ThisPointeeLoc of lambdas too.
if (MethodDecl && !MethodDecl->isStatic()) {
QualType ThisPointeeType = MethodDecl->getThisObjectType();
- ThisPointeeLoc = &createStorageLocation(ThisPointeeType);
+ ThisPointeeLoc = &cast<AggregateStorageLocation>(
+ createStorageLocation(ThisPointeeType));
if (Value *ThisPointeeVal = createValue(ThisPointeeType))
setValue(*ThisPointeeLoc, *ThisPointeeVal);
}
if (const auto *MethodCall = dyn_cast<CXXMemberCallExpr>(Call)) {
if (const Expr *Arg = MethodCall->getImplicitObjectArgument()) {
if (!isa<CXXThisExpr>(Arg))
- Env.ThisPointeeLoc = getStorageLocation(*Arg, SkipPast::Reference);
+ Env.ThisPointeeLoc = cast<AggregateStorageLocation>(
+ getStorageLocation(*Arg, SkipPast::Reference));
// Otherwise (when the argument is `this`), retain the current
// environment's `ThisPointeeLoc`.
}
Environment Environment::pushCall(const CXXConstructExpr *Call) const {
Environment Env(*this);
- Env.ThisPointeeLoc = &Env.createStorageLocation(Call->getType());
+ Env.ThisPointeeLoc = &cast<AggregateStorageLocation>(
+ Env.createStorageLocation(Call->getType()));
if (Value *Val = Env.createValue(Call->getType()))
Env.setValue(*Env.ThisPointeeLoc, *Val);
return Loc;
}
-StorageLocation *Environment::getThisPointeeStorageLocation() const {
+AggregateStorageLocation *Environment::getThisPointeeStorageLocation() const {
return ThisPointeeLoc;
}
ASSERT_THAT(Results.keys(), UnorderedElementsAre("p"));
const Environment &Env = getEnvironmentAtAnnotation(Results, "p");
- const auto *ThisLoc = dyn_cast<AggregateStorageLocation>(
- Env.getThisPointeeStorageLocation());
+ const auto *ThisLoc = Env.getThisPointeeStorageLocation();
ASSERT_THAT(ThisLoc, NotNull());
const ValueDecl *BarDecl = findValueDecl(ASTCtx, "Bar");
ASSERT_THAT(Results.keys(), UnorderedElementsAre("p"));
const Environment &Env = getEnvironmentAtAnnotation(Results, "p");
- const auto *ThisLoc =
- cast<AggregateStorageLocation>(Env.getThisPointeeStorageLocation());
+ const auto *ThisLoc = Env.getThisPointeeStorageLocation();
const ValueDecl *BarDecl = findValueDecl(ASTCtx, "Bar");
ASSERT_THAT(BarDecl, NotNull());
ASSERT_THAT(Results.keys(), UnorderedElementsAre("p"));
const Environment &Env = getEnvironmentAtAnnotation(Results, "p");
- const auto *ThisLoc = dyn_cast<AggregateStorageLocation>(
- Env.getThisPointeeStorageLocation());
+ const auto *ThisLoc = Env.getThisPointeeStorageLocation();
ASSERT_THAT(ThisLoc, NotNull());
const ValueDecl *FooDecl = findValueDecl(ASTCtx, "Foo");
ASSERT_THAT(Results.keys(), UnorderedElementsAre("p1"));
const Environment &Env = getEnvironmentAtAnnotation(Results, "p1");
- const auto *ThisLoc = dyn_cast<AggregateStorageLocation>(
- Env.getThisPointeeStorageLocation());
+ const auto *ThisLoc = Env.getThisPointeeStorageLocation();
ASSERT_THAT(ThisLoc, NotNull());
const ValueDecl *BarDecl = findValueDecl(ASTCtx, "Bar");
ASSERT_THAT(Results.keys(), UnorderedElementsAre("p2"));
const Environment &Env = getEnvironmentAtAnnotation(Results, "p2");
- const auto *ThisLoc = dyn_cast<AggregateStorageLocation>(
- Env.getThisPointeeStorageLocation());
+ const auto *ThisLoc = Env.getThisPointeeStorageLocation();
ASSERT_THAT(ThisLoc, NotNull());
const ValueDecl *BarDecl = findValueDecl(ASTCtx, "Bar");
ASSERT_THAT(Results.keys(), UnorderedElementsAre("p"));
const Environment &Env = getEnvironmentAtAnnotation(Results, "p");
- const auto *ThisLoc = dyn_cast<AggregateStorageLocation>(
- Env.getThisPointeeStorageLocation());
+ const auto *ThisLoc = Env.getThisPointeeStorageLocation();
ASSERT_THAT(ThisLoc, NotNull());
const ValueDecl *FooDecl = findValueDecl(ASTCtx, "Foo");
ASSERT_THAT(Results.keys(), UnorderedElementsAre("p"));
const Environment &Env = getEnvironmentAtAnnotation(Results, "p");
- const auto *ThisLoc = dyn_cast<AggregateStorageLocation>(
- Env.getThisPointeeStorageLocation());
+ const auto *ThisLoc = Env.getThisPointeeStorageLocation();
ASSERT_THAT(ThisLoc, NotNull());
const ValueDecl *FooDecl = findValueDecl(ASTCtx, "Foo");
ASSERT_THAT(Results.keys(), UnorderedElementsAre("p"));
const Environment &Env = getEnvironmentAtAnnotation(Results, "p");
- const auto *ThisLoc = dyn_cast<AggregateStorageLocation>(
- Env.getThisPointeeStorageLocation());
+ const auto *ThisLoc = Env.getThisPointeeStorageLocation();
ASSERT_THAT(ThisLoc, NotNull());
const ValueDecl *FooDecl = findValueDecl(ASTCtx, "Foo");