> On Mar 4, 2015, at 3:39 PM, Reid Kleckner <[email protected]> wrote: > Author: rnk > Date: Wed Mar 4 17:39:17 2015 > New Revision: 231317 > > URL: http://llvm.org/viewvc/llvm-project?rev=231317&view=rev > Log: > Implement section pragma feedback on r205810 > > Mostly short-circuits some conditionals. Adds target validation of > sections passed to these pragmas. > > Modified: > cfe/trunk/include/clang/Sema/Sema.h > cfe/trunk/lib/Sema/SemaAttr.cpp > cfe/trunk/lib/Sema/SemaDecl.cpp > cfe/trunk/lib/Sema/SemaDeclAttr.cpp > > Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=231317&r1=231316&r2=231317&view=diff > ============================================================================== > --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original) > +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Mar 4 17:39:17 2015 > @@ -2342,6 +2342,15 @@ SectionAttr *Sema::mergeSectionAttr(Decl > AttrSpellingListIndex); > } > > +bool Sema::checkSectionName(SourceLocation LiteralLoc, StringRef SecName) { > + std::string Error = > Context.getTargetInfo().isValidSectionSpecifier(SecName); > + if (!Error.empty()) { > + Diag(LiteralLoc, diag::err_attribute_section_invalid_for_target) << > Error; > + return false; > + } > + return true; > +} > + > static void handleSectionAttr(Sema &S, Decl *D, const AttributeList &Attr) { > // Make sure that there is a string literal as the sections's single > // argument. > @@ -2350,6 +2359,9 @@ static void handleSectionAttr(Sema &S, D > if (!S.checkStringLiteralArgumentAttr(Attr, 0, Str, &LiteralLoc)) > return; > > + if (!S.checkSectionName(LiteralLoc, Str)) > + return; > + > // If the target wants to validate the section specifier, make it happen. > std::string Error = S.Context.getTargetInfo().isValidSectionSpecifier(Str); > if (!Error.empty()) {
I think you copied the body of checkSectionName from this function and then forgot to remove it from the original. John. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
