This is an archive of the discontinued LLVM Phabricator instance.

Fix crash when dumping NamedDecl with NULL getQualifier().
ClosedPublic

Authored by dawn on Dec 4 2015, 6:48 PM.

Details

Summary

This fixes calls to the dump() routine for cases when the NamedDecl's getQualifier() is NULL.

Since ASTDumper is a debugging utility, it should handle the case that getQualifier() is NULL. I don't know if the crash can happen in clang, but it can happen while debugging lldb for the source:

namespace ns {
    int func();
    int context() {
        // execution context is here
    }
}

commands in lldb being debugged:

p ns::func() <- adds the namespace to decl map in lldb
p func()  <- crash while dumping the NamedDecl of the function's parent's
             declaration contexts because getQualifier() is NULL.

Diff Detail

Repository
rL LLVM

Event Timeline

dawn updated this revision to Diff 41968.Dec 4 2015, 6:48 PM
dawn retitled this revision from to Fix crash when dumping NamedDecl with NULL getQualifier()..
dawn updated this object.
dawn added reviewers: rsmith, alexfh.
dawn set the repository for this revision to rL LLVM.
dawn added a subscriber: cfe-commits.
aaron.ballman accepted this revision.Dec 5 2015, 7:49 AM
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a subscriber: aaron.ballman.

LGTM, thank you!

This revision is now accepted and ready to land.Dec 5 2015, 7:49 AM
This revision was automatically updated to reflect the committed changes.