Summary:
The code was accessing uninstantiated default argument.
This resulted in failing assertion at ParmVarDecl::getDefaultArg().
Reviewers: erikjv, klimek, bkramer, krasimir
Reviewed By: krasimir
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D35682
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308722
91177308-0d34-0410-b5e6-
96231b3b80d8
static std::string GetDefaultValueString(const ParmVarDecl *Param,
const SourceManager &SM,
const LangOptions &LangOpts) {
- const Expr *defaultArg = Param->getDefaultArg();
- if (!defaultArg)
- return "";
- const SourceRange SrcRange = defaultArg->getSourceRange();
+ const SourceRange SrcRange = Param->getDefaultArgRange();
CharSourceRange CharSrcRange = CharSourceRange::getTokenRange(SrcRange);
bool Invalid = CharSrcRange.isInvalid();
if (Invalid)
--- /dev/null
+template <class T>
+struct unique_ptr {
+ typedef T* pointer;
+
+ void reset(pointer ptr = pointer());
+};
+
+void test() {
+ unique_ptr<int> x;
+ x.
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:5 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // CHECK-CC1: [#void#]reset({#<#unique_ptr<int>::pointer ptr = pointer()#>#})
+}