From df7855bb179f2cbdfbc7aea8f10a3a2171cdc9f3 Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Wed, 21 Feb 2007 23:46:25 +0000 Subject: [PATCH] Batch search/replace snafu (inadvertantly changed IntegerConstant->StringLiteral). clang still compiled/linked/ran properly...simply a confusing name regression. From now on I'll make sure I run "cvs diff" before committing any changes! llvm-svn: 39342 --- clang/AST/Expr.cpp | 6 +++--- clang/AST/Sema.h | 6 +++--- clang/AST/SemaExpr.cpp | 14 +++++++------- clang/AST/StmtPrinter.cpp | 4 ++-- clang/Parse/ParseExpr.cpp | 4 ++-- clang/Sema/Sema.h | 6 +++--- clang/Sema/SemaExpr.cpp | 14 +++++++------- clang/include/clang/AST/Expr.h | 10 +++++----- clang/include/clang/AST/StmtNodes.def | 6 +++--- clang/include/clang/Parse/Action.h | 6 +++--- 10 files changed, 38 insertions(+), 38 deletions(-) diff --git a/clang/AST/Expr.cpp b/clang/AST/Expr.cpp index 5df2cb211d31..49561bb9be68 100644 --- a/clang/AST/Expr.cpp +++ b/clang/AST/Expr.cpp @@ -21,8 +21,8 @@ using namespace clang; // Primary Expressions. //===----------------------------------------------------------------------===// -StringExpr::StringExpr(const char *strData, unsigned byteLength, bool Wide) { - // OPTIMIZE: could allocate this appended to the StringExpr. +StringLiteral::StringLiteral(const char *strData, unsigned byteLength, bool Wide) { + // OPTIMIZE: could allocate this appended to the StringLiteral. char *AStrData = new char[byteLength]; memcpy(AStrData, strData, byteLength); StrData = AStrData; @@ -30,7 +30,7 @@ StringExpr::StringExpr(const char *strData, unsigned byteLength, bool Wide) { IsWide = Wide; } -StringExpr::~StringExpr() { +StringLiteral::~StringLiteral() { delete[] StrData; } diff --git a/clang/AST/Sema.h b/clang/AST/Sema.h index 19ae547e8edc..7b6cead61e77 100644 --- a/clang/AST/Sema.h +++ b/clang/AST/Sema.h @@ -155,14 +155,14 @@ public: bool HasTrailingLParen); virtual ExprResult ParseSimplePrimaryExpr(SourceLocation Loc, tok::TokenKind Kind); - virtual ExprResult ParseStringLiteral(SourceLocation Loc); + virtual ExprResult ParseIntegerLiteral(SourceLocation Loc); virtual ExprResult ParseFloatingLiteral(SourceLocation Loc); virtual ExprResult ParseParenExpr(SourceLocation L, SourceLocation R, ExprTy *Val); - /// ParseStringExpr - The specified tokens were lexed as pasted string + /// ParseStringLiteral - The specified tokens were lexed as pasted string /// fragments (e.g. "foo" "bar" L"baz"). - virtual ExprResult ParseStringExpr(const LexerToken *Toks, unsigned NumToks); + virtual ExprResult ParseStringLiteral(const LexerToken *Toks, unsigned NumToks); // Binary/Unary Operators. 'Tok' is the token for the operator. virtual ExprResult ParseUnaryOp(SourceLocation OpLoc, tok::TokenKind Op, diff --git a/clang/AST/SemaExpr.cpp b/clang/AST/SemaExpr.cpp index 5e4733e8cc18..84dbad3a828e 100644 --- a/clang/AST/SemaExpr.cpp +++ b/clang/AST/SemaExpr.cpp @@ -35,14 +35,14 @@ static int HexDigitValue(char C) { return -1; } -/// ParseStringExpr - The specified tokens were lexed as pasted string +/// ParseStringLiteral - The specified tokens were lexed as pasted string /// fragments (e.g. "foo" "bar" L"baz"). The result string has to handle string /// concatenation ([C99 5.1.1.2, translation phase #6]), so it may come from /// multiple tokens. However, the common case is that StringToks points to one /// string. /// Action::ExprResult -Sema::ParseStringExpr(const LexerToken *StringToks, unsigned NumStringToks) { +Sema::ParseStringLiteral(const LexerToken *StringToks, unsigned NumStringToks) { assert(NumStringToks && "Must have at least one string!"); // Scan all of the string portions, remember the max individual token length, @@ -236,7 +236,7 @@ Sema::ParseStringExpr(const LexerToken *StringToks, unsigned NumStringToks) { // FIXME: use factory. // Pass &StringTokLocs[0], StringTokLocs.size() to factory! - return new StringExpr(&ResultBuf[0], ResultPtr-&ResultBuf[0], AnyWide); + return new StringLiteral(&ResultBuf[0], ResultPtr-&ResultBuf[0], AnyWide); } @@ -285,8 +285,8 @@ Sema::ExprResult Sema::ParseSimplePrimaryExpr(SourceLocation Loc, } } -Sema::ExprResult Sema::ParseStringLiteral(SourceLocation Loc) { - return new StringLiteral(); +Sema::ExprResult Sema::ParseIntegerLiteral(SourceLocation Loc) { + return new IntegerLiteral(); } Sema::ExprResult Sema::ParseFloatingLiteral(SourceLocation Loc) { return new FloatingLiteral(); @@ -339,7 +339,7 @@ ParseSizeOfAlignOfTypeExpr(SourceLocation OpLoc, bool isSizeof, if (isa(ArgTy) && isSizeof) { // alignof(function) is allowed. Diag(OpLoc, diag::ext_sizeof_function_type); - return new StringLiteral(/*1*/); + return new IntegerLiteral(/*1*/); } else if (ArgTy->isVoidType()) { Diag(OpLoc, diag::ext_sizeof_void_type, isSizeof ? "sizeof" : "__alignof"); } else if (ArgTy->isIncompleteType()) { @@ -347,7 +347,7 @@ ParseSizeOfAlignOfTypeExpr(SourceLocation OpLoc, bool isSizeof, ArgTy->getAsString(TypeName); Diag(OpLoc, isSizeof ? diag::err_sizeof_incomplete_type : diag::err_alignof_incomplete_type, TypeName); - return new StringLiteral(/*0*/); + return new IntegerLiteral(/*0*/); } return new SizeOfAlignOfTypeExpr(isSizeof, ArgTy); diff --git a/clang/AST/StmtPrinter.cpp b/clang/AST/StmtPrinter.cpp index ff01b1a7c176..9c0cb0636233 100644 --- a/clang/AST/StmtPrinter.cpp +++ b/clang/AST/StmtPrinter.cpp @@ -215,7 +215,7 @@ void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) { OS << Node->getDecl()->getName(); } -void StmtPrinter::VisitStringLiteral(StringLiteral *Node) { +void StmtPrinter::VisitIntegerLiteral(IntegerLiteral *Node) { // FIXME: print value. OS << "1"; } @@ -223,7 +223,7 @@ void StmtPrinter::VisitFloatingLiteral(FloatingLiteral *Node) { // FIXME: print value. OS << "1.0"; } -void StmtPrinter::VisitStringExpr(StringExpr *Str) { +void StmtPrinter::VisitStringLiteral(StringLiteral *Str) { if (Str->isWide()) OS << 'L'; OS << '"'; diff --git a/clang/Parse/ParseExpr.cpp b/clang/Parse/ParseExpr.cpp index 3bf84ddf1127..b2d51441db11 100644 --- a/clang/Parse/ParseExpr.cpp +++ b/clang/Parse/ParseExpr.cpp @@ -476,7 +476,7 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) { // TODO: Validate whether this is an integer or floating-constant or // neither. if (1) { - Res = Actions.ParseStringLiteral(Tok.getLocation()); + Res = Actions.ParseIntegerLiteral(Tok.getLocation()); } else { Res = Actions.ParseFloatingLiteral(Tok.getLocation()); } @@ -929,5 +929,5 @@ Parser::ExprResult Parser::ParseStringLiteralExpression() { } while (isTokenStringLiteral()); // Pass the set of string tokens, ready for concatenation, to the actions. - return Actions.ParseStringExpr(&StringToks[0], StringToks.size()); + return Actions.ParseStringLiteral(&StringToks[0], StringToks.size()); } diff --git a/clang/Sema/Sema.h b/clang/Sema/Sema.h index 19ae547e8edc..7b6cead61e77 100644 --- a/clang/Sema/Sema.h +++ b/clang/Sema/Sema.h @@ -155,14 +155,14 @@ public: bool HasTrailingLParen); virtual ExprResult ParseSimplePrimaryExpr(SourceLocation Loc, tok::TokenKind Kind); - virtual ExprResult ParseStringLiteral(SourceLocation Loc); + virtual ExprResult ParseIntegerLiteral(SourceLocation Loc); virtual ExprResult ParseFloatingLiteral(SourceLocation Loc); virtual ExprResult ParseParenExpr(SourceLocation L, SourceLocation R, ExprTy *Val); - /// ParseStringExpr - The specified tokens were lexed as pasted string + /// ParseStringLiteral - The specified tokens were lexed as pasted string /// fragments (e.g. "foo" "bar" L"baz"). - virtual ExprResult ParseStringExpr(const LexerToken *Toks, unsigned NumToks); + virtual ExprResult ParseStringLiteral(const LexerToken *Toks, unsigned NumToks); // Binary/Unary Operators. 'Tok' is the token for the operator. virtual ExprResult ParseUnaryOp(SourceLocation OpLoc, tok::TokenKind Op, diff --git a/clang/Sema/SemaExpr.cpp b/clang/Sema/SemaExpr.cpp index 5e4733e8cc18..84dbad3a828e 100644 --- a/clang/Sema/SemaExpr.cpp +++ b/clang/Sema/SemaExpr.cpp @@ -35,14 +35,14 @@ static int HexDigitValue(char C) { return -1; } -/// ParseStringExpr - The specified tokens were lexed as pasted string +/// ParseStringLiteral - The specified tokens were lexed as pasted string /// fragments (e.g. "foo" "bar" L"baz"). The result string has to handle string /// concatenation ([C99 5.1.1.2, translation phase #6]), so it may come from /// multiple tokens. However, the common case is that StringToks points to one /// string. /// Action::ExprResult -Sema::ParseStringExpr(const LexerToken *StringToks, unsigned NumStringToks) { +Sema::ParseStringLiteral(const LexerToken *StringToks, unsigned NumStringToks) { assert(NumStringToks && "Must have at least one string!"); // Scan all of the string portions, remember the max individual token length, @@ -236,7 +236,7 @@ Sema::ParseStringExpr(const LexerToken *StringToks, unsigned NumStringToks) { // FIXME: use factory. // Pass &StringTokLocs[0], StringTokLocs.size() to factory! - return new StringExpr(&ResultBuf[0], ResultPtr-&ResultBuf[0], AnyWide); + return new StringLiteral(&ResultBuf[0], ResultPtr-&ResultBuf[0], AnyWide); } @@ -285,8 +285,8 @@ Sema::ExprResult Sema::ParseSimplePrimaryExpr(SourceLocation Loc, } } -Sema::ExprResult Sema::ParseStringLiteral(SourceLocation Loc) { - return new StringLiteral(); +Sema::ExprResult Sema::ParseIntegerLiteral(SourceLocation Loc) { + return new IntegerLiteral(); } Sema::ExprResult Sema::ParseFloatingLiteral(SourceLocation Loc) { return new FloatingLiteral(); @@ -339,7 +339,7 @@ ParseSizeOfAlignOfTypeExpr(SourceLocation OpLoc, bool isSizeof, if (isa(ArgTy) && isSizeof) { // alignof(function) is allowed. Diag(OpLoc, diag::ext_sizeof_function_type); - return new StringLiteral(/*1*/); + return new IntegerLiteral(/*1*/); } else if (ArgTy->isVoidType()) { Diag(OpLoc, diag::ext_sizeof_void_type, isSizeof ? "sizeof" : "__alignof"); } else if (ArgTy->isIncompleteType()) { @@ -347,7 +347,7 @@ ParseSizeOfAlignOfTypeExpr(SourceLocation OpLoc, bool isSizeof, ArgTy->getAsString(TypeName); Diag(OpLoc, isSizeof ? diag::err_sizeof_incomplete_type : diag::err_alignof_incomplete_type, TypeName); - return new StringLiteral(/*0*/); + return new IntegerLiteral(/*0*/); } return new SizeOfAlignOfTypeExpr(isSizeof, ArgTy); diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index 39e1c15889f2..1b95416a9c5a 100644 --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -51,9 +51,9 @@ public: virtual void visit(StmtVisitor &Visitor); }; -class StringLiteral : public Expr { +class IntegerLiteral : public Expr { public: - StringLiteral() {} + IntegerLiteral() {} virtual void visit(StmtVisitor &Visitor); }; @@ -63,13 +63,13 @@ public: virtual void visit(StmtVisitor &Visitor); }; -class StringExpr : public Expr { +class StringLiteral : public Expr { const char *StrData; unsigned ByteLength; bool IsWide; public: - StringExpr(const char *strData, unsigned byteLength, bool Wide); - virtual ~StringExpr(); + StringLiteral(const char *strData, unsigned byteLength, bool Wide); + virtual ~StringLiteral(); const char *getStrData() const { return StrData; } unsigned getByteLength() const { return ByteLength; } diff --git a/clang/include/clang/AST/StmtNodes.def b/clang/include/clang/AST/StmtNodes.def index 4a4508288a3e..de57dcdd75d6 100644 --- a/clang/include/clang/AST/StmtNodes.def +++ b/clang/include/clang/AST/StmtNodes.def @@ -30,9 +30,9 @@ STMT(ReturnStmt , Stmt) // Expressions. STMT(Expr , Stmt) STMT(DeclRefExpr , Expr) -STMT(StringLiteral , Expr) -STMT(FloatingLiteral , Expr) -STMT(StringExpr , Expr) +STMT(IntegerLiteral , Expr) +STMT(FloatingLiteral , Expr) +STMT(StringLiteral , Expr) STMT(ParenExpr , Expr) STMT(UnaryOperator , Expr) STMT(SizeOfAlignOfTypeExpr, Expr) diff --git a/clang/include/clang/Parse/Action.h b/clang/include/clang/Parse/Action.h index 9bece9625185..240d0bd6acc7 100644 --- a/clang/include/clang/Parse/Action.h +++ b/clang/include/clang/Parse/Action.h @@ -263,12 +263,12 @@ public: tok::TokenKind Kind) { return 0; } - virtual ExprResult ParseStringLiteral(SourceLocation Loc) { return 0; } + virtual ExprResult ParseIntegerLiteral(SourceLocation Loc) { return 0; } virtual ExprResult ParseFloatingLiteral(SourceLocation Loc) { return 0; } - /// ParseStringExpr - The specified tokens were lexed as pasted string + /// ParseStringLiteral - The specified tokens were lexed as pasted string /// fragments (e.g. "foo" "bar" L"baz"). - virtual ExprResult ParseStringExpr(const LexerToken *Toks, unsigned NumToks) { + virtual ExprResult ParseStringLiteral(const LexerToken *Toks, unsigned NumToks) { return 0; }