File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -403,7 +403,6 @@ SourceLocation PrettyPrint::Get_Expanded_Loc(Decl *decl)
403403 Therefore we must check for the attributes of this declaration and compute
404404 the furthest location. */
405405
406- AttrVec &attrvec = decl->getAttrs ();
407406 bool has_attr = false ;
408407 SourceManager &SM = AST->getSourceManager ();
409408
@@ -416,14 +415,18 @@ SourceLocation PrettyPrint::Get_Expanded_Loc(Decl *decl)
416415 }
417416 }
418417
419- for (size_t i = 0 ; i < attrvec.size (); i++) {
420- const Attr *attr = attrvec[i];
421- SourceLocation loc = attr->getRange ().getEnd ();
422- loc = SM.getExpansionLoc (loc);
423-
424- if (loc.isValid () && Is_Before (furthest, loc)) {
425- furthest = loc;
426- has_attr = true ;
418+ /* Get atttributes vector if it exists. */
419+ if (decl->hasAttrs ()) {
420+ AttrVec &attrvec = decl->getAttrs ();
421+ for (size_t i = 0 ; i < attrvec.size (); i++) {
422+ const Attr *attr = attrvec[i];
423+ SourceLocation loc = attr->getRange ().getEnd ();
424+ loc = SM.getExpansionLoc (loc);
425+
426+ if (loc.isValid () && Is_Before (furthest, loc)) {
427+ furthest = loc;
428+ has_attr = true ;
429+ }
427430 }
428431 }
429432
You can’t perform that action at this time.
0 commit comments