diff options
author | dim <dim@FreeBSD.org> | 2011-02-27 01:32:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-02-27 01:32:10 +0000 |
commit | b951d621be1d00a520871c689c1cd687b6aa3ae6 (patch) | |
tree | 5c342f2374324ffec4626f558d9aa49f323f90b4 /contrib/llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp | |
parent | 4004d6a3076e94bd23e681411c43682267a202fe (diff) | |
parent | a0fb00f9837bd0d2e5948f16f6a6b82a7a628f51 (diff) | |
download | FreeBSD-src-b951d621be1d00a520871c689c1cd687b6aa3ae6.zip FreeBSD-src-b951d621be1d00a520871c689c1cd687b6aa3ae6.tar.gz |
Update llvm/clang to trunk r126547.
There are several bugfixes in this update, but the most important one is
to ensure __start_ and __stop_ symbols for linker sets and kernel module
metadata are always emitted in object files:
http://llvm.org/bugs/show_bug.cgi?id=9292
Before this fix, if you compiled kernel modules with clang, they would
not be properly processed by kldxref, and if they had any dependencies,
the kernel would fail to load those. Another problem occurred when
attempting to mount a tmpfs filesystem, which would result in 'operation
not supported by device'.
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/contrib/llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp b/contrib/llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp index cbc940f..893cf6a 100644 --- a/contrib/llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp +++ b/contrib/llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp @@ -1014,54 +1014,48 @@ static void HandleDestructorAttr(Decl *d, const AttributeList &Attr, Sema &S) { } static void HandleDeprecatedAttr(Decl *d, const AttributeList &Attr, Sema &S) { - // check the attribute arguments. - int noArgs = Attr.getNumArgs(); - if (noArgs > 1) { + unsigned NumArgs = Attr.getNumArgs(); + if (NumArgs > 1) { S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0 or 1"; return; } + // Handle the case where deprecated attribute has a text message. - StringLiteral *SE; - if (noArgs == 1) { - Expr *ArgExpr = Attr.getArg(0); - SE = dyn_cast<StringLiteral>(ArgExpr); + llvm::StringRef Str; + if (NumArgs == 1) { + StringLiteral *SE = dyn_cast<StringLiteral>(Attr.getArg(0)); if (!SE) { - S.Diag(ArgExpr->getLocStart(), - diag::err_attribute_not_string) << "deprecated"; + S.Diag(Attr.getArg(0)->getLocStart(), diag::err_attribute_not_string) + << "deprecated"; return; } + Str = SE->getString(); } - else - SE = StringLiteral::CreateEmpty(S.Context, 1); - d->addAttr(::new (S.Context) DeprecatedAttr(Attr.getLoc(), S.Context, - SE->getString())); + d->addAttr(::new (S.Context) DeprecatedAttr(Attr.getLoc(), S.Context, Str)); } static void HandleUnavailableAttr(Decl *d, const AttributeList &Attr, Sema &S) { - // check the attribute arguments. - int noArgs = Attr.getNumArgs(); - if (noArgs > 1) { + unsigned NumArgs = Attr.getNumArgs(); + if (NumArgs > 1) { S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0 or 1"; return; } + // Handle the case where unavailable attribute has a text message. - StringLiteral *SE; - if (noArgs == 1) { - Expr *ArgExpr = Attr.getArg(0); - SE = dyn_cast<StringLiteral>(ArgExpr); + llvm::StringRef Str; + if (NumArgs == 1) { + StringLiteral *SE = dyn_cast<StringLiteral>(Attr.getArg(0)); if (!SE) { - S.Diag(ArgExpr->getLocStart(), + S.Diag(Attr.getArg(0)->getLocStart(), diag::err_attribute_not_string) << "unavailable"; return; } + Str = SE->getString(); } - else - SE = StringLiteral::CreateEmpty(S.Context, 1); - d->addAttr(::new (S.Context) UnavailableAttr(Attr.getLoc(), S.Context, - SE->getString())); + d->addAttr(::new (S.Context) UnavailableAttr(Attr.getLoc(), S.Context, Str)); } static void HandleVisibilityAttr(Decl *d, const AttributeList &Attr, Sema &S) { @@ -2847,7 +2841,7 @@ NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II) { FD->getType(), FD->getTypeSourceInfo()); if (FD->getQualifier()) { FunctionDecl *NewFD = cast<FunctionDecl>(NewD); - NewFD->setQualifierInfo(FD->getQualifier(), FD->getQualifierRange()); + NewFD->setQualifierInfo(FD->getQualifierLoc()); } } else if (VarDecl *VD = dyn_cast<VarDecl>(ND)) { NewD = VarDecl::Create(VD->getASTContext(), VD->getDeclContext(), @@ -2857,7 +2851,7 @@ NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II) { VD->getStorageClassAsWritten()); if (VD->getQualifier()) { VarDecl *NewVD = cast<VarDecl>(NewD); - NewVD->setQualifierInfo(VD->getQualifier(), VD->getQualifierRange()); + NewVD->setQualifierInfo(VD->getQualifierLoc()); } } return NewD; |