diff options
| author | Raphael Isemann <teemperor@gmail.com> | 2020-01-02 14:46:39 +0100 |
|---|---|---|
| committer | Raphael Isemann <teemperor@gmail.com> | 2020-01-02 14:47:04 +0100 |
| commit | 7ead00872929a994ac40fc2c99fce15968e2c5a6 (patch) | |
| tree | a5a52a72d985b676793b20158c3e1cc811a79f3b /lldb/source/Symbol | |
| parent | 136f34fed661869ebb0082d32f7b5399baca204c (diff) | |
| download | bcm5719-llvm-7ead00872929a994ac40fc2c99fce15968e2c5a6.tar.gz bcm5719-llvm-7ead00872929a994ac40fc2c99fce15968e2c5a6.zip | |
[lldb] Fix crash in AccessDeclContextSanity when copying FunctionTemplateDecl inside a record.
Summary:
We currently don't set access specifiers for function template declarations. This seems to be fine
as long as the function template is not declared inside any record in which case Clang asserts
with the following once we try to query it's access:
```
Assertion failed: (Access != AS_none && "Access specifier is AS_none inside a record decl"), function AccessDeclContextSanity,
```
This patch just marks these function template declarations as public to make Clang happy.
Reviewers: shafik, teemperor
Reviewed By: teemperor
Subscribers: JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71909
Diffstat (limited to 'lldb/source/Symbol')
| -rw-r--r-- | lldb/source/Symbol/ClangASTContext.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 4cf70fa9c1c..99299c3c6c4 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -1340,6 +1340,11 @@ clang::FunctionTemplateDecl *ClangASTContext::CreateFunctionTemplateDecl( // TODO: verify which decl context we should put template_param_decls into.. template_param_decls[i]->setDeclContext(func_decl); } + // Function templates inside a record need to have an access specifier. + // It doesn't matter what access specifier we give the template as LLDB + // anyway allows accessing everything inside a record. + if (decl_ctx->isRecord()) + func_tmpl_decl->setAccess(clang::AccessSpecifier::AS_public); return func_tmpl_decl; } |

