From d736e5d8623f67074ac1cfc65a12494a827a927d Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Thu, 17 Apr 2014 14:14:00 +0200 Subject: [PATCH] Skip trailing space, we never need it. Fixes cling tests. --- lib/MetaProcessor/MetaParser.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/MetaProcessor/MetaParser.cpp b/lib/MetaProcessor/MetaParser.cpp index 9070b4c0..3376745d 100644 --- a/lib/MetaProcessor/MetaParser.cpp +++ b/lib/MetaProcessor/MetaParser.cpp @@ -61,12 +61,19 @@ namespace cling { return; Token Tok = lookAhead(1); + Token PrevTok = Tok; while (Tok.isNot(stopAt) && Tok.isNot(tok::eof)){ //MergedTok.setLength(MergedTok.getLength() + Tok.getLength()); m_TokenCache.erase(m_TokenCache.begin() + 1); + PrevTok = Tok; Tok = lookAhead(1); } MergedTok.setKind(tok::raw_ident); + if (PrevTok.is(tok::space)) { + // for "id eof" the merged token should contain "id", not + // "id ". + Tok = PrevTok; + } MergedTok.setLength(Tok.getBufStart() - MergedTok.getBufStart()); }