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