[PATCH] D158055: [clang][AST] Added some missing setter methods

Timo Stripf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 16 00:22:10 PDT 2023


strimo378 created this revision.
Herald added a project: All.
strimo378 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158055

Files:
  clang/include/clang/AST/Decl.h
  clang/include/clang/AST/Expr.h


Index: clang/include/clang/AST/Expr.h
===================================================================
--- clang/include/clang/AST/Expr.h
+++ clang/include/clang/AST/Expr.h
@@ -1199,6 +1199,8 @@
   /// place.
   Expr *getSourceExpr() const { return SourceExpr; }
 
+  void setSourceExpr(Expr *E) { SourceExpr = E; }
+
   void setIsUnique(bool V) {
     assert((!V || SourceExpr) &&
            "unique OVEs are expected to have source expressions");
@@ -1332,6 +1334,11 @@
     return *getTrailingObjects<NestedNameSpecifierLoc>();
   }
 
+  void setQualifierLoc(NestedNameSpecifierLoc QL) {
+    assert(hasQualifier());
+    *getTrailingObjects<NestedNameSpecifierLoc>() = QL;
+  }
+
   /// If the name was qualified, retrieves the nested-name-specifier
   /// that precedes the name. Otherwise, returns NULL.
   NestedNameSpecifier *getQualifier() const {
@@ -1354,6 +1361,11 @@
     return hasFoundDecl() ? *getTrailingObjects<NamedDecl *>() : D;
   }
 
+  void setFoundDecl(NamedDecl *ND) {
+    assert(hasFoundDecl());
+    *getTrailingObjects<NamedDecl *>() = ND;
+  }
+
   bool hasTemplateKWAndArgsInfo() const {
     return DeclRefExprBits.HasTemplateKWAndArgsInfo;
   }
@@ -3296,6 +3308,11 @@
     return getTrailingObjects<MemberExprNameQualifier>()->QualifierLoc;
   }
 
+  void setQualifierLoc(NestedNameSpecifierLoc QL) {
+    assert(hasQualifierOrFoundDecl());
+    getTrailingObjects<MemberExprNameQualifier>()->QualifierLoc = QL;
+  }
+
   /// If the member name was qualified, retrieves the
   /// nested-name-specifier that precedes the member name. Otherwise, returns
   /// NULL.
@@ -3370,6 +3387,10 @@
                                MemberLoc, MemberDNLoc);
   }
 
+  void setMemberDeclNameLoc(const DeclarationNameLoc &Loc) {
+    MemberDNLoc = Loc;
+  }
+
   SourceLocation getOperatorLoc() const { return MemberExprBits.OperatorLoc; }
 
   bool isArrow() const { return MemberExprBits.IsArrow; }
Index: clang/include/clang/AST/Decl.h
===================================================================
--- clang/include/clang/AST/Decl.h
+++ clang/include/clang/AST/Decl.h
@@ -2118,6 +2118,8 @@
     return DeclarationNameInfo(getDeclName(), getLocation(), DNLoc);
   }
 
+  void setDeclNameLoc(const DeclarationNameLoc &Loc) { DNLoc = Loc; }
+
   void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy,
                             bool Qualified) const override;
 
@@ -3046,6 +3048,8 @@
   /// Determines whether this field is mutable (C++ only).
   bool isMutable() const { return Mutable; }
 
+  void setMutable(bool Mutable) { this->Mutable = Mutable; }
+
   /// Determines whether this field is a bitfield.
   bool isBitField() const { return BitField; }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158055.550647.patch
Type: text/x-patch
Size: 2707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230816/b96d4a0a/attachment.bin>


More information about the cfe-commits mailing list