File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -498,7 +498,7 @@ namespace Cpp {
498498
499499  TCppScope_t GetGlobalScope ()
500500  {
501-     return  getSema ().getASTContext ().getTranslationUnitDecl ();
501+     return  getSema ().getASTContext ().getTranslationUnitDecl ()-> getFirstDecl () ;
502502  }
503503
504504  static  Decl *GetScopeFromType (QualType QT) {
@@ -604,8 +604,12 @@ namespace Cpp {
604604    if  (!ParentDC)
605605      return  0 ;
606606
607-     return  (TCppScope_t) clang::Decl::castFromDeclContext (
608-             ParentDC)->getCanonicalDecl ();
607+     auto * P = clang::Decl::castFromDeclContext (ParentDC)->getCanonicalDecl ();
608+ 
609+     if  (auto * TU = llvm::dyn_cast_or_null<TranslationUnitDecl>(P))
610+       return  (TCppScope_t)TU->getFirstDecl ();
611+ 
612+     return  (TCppScope_t)P;
609613  }
610614
611615  TCppIndex_t GetNumBases (TCppScope_t klass)
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments