diff options
author | Alexander Musman <alexander.musman@gmail.com> | 2015-11-26 09:34:30 +0000 |
---|---|---|
committer | Alexander Musman <alexander.musman@gmail.com> | 2015-11-26 09:34:30 +0000 |
commit | f97c8933cb7629422008b3ac643c3a33ded7b53d (patch) | |
tree | 9a5e8b858338d193e9e363b5d7d82647f6414f97 /clang/lib/Sema/SemaDeclAttr.cpp | |
parent | a3ac738725bbfcee8b3803df73c999c1822047bb (diff) | |
download | bcm5719-llvm-f97c8933cb7629422008b3ac643c3a33ded7b53d.tar.gz bcm5719-llvm-f97c8933cb7629422008b3ac643c3a33ded7b53d.zip |
Fix for merging decls in pragma weak
Calling CheckFunctionDeclaration so that 2 decls for the 'weak' are merged.
Differential Revision: http://reviews.llvm.org/D13048
llvm-svn: 254143
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index c00914663aa..13a11bcac9e 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -5435,17 +5435,22 @@ NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II, assert(isa<FunctionDecl>(ND) || isa<VarDecl>(ND)); NamedDecl *NewD = nullptr; if (FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) { - FunctionDecl *NewFD; - // FIXME: Missing call to CheckFunctionDeclaration(). // FIXME: Mangling? // FIXME: Is the qualifier info correct? // FIXME: Is the DeclContext correct? - NewFD = FunctionDecl::Create(FD->getASTContext(), FD->getDeclContext(), - Loc, Loc, DeclarationName(II), - FD->getType(), FD->getTypeSourceInfo(), - SC_None, false/*isInlineSpecified*/, - FD->hasPrototype(), - false/*isConstexprSpecified*/); + + LookupResult Previous(*this, II, Loc, LookupOrdinaryName); + LookupParsedName(Previous, TUScope, nullptr, true); + + auto NewFD = FunctionDecl::Create( + FD->getASTContext(), FD->getDeclContext(), Loc, Loc, + DeclarationName(II), FD->getType(), FD->getTypeSourceInfo(), SC_None, + false /*isInlineSpecified*/, FD->hasPrototype(), + false /*isConstexprSpecified*/); + + CheckFunctionDeclaration(TUScope, NewFD, Previous, + false /*IsExplicitSpecialization*/); + NewD = NewFD; if (FD->getQualifier()) |