@@ -13378,56 +13378,56 @@ void Sema::checkNonTrivialCUnion(QualType QT, SourceLocation Loc,
13378
13378
}
13379
13379
13380
13380
bool Sema::GloballyUniqueObjectMightBeAccidentallyDuplicated(
13381
- const VarDecl *dcl) {
13382
- if (!dcl || !getLangOpts().CPlusPlus)
13383
- return false;
13384
-
13385
- // If an object is defined in a source file, its definition can't get
13386
- // duplicated since it will never appear in more than one TU.
13387
- if (dcl->getASTContext().getSourceManager().isInMainFile(dcl->getLocation()))
13381
+ const VarDecl *Dcl) {
13382
+ if (!Dcl || !getLangOpts().CPlusPlus)
13388
13383
return false;
13389
13384
13390
13385
// We only need to warn if the definition is in a header file, so wait to
13391
13386
// diagnose until we've seen the definition.
13392
- if (!dcl->isThisDeclarationADefinition())
13387
+ if (!Dcl->isThisDeclarationADefinition())
13388
+ return false;
13389
+
13390
+ // If an object is defined in a source file, its definition can't get
13391
+ // duplicated since it will never appear in more than one TU.
13392
+ if (Dcl->getASTContext().getSourceManager().isInMainFile(Dcl->getLocation()))
13393
13393
return false;
13394
13394
13395
13395
// If the variable we're looking at is a static local, then we actually care
13396
13396
// about the properties of the function containing it.
13397
- const ValueDecl *target = dcl ;
13397
+ const ValueDecl *Target = Dcl ;
13398
13398
// VarDecls and FunctionDecls have different functions for checking
13399
13399
// inline-ness, so we have to do it manually.
13400
- bool target_is_inline = dcl ->isInline();
13400
+ bool TargetIsInline = Dcl ->isInline();
13401
13401
13402
- // Update the target and target_is_inline property if necessary
13403
- if (dcl ->isStaticLocal()) {
13404
- const DeclContext *ctx = dcl ->getDeclContext();
13405
- if (!ctx )
13402
+ // Update the Target and TargetIsInline property if necessary
13403
+ if (Dcl ->isStaticLocal()) {
13404
+ const DeclContext *Ctx = Dcl ->getDeclContext();
13405
+ if (!Ctx )
13406
13406
return false;
13407
13407
13408
- const FunctionDecl *f_dcl =
13409
- dyn_cast_if_present<FunctionDecl>(ctx ->getNonClosureAncestor());
13410
- if (!f_dcl )
13408
+ const FunctionDecl *FunDcl =
13409
+ dyn_cast_if_present<FunctionDecl>(Ctx ->getNonClosureAncestor());
13410
+ if (!FunDcl )
13411
13411
return false;
13412
13412
13413
- target = f_dcl ;
13413
+ Target = FunDcl ;
13414
13414
// IsInlined() checks for the C++ inline property
13415
- target_is_inline = f_dcl ->isInlined();
13415
+ TargetIsInline = FunDcl ->isInlined();
13416
13416
}
13417
13417
13418
13418
// Non-inline variables can only legally appear in one TU
13419
13419
// FIXME: This also applies to templated variables, but that can rarely lead
13420
13420
// to false positives so templates are disabled for now.
13421
- if (!target_is_inline )
13421
+ if (!TargetIsInline )
13422
13422
return false;
13423
13423
13424
13424
// If the object isn't hidden, the dynamic linker will prevent duplication.
13425
- clang::LinkageInfo lnk = target ->getLinkageAndVisibility();
13426
- if (lnk .getVisibility() != HiddenVisibility)
13425
+ clang::LinkageInfo Lnk = Target ->getLinkageAndVisibility();
13426
+ if (Lnk .getVisibility() != HiddenVisibility)
13427
13427
return false;
13428
13428
13429
13429
// If the obj doesn't have external linkage, it's supposed to be duplicated.
13430
- if (!isExternalFormalLinkage(lnk .getLinkage()))
13430
+ if (!isExternalFormalLinkage(Lnk .getLinkage()))
13431
13431
return false;
13432
13432
13433
13433
return true;
0 commit comments