File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
include/clang/Interpreter Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -224,8 +224,9 @@ namespace Cpp {
224
224
// / underlying decl is not a class it returns the input unchanged.
225
225
TCppScope_t GetUnderlyingScope (TCppScope_t scope);
226
226
227
- // / Gets the namespace or class for the name passed as a parameter,
228
- // / and if the parent is not passed, then global scope will be assumed.
227
+ // / Gets the namespace or class (by stripping typedefs) for the name
228
+ // / passed as a parameter, and if the parent is not passed,
229
+ // / then global scope will be assumed.
229
230
TCppScope_t GetScope (const std::string &name, TCppScope_t parent = 0 );
230
231
231
232
// / When the namespace is known, then the parent doesn't need
Original file line number Diff line number Diff line change @@ -502,11 +502,13 @@ namespace Cpp {
502
502
503
503
auto *ND = (NamedDecl*)GetNamed (name, parent);
504
504
505
- if (!(ND == (NamedDecl *)-1 ) &&
506
- (llvm::isa_and_nonnull<NamespaceDecl>(ND) ||
507
- llvm::isa_and_nonnull<RecordDecl>(ND) ||
508
- llvm::isa_and_nonnull<ClassTemplateDecl>(ND) ||
509
- llvm::isa_and_nonnull<TypedefDecl>(ND)))
505
+ ND = llvm::dyn_cast_or_null<NamedDecl>(GetUnderlyingScope (ND));
506
+
507
+ if (!ND || ND == (NamedDecl *) -1 )
508
+ return 0 ;
509
+
510
+ if (llvm::isa<NamespaceDecl>(ND) || llvm::isa<RecordDecl>(ND) ||
511
+ llvm::isa<ClassTemplateDecl>(ND))
510
512
return (TCppScope_t)(ND->getCanonicalDecl ());
511
513
512
514
return 0 ;
You can’t perform that action at this time.
0 commit comments