[llvm] r250193 - ExecutionEngine: Remove implicit ilist iterator conversions, NFC

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 14:26:05 PDT 2015


> On 2015-Oct-13, at 14:12, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> On Tue, Oct 13, 2015 at 11:11 AM, Duncan P. N. Exon Smith via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> Author: dexonsmith
> Date: Tue Oct 13 13:11:02 2015
> New Revision: 250193
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=250193&view=rev
> Log:
> ExecutionEngine: Remove implicit ilist iterator conversions, NFC
> 
> BTW, I realize this is probably out of scope for your refactoring, but an alternative approach would be to make a lot of these functions take references instead of pointers so there's not adding lots of address-of operators all over the place. (I did this a lot with unique_ptr migrations - by making the underlying APIs take references intsead of pointers first, the actual unique_ptrification doesn't change the use at all (what was a pointer deref becomes a smart pointer deref - the same syntax) - not quite as clean in your case, there's still going to be a range-for-ification and/or a deref to be added, but otherwise might be nice)

Yeah, most of these are known non-null.  I'll try to do that if I
find places where it doesn't add too much time.

>  
> 
> Modified:
>     llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
> 
> Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=250193&r1=250192&r2=250193&view=diff
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Tue Oct 13 13:11:02 2015
> @@ -237,11 +237,10 @@ void ExecutionEngine::clearAllGlobalMapp
>  void ExecutionEngine::clearGlobalMappingsFromModule(Module *M) {
>    MutexGuard locked(lock);
> 
> -  for (Module::iterator FI = M->begin(), FE = M->end(); FI != FE; ++FI)
> -    EEState.RemoveMapping(getMangledName(FI));
> -  for (Module::global_iterator GI = M->global_begin(), GE = M->global_end();
> -       GI != GE; ++GI)
> -    EEState.RemoveMapping(getMangledName(GI));
> +  for (Function &FI : *M)
> +    EEState.RemoveMapping(getMangledName(&FI));
> +  for (GlobalVariable &GI : M->globals())
> +    EEState.RemoveMapping(getMangledName(&GI));
>  }
> 
>  uint64_t ExecutionEngine::updateGlobalMapping(const GlobalValue *GV,
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 



More information about the llvm-commits mailing list