[llvm-commits] [PATCH 2/6] Use a separate function to translate from dot to ps

Joerg Sonnenberger joerg at britannica.bec.de
Tue Jul 5 09:51:10 PDT 2011


On Tue, Jul 05, 2011 at 10:23:28AM -0500, Tobias Grosser wrote:
> +  sys::Path prog;
> +
> +  // Set default grapher
> +#if HAVE_CIRCO
> +  prog = sys::Path(LLVM_PATH_CIRCO);
> +#endif
> +#if HAVE_TWOPI
> +  prog = sys::Path(LLVM_PATH_TWOPI);
> +#endif
> +#if HAVE_NEATO
> +  prog = sys::Path(LLVM_PATH_NEATO);
> +#endif
> +#if HAVE_FDP
> +  prog = sys::Path(LLVM_PATH_FDP);
> +#endif
> +#if HAVE_DOT
> +  prog = sys::Path(LLVM_PATH_DOT);
> +#endif
> +
> +  // Find which program the user wants
> +#if HAVE_DOT
> +  if (program == GraphProgram::DOT)
> +    prog = sys::Path(LLVM_PATH_DOT);
> +#endif
> +#if (HAVE_FDP)
> +  if (program == GraphProgram::FDP)
> +    prog = sys::Path(LLVM_PATH_FDP);
> +#endif
> +#if (HAVE_NEATO)
> +  if (program == GraphProgram::NEATO)
> +    prog = sys::Path(LLVM_PATH_NEATO);
> +#endif
> +#if (HAVE_TWOPI)
> +  if (program == GraphProgram::TWOPI)
> +    prog = sys::Path(LLVM_PATH_TWOPI);
> +#endif
> +#if (HAVE_CIRCO)
> +  if (program == GraphProgram::CIRCO)
> +    prog = sys::Path(LLVM_PATH_CIRCO);
> +#endif

This is assigning prog at least twice. This should be a switch on
program and default to dot/fdp/neato/twopi/circo without full path if it
couldn't be found during installation. I would even argue that no full
path should be hard-coded without a good reason, but that's a separate
change.

Joerg



More information about the llvm-commits mailing list