summaryrefslogtreecommitdiffstats
path: root/clang/lib/Index/CommentToXML.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-09-09 14:37:39 +0000
committerDaniel Jasper <djasper@google.com>2014-09-09 14:37:39 +0000
commit23376259c087f8629345230087ac9ed6df6d6134 (patch)
treea4850374f4835915588fcd3d38bfcbca486d50fb /clang/lib/Index/CommentToXML.cpp
parent7fc29546f93e1c4ca579be76c69245e7521cce4b (diff)
downloadbcm5719-llvm-23376259c087f8629345230087ac9ed6df6d6134.tar.gz
bcm5719-llvm-23376259c087f8629345230087ac9ed6df6d6134.zip
clang-format: [JS] Support regex literals with trailing escaped slash.
Before: var regex = / a\//; int i; After: var regex = /a\//; int i; This required pushing the Lexer into its wrapper class and generating a new one in this specific case. Otherwise, the sequence get lexed as a //-comment. This is hacky, but I don't know a better way (short of supporting regex literals in the Lexer). Pushing the Lexer down seems to make all the call sites simpler. llvm-svn: 217444
Diffstat (limited to 'clang/lib/Index/CommentToXML.cpp')
-rw-r--r--clang/lib/Index/CommentToXML.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/clang/lib/Index/CommentToXML.cpp b/clang/lib/Index/CommentToXML.cpp
index a67c806550d..d1100c44e16 100644
--- a/clang/lib/Index/CommentToXML.cpp
+++ b/clang/lib/Index/CommentToXML.cpp
@@ -15,7 +15,6 @@
#include "clang/AST/CommentVisitor.h"
#include "clang/Format/Format.h"
#include "clang/Index/USRGeneration.h"
-#include "clang/Lex/Lexer.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/Support/raw_ostream.h"
@@ -611,12 +610,8 @@ void CommentASTToXMLConverter::formatTextOfDeclaration(
std::vector<CharSourceRange> Ranges(
1, CharSourceRange::getCharRange(Start, Start.getLocWithOffset(Length)));
- ASTContext &Context = DI->CurrentDecl->getASTContext();
- const LangOptions &LangOpts = Context.getLangOpts();
- Lexer Lex(ID, FormatRewriterContext.Sources.getBuffer(ID),
- FormatRewriterContext.Sources, LangOpts);
tooling::Replacements Replace = reformat(
- format::getLLVMStyle(), Lex, FormatRewriterContext.Sources, Ranges);
+ format::getLLVMStyle(), FormatRewriterContext.Sources, ID, Ranges);
applyAllReplacements(Replace, FormatRewriterContext.Rewrite);
Declaration = FormatRewriterContext.getRewrittenText(ID);
}
OpenPOWER on IntegriCloud