diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-06 05:25:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-06 05:25:04 +0000 |
commit | 79ed16e2e605d67a12cccdcf9ad1b231175da1a6 (patch) | |
tree | e03a3e695d2b1dce533e41d9f47a6f3267d4e225 | |
parent | ea14609c806d22d9eb876a029deed9bc3de4aacd (diff) |
Make Token::setLength assert that the token is not an annotation token.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61791 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Lex/Token.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/clang/Lex/Token.h b/include/clang/Lex/Token.h index a661ba82af..c0dd2b7837 100644 --- a/include/clang/Lex/Token.h +++ b/include/clang/Lex/Token.h @@ -87,12 +87,15 @@ public: /// 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 @@ public: /// startToken - Reset all flags to cleared. /// void startToken() { + Kind = tok::unknown; Flags = 0; PtrData = 0; Loc = SourceLocation(); |