From: Ted Kremenek Date: Wed, 9 Dec 2009 03:45:19 +0000 (+0000) Subject: Fix crash in DisplayFunction(). ObjCInterfaceDecls can also get passed to this funct... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=029a14ae819fab05b1ce0b3612cb6e34f1110754;p=clang Fix crash in DisplayFunction(). ObjCInterfaceDecls can also get passed to this function, but we don't want to display them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90944 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/AnalysisConsumer.cpp b/lib/Frontend/AnalysisConsumer.cpp index 92f34b21fe..dab64d0d93 100644 --- a/lib/Frontend/AnalysisConsumer.cpp +++ b/lib/Frontend/AnalysisConsumer.cpp @@ -143,17 +143,14 @@ public: PresumedLoc Loc = SM.getPresumedLoc(D->getLocation()); llvm::errs() << "ANALYZE: " << Loc.getFilename(); - if (const NamedDecl *ND = dyn_cast(D)) { - assert(isa(D) || isa(D)); - llvm::errs() << ' ' << ND->getNameAsString(); + if (isa(D) || isa(D)) { + const NamedDecl *ND = cast(D); + llvm::errs() << ' ' << ND->getNameAsString() << '\n'; } - else { - assert(isa(D)); + else if (isa(D)) { llvm::errs() << ' ' << "block(line:" << Loc.getLine() << ",col:" - << Loc.getColumn(); + << Loc.getColumn() << '\n'; } - - llvm::errs() << '\n'; } void addCodeAction(CodeAction action) {