diff options
| author | 2020-08-03 15:06:44 +0000 | |
|---|---|---|
| committer | 2020-08-03 15:06:44 +0000 | |
| commit | b64793999546ed8adebaeebd9d8345d18db8927d (patch) | |
| tree | 4357c27b561d73b0e089727c6ed659f2ceff5f47 /gnu/llvm/tools/clang/lib/AST/StmtIterator.cpp | |
| parent | Add support for UTF-8 DISPLAY-HINTs with octet length. For now only (diff) | |
| download | wireguard-openbsd-b64793999546ed8adebaeebd9d8345d18db8927d.tar.xz wireguard-openbsd-b64793999546ed8adebaeebd9d8345d18db8927d.zip | |
Remove LLVM 8.0.1 files.
Diffstat (limited to 'gnu/llvm/tools/clang/lib/AST/StmtIterator.cpp')
| -rw-r--r-- | gnu/llvm/tools/clang/lib/AST/StmtIterator.cpp | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/gnu/llvm/tools/clang/lib/AST/StmtIterator.cpp b/gnu/llvm/tools/clang/lib/AST/StmtIterator.cpp deleted file mode 100644 index 00056e83af2..00000000000 --- a/gnu/llvm/tools/clang/lib/AST/StmtIterator.cpp +++ /dev/null @@ -1,119 +0,0 @@ -//===- StmtIterator.cpp - Iterators for Statements ------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines internal methods for StmtIterator. -// -//===----------------------------------------------------------------------===// - -#include "clang/AST/StmtIterator.h" -#include "clang/AST/Decl.h" -#include "clang/AST/Type.h" -#include "clang/Basic/LLVM.h" -#include "llvm/Support/Casting.h" -#include <cassert> -#include <cstdint> - -using namespace clang; - -// FIXME: Add support for dependent-sized array types in C++? -// Does it even make sense to build a CFG for an uninstantiated template? -static inline const VariableArrayType *FindVA(const Type* t) { - while (const ArrayType *vt = dyn_cast<ArrayType>(t)) { - if (const VariableArrayType *vat = dyn_cast<VariableArrayType>(vt)) - if (vat->getSizeExpr()) - return vat; - - t = vt->getElementType().getTypePtr(); - } - - return nullptr; -} - -void StmtIteratorBase::NextVA() { - assert(getVAPtr()); - - const VariableArrayType *p = getVAPtr(); - p = FindVA(p->getElementType().getTypePtr()); - setVAPtr(p); - - if (p) - return; - - if (inDeclGroup()) { - if (VarDecl* VD = dyn_cast<VarDecl>(*DGI)) - if (VD->hasInit()) - return; - - NextDecl(); - } - else { - assert(inSizeOfTypeVA()); - RawVAPtr = 0; - } -} - -void StmtIteratorBase::NextDecl(bool ImmediateAdvance) { - assert(getVAPtr() == nullptr); - assert(inDeclGroup()); - - if (ImmediateAdvance) - ++DGI; - - for ( ; DGI != DGE; ++DGI) - if (HandleDecl(*DGI)) - return; - - RawVAPtr = 0; -} - -bool StmtIteratorBase::HandleDecl(Decl* D) { - if (VarDecl* VD = dyn_cast<VarDecl>(D)) { - if (const VariableArrayType* VAPtr = FindVA(VD->getType().getTypePtr())) { - setVAPtr(VAPtr); - return true; - } - - if (VD->getInit()) - return true; - } - else if (TypedefNameDecl* TD = dyn_cast<TypedefNameDecl>(D)) { - if (const VariableArrayType* VAPtr = - FindVA(TD->getUnderlyingType().getTypePtr())) { - setVAPtr(VAPtr); - return true; - } - } - else if (EnumConstantDecl* ECD = dyn_cast<EnumConstantDecl>(D)) { - if (ECD->getInitExpr()) - return true; - } - - return false; -} - -StmtIteratorBase::StmtIteratorBase(Decl** dgi, Decl** dge) - : DGI(dgi), RawVAPtr(DeclGroupMode), DGE(dge) { - NextDecl(false); -} - -StmtIteratorBase::StmtIteratorBase(const VariableArrayType* t) - : DGI(nullptr), RawVAPtr(SizeOfTypeVAMode) { - RawVAPtr |= reinterpret_cast<uintptr_t>(t); -} - -Stmt*& StmtIteratorBase::GetDeclExpr() const { - if (const VariableArrayType* VAPtr = getVAPtr()) { - assert(VAPtr->SizeExpr); - return const_cast<Stmt*&>(VAPtr->SizeExpr); - } - - assert(inDeclGroup()); - VarDecl* VD = cast<VarDecl>(*DGI); - return *VD->getInitAddress(); -} |
