diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2019-07-10 08:24:42 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2019-07-10 08:24:42 +0000 |
commit | 625a0f70a9886d9f652a9c85b29c0e1765c17361 (patch) | |
tree | 72fe7926cc94a4f5dedabc2d5e0a448e86deaaa7 /clang/lib/Tooling/Syntax/Tokens.cpp | |
parent | 3490aab63af3c82b87369ae974c95bb6d1b1c89f (diff) | |
download | bcm5719-llvm-625a0f70a9886d9f652a9c85b29c0e1765c17361.tar.gz bcm5719-llvm-625a0f70a9886d9f652a9c85b29c0e1765c17361.zip |
[Syntax] Add assertion to catch invalid tokens early. NFC
To help with identifiying root cause of a crash we are seeing.
llvm-svn: 365599
Diffstat (limited to 'clang/lib/Tooling/Syntax/Tokens.cpp')
-rw-r--r-- | clang/lib/Tooling/Syntax/Tokens.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Tooling/Syntax/Tokens.cpp b/clang/lib/Tooling/Syntax/Tokens.cpp index b42d5a2ca64..d82dc1f35c9 100644 --- a/clang/lib/Tooling/Syntax/Tokens.cpp +++ b/clang/lib/Tooling/Syntax/Tokens.cpp @@ -35,6 +35,12 @@ using namespace clang; using namespace clang::syntax; +syntax::Token::Token(SourceLocation Location, unsigned Length, + tok::TokenKind Kind) + : Location(Location), Length(Length), Kind(Kind) { + assert(Location.isValid()); +} + syntax::Token::Token(const clang::Token &T) : Token(T.getLocation(), T.getLength(), T.getKind()) { assert(!T.isAnnotation()); |