aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/SourceManager.h
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-16 00:06:06 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-16 00:06:06 +0000
commitf715ca12bfc9fddfde75f98a197424434428b821 (patch)
treebd19f3ce3d9a7850942f25d25c03633954e91faa /include/clang/Basic/SourceManager.h
parentf9b0a58a103784495309543dce4469e44861b4cc (diff)
Give SourceManager a Diagnostic object with which to report errors,
and start simplifying the interfaces in SourceManager that can fail. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98594 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceManager.h')
-rw-r--r--include/clang/Basic/SourceManager.h24
1 files changed, 9 insertions, 15 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index 05480419ab..4d423058fb 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -321,6 +321,9 @@ public:
/// location indicates where the expanded token came from and the instantiation
/// location specifies where it was expanded.
class SourceManager {
+ /// \brief Diagnostic object.
+ Diagnostic &Diag;
+
mutable llvm::BumpPtrAllocator ContentCacheAlloc;
/// FileInfos - Memoized information about all of the files tracked by this
@@ -380,8 +383,8 @@ class SourceManager {
explicit SourceManager(const SourceManager&);
void operator=(const SourceManager&);
public:
- SourceManager()
- : ExternalSLocEntries(0), LineTable(0), NumLinearScans(0),
+ SourceManager(Diagnostic &Diag)
+ : Diag(Diag), ExternalSLocEntries(0), LineTable(0), NumLinearScans(0),
NumBinaryProbes(0) {
clearIDTables();
}
@@ -484,20 +487,11 @@ public:
/// getBufferData - Return a pointer to the start and end of the source buffer
/// data for the specified FileID.
- ///
- /// If an error occurs while reading in the file, provides the file name
- /// and a non-empty error string and returns a pair of NULL pointers.
- std::pair<const char*, const char*> getBufferData(FileID FID,
- llvm::StringRef &FileName,
- std::string &Error) const;
-
- /// getBufferData - Return a pointer to the start and end of the source buffer
- /// data for the specified FileID.
///
- /// If an error occurs while reading in the file, emits a diagnostic to the
- /// given \c Diagnostic object and returns a pair of NULL pointers.
- std::pair<const char*, const char*> getBufferData(FileID FID,
- Diagnostic &Diags) const;
+ /// \param FID The file ID whose contents will be returned.
+ /// \param Invalid If non-NULL, will be set true if an error occurred.
+ std::pair<const char*, const char*> getBufferData(FileID FID,
+ bool *Invalid = 0) const;
//===--------------------------------------------------------------------===//