diff options
author | Chris Lattner <sabre@nondot.org> | 2011-07-20 07:06:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-07-20 07:06:53 +0000 |
commit | 8cc488fefb2fb04bc8d5398da29f0182f97934cf (patch) | |
tree | ac1e7addc1639bec225c9e5e8f4b04ed5d2d6fb0 /include/clang/Basic | |
parent | 686775deca8b8685eb90801495880e3abdd844c2 (diff) |
add raw_ostream and Twine to LLVM.h, eliminating a ton of llvm:: qualifications.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135577 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic')
-rw-r--r-- | include/clang/Basic/LLVM.h | 9 | ||||
-rw-r--r-- | include/clang/Basic/MacroBuilder.h | 10 | ||||
-rw-r--r-- | include/clang/Basic/OnDiskHashTable.h | 16 | ||||
-rw-r--r-- | include/clang/Basic/PrettyStackTrace.h | 2 | ||||
-rw-r--r-- | include/clang/Basic/SourceLocation.h | 2 | ||||
-rw-r--r-- | include/clang/Basic/VersionTuple.h | 7 |
6 files changed, 24 insertions, 22 deletions
diff --git a/include/clang/Basic/LLVM.h b/include/clang/Basic/LLVM.h index a4aaa2f890..7df5936964 100644 --- a/include/clang/Basic/LLVM.h +++ b/include/clang/Basic/LLVM.h @@ -22,10 +22,12 @@ namespace llvm { // ADT's. class StringRef; + class Twine; template<typename T, unsigned N> class SmallVector; template<typename T> class SmallVectorImpl; - - // TODO: Twine, raw_ostream, DenseMap, ... + + class raw_ostream; + // TODO: DenseMap, ... } @@ -37,10 +39,13 @@ namespace clang { using llvm::dyn_cast_or_null; using llvm::cast_or_null; + // ADT's. using llvm::StringRef; + using llvm::Twine; using llvm::SmallVector; using llvm::SmallVectorImpl; + using llvm::raw_ostream; } // end namespace clang. #endif diff --git a/include/clang/Basic/MacroBuilder.h b/include/clang/Basic/MacroBuilder.h index 3287b304c9..1d0f1e899c 100644 --- a/include/clang/Basic/MacroBuilder.h +++ b/include/clang/Basic/MacroBuilder.h @@ -20,23 +20,23 @@ namespace clang { class MacroBuilder { - llvm::raw_ostream &Out; + raw_ostream &Out; public: - MacroBuilder(llvm::raw_ostream &Output) : Out(Output) {} + MacroBuilder(raw_ostream &Output) : Out(Output) {} /// Append a #define line for macro of the form "#define Name Value\n". - void defineMacro(const llvm::Twine &Name, const llvm::Twine &Value = "1") { + void defineMacro(const Twine &Name, const Twine &Value = "1") { Out << "#define " << Name << ' ' << Value << '\n'; } /// Append a #undef line for Name. Name should be of the form XXX /// and we emit "#undef XXX". - void undefineMacro(const llvm::Twine &Name) { + void undefineMacro(const Twine &Name) { Out << "#undef " << Name << '\n'; } /// Directly append Str and a newline to the underlying buffer. - void append(const llvm::Twine &Str) { + void append(const Twine &Str) { Out << Str << '\n'; } }; diff --git a/include/clang/Basic/OnDiskHashTable.h b/include/clang/Basic/OnDiskHashTable.h index 267ecbcd6d..3705a8941e 100644 --- a/include/clang/Basic/OnDiskHashTable.h +++ b/include/clang/Basic/OnDiskHashTable.h @@ -28,31 +28,31 @@ namespace io { typedef uint32_t Offset; -inline void Emit8(llvm::raw_ostream& Out, uint32_t V) { +inline void Emit8(raw_ostream& Out, uint32_t V) { Out << (unsigned char)(V); } -inline void Emit16(llvm::raw_ostream& Out, uint32_t V) { +inline void Emit16(raw_ostream& Out, uint32_t V) { Out << (unsigned char)(V); Out << (unsigned char)(V >> 8); assert((V >> 16) == 0); } -inline void Emit24(llvm::raw_ostream& Out, uint32_t V) { +inline void Emit24(raw_ostream& Out, uint32_t V) { Out << (unsigned char)(V); Out << (unsigned char)(V >> 8); Out << (unsigned char)(V >> 16); assert((V >> 24) == 0); } -inline void Emit32(llvm::raw_ostream& Out, uint32_t V) { +inline void Emit32(raw_ostream& Out, uint32_t V) { Out << (unsigned char)(V); Out << (unsigned char)(V >> 8); Out << (unsigned char)(V >> 16); Out << (unsigned char)(V >> 24); } -inline void Emit64(llvm::raw_ostream& Out, uint64_t V) { +inline void Emit64(raw_ostream& Out, uint64_t V) { Out << (unsigned char)(V); Out << (unsigned char)(V >> 8); Out << (unsigned char)(V >> 16); @@ -63,7 +63,7 @@ inline void Emit64(llvm::raw_ostream& Out, uint64_t V) { Out << (unsigned char)(V >> 56); } -inline void Pad(llvm::raw_ostream& Out, unsigned A) { +inline void Pad(raw_ostream& Out, unsigned A) { Offset off = (Offset) Out.tell(); uint32_t n = ((uintptr_t)(off+A-1) & ~(uintptr_t)(A-1)) - off; for (; n ; --n) @@ -182,12 +182,12 @@ public: InfoObj)); } - io::Offset Emit(llvm::raw_ostream &out) { + io::Offset Emit(raw_ostream &out) { Info InfoObj; return Emit(out, InfoObj); } - io::Offset Emit(llvm::raw_ostream &out, Info &InfoObj) { + io::Offset Emit(raw_ostream &out, Info &InfoObj) { using namespace clang::io; // Emit the payload of the table. diff --git a/include/clang/Basic/PrettyStackTrace.h b/include/clang/Basic/PrettyStackTrace.h index 5a5d55192b..06a12644c3 100644 --- a/include/clang/Basic/PrettyStackTrace.h +++ b/include/clang/Basic/PrettyStackTrace.h @@ -30,7 +30,7 @@ namespace clang { public: PrettyStackTraceLoc(SourceManager &sm, SourceLocation L, const char *Msg) : SM(sm), Loc(L), Message(Msg) {} - virtual void print(llvm::raw_ostream &OS) const; + virtual void print(raw_ostream &OS) const; }; } diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index 5e3fe0c0c9..3a4780c20d 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -164,7 +164,7 @@ public: return getFromRawEncoding((unsigned)(uintptr_t)Encoding); } - void print(llvm::raw_ostream &OS, const SourceManager &SM) const; + void print(raw_ostream &OS, const SourceManager &SM) const; void dump(const SourceManager &SM) const; }; diff --git a/include/clang/Basic/VersionTuple.h b/include/clang/Basic/VersionTuple.h index 91eb68eaad..30ef6641ef 100644 --- a/include/clang/Basic/VersionTuple.h +++ b/include/clang/Basic/VersionTuple.h @@ -14,13 +14,10 @@ #ifndef LLVM_CLANG_BASIC_VERSIONTUPLE_H #define LLVM_CLANG_BASIC_VERSIONTUPLE_H +#include "clang/Basic/LLVM.h" #include "llvm/ADT/Optional.h" #include <string> -namespace llvm { - class raw_ostream; -} - namespace clang { /// \brief Represents a version number in the form major[.minor[.subminor]]. @@ -120,7 +117,7 @@ public: }; /// \brief Print a version number. -llvm::raw_ostream& operator<<(llvm::raw_ostream &Out, const VersionTuple &V); +raw_ostream& operator<<(raw_ostream &Out, const VersionTuple &V); } // end namespace clang #endif // LLVM_CLANG_BASIC_VERSIONTUPLE_H |