003 File Manager
Current Path:
/usr/src/contrib/llvm-project/clang/lib/Sema
usr
/
src
/
contrib
/
llvm-project
/
clang
/
lib
/
Sema
/
📁
..
📄
AnalysisBasedWarnings.cpp
(83.16 KB)
📄
CodeCompleteConsumer.cpp
(22.58 KB)
📄
CoroutineStmtBuilder.h
(2.34 KB)
📄
DeclSpec.cpp
(52.98 KB)
📄
DelayedDiagnostic.cpp
(2.46 KB)
📄
IdentifierResolver.cpp
(12.75 KB)
📄
JumpDiagnostics.cpp
(37.08 KB)
📄
MultiplexExternalSemaSource.cpp
(11.97 KB)
📄
OpenCLBuiltins.td
(74.48 KB)
📄
ParsedAttr.cpp
(6.91 KB)
📄
Scope.cpp
(6.24 KB)
📄
ScopeInfo.cpp
(8.02 KB)
📄
Sema.cpp
(92.56 KB)
📄
SemaAccess.cpp
(70.03 KB)
📄
SemaAttr.cpp
(39.44 KB)
📄
SemaAvailability.cpp
(35.52 KB)
📄
SemaCUDA.cpp
(32.46 KB)
📄
SemaCXXScopeSpec.cpp
(42.62 KB)
📄
SemaCast.cpp
(117.77 KB)
📄
SemaChecking.cpp
(580.53 KB)
📄
SemaCodeComplete.cpp
(357.59 KB)
📄
SemaConcept.cpp
(41.79 KB)
📄
SemaConsumer.cpp
(464 B)
📄
SemaCoroutine.cpp
(61.87 KB)
📄
SemaDecl.cpp
(711.18 KB)
📄
SemaDeclAttr.cpp
(266.6 KB)
📄
SemaDeclCXX.cpp
(674.92 KB)
📄
SemaDeclObjC.cpp
(208.27 KB)
📄
SemaExceptionSpec.cpp
(58.64 KB)
📄
SemaExpr.cpp
(744.15 KB)
📄
SemaExprCXX.cpp
(343.26 KB)
📄
SemaExprMember.cpp
(73.07 KB)
📄
SemaExprObjC.cpp
(184.87 KB)
📄
SemaFixItUtils.cpp
(7.49 KB)
📄
SemaInit.cpp
(392.01 KB)
📄
SemaLambda.cpp
(80.53 KB)
📄
SemaLookup.cpp
(202.16 KB)
📄
SemaModule.cpp
(27.05 KB)
📄
SemaObjCProperty.cpp
(119.38 KB)
📄
SemaOpenMP.cpp
(760.99 KB)
📄
SemaOverload.cpp
(596.12 KB)
📄
SemaPseudoObject.cpp
(64.4 KB)
📄
SemaSYCL.cpp
(2 KB)
📄
SemaStmt.cpp
(167.23 KB)
📄
SemaStmtAsm.cpp
(36.06 KB)
📄
SemaStmtAttr.cpp
(14.59 KB)
📄
SemaTemplate.cpp
(438.46 KB)
📄
SemaTemplateDeduction.cpp
(247.26 KB)
📄
SemaTemplateInstantiate.cpp
(150.48 KB)
📄
SemaTemplateInstantiateDecl.cpp
(240.7 KB)
📄
SemaTemplateVariadic.cpp
(44.44 KB)
📄
SemaType.cpp
(332.48 KB)
📄
TreeTransform.h
(554.25 KB)
📄
TypeLocBuilder.cpp
(5.17 KB)
📄
TypeLocBuilder.h
(4.5 KB)
📄
UsedDeclVisitor.h
(3.33 KB)
Editing: Scope.cpp
//===- 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" using namespace clang; void Scope::setFlags(Scope *parent, unsigned flags) { AnyParent = parent; Flags = flags; if (parent && !(flags & FnScope)) { BreakParent = parent->BreakParent; ContinueParent = parent->ContinueParent; } else { // Control scopes do not contain the contents of nested function scopes for // control flow purposes. BreakParent = ContinueParent = nullptr; } if (parent) { Depth = parent->Depth + 1; PrototypeDepth = parent->PrototypeDepth; PrototypeIndex = 0; FnParent = parent->FnParent; BlockParent = parent->BlockParent; TemplateParamParent = parent->TemplateParamParent; MSLastManglingParent = parent->MSLastManglingParent; MSCurManglingNumber = getMSLastManglingNumber(); if ((Flags & (FnScope | ClassScope | BlockScope | TemplateParamScope | FunctionPrototypeScope | AtCatchScope | ObjCMethodScope)) == 0) Flags |= parent->getFlags() & OpenMPSimdDirectiveScope; } else { Depth = 0; PrototypeDepth = 0; PrototypeIndex = 0; MSLastManglingParent = FnParent = BlockParent = nullptr; TemplateParamParent = nullptr; MSLastManglingNumber = 1; MSCurManglingNumber = 1; } // If this scope is a function or contains breaks/continues, remember it. if (flags & FnScope) FnParent = this; // The MS mangler uses the number of scopes that can hold declarations as // part of an external name. if (Flags & (ClassScope | FnScope)) { MSLastManglingNumber = getMSLastManglingNumber(); MSLastManglingParent = this; MSCurManglingNumber = 1; } if (flags & BreakScope) BreakParent = this; if (flags & ContinueScope) ContinueParent = this; if (flags & BlockScope) BlockParent = this; if (flags & TemplateParamScope) TemplateParamParent = this; // If this is a prototype scope, record that. if (flags & FunctionPrototypeScope) PrototypeDepth++; if (flags & DeclScope) { if (flags & FunctionPrototypeScope) ; // Prototype scopes are uninteresting. else if ((flags & ClassScope) && getParent()->isClassScope()) ; // Nested class scopes aren't ambiguous. else if ((flags & ClassScope) && getParent()->getFlags() == DeclScope) ; // Classes inside of namespaces aren't ambiguous. else if ((flags & EnumScope)) ; // Don't increment for enum scopes. else incrementMSManglingNumber(); } } void Scope::Init(Scope *parent, unsigned flags) { setFlags(parent, flags); DeclsInScope.clear(); UsingDirectives.clear(); Entity = nullptr; ErrorTrap.reset(); NRVO.setPointerAndInt(nullptr, 0); } bool Scope::containedInPrototypeScope() const { const Scope *S = this; while (S) { if (S->isFunctionPrototypeScope()) return true; S = S->getParent(); } return false; } void Scope::AddFlags(unsigned FlagsToSet) { assert((FlagsToSet & ~(BreakScope | ContinueScope)) == 0 && "Unsupported scope flags"); if (FlagsToSet & BreakScope) { assert((Flags & BreakScope) == 0 && "Already set"); BreakParent = this; } if (FlagsToSet & ContinueScope) { assert((Flags & ContinueScope) == 0 && "Already set"); ContinueParent = this; } Flags |= FlagsToSet; } void Scope::mergeNRVOIntoParent() { if (VarDecl *Candidate = NRVO.getPointer()) { if (isDeclScope(Candidate)) Candidate->setNRVOVariable(true); } if (getEntity()) return; if (NRVO.getInt()) getParent()->setNoNRVO(); else if (NRVO.getPointer()) getParent()->addNRVOCandidate(NRVO.getPointer()); } LLVM_DUMP_METHOD void Scope::dump() const { dumpImpl(llvm::errs()); } void Scope::dumpImpl(raw_ostream &OS) const { unsigned Flags = getFlags(); bool HasFlags = Flags != 0; if (HasFlags) OS << "Flags: "; std::pair<unsigned, const char *> FlagInfo[] = { {FnScope, "FnScope"}, {BreakScope, "BreakScope"}, {ContinueScope, "ContinueScope"}, {DeclScope, "DeclScope"}, {ControlScope, "ControlScope"}, {ClassScope, "ClassScope"}, {BlockScope, "BlockScope"}, {TemplateParamScope, "TemplateParamScope"}, {FunctionPrototypeScope, "FunctionPrototypeScope"}, {FunctionDeclarationScope, "FunctionDeclarationScope"}, {AtCatchScope, "AtCatchScope"}, {ObjCMethodScope, "ObjCMethodScope"}, {SwitchScope, "SwitchScope"}, {TryScope, "TryScope"}, {FnTryCatchScope, "FnTryCatchScope"}, {OpenMPDirectiveScope, "OpenMPDirectiveScope"}, {OpenMPLoopDirectiveScope, "OpenMPLoopDirectiveScope"}, {OpenMPSimdDirectiveScope, "OpenMPSimdDirectiveScope"}, {EnumScope, "EnumScope"}, {SEHTryScope, "SEHTryScope"}, {SEHExceptScope, "SEHExceptScope"}, {SEHFilterScope, "SEHFilterScope"}, {CompoundStmtScope, "CompoundStmtScope"}, {ClassInheritanceScope, "ClassInheritanceScope"}, {CatchScope, "CatchScope"}, }; for (auto Info : FlagInfo) { if (Flags & Info.first) { OS << Info.second; Flags &= ~Info.first; if (Flags) OS << " | "; } } assert(Flags == 0 && "Unknown scope flags"); if (HasFlags) OS << '\n'; if (const Scope *Parent = getParent()) OS << "Parent: (clang::Scope*)" << Parent << '\n'; OS << "Depth: " << Depth << '\n'; OS << "MSLastManglingNumber: " << getMSLastManglingNumber() << '\n'; OS << "MSCurManglingNumber: " << getMSCurManglingNumber() << '\n'; if (const DeclContext *DC = getEntity()) OS << "Entity : (clang::DeclContext*)" << DC << '\n'; if (NRVO.getInt()) OS << "NRVO not allowed\n"; else if (NRVO.getPointer()) OS << "NRVO candidate : (clang::VarDecl*)" << NRVO.getPointer() << '\n'; }
Upload File
Create Folder