Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5175861

Browse files
committed
Remove redundant code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168410 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 289994c commit 5175861

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed

lib/AST/Decl.cpp

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -355,30 +355,9 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
355355
if (Function->getStorageClass() == SC_PrivateExtern)
356356
LV.mergeVisibility(HiddenVisibility, true);
357357

358-
// C99 6.2.2p5:
359-
// If the declaration of an identifier for a function has no
360-
// storage-class specifier, its linkage is determined exactly
361-
// as if it were declared with the storage-class specifier
362-
// extern.
363-
if (!Context.getLangOpts().CPlusPlus &&
364-
(Function->getStorageClass() == SC_Extern ||
365-
Function->getStorageClass() == SC_PrivateExtern ||
366-
Function->getStorageClass() == SC_None)) {
367-
// C99 6.2.2p4:
368-
// For an identifier declared with the storage-class specifier
369-
// extern in a scope in which a prior declaration of that
370-
// identifier is visible, if the prior declaration specifies
371-
// internal or external linkage, the linkage of the identifier
372-
// at the later declaration is the same as the linkage
373-
// specified at the prior declaration. If no prior declaration
374-
// is visible, or if the prior declaration specifies no
375-
// linkage, then the identifier has external linkage.
376-
if (const FunctionDecl *PrevFunc = Function->getPreviousDecl()) {
377-
LinkageInfo PrevLV = getLVForDecl(PrevFunc, OnlyTemplate);
378-
if (PrevLV.linkage()) LV.setLinkage(PrevLV.linkage());
379-
LV.mergeVisibility(PrevLV);
380-
}
381-
}
358+
// Note that Sema::MergeCompatibleFunctionDecls already takes care of
359+
// merging storage classes and visibility attributes, so we don't have to
360+
// look at previous decls in here.
382361

383362
// In C++, then if the type of the function uses a type with
384363
// unique-external linkage, it's not legally usable from outside

0 commit comments

Comments
 (0)