@@ -355,30 +355,9 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
355
355
if (Function->getStorageClass () == SC_PrivateExtern)
356
356
LV.mergeVisibility (HiddenVisibility, true );
357
357
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.
382
361
383
362
// In C++, then if the type of the function uses a type with
384
363
// unique-external linkage, it's not legally usable from outside
0 commit comments