blob: ff8df3bdfc57652822a0c08709a7d36f4a3ea47e [file] [log] [blame]
Lukasz Anforowiczb1ff2e52022-05-16 10:54:23 -07001// 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 Anforowiczb1ff2e52022-05-16 10:54:23 -07007#include "clang/AST/DeclCXX.h"
8#include "clang/AST/DeclTemplate.h"
9
10namespace crubit {
11
12bool 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