summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Basic/Targets.cpp9
-rw-r--r--clang/lib/Sema/SemaDecl.cpp16
2 files changed, 23 insertions, 2 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 69b930b55ac..49c3ea8c4cb 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -1247,9 +1247,14 @@ namespace {
Define(Defines, "__pic16");
Define(Defines, "rom", "__attribute__((address_space(1)))");
Define(Defines, "ram", "__attribute__((address_space(0)))");
- Define(Defines, "_section(SectName)", "__attribute__((section(SectName)))");
- Define(Defines, "_address(Addr)","__attribute__((section(\"Address=\"#Addr)))");
+ Define(Defines, "_section(SectName)",
+ "__attribute__((section(SectName)))");
+ Define(Defines, "_address(Addr)",
+ "__attribute__((section(\"Address=\"#Addr)))");
Define(Defines, "_CONFIG(conf)", "asm(\"CONFIG \"#conf)");
+ Define(Defines, "_interrupt",
+ "__attribute__((section(\"interrupt=0x4\"))) \
+ __attribute__((used))");
}
virtual void getTargetBuiltins(const Builtin::Info *&Records,
unsigned &NumRecords) const {}
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index f2a0ed7e04c..060b4f436a7 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1240,6 +1240,22 @@ void Sema::CheckFallThroughForBlock(QualType BlockTy, Stmt *Body) {
/// 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);
OpenPOWER on IntegriCloud