1111#include " Protocol.h"
1212#include " Selection.h"
1313#include " SourceCode.h"
14- #include " clang-pseudo/Bracket.h"
15- #include " clang-pseudo/DirectiveTree.h"
16- #include " clang-pseudo/Token.h"
1714#include " clang/AST/DeclBase.h"
1815#include " clang/Basic/SourceLocation.h"
1916#include " clang/Basic/SourceManager.h"
2522#include " llvm/ADT/StringRef.h"
2623#include " llvm/Support/Casting.h"
2724#include " llvm/Support/Error.h"
25+ #include " support/Bracket.h"
26+ #include " support/DirectiveTree.h"
27+ #include " support/Token.h"
2828#include < optional>
2929#include < queue>
3030#include < vector>
@@ -181,16 +181,16 @@ llvm::Expected<std::vector<FoldingRange>> getFoldingRanges(ParsedAST &AST) {
181181// Related issue: https://github.com/clangd/clangd/issues/310
182182llvm::Expected<std::vector<FoldingRange>>
183183getFoldingRanges (const std::string &Code, bool LineFoldingOnly) {
184- auto OrigStream = pseudo:: lex (Code, clang::pseudo:: genericLangOpts ());
184+ auto OrigStream = lex (Code, genericLangOpts ());
185185
186- auto DirectiveStructure = pseudo:: DirectiveTree::parse (OrigStream);
187- pseudo:: chooseConditionalBranches (DirectiveStructure, OrigStream);
186+ auto DirectiveStructure = DirectiveTree::parse (OrigStream);
187+ chooseConditionalBranches (DirectiveStructure, OrigStream);
188188
189189 // FIXME: Provide ranges in the disabled-PP regions as well.
190190 auto Preprocessed = DirectiveStructure.stripDirectives (OrigStream);
191191
192- auto ParseableStream = cook (Preprocessed, clang::pseudo:: genericLangOpts ());
193- pseudo:: pairBrackets (ParseableStream);
192+ auto ParseableStream = cook (Preprocessed, genericLangOpts ());
193+ pairBrackets (ParseableStream);
194194
195195 std::vector<FoldingRange> Result;
196196 auto AddFoldingRange = [&](Position Start, Position End,
@@ -205,19 +205,19 @@ getFoldingRanges(const std::string &Code, bool LineFoldingOnly) {
205205 FR.kind = Kind.str ();
206206 Result.push_back (FR);
207207 };
208- auto OriginalToken = [&](const pseudo:: Token &T) {
208+ auto OriginalToken = [&](const Token &T) {
209209 return OrigStream.tokens ()[T.OriginalIndex ];
210210 };
211- auto StartOffset = [&](const pseudo:: Token &T) {
211+ auto StartOffset = [&](const Token &T) {
212212 return OriginalToken (T).text ().data () - Code.data ();
213213 };
214- auto StartPosition = [&](const pseudo:: Token &T) {
214+ auto StartPosition = [&](const Token &T) {
215215 return offsetToPosition (Code, StartOffset (T));
216216 };
217- auto EndOffset = [&](const pseudo:: Token &T) {
217+ auto EndOffset = [&](const Token &T) {
218218 return StartOffset (T) + OriginalToken (T).Length ;
219219 };
220- auto EndPosition = [&](const pseudo:: Token &T) {
220+ auto EndPosition = [&](const Token &T) {
221221 return offsetToPosition (Code, EndOffset (T));
222222 };
223223 auto Tokens = ParseableStream.tokens ();
@@ -235,7 +235,7 @@ getFoldingRanges(const std::string &Code, bool LineFoldingOnly) {
235235 }
236236 }
237237 }
238- auto IsBlockComment = [&](const pseudo:: Token &T) {
238+ auto IsBlockComment = [&](const Token &T) {
239239 assert (T.Kind == tok::comment);
240240 return OriginalToken (T).Length >= 2 &&
241241 Code.substr (StartOffset (T), 2 ) == " /*" ;
@@ -246,10 +246,10 @@ getFoldingRanges(const std::string &Code, bool LineFoldingOnly) {
246246 T++;
247247 continue ;
248248 }
249- pseudo:: Token *FirstComment = T;
249+ Token *FirstComment = T;
250250 // Show starting sentinals (// and /*) of the comment.
251251 Position Start = offsetToPosition (Code, 2 + StartOffset (*FirstComment));
252- pseudo:: Token *LastComment = T;
252+ Token *LastComment = T;
253253 Position End = EndPosition (*T);
254254 while (T != Tokens.end () && T->Kind == tok::comment &&
255255 StartPosition (*T).line <= End.line + 1 ) {
0 commit comments