Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove attributes iterating methods #9 #10

Merged
merged 2 commits into from
Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions include/clang/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2863,15 +2863,6 @@ class TypeDecl : public NamedDecl {
static bool classofKind(Kind K) { return K >= firstType && K <= lastType; }
};

struct EosioOrder {
std::string field;
std::string order;
};

using EosioOrders = SmallVector<EosioOrder, 2>;

using EosioContracts = SmallVector<std::string, 2>;

/// Base class for declarations which introduce a typedef-name.
class TypedefNameDecl : public TypeDecl, public Redeclarable<TypedefNameDecl> {
struct LLVM_ALIGNAS(8) ModedTInfo {
Expand Down Expand Up @@ -2970,7 +2961,6 @@ class TypedefNameDecl : public TypeDecl, public Redeclarable<TypedefNameDecl> {
}

bool hasEosioOrders() const;
EosioOrders getEosioOrders() const;
bool hasEosioNonUnique() const;

bool hasEosioTable() const;
Expand All @@ -2979,7 +2969,6 @@ class TypedefNameDecl : public TypeDecl, public Redeclarable<TypedefNameDecl> {
std::string getEosioScopeType() const;

bool hasEosioContracts() const;
EosioContracts getEosioContracts() const;
private:
bool isTransparentTagSlow() const;
};
Expand Down
13 changes: 1 addition & 12 deletions include/clang/AST/DeclBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,19 +478,8 @@ class LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) Decl {
AttrVec &getAttrs() {
return const_cast<AttrVec&>(const_cast<const Decl*>(this)->getAttrs());
}
const AttrVec &getAttrs() const;

template<typename T>
SmallVector<T*, 4> getAttrs() const {
SmallVector<T*, 4> ret;
for (auto* attr: getAttrs()) {
if (auto spec_attr = dyn_cast<T>(attr)) {
ret.push_back(spec_attr);
}
}
return ret;
}

const AttrVec &getAttrs() const;
void dropAttrs();

void addAttr(Attr *A) {
Expand Down
4 changes: 2 additions & 2 deletions include/clang/AST/DeclCXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ class CXXRecordDecl : public RecordDecl {
EosioActionAttr* getEosioActionAttr() const { return getAttr<EosioActionAttr>(); }
EosioTableAttr* getEosioTableAttr() const { return getAttr<EosioTableAttr>(); }
EosioEventAttr* getEosioEventAttr() const { return getAttr<EosioEventAttr>(); }
SmallVector<EosioContractAttr*, 4> getEosioContractAttrs() const { return getAttrs<EosioContractAttr>(); }
EosioContractAttr* getEosioContractAttr() const { return getAttr<EosioContractAttr>(); }
EosioRicardianAttr* getEosioRicardianAttr() const { return getAttr<EosioRicardianAttr>(); }

CXXRecordDecl *getCanonicalDecl() override {
Expand Down Expand Up @@ -2075,7 +2075,7 @@ class CXXMethodDecl : public FunctionDecl {
bool hasEosioRicardian() const { return hasAttr<EosioRicardianAttr>(); }
EosioActionAttr* getEosioActionAttr() const { return getAttr<EosioActionAttr>(); }
EosioNotifyAttr* getEosioNotifyAttr() const { return getAttr<EosioNotifyAttr>(); }
SmallVector<EosioContractAttr*, 4> getEosioContractAttrs() const { return getAttrs<EosioContractAttr>(); }
EosioContractAttr* getEosioContractAttr() const { return getAttr<EosioContractAttr>(); }
EosioRicardianAttr* getEosioRicardianAttr() const { return getAttr<EosioRicardianAttr>(); }

/// Returns true if the given operator is implicitly static in a record
Expand Down
20 changes: 0 additions & 20 deletions lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4426,19 +4426,6 @@ TagDecl *TypedefNameDecl::getAnonDeclWithTypedefName(bool AnyRedecl) const {
}

bool TypedefNameDecl::hasEosioOrders()const { return hasAttr<EosioOrderAttr>(); }
EosioOrders TypedefNameDecl::getEosioOrders()const {
EosioOrders ret;
for (auto* attr: getAttrs()) {
if (auto order = dyn_cast<EosioOrderAttr>(attr)) {
EosioOrder ord;
ord.field = order->getField();
ord.order = order->getOrder();
ret.push_back(ord);
}
}
return ret;
}

bool TypedefNameDecl::hasEosioNonUnique()const { return hasAttr<EosioNonUniqueAttr>(); }

bool TypedefNameDecl::hasEosioTable()const { return hasAttr<EosioTableAttr>(); }
Expand All @@ -4451,13 +4438,6 @@ std::string TypedefNameDecl::getEosioScopeType()const {
}

bool TypedefNameDecl::hasEosioContracts()const { return hasAttr<EosioContractAttr>(); }
EosioContracts TypedefNameDecl::getEosioContracts()const {
EosioContracts ret;
for (auto* attr: getAttrs()) {
if (auto contract = dyn_cast<EosioContractAttr>(attr)) ret.push_back(contract->getName());
}
return ret;
}

bool TypedefNameDecl::isTransparentTagSlow() const {
auto determineIsTransparent = [&]() {
Expand Down