PR51034: Debug Info: Remove 'prototyped' from K&R function declarations
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 9 Jul 2021 18:56:37 +0000 (11:56 -0700)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 9 Jul 2021 19:07:36 +0000 (12:07 -0700)
Regression caused by 6c9559b67b91966bfeff9e17808a3e84a92e64a0.

clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGen/overloadable-debug.c

index adace59..e4c3af0 100644 (file)
@@ -3549,10 +3549,10 @@ void CGDebugInfo::collectFunctionDeclProps(GlobalDecl GD, llvm::DIFile *Unit,
   const auto *FD = cast<FunctionDecl>(GD.getCanonicalDecl().getDecl());
   Name = getFunctionName(FD);
   // Use mangled name as linkage name for C/C++ functions.
-  if (FD->getType()->getAs<FunctionProtoType>()) {
+  if (FD->getType()->getAs<FunctionProtoType>())
     LinkageName = CGM.getMangledName(GD);
+  if (FD->hasPrototype())
     Flags |= llvm::DINode::FlagPrototyped;
-  }
   // No need to replicate the linkage name if it isn't different from the
   // subprogram name, no need to have it at all unless coverage is enabled or
   // debug is set to more than just line tables or extra debug info is needed.
index 6eda318..c742f74 100644 (file)
@@ -2,5 +2,8 @@
 
 __attribute__((overloadable)) void f1(a) int a; {
 }
+void f2(a) int a; {
+}
 
 // CHECK: !DISubprogram(name: "f1", linkageName: "_Z2f1i"
+// CHECK: !DISubprogram(name: "f2", scope: {{.*}}, spFlags: DISPFlagDefinition,