aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/StackProtector.cpp
diff options
context:
space:
mode:
authorMichael Buch <michaelbuch12@gmail.com>2023-01-15 03:36:50 +0000
committerMichael Buch <michaelbuch12@gmail.com>2023-01-27 02:24:33 +0000
commit8b4279b66fc2f535184642b739b573ead1733711 (patch)
treeaaebdccabd16491724ebba42820c2d15dc246839 /llvm/lib/CodeGen/StackProtector.cpp
parent798494ed4f112bf64dcabbe8b60becb42b23208f (diff)
downloadllvm-8b4279b66fc2f535184642b739b573ead1733711.zip
llvm-8b4279b66fc2f535184642b739b573ead1733711.tar.gz
llvm-8b4279b66fc2f535184642b739b573ead1733711.tar.bz2
[clang][TemplateBase] Add IsDefaulted bit to TemplateArgument
**Summary** This patch adds a `IsDefaulted` field to `clang::TemplateArgument`. To prevent memory footprint increase we still 1 bit from `ArgKind`. **Changes** 1. `getIsDefaulted`/`setIsDefaulted` to allow clients to communicate an argument's defaulted-ness to the TypePrinter 2. The `TemplateArgument` properties description had to be changed to make sure we correctly mark the defaulted-ness of arguments that came from a deserialized AST (caught by the HLSL test-suite) 3. The `TemplateArgument` constructors now accept a `IsDefaulted` parameter to simplify construction from the tablegen description. Though if people don't want to clutter the constructors we can instead call `setIsDefaulted` from tablegen 4. When `clang::Sema` checks the template arguments against template parameters we now call `setIsDefaulted`. This makes sure that whenever a specialization decl gets constructed, the defaulted-ness of the associated `TemplateArgument`s has already been deduced. This preserves the immutability of `TemplateArgumentList`s **Background** In LLDB we construct ASTs from debug-info and hand it to clang to perform actions such as printing/formatting a typenames. Some debug formats, specifically DWARF, may only encode information about class template instantiations, losing the structure of the generic class definition. However, the `clang::TypePrinter` needs a properly constructed `ClassTemplateDecl` with generic default argument decls to be able to deduce whether a `ClassTemplateSpecializationDecl` was instantiatiated with `TemplateArgument`s that correspond to the defaults. LLDB does know whether a particular template argument was defaulted, but can't currently tell clang about it. This patch allows LLDB to set the defaulted-ness of a `TemplateArgument` and thus benefit more from `clang::TypePrinter`. See discussion in https://reviews.llvm.org/D140423 **Testing** * Added unit-test * LLDB/clang/llvm test-suite passes Differential Revision: https://reviews.llvm.org/D141826
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
0 files changed, 0 insertions, 0 deletions