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