#include "clang/Edit/Rewriters.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/NSAPI.h"
#include "clang/AST/ParentMap.h"
#include "clang/Edit/Commit.h"
#include "clang/Lex/Lexer.h"
#include <optional>
usingnamespaceclang;
usingnamespaceedit;
static bool checkForLiteralCreation(const ObjCMessageExpr *Msg,
IdentifierInfo *&ClassId,
const LangOptions &LangOpts) { … }
bool edit::rewriteObjCRedundantCallWithLiteral(const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit) { … }
static const ObjCInterfaceDecl *
maybeAdjustInterfaceForSubscriptingCheck(const ObjCInterfaceDecl *IFace,
const Expr *Receiver,
ASTContext &Ctx) { … }
static bool canRewriteToSubscriptSyntax(const ObjCInterfaceDecl *&IFace,
const ObjCMessageExpr *Msg,
ASTContext &Ctx,
Selector subscriptSel) { … }
static bool subscriptOperatorNeedsParens(const Expr *FullExpr);
static void maybePutParensOnReceiver(const Expr *Receiver, Commit &commit) { … }
static bool rewriteToSubscriptGetCommon(const ObjCMessageExpr *Msg,
Commit &commit) { … }
static bool rewriteToArraySubscriptGet(const ObjCInterfaceDecl *IFace,
const ObjCMessageExpr *Msg,
const NSAPI &NS,
Commit &commit) { … }
static bool rewriteToDictionarySubscriptGet(const ObjCInterfaceDecl *IFace,
const ObjCMessageExpr *Msg,
const NSAPI &NS,
Commit &commit) { … }
static bool rewriteToArraySubscriptSet(const ObjCInterfaceDecl *IFace,
const ObjCMessageExpr *Msg,
const NSAPI &NS,
Commit &commit) { … }
static bool rewriteToDictionarySubscriptSet(const ObjCInterfaceDecl *IFace,
const ObjCMessageExpr *Msg,
const NSAPI &NS,
Commit &commit) { … }
bool edit::rewriteToObjCSubscriptSyntax(const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit) { … }
static bool rewriteToArrayLiteral(const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit,
const ParentMap *PMap);
static bool rewriteToDictionaryLiteral(const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit);
static bool rewriteToNumberLiteral(const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit);
static bool rewriteToNumericBoxedExpression(const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit);
static bool rewriteToStringBoxedExpression(const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit);
bool edit::rewriteToObjCLiteralSyntax(const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit,
const ParentMap *PMap) { … }
static bool shouldNotRewriteImmediateMessageArgs(const ObjCMessageExpr *Msg,
const NSAPI &NS);
static void objectifyExpr(const Expr *E, Commit &commit);
static bool rewriteToArrayLiteral(const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit,
const ParentMap *PMap) { … }
static bool getNSArrayObjects(const Expr *E, const NSAPI &NS,
SmallVectorImpl<const Expr *> &Objs) { … }
static bool rewriteToDictionaryLiteral(const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit) { … }
static bool shouldNotRewriteImmediateMessageArgs(const ObjCMessageExpr *Msg,
const NSAPI &NS) { … }
static bool rewriteToCharLiteral(const ObjCMessageExpr *Msg,
const CharacterLiteral *Arg,
const NSAPI &NS, Commit &commit) { … }
static bool rewriteToBoolLiteral(const ObjCMessageExpr *Msg,
const Expr *Arg,
const NSAPI &NS, Commit &commit) { … }
namespace {
struct LiteralInfo { … };
}
static bool getLiteralInfo(SourceRange literalRange,
bool isFloat, bool isIntZero,
ASTContext &Ctx, LiteralInfo &Info) { … }
static bool rewriteToNumberLiteral(const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit) { … }
static bool subscriptOperatorNeedsParens(const Expr *FullExpr) { … }
static bool castOperatorNeedsParens(const Expr *FullExpr) { … }
static void objectifyExpr(const Expr *E, Commit &commit) { … }
static bool isEnumConstant(const Expr *E) { … }
static bool rewriteToNumericBoxedExpression(const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit) { … }
static bool doRewriteToUTF8StringBoxedExpressionHelper(
const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit) { … }
static bool rewriteToStringBoxedExpression(const ObjCMessageExpr *Msg,
const NSAPI &NS, Commit &commit) { … }