Lukasz Anforowicz | b1ff2e5 | 2022-05-16 10:54:23 -0700 | [diff] [blame] | 1 | // Part of the Crubit project, under the Apache License v2.0 with LLVM |
| 2 | // Exceptions. See /LICENSE for license information. |
| 3 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 4 | |
| 5 | #include "rs_bindings_from_cc/ast_util.h" |
| 6 | |
Lukasz Anforowicz | b1ff2e5 | 2022-05-16 10:54:23 -0700 | [diff] [blame] | 7 | #include "clang/AST/DeclCXX.h" |
| 8 | #include "clang/AST/DeclTemplate.h" |
| 9 | |
| 10 | namespace crubit { |
| 11 | |
| 12 | bool IsFullClassTemplateSpecializationOrChild(const clang::Decl* decl) { |
| 13 | if (clang::isa<clang::ClassTemplatePartialSpecializationDecl>(decl)) { |
| 14 | return false; |
| 15 | } |
| 16 | if (clang::isa<clang::ClassTemplateSpecializationDecl>(decl)) { |
| 17 | return true; |
| 18 | } |
| 19 | |
| 20 | if (const auto* decl_context = decl->getDeclContext()) { |
| 21 | return IsFullClassTemplateSpecializationOrChild( |
| 22 | clang::dyn_cast<clang::Decl>(decl_context)); |
| 23 | } |
| 24 | |
| 25 | return false; |
| 26 | } |
| 27 | |
| 28 | } // namespace crubit |