[clang] 768e3af - PR51034: Debug Info: Remove 'prototyped' from K&R function declarations

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 9 12:07:49 PDT 2021


Author: David Blaikie
Date: 2021-07-09T12:07:36-07:00
New Revision: 768e3af6345a532d383205049679aaaccca26628

URL: https://github.com/llvm/llvm-project/commit/768e3af6345a532d383205049679aaaccca26628
DIFF: https://github.com/llvm/llvm-project/commit/768e3af6345a532d383205049679aaaccca26628.diff

LOG: PR51034: Debug Info: Remove 'prototyped' from K&R function declarations

Regression caused by 6c9559b67b91966bfeff9e17808a3e84a92e64a0.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index adace59c9ee6..e4c3af07e664 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -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 
diff erent 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.

diff  --git a/clang/test/CodeGen/overloadable-debug.c b/clang/test/CodeGen/overloadable-debug.c
index 6eda31884496..c742f74f77ba 100644
--- a/clang/test/CodeGen/overloadable-debug.c
+++ b/clang/test/CodeGen/overloadable-debug.c
@@ -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,


        


More information about the cfe-commits mailing list