[llvm-commits] [llvm] r123550 - /llvm/trunk/include/llvm/Support/GraphWriter.h

Devang Patel dpatel at apple.com
Mon Jan 17 09:37:46 PST 2011


Michael,

This patch causes clang build failure on darwin9. I have revert it for now. Please investigate. Thanks,
-
Devang

/Users/admin/dpatel/llvm/tools/clang/lib/Analysis/CFG.cpp: In member function 'clang::CFGBlock*<unnamed>::CFGBuilder::VisitDeclStmt(clang::DeclStmt*)':
/Users/admin/dpatel/llvm/tools/clang/lib/Analysis/CFG.cpp:1252: error: 'llvm::AlignOf<clang::DeclStmt>::<anonymous enum>' is/uses anonymous type
/Users/admin/dpatel/llvm/tools/clang/lib/Analysis/CFG.cpp:1252: error:   trying to instantiate 'template<class Tp> struct llvm::is_error_condition_enum'
/Users/admin/dpatel/llvm/tools/clang/lib/Analysis/CFG.cpp:1252: error: 'llvm::AlignOf<clang::DeclStmt>::<anonymous enum>' is/uses anonymous type
/Users/admin/dpatel/llvm/tools/clang/lib/Analysis/CFG.cpp:1252: error:   trying to instantiate 'template<class Tp> struct llvm::is_error_code_enum'

On Jan 15, 2011, at 1:43 PM, Michael J. Spencer wrote:

> Author: mspencer
> Date: Sat Jan 15 15:43:25 2011
> New Revision: 123550
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=123550&view=rev
> Log:
> Support/GraphWriter: Replace all internal uses of PathV1 with PathV2. The external API still uses PathV1.
> 
> Modified:
>    llvm/trunk/include/llvm/Support/GraphWriter.h
> 
> Modified: llvm/trunk/include/llvm/Support/GraphWriter.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=123550&r1=123549&r2=123550&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/GraphWriter.h (original)
> +++ llvm/trunk/include/llvm/Support/GraphWriter.h Sat Jan 15 15:43:25 2011
> @@ -24,6 +24,7 @@
> #define LLVM_SUPPORT_GRAPHWRITER_H
> 
> #include "llvm/Support/DOTGraphTraits.h"
> +#include "llvm/Support/FileSystem.h"
> #include "llvm/Support/raw_ostream.h"
> #include "llvm/ADT/GraphTraits.h"
> #include "llvm/Support/Path.h"
> @@ -309,32 +310,21 @@
> template<typename GraphType>
> sys::Path WriteGraph(const GraphType &G, const std::string &Name,
>                      bool ShortNames = false, const std::string &Title = "") {
> -  std::string ErrMsg;
> -  sys::Path Filename = sys::Path::GetTemporaryDirectory(&ErrMsg);
> -  if (Filename.isEmpty()) {
> -    errs() << "Error: " << ErrMsg << "\n";
> -    return Filename;
> -  }
> -  Filename.appendComponent(Name + ".dot");
> -  if (Filename.makeUnique(true,&ErrMsg)) {
> -    errs() << "Error: " << ErrMsg << "\n";
> +  SmallString<128> FilePath;
> +
> +  int FileFD;
> +  if (error_code ec = sys::fs::unique_file("graph-" + Name + "-%%-%%-%%-%%.dot",
> +                                           FileFD, FilePath)) {
> +    errs() << "Error creating output file: " << ec.message() << '\n';
>     return sys::Path();
>   }
> 
> -  errs() << "Writing '" << Filename.str() << "'... ";
> -
> -  std::string ErrorInfo;
> -  raw_fd_ostream O(Filename.c_str(), ErrorInfo);
> -
> -  if (ErrorInfo.empty()) {
> -    llvm::WriteGraph(O, G, ShortNames, Title);
> -    errs() << " done. \n";
> -  } else {
> -    errs() << "error opening file '" << Filename.str() << "' for writing!\n";
> -    Filename.clear();
> -  }
> +  errs() << "Writing '" << FilePath << "'... ";
> +  raw_fd_ostream O(FileFD, true);
> +  llvm::WriteGraph(O, G, ShortNames, Title);
> +  errs() << " done. \n";
> 
> -  return Filename;
> +  return sys::Path(FilePath.str());
> }
> 
> /// ViewGraph - Emit a dot graph, run 'dot', run gv on the postscript file,
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list