[llvm] r264823 - IR: Constify LLVMContext::discardValueNames, NFC

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 30 16:28:21 PDT 2016


This function's naming is confusing. Shouldn't it be `getDiscardValueNames`
or `shouldDiscardValueNames` or similar? As it stands, our rule about
"functions should be verb phrases" makes a name like `discardValueNames`
sounds like this function does discarding.

-- Sean Silva

On Tue, Mar 29, 2016 at 9:32 PM, Duncan P. N. Exon Smith via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: dexonsmith
> Date: Tue Mar 29 23:32:29 2016
> New Revision: 264823
>
> URL: http://llvm.org/viewvc/llvm-project?rev=264823&view=rev
> Log:
> IR: Constify LLVMContext::discardValueNames, NFC
>
> Modified:
>     llvm/trunk/include/llvm/IR/LLVMContext.h
>     llvm/trunk/lib/IR/LLVMContext.cpp
>
> Modified: llvm/trunk/include/llvm/IR/LLVMContext.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/LLVMContext.h?rev=264823&r1=264822&r2=264823&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/IR/LLVMContext.h (original)
> +++ llvm/trunk/include/llvm/IR/LLVMContext.h Tue Mar 29 23:32:29 2016
> @@ -108,7 +108,7 @@ public:
>    /// Return true if the Context runtime configuration is set to discard
> all
>    /// value names. When true, only GlobalValue names will be available in
> the
>    /// IR.
> -  bool discardValueNames();
> +  bool discardValueNames() const;
>
>    /// Set the Context runtime configuration to discard all value name (but
>    /// GlobalValue). Clients can use this flag to save memory and runtime,
>
> Modified: llvm/trunk/lib/IR/LLVMContext.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContext.cpp?rev=264823&r1=264822&r2=264823&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/IR/LLVMContext.cpp (original)
> +++ llvm/trunk/lib/IR/LLVMContext.cpp Tue Mar 29 23:32:29 2016
> @@ -331,7 +331,7 @@ void LLVMContext::deleteGC(const Functio
>    pImpl->GCNames.erase(&Fn);
>  }
>
> -bool LLVMContext::discardValueNames() { return pImpl->DiscardValueNames; }
> +bool LLVMContext::discardValueNames() const { return
> pImpl->DiscardValueNames; }
>
>  void LLVMContext::setDiscardValueNames(bool Discard) {
>    pImpl->DiscardValueNames = Discard;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160330/aa6dd280/attachment.html>


More information about the llvm-commits mailing list