r348131 - [AST] Fix an uninitialized bug in the bits of FunctionDecl

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 3 14:01:31 PST 2018


Why the change from using setter functions to direct assignment?

On Mon, Dec 3, 2018 at 5:06 AM Bruno Ricci via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: brunoricci
> Date: Mon Dec  3 05:04:10 2018
> New Revision: 348131
>
> URL: http://llvm.org/viewvc/llvm-project?rev=348131&view=rev
> Log:
> [AST] Fix an uninitialized bug in the bits of FunctionDecl
>
> FunctionDeclBits.IsCopyDeductionCandidate was not initialized.
> This caused a warning with valgrind.
>
>
> Modified:
>     cfe/trunk/lib/AST/Decl.cpp
>
> Modified: cfe/trunk/lib/AST/Decl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=348131&r1=348130&r2=348131&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/AST/Decl.cpp (original)
> +++ cfe/trunk/lib/AST/Decl.cpp Mon Dec  3 05:04:10 2018
> @@ -2653,27 +2653,29 @@ FunctionDecl::FunctionDecl(Kind DK, ASTC
>        DeclContext(DK), redeclarable_base(C), ODRHash(0),
>        EndRangeLoc(NameInfo.getEndLoc()), DNLoc(NameInfo.getInfo()) {
>    assert(T.isNull() || T->isFunctionType());
> -  setStorageClass(S);
> -  setInlineSpecified(isInlineSpecified);
> -  setExplicitSpecified(false);
> -  setVirtualAsWritten(false);
> -  setPure(false);
> -  setHasInheritedPrototype(false);
> -  setHasWrittenPrototype(true);
> -  setDeletedAsWritten(false);
> -  setTrivial(false);
> -  setTrivialForCall(false);
> -  setDefaulted(false);
> -  setExplicitlyDefaulted(false);
> -  setHasImplicitReturnZero(false);
> -  setLateTemplateParsed(false);
> -  setConstexpr(isConstexprSpecified);
> -  setInstantiationIsPending(false);
> -  setUsesSEHTry(false);
> -  setHasSkippedBody(false);
> -  setWillHaveBody(false);
> -  setIsMultiVersion(false);
> -  setHasODRHash(false);
> +  FunctionDeclBits.SClass = S;
> +  FunctionDeclBits.IsInline = isInlineSpecified;
> +  FunctionDeclBits.IsInlineSpecified = isInlineSpecified;
> +  FunctionDeclBits.IsExplicitSpecified = false;
> +  FunctionDeclBits.IsVirtualAsWritten = false;
> +  FunctionDeclBits.IsPure = false;
> +  FunctionDeclBits.HasInheritedPrototype = false;
> +  FunctionDeclBits.HasWrittenPrototype = true;
> +  FunctionDeclBits.IsDeleted = false;
> +  FunctionDeclBits.IsTrivial = false;
> +  FunctionDeclBits.IsTrivialForCall = false;
> +  FunctionDeclBits.IsDefaulted = false;
> +  FunctionDeclBits.IsExplicitlyDefaulted = false;
> +  FunctionDeclBits.HasImplicitReturnZero = false;
> +  FunctionDeclBits.IsLateTemplateParsed = false;
> +  FunctionDeclBits.IsConstexpr = isConstexprSpecified;
> +  FunctionDeclBits.InstantiationIsPending = false;
> +  FunctionDeclBits.UsesSEHTry = false;
> +  FunctionDeclBits.HasSkippedBody = false;
> +  FunctionDeclBits.WillHaveBody = false;
> +  FunctionDeclBits.IsMultiVersion = false;
> +  FunctionDeclBits.IsCopyDeductionCandidate = false;
> +  FunctionDeclBits.HasODRHash = false;
>  }
>
>  void FunctionDecl::getNameForDiagnostic(
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181203/973dde7e/attachment.html>


More information about the cfe-commits mailing list