-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang] Add frontend flag to enable support for broken external resug…
…arers (#103219) Forked from #102510 by [mizvekov](https://github.com/mizvekov). Changes are captured as a fixup commit. There are some external projects that can't rely on our own sugar propagation for templated entities, because they need to resugar types which only exist within their framework, and so are entirely invisible to our internal tooling. This new flag is meant to prevent our transforms from removing any Subst* nodes. For this, this is wired only to template type alias subsititutions. Note that our AST does represent enough information to correctly resugar template type alias, so any users of this are limited in their capacity to reconstruct the parameter substitutions fully. --------- Co-authored-by: Matheus Izvekov <mizvekov@gmail.com>
- Loading branch information
Showing
4 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
clang/test/AST/ast-dump-retain-subst-template-type-parm-type-ast-nodes.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -fretain-subst-template-type-parm-type-ast-nodes -ast-dump -ast-dump-filter=dump %s | FileCheck -strict-whitespace %s | ||
|
||
namespace t1 { | ||
template<class T> using X = T; | ||
using dump = X<int>; | ||
|
||
// CHECK-LABEL: Dumping t1::dump: | ||
// CHECK-NEXT: TypeAliasDecl | ||
// CHECK-NEXT: `-ElaboratedType | ||
// CHECK-NEXT: `-TemplateSpecializationType | ||
// CHECK-NEXT: |-name: 'X':'t1::X' qualified | ||
// CHECK-NEXT: | `-TypeAliasTemplateDecl | ||
// CHECK-NEXT: |-TemplateArgument | ||
// CHECK-NEXT: | `-BuiltinType {{.+}} 'int' | ||
// CHECK-NEXT: `-SubstTemplateTypeParmType 0x{{[0-9a-f]+}} 'int' sugar class depth 0 index 0 T | ||
// CHECK-NEXT: |-TypeAliasTemplate {{.+}} 'X' | ||
// CHECK-NEXT: `-BuiltinType {{.+}} 'int' | ||
} // namespace t1 |