[PATCH] D70524: Support DebugInfo generation for auto return type for C++ functions.

Adrian Prantl via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 22 08:34:44 PST 2019


aprantl added inline comments.


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:2925
+        return C.getQualifiedType(T.getTypePtr(), Quals);
+      }
     case Type::DeducedTemplateSpecialization: {
----------------
You need to mark this `LLVM_FALLTHROUGH` now or you'll get a warning.


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:3104
   case Type::Auto:
+    if (CGM.getCodeGenOpts().DwarfVersion >= 5) {
+      return CreateType(cast<AutoType>(Ty));
----------------
LLVM coding style doesn't put single statements into `{}`


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:3106
+      return CreateType(cast<AutoType>(Ty));
+    }
   case Type::Attributed:
----------------
same here


================
Comment at: clang/test/CodeGenCXX/debug-info-auto-return.cpp:7
+
+// CHECK: !DISubprogram(name: "findMax",{{.*}}, type: !18
+// CHECK: !18 =  !DISubroutineType(types: !19)
----------------
Please don't hardcode the MDNode numbers, they will inevitably change over time. Instead use variables:
```
type: ![[SUBROUTINE_TYPE:[0-9]+]]`
// CHECK: ![[SUBROUTINE_TYPE]] =  !DISubroutineType(types: ![[ARGS:[0-9]+)
```
etc


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70524/new/

https://reviews.llvm.org/D70524





More information about the cfe-commits mailing list