Skip to content

Commit

Permalink
[gmodules] Skip CXXDeductionGuideDecls when visiting FunctionDecls in
Browse files Browse the repository at this point in the history
DebugTypeVisitor

Differential Revision: https://reviews.llvm.org/D125839
  • Loading branch information
ahatanaka committed Jun 6, 2022
1 parent 6071de3 commit d1346e2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
Expand Up @@ -96,6 +96,10 @@ class PCHContainerGenerator : public ASTConsumer {
}

bool VisitFunctionDecl(FunctionDecl *D) {
// Skip deduction guides.
if (isa<CXXDeductionGuideDecl>(D))
return true;

if (isa<CXXMethodDecl>(D))
// This is not yet supported. Constructing the `this' argument
// mandates a CodeGenFunction.
Expand Down
11 changes: 11 additions & 0 deletions clang/test/Modules/Inputs/gmodules-deduction-guide.h
@@ -0,0 +1,11 @@
struct A {
};

template <class T>
struct S{
S(const A &);
};

S(const A&) -> S<A>;

typedef decltype(S(A())) Type0;
7 changes: 7 additions & 0 deletions clang/test/Modules/gmodules-deduction-guide.cpp
@@ -0,0 +1,7 @@
// RUN: %clang_cc1 -std=c++2b -x c++-header -emit-pch -fmodule-format=obj -I %S/Inputs \
// RUN: -o %t.pch %S/Inputs/gmodules-deduction-guide.h \
// RUN: -mllvm -debug-only=pchcontainer &>%t-pch.ll
// RUN: cat %t-pch.ll | FileCheck %s

// CHECK: ![[V0:.*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S<A>",
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "Type0",{{.*}}, baseType: ![[V0]])

0 comments on commit d1346e2

Please sign in to comment.