//===- Scope.cpp - Lexical scope information --------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements the Scope class, which is used for recording // information about a lexical scope. // //===----------------------------------------------------------------------===// #include "clang/Sema/Scope.h" #include "clang/AST/Decl.h" #include "llvm/Support/raw_ostream.h" usingnamespaceclang; void Scope::setFlags(Scope *parent, unsigned flags) { … } void Scope::Init(Scope *parent, unsigned flags) { … } bool Scope::containedInPrototypeScope() const { … } void Scope::AddFlags(unsigned FlagsToSet) { … } // The algorithm for updating NRVO candidate is as follows: // 1. All previous candidates become invalid because a new NRVO candidate is // obtained. Therefore, we need to clear return slots for other // variables defined before the current return statement in the current // scope and in outer scopes. // 2. Store the new candidate if its return slot is available. Otherwise, // there is no NRVO candidate so far. void Scope::updateNRVOCandidate(VarDecl *VD) { … } void Scope::applyNRVO() { … } LLVM_DUMP_METHOD void Scope::dump() const { … } void Scope::dumpImpl(raw_ostream &OS) const { … }