aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorSean Hunt <scshunt@csclub.uwaterloo.ca>2010-08-30 17:47:05 +0000
committerSean Hunt <scshunt@csclub.uwaterloo.ca>2010-08-30 17:47:05 +0000
commit6cf750298d3621d8a10a6dd07fcee8e274b9d94d (patch)
tree2d4b62e04dd3a48b65398bcc56ecc383719fdad8 /lib/Lex/Preprocessor.cpp
parent4a551000bee716ac8b1bbe16134a53f0ad221a5a (diff)
Revert my user-defined literal commits - r1124{58,60,67} pending
some issues being sorted out. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112493 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r--lib/Lex/Preprocessor.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index f52d35494a..5160acf19e 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -352,25 +352,15 @@ std::string Preprocessor::getSpelling(const Token &Tok, bool *Invalid) const {
/// to point to a constant buffer with the data already in it (avoiding a
/// copy). The caller is not allowed to modify the returned buffer pointer
/// if an internal buffer is returned.
-///
-/// If LiteralOnly is specified, only the literal portion of the token is
-/// processed.
-unsigned Preprocessor::getSpelling(const Token &Tok, const char *&Buffer,
- bool *Invalid, bool LiteralOnly) const {
+unsigned Preprocessor::getSpelling(const Token &Tok,
+ const char *&Buffer, bool *Invalid) const {
assert((int)Tok.getLength() >= 0 && "Token character range is bogus!");
- assert((!LiteralOnly || Tok.isLiteral()) &&
- "LiteralOnly used on a non-literal token");
-
- unsigned (Token::*getLength) () const =
- LiteralOnly ? &Token::getLiteralLength : &Token::getLength;
// If this token is an identifier, just return the string from the identifier
// table, which is very quick.
if (const IdentifierInfo *II = Tok.getIdentifierInfo()) {
- if (!Tok.isUserDefinedLiteral()) {
- Buffer = II->getNameStart();
- return II->getLength();
- }
+ Buffer = II->getNameStart();
+ return II->getLength();
}
// Otherwise, compute the start of the token in the input lexer buffer.
@@ -391,20 +381,20 @@ unsigned Preprocessor::getSpelling(const Token &Tok, const char *&Buffer,
}
// If this token contains nothing interesting, return it directly.
- if (!(LiteralOnly ? Tok.literalNeedsCleaning() : Tok.needsCleaning())) {
+ if (!Tok.needsCleaning()) {
Buffer = TokStart;
- return (Tok.*getLength)();
+ return Tok.getLength();
}
// Otherwise, hard case, relex the characters into the string.
char *OutBuf = const_cast<char*>(Buffer);
- for (const char *Ptr = TokStart, *End = TokStart+(Tok.*getLength)();
+ for (const char *Ptr = TokStart, *End = TokStart+Tok.getLength();
Ptr != End; ) {
unsigned CharSize;
*OutBuf++ = Lexer::getCharAndSizeNoWarn(Ptr, CharSize, Features);
Ptr += CharSize;
}
- assert(unsigned(OutBuf-Buffer) != (Tok.*getLength)() &&
+ assert(unsigned(OutBuf-Buffer) != Tok.getLength() &&
"NeedsCleaning flag set on something that didn't need cleaning!");
return OutBuf-Buffer;