1*0fca6ea1SDimitry Andric //===------ SemaAVR.cpp ---------- AVR target-specific routines -----------===//
2*0fca6ea1SDimitry Andric //
3*0fca6ea1SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0fca6ea1SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0fca6ea1SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0fca6ea1SDimitry Andric //
7*0fca6ea1SDimitry Andric //===----------------------------------------------------------------------===//
8*0fca6ea1SDimitry Andric //
9*0fca6ea1SDimitry Andric // This file implements semantic analysis functions specific to AVR.
10*0fca6ea1SDimitry Andric //
11*0fca6ea1SDimitry Andric //===----------------------------------------------------------------------===//
12*0fca6ea1SDimitry Andric
13*0fca6ea1SDimitry Andric #include "clang/Sema/SemaAVR.h"
14*0fca6ea1SDimitry Andric #include "clang/AST/DeclBase.h"
15*0fca6ea1SDimitry Andric #include "clang/Basic/DiagnosticSema.h"
16*0fca6ea1SDimitry Andric #include "clang/Sema/Attr.h"
17*0fca6ea1SDimitry Andric #include "clang/Sema/ParsedAttr.h"
18*0fca6ea1SDimitry Andric #include "clang/Sema/Sema.h"
19*0fca6ea1SDimitry Andric
20*0fca6ea1SDimitry Andric namespace clang {
SemaAVR(Sema & S)21*0fca6ea1SDimitry Andric SemaAVR::SemaAVR(Sema &S) : SemaBase(S) {}
22*0fca6ea1SDimitry Andric
handleInterruptAttr(Decl * D,const ParsedAttr & AL)23*0fca6ea1SDimitry Andric void SemaAVR::handleInterruptAttr(Decl *D, const ParsedAttr &AL) {
24*0fca6ea1SDimitry Andric if (!isFuncOrMethodForAttrSubject(D)) {
25*0fca6ea1SDimitry Andric Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type)
26*0fca6ea1SDimitry Andric << AL << AL.isRegularKeywordAttribute() << ExpectedFunction;
27*0fca6ea1SDimitry Andric return;
28*0fca6ea1SDimitry Andric }
29*0fca6ea1SDimitry Andric
30*0fca6ea1SDimitry Andric if (!AL.checkExactlyNumArgs(SemaRef, 0))
31*0fca6ea1SDimitry Andric return;
32*0fca6ea1SDimitry Andric
33*0fca6ea1SDimitry Andric handleSimpleAttribute<AVRInterruptAttr>(*this, D, AL);
34*0fca6ea1SDimitry Andric }
35*0fca6ea1SDimitry Andric
handleSignalAttr(Decl * D,const ParsedAttr & AL)36*0fca6ea1SDimitry Andric void SemaAVR::handleSignalAttr(Decl *D, const ParsedAttr &AL) {
37*0fca6ea1SDimitry Andric if (!isFuncOrMethodForAttrSubject(D)) {
38*0fca6ea1SDimitry Andric Diag(D->getLocation(), diag::warn_attribute_wrong_decl_type)
39*0fca6ea1SDimitry Andric << AL << AL.isRegularKeywordAttribute() << ExpectedFunction;
40*0fca6ea1SDimitry Andric return;
41*0fca6ea1SDimitry Andric }
42*0fca6ea1SDimitry Andric
43*0fca6ea1SDimitry Andric if (!AL.checkExactlyNumArgs(SemaRef, 0))
44*0fca6ea1SDimitry Andric return;
45*0fca6ea1SDimitry Andric
46*0fca6ea1SDimitry Andric handleSimpleAttribute<AVRSignalAttr>(*this, D, AL);
47*0fca6ea1SDimitry Andric }
48*0fca6ea1SDimitry Andric
49*0fca6ea1SDimitry Andric } // namespace clang
50