forked from OSchip/llvm-project
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
This commit is contained in:
parent
ab62488ae3
commit
df7855bb17
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<FunctionType>(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);
|
||||
|
|
|
@ -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 << '"';
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<FunctionType>(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);
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue