[AST] Remove args from LocationCall

This class initially had args to be generic to future needs. In
particular, I thought that source location introspection should show the
getBeginLoc of CallExpr args and the getArgLoc of
TemplateSpecializationLocInfo etc.  However, that is probably best left
out of source location introspection because it involves node traversal.

If something like this is needed in the future, it can be added in the
future.

Differential Revision: https://reviews.llvm.org/D100688
This commit is contained in:
Stephen Kelly 2021-04-16 22:29:06 +01:00
parent bbf01f96b5
commit ebc6608fb7
3 changed files with 2 additions and 26 deletions

View File

@ -38,14 +38,9 @@ public:
LocationCall(SharedLocationCall on, std::string name,
LocationCallFlags flags = NoFlags)
: m_flags(flags), m_on(std::move(on)), m_name(std::move(name)) {}
LocationCall(SharedLocationCall on, std::string name,
std::vector<std::string> args, LocationCallFlags flags = NoFlags)
: m_flags(flags), m_on(std::move(on)), m_name(std::move(name)),
m_args(std::move(args)) {}
LocationCall *on() const { return m_on.get(); }
StringRef name() const { return m_name; }
ArrayRef<std::string> args() const { return m_args; }
bool returnsPointer() const { return m_flags & ReturnsPointer; }
bool isCast() const { return m_flags & IsCast; }
@ -53,7 +48,6 @@ private:
LocationCallFlags m_flags;
SharedLocationCall m_on;
std::string m_name;
std::vector<std::string> m_args;
};
class LocationCallFormatterCpp {

View File

@ -29,16 +29,7 @@ void LocationCallFormatterCpp::print(const LocationCall &Call,
OS << '.';
}
OS << Call.name();
if (Call.args().empty()) {
OS << "()";
return;
}
OS << '(' << Call.args().front();
for (const std::string &Arg : Call.args().drop_front()) {
OS << ", " << Arg;
}
OS << ')';
OS << Call.name() << "()";
}
std::string LocationCallFormatterCpp::format(const LocationCall &Call) {

View File

@ -61,16 +61,7 @@ public:
print(*On, OS);
OS << '.';
}
OS << Call.name();
if (Call.args().empty()) {
OS << "()";
return;
}
OS << '(' << Call.args().front();
for (const std::string &Arg : Call.args().drop_front()) {
OS << ", " << Arg;
}
OS << ')';
OS << Call.name() << "()";
}
static std::string format(const LocationCall &Call) {