aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-23 22:45:37 +0000
committerChris Lattner <sabre@nondot.org>2009-08-23 22:45:37 +0000
commit74382b7c699120fbec5cb5603c9cf4212eb37f06 (patch)
treec8c2c5b8879b256c428b0d35841b9cce1c2cc51c /include
parent983c592272eb59d39fd78c515e1f2701638879e0 (diff)
downloadexternal_llvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.zip
external_llvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.tar.gz
external_llvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.tar.bz2
Prune #includes from llvm/Linker.h and llvm/System/Path.h,
forcing them down into various .cpp files. This change also: 1. Renames TimeValue::toString() and Path::toString() to ::str() for similarity with the STL. 2. Removes all stream insertion support for sys::Path, forcing clients to call .str(). 3. Removes a use of Config/alloca.h from bugpoint, using smallvector instead. 4. Weans llvm-db off <iostream> sys::Path really needs to be gutted, but I don't have the desire to do it at this point. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Debugger/SourceFile.h2
-rw-r--r--include/llvm/Linker.h12
-rw-r--r--include/llvm/Support/GraphWriter.h21
-rw-r--r--include/llvm/System/Path.h32
-rw-r--r--include/llvm/System/TimeValue.h2
5 files changed, 20 insertions, 49 deletions
diff --git a/include/llvm/Debugger/SourceFile.h b/include/llvm/Debugger/SourceFile.h
index 249435a..155b45f 100644
--- a/include/llvm/Debugger/SourceFile.h
+++ b/include/llvm/Debugger/SourceFile.h
@@ -60,7 +60,7 @@ namespace llvm {
/// getFilename - Return the fully resolved path that this file was loaded
/// from.
- const std::string &getFilename() const { return Filename.toString(); }
+ const std::string &getFilename() const { return Filename.str(); }
/// getSourceLine - Given a line number, return the start and end of the
/// line in the file. If the line number is invalid, or if the file could
diff --git a/include/llvm/Linker.h b/include/llvm/Linker.h
index 2f3d374..1e1da86 100644
--- a/include/llvm/Linker.h
+++ b/include/llvm/Linker.h
@@ -14,11 +14,12 @@
#ifndef LLVM_LINKER_H
#define LLVM_LINKER_H
-#include "llvm/System/Path.h"
#include <memory>
#include <vector>
+#include "llvm/ADT/StringRef.h"
namespace llvm {
+ namespace sys { class Path; }
class Module;
class LLVMContext;
@@ -64,11 +65,10 @@ class Linker {
/// Construct the Linker with an empty module which will be given the
/// name \p progname. \p progname will also be used for error messages.
/// @brief Construct with empty module
- Linker(
- const StringRef& progname, ///< name of tool running linker
- const StringRef& modulename, ///< name of linker's end-result module
- LLVMContext& C, ///< Context for global info
- unsigned Flags = 0 ///< ControlFlags (one or more |'d together)
+ Linker(const StringRef &progname, ///< name of tool running linker
+ const StringRef &modulename, ///< name of linker's end-result module
+ LLVMContext &C, ///< Context for global info
+ unsigned Flags = 0 ///< ControlFlags (one or more |'d together)
);
/// Construct the Linker with a previously defined module, \p aModule. Use
diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h
index f77b3db..b88dd3f 100644
--- a/include/llvm/Support/GraphWriter.h
+++ b/include/llvm/Support/GraphWriter.h
@@ -257,10 +257,8 @@ raw_ostream &WriteGraph(raw_ostream &O, const GraphType &G,
}
template<typename GraphType>
-sys::Path WriteGraph(const GraphType &G,
- const std::string& Name,
- bool ShortNames = false,
- const std::string& Title = "") {
+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()) {
@@ -273,7 +271,7 @@ sys::Path WriteGraph(const GraphType &G,
return sys::Path();
}
- errs() << "Writing '" << Filename << "'... ";
+ errs() << "Writing '" << Filename.str() << "'... ";
std::string ErrorInfo;
raw_fd_ostream O(Filename.c_str(), ErrorInfo, raw_fd_ostream::F_Force);
@@ -282,7 +280,7 @@ sys::Path WriteGraph(const GraphType &G,
WriteGraph(O, G, ShortNames, Name, Title);
errs() << " done. \n";
} else {
- errs() << "error opening file '" << Filename << "' for writing!\n";
+ errs() << "error opening file '" << Filename.str() << "' for writing!\n";
Filename.clear();
}
@@ -293,16 +291,13 @@ sys::Path WriteGraph(const GraphType &G,
/// then cleanup. For use from the debugger.
///
template<typename GraphType>
-void ViewGraph(const GraphType& G,
- const std::string& Name,
- bool ShortNames = false,
- const std::string& Title = "",
+void ViewGraph(const GraphType &G, const std::string &Name,
+ bool ShortNames = false, const std::string &Title = "",
GraphProgram::Name Program = GraphProgram::DOT) {
- sys::Path Filename = WriteGraph(G, Name, ShortNames, Title);
+ sys::Path Filename = WriteGraph(G, Name, ShortNames, Title);
- if (Filename.isEmpty()) {
+ if (Filename.isEmpty())
return;
- }
DisplayGraph(Filename, true, Program);
}
diff --git a/include/llvm/System/Path.h b/include/llvm/System/Path.h
index 54c1066..3b73a12 100644
--- a/include/llvm/System/Path.h
+++ b/include/llvm/System/Path.h
@@ -15,11 +15,9 @@
#define LLVM_SYSTEM_PATH_H
#include "llvm/System/TimeValue.h"
-#include "llvm/Support/raw_ostream.h"
#include <set>
#include <string>
#include <vector>
-#include <iosfwd>
namespace llvm {
namespace sys {
@@ -217,7 +215,7 @@ namespace sys {
/// Compares \p this Path with \p that Path for inequality.
/// @returns true if \p this and \p that refer to different things.
/// @brief Inequality Operator
- bool operator!=(const Path &that) const;
+ bool operator!=(const Path &that) const { return !(*this == that); }
/// Determines if \p this Path is less than \p that Path. This is required
/// so that Path objects can be placed into ordered collections (e.g.
@@ -249,13 +247,7 @@ namespace sys {
/// @brief Determines if the path name is empty (invalid).
bool isEmpty() const { return path.empty(); }
- /// This function returns the current contents of the path as a
- /// std::string. This allows the underlying path string to be manipulated.
- /// @returns std::string containing the path name.
- /// @brief Returns the path as a std::string.
- const std::string &toString() const { return path; }
-
- /// This function returns the last component of the path name. The last
+ /// This function returns the last component of the path name. The last
/// component is the file or directory name occuring after the last
/// directory separator. If no directory separator is present, the entire
/// path name is returned (i.e. same as toString).
@@ -286,6 +278,8 @@ namespace sys {
/// @returns a 'C' string containing the path name.
/// @brief Returns the path as a C string.
const char *c_str() const { return path.c_str(); }
+ const std::string &str() const { return path; }
+
/// size - Return the length in bytes of this path name.
size_t size() const { return path.size(); }
@@ -716,24 +710,6 @@ namespace sys {
extern const char PathSeparator;
}
-inline raw_ostream& operator<<(raw_ostream& strm, const sys::Path& aPath) {
- strm << aPath.toString();
- return strm;
-}
-
-inline raw_ostream& operator<<(raw_ostream& strm,
- const sys::PathWithStatus& aPath) {
- strm << static_cast<const sys::Path&>(aPath);
- return strm;
-}
-
-std::ostream& operator<<(std::ostream& strm, const sys::Path& aPath);
-inline std::ostream& operator<<(std::ostream& strm,
- const sys::PathWithStatus& aPath) {
- strm << static_cast<const sys::Path&>(aPath);
- return strm;
-}
-
}
#endif
diff --git a/include/llvm/System/TimeValue.h b/include/llvm/System/TimeValue.h
index b9ada00..4e419f1 100644
--- a/include/llvm/System/TimeValue.h
+++ b/include/llvm/System/TimeValue.h
@@ -271,7 +271,7 @@ namespace sys {
/// Provides conversion of the TimeValue into a readable time & date.
/// @returns std::string containing the readable time value
/// @brief Convert time to a string.
- std::string toString() const;
+ std::string str() const;
/// @}
/// @name Mutators