if (Style.InsertBraces) {
Passes.emplace_back([&](const Environment &Env) {
- return BracesInserter(Env, Expanded).process();
+ return BracesInserter(Env, Expanded).process(/*SkipAnnotation=*/true);
});
}
if (Style.RemoveBracesLLVM) {
Passes.emplace_back([&](const Environment &Env) {
- return BracesRemover(Env, Expanded).process();
+ return BracesRemover(Env, Expanded).process(/*SkipAnnotation=*/true);
});
}
if (Style.isJavaScript() &&
Style.JavaScriptQuotes != FormatStyle::JSQS_Leave) {
Passes.emplace_back([&](const Environment &Env) {
- return JavaScriptRequoter(Env, Expanded).process();
+ return JavaScriptRequoter(Env, Expanded).process(/*SkipAnnotation=*/true);
});
}
<< "\n");
}
-std::pair<tooling::Replacements, unsigned> TokenAnalyzer::process() {
+std::pair<tooling::Replacements, unsigned>
+TokenAnalyzer::process(bool SkipAnnotation) {
tooling::Replacements Result;
llvm::SpecificBumpPtrAllocator<FormatToken> Allocator;
IdentifierTable IdentTable(getFormattingLangOpts(Style));
TokenAnnotator Annotator(Style, Lex.getKeywords());
for (const UnwrappedLine &Line : Lines) {
AnnotatedLines.push_back(new AnnotatedLine(Line));
- Annotator.annotate(*AnnotatedLines.back());
+ if (!SkipAnnotation)
+ Annotator.annotate(*AnnotatedLines.back());
}
std::pair<tooling::Replacements, unsigned> RunResult =
public:
TokenAnalyzer(const Environment &Env, const FormatStyle &Style);
- std::pair<tooling::Replacements, unsigned> process();
+ std::pair<tooling::Replacements, unsigned>
+ process(bool SkipAnnotation = false);
protected:
virtual std::pair<tooling::Replacements, unsigned>