[cfe-commits] r61791 - /cfe/trunk/include/clang/Lex/Token.h
Chris Lattner
sabre at nondot.org
Mon Jan 5 21:25:06 PST 2009
Author: lattner
Date: Mon Jan 5 23:25:04 2009
New Revision: 61791
URL: http://llvm.org/viewvc/llvm-project?rev=61791&view=rev
Log:
Make Token::setLength assert that the token is not an annotation token.
Modified:
cfe/trunk/include/clang/Lex/Token.h
Modified: cfe/trunk/include/clang/Lex/Token.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Token.h?rev=61791&r1=61790&r2=61791&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Token.h (original)
+++ cfe/trunk/include/clang/Lex/Token.h Mon Jan 5 23:25:04 2009
@@ -87,12 +87,15 @@
/// offset in the current file.
SourceLocation getLocation() const { return Loc; }
unsigned getLength() const {
- assert(!isAnnotationToken() && "Used Length on annotation token");
+ assert(!isAnnotationToken() && "Annotation tokens have no length field");
return UintData;
}
void setLocation(SourceLocation L) { Loc = L; }
- void setLength(unsigned Len) { UintData = Len; }
+ void setLength(unsigned Len) {
+ assert(!isAnnotationToken() && "Annotation tokens have no length field");
+ UintData = Len;
+ }
SourceLocation getAnnotationEndLoc() const {
assert(isAnnotationToken() && "Used AnnotEndLocID on non-annotation token");
@@ -120,6 +123,7 @@
/// startToken - Reset all flags to cleared.
///
void startToken() {
+ Kind = tok::unknown;
Flags = 0;
PtrData = 0;
Loc = SourceLocation();
More information about the cfe-commits
mailing list