diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index 2cc32a1c4f4c..469bf3cbfd44 100644 --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -1393,8 +1393,7 @@ public: : Expr(ObjCSelectorExprClass, T), SelName(selInfo), AtLoc(at), RParenLoc(rp) {} - const Selector &getSelector() const { return SelName; } - Selector &getSelector() { return SelName; } + Selector getSelector() const { return SelName; } SourceLocation getAtLoc() const { return AtLoc; } SourceLocation getRParenLoc() const { return RParenLoc; } @@ -1518,7 +1517,6 @@ public: Expr *getReceiver() { return SubExprs[RECEIVER]; } Selector getSelector() const { return SelName; } - Selector &getSelector() { return SelName; } const ObjCMethodDecl *getMethodDecl() const { return MethodProto; } ObjCMethodDecl *getMethodDecl() { return MethodProto; } diff --git a/clang/include/clang/Basic/IdentifierTable.h b/clang/include/clang/Basic/IdentifierTable.h index f64fd6fda4ff..7c9efc8bc401 100644 --- a/clang/include/clang/Basic/IdentifierTable.h +++ b/clang/include/clang/Basic/IdentifierTable.h @@ -231,10 +231,10 @@ public: return InfoPtr & ArgFlags; } /// operator==/!= - Indicate whether the specified selectors are identical. - bool operator==(const Selector &RHS) const { + bool operator==(Selector RHS) const { return InfoPtr == RHS.InfoPtr; } - bool operator!=(const Selector &RHS) const { + bool operator!=(Selector RHS) const { return InfoPtr != RHS.InfoPtr; } void *getAsOpaquePtr() const { diff --git a/clang/lib/AST/StmtDumper.cpp b/clang/lib/AST/StmtDumper.cpp index 2d4adf893879..52eb91e4bf7d 100644 --- a/clang/lib/AST/StmtDumper.cpp +++ b/clang/lib/AST/StmtDumper.cpp @@ -441,7 +441,7 @@ void StmtDumper::VisitObjCSelectorExpr(ObjCSelectorExpr *Node) { DumpExpr(Node); fprintf(F, " "); - Selector &selector = Node->getSelector(); + Selector selector = Node->getSelector(); fprintf(F, "%s", selector.getName().c_str()); } diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index a76fd1f9b5e9..2ff7f79c2de0 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -822,7 +822,7 @@ void StmtPrinter::VisitObjCMessageExpr(ObjCMessageExpr *Mess) { Expr *receiver = Mess->getReceiver(); if (receiver) PrintExpr(receiver); else OS << Mess->getClassName()->getName(); - Selector &selector = Mess->getSelector(); + Selector selector = Mess->getSelector(); if (selector.isUnarySelector()) { OS << " " << selector.getIdentifierInfoForSlot(0)->getName(); } else {