mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-13 22:00:14 +00:00
Fixed failing assert in code completion.
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 llvm-svn: 308722
This commit is contained in:
parent
ba3bd7ce3e
commit
b6d1ec8073
@ -2401,10 +2401,7 @@ formatBlockPlaceholder(const PrintingPolicy &Policy, const NamedDecl *BlockDecl,
|
||||
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)
|
||||
|
13
clang/test/CodeCompletion/uninstantiated_params.cpp
Normal file
13
clang/test/CodeCompletion/uninstantiated_params.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
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()#>#})
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user