diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-02-16 20:45:32 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-02-16 20:45:32 +0000 | 
| commit | 954b921d6615024563b189027bcc5e3c737c328b (patch) | |
| tree | 6ba393315eb7781cf3ce8cfb28c7c6655c8f9592 /contrib/llvm/tools/clang/lib/AST/DeclBase.cpp | |
| parent | 574a8bf981301e233e953c3119165bea36118006 (diff) | |
| parent | 3c315f3a8e8f326948fc789f146794ecd33cc540 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/tools/clang/lib/AST/DeclBase.cpp')
| -rw-r--r-- | contrib/llvm/tools/clang/lib/AST/DeclBase.cpp | 13 | 
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/llvm/tools/clang/lib/AST/DeclBase.cpp b/contrib/llvm/tools/clang/lib/AST/DeclBase.cpp index 2cdcdae9ab02..d427c79c44ab 100644 --- a/contrib/llvm/tools/clang/lib/AST/DeclBase.cpp +++ b/contrib/llvm/tools/clang/lib/AST/DeclBase.cpp @@ -236,10 +236,23 @@ TemplateDecl *Decl::getDescribedTemplate() const {      return RD->getDescribedClassTemplate();    else if (auto *VD = dyn_cast<VarDecl>(this))      return VD->getDescribedVarTemplate(); +  else if (auto *AD = dyn_cast<TypeAliasDecl>(this)) +    return AD->getDescribedAliasTemplate();    return nullptr;  } +bool Decl::isTemplated() const { +  // A declaration is dependent if it is a template or a template pattern, or +  // is within (lexcially for a friend, semantically otherwise) a dependent +  // context. +  // FIXME: Should local extern declarations be treated like friends? +  if (auto *AsDC = dyn_cast<DeclContext>(this)) +    return AsDC->isDependentContext(); +  auto *DC = getFriendObjectKind() ? getLexicalDeclContext() : getDeclContext(); +  return DC->isDependentContext() || isTemplateDecl() || getDescribedTemplate(); +} +  const DeclContext *Decl::getParentFunctionOrMethod() const {    for (const DeclContext *DC = getDeclContext();         DC && !DC->isTranslationUnit() && !DC->isNamespace();   | 
