Issue an error if the user specifies parameters in a function marked as ISR.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79544 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index f2a0ed7..060b4f4 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1240,6 +1240,22 @@
/// parameters are complete.
bool Sema::CheckParmsForFunctionDef(FunctionDecl *FD) {
bool HasInvalidParm = false;
+
+ // PIC16 uses section string to encode the info about ISR.
+ // Flash error if ISR has arguments.
+ const char *TargetPrefix = Context.Target.getTargetPrefix();
+ if (strcmp(TargetPrefix, "pic16") == 0) {
+ unsigned ParamCount = FD->getNumParams();
+ if (const SectionAttr *SA = FD->getAttr<SectionAttr>()) {
+ const std::string &SecString = SA->getName();
+ if (SecString.find("interrupt") != std::string::npos
+ && ParamCount > 0) {
+ Diag(FD->getLocation(), diag::warn_ISR_has_arguments)
+ << FD->getNameAsString();
+ }
+ }
+ }
+
for (unsigned p = 0, NumParams = FD->getNumParams(); p < NumParams; ++p) {
ParmVarDecl *Param = FD->getParamDecl(p);