[all-commits] [llvm/llvm-project] fb4596: Use C++14-style return type deduction in LLVM.

Justin Lebar via All-commits all-commits at lists.llvm.org
Tue Feb 11 07:39:11 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: fb45968e6285127a18d4d046613b62f125339576
      https://github.com/llvm/llvm-project/commit/fb45968e6285127a18d4d046613b62f125339576
  Author: Justin Lebar <jlebar at google.com>
  Date:   2020-02-11 (Tue, 11 Feb 2020)

  Changed paths:
    M llvm/include/llvm/ADT/STLExtras.h
    M llvm/include/llvm/ADT/fallible_iterator.h
    M llvm/include/llvm/DebugInfo/PDB/PDBSymbol.h
    M llvm/include/llvm/ExecutionEngine/Orc/Core.h
    M llvm/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h
    M llvm/include/llvm/Support/Casting.h
    M llvm/include/llvm/Support/Errno.h
    M llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
    M llvm/unittests/ADT/STLExtrasTest.cpp
    M llvm/unittests/Support/FormatVariadicTest.cpp
    M llvm/utils/unittest/googletest/include/gtest/internal/custom/raw-ostream.h

  Log Message:
  -----------
  Use C++14-style return type deduction in LLVM.

Summary:
Simplifies the C++11-style "-> decltype(...)" return-type deduction.

Note that you have to be careful about whether the function return type
is `auto` or `decltype(auto)`.  The difference is that bare `auto`
strips const and reference, just like lambda return type deduction.  In
some cases that's what we want (or more likely, we know that the return
type is a value type), but whenever we're wrapping a templated function
which might return a reference, we need to be sure that the return type
is decltype(auto).

No functional change.

Subscribers: dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D74383




More information about the All-commits mailing list