forked from OSchip/llvm-project
[SyntaxTree] Add const qualifiers, from [llvm-qualified-auto]
Differential Revision: https://reviews.llvm.org/D87522
This commit is contained in:
parent
515238d5b1
commit
238ae4eee0
|
@ -558,7 +558,7 @@ private:
|
|||
assert(A.getTokenBuffer().expandedTokens().back().kind() == tok::eof);
|
||||
// Create all leaf nodes.
|
||||
// Note that we do not have 'eof' in the tree.
|
||||
for (auto &T : A.getTokenBuffer().expandedTokens().drop_back()) {
|
||||
for (const auto &T : A.getTokenBuffer().expandedTokens().drop_back()) {
|
||||
auto *L = new (A.getAllocator()) syntax::Leaf(&T);
|
||||
L->Original = true;
|
||||
L->CanModify = A.getTokenBuffer().spelledForExpanded(T).hasValue();
|
||||
|
|
|
@ -32,7 +32,7 @@ void enumerateTokenSpans(const syntax::Tree *Root, ProcessTokensFn Callback) {
|
|||
private:
|
||||
void process(const syntax::Node *N) {
|
||||
if (auto *T = dyn_cast<syntax::Tree>(N)) {
|
||||
for (auto *C = T->getFirstChild(); C != nullptr;
|
||||
for (const auto *C = T->getFirstChild(); C != nullptr;
|
||||
C = C->getNextSibling())
|
||||
process(C);
|
||||
return;
|
||||
|
@ -64,8 +64,8 @@ void enumerateTokenSpans(const syntax::Tree *Root, ProcessTokensFn Callback) {
|
|||
|
||||
syntax::FileRange rangeOfExpanded(const syntax::Arena &A,
|
||||
llvm::ArrayRef<syntax::Token> Expanded) {
|
||||
auto &Buffer = A.getTokenBuffer();
|
||||
auto &SM = A.getSourceManager();
|
||||
const auto &Buffer = A.getTokenBuffer();
|
||||
const auto &SM = A.getSourceManager();
|
||||
|
||||
// Check that \p Expanded actually points into expanded tokens.
|
||||
assert(Buffer.expandedTokens().begin() <= Expanded.begin());
|
||||
|
@ -85,8 +85,8 @@ syntax::FileRange rangeOfExpanded(const syntax::Arena &A,
|
|||
tooling::Replacements
|
||||
syntax::computeReplacements(const syntax::Arena &A,
|
||||
const syntax::TranslationUnit &TU) {
|
||||
auto &Buffer = A.getTokenBuffer();
|
||||
auto &SM = A.getSourceManager();
|
||||
const auto &Buffer = A.getTokenBuffer();
|
||||
const auto &SM = A.getSourceManager();
|
||||
|
||||
tooling::Replacements Replacements;
|
||||
// Text inserted by the replacement we are building now.
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace {
|
|||
static void traverse(const syntax::Node *N,
|
||||
llvm::function_ref<void(const syntax::Node *)> Visit) {
|
||||
if (auto *T = dyn_cast<syntax::Tree>(N)) {
|
||||
for (auto *C = T->getFirstChild(); C; C = C->getNextSibling())
|
||||
for (const auto *C = T->getFirstChild(); C; C = C->getNextSibling())
|
||||
traverse(C, Visit);
|
||||
}
|
||||
Visit(N);
|
||||
|
@ -226,7 +226,7 @@ void syntax::Node::assertInvariants() const {
|
|||
auto *T = dyn_cast<Tree>(this);
|
||||
if (!T)
|
||||
return;
|
||||
for (auto *C = T->getFirstChild(); C; C = C->getNextSibling()) {
|
||||
for (const auto *C = T->getFirstChild(); C; C = C->getNextSibling()) {
|
||||
if (T->isOriginal())
|
||||
assert(C->isOriginal());
|
||||
assert(!C->isDetached());
|
||||
|
|
Loading…
Reference in New Issue