//== AnalysisManager.cpp - Path sensitive analysis data manager ----*- C++ -*-//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements the AnalysisManager class.
//
//===----------------------------------------------------------------------===//

#include "clang/Analysis/PathSensitive/AnalysisManager.h"
#include "clang/Basic/SourceManager.h"

using namespace clang;

void AnalysisManager::DisplayFunction(Decl *D) {

  if (DisplayedFunction)
    return;

  DisplayedFunction = true;

  // FIXME: Is getCodeDecl() always a named decl?
  if (isa<FunctionDecl>(D) || isa<ObjCMethodDecl>(D)) {
    const NamedDecl *ND = cast<NamedDecl>(D);
    SourceManager &SM = getASTContext().getSourceManager();
    (llvm::errs() << "ANALYZE: "
                  << SM.getPresumedLoc(ND->getLocation()).getFilename()
                  << ' ' << ND->getNameAsString() << '\n').flush();
  }
}


//== AnalysisManager.cpp - Path sensitive analysis data manager ----*- C++ -*-//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements the AnalysisManager class.
//
//===----------------------------------------------------------------------===//

#include "clang/Analysis/PathSensitive/AnalysisManager.h"
#include "clang/Basic/SourceManager.h"

using namespace clang;

void AnalysisManager::DisplayFunction(Decl *D) {

  if (DisplayedFunction)
    return;

  DisplayedFunction = true;

  // FIXME: Is getCodeDecl() always a named decl?
  if (isa<FunctionDecl>(D) || isa<ObjCMethodDecl>(D)) {
    const NamedDecl *ND = cast<NamedDecl>(D);
    SourceManager &SM = getASTContext().getSourceManager();
    llvm::errs() << "ANALYZE: "
                 << SM.getPresumedLoc(ND->getLocation()).getFilename()
                 << ' ' << ND->getNameAsString() << '\n';
  }
}


--- 
+++ 
@@ -27,9 +27,9 @@
   if (isa<FunctionDecl>(D) || isa<ObjCMethodDecl>(D)) {
     const NamedDecl *ND = cast<NamedDecl>(D);
     SourceManager &SM = getASTContext().getSourceManager();
-    llvm::errs() << "ANALYZE: "
-                 << SM.getPresumedLoc(ND->getLocation()).getFilename()
-                 << ' ' << ND->getNameAsString() << '\n';
+    (llvm::errs() << "ANALYZE: "
+                  << SM.getPresumedLoc(ND->getLocation()).getFilename()
+                  << ' ' << ND->getNameAsString() << '\n').flush();
   }
 }
 
Fix 'clang-cc -analyzer-display-progress' by flushing standard error after printing the name of the analyzed function.


git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@83369 91177308-0d34-0410-b5e6-96231b3b80d8
