aboutsummaryrefslogtreecommitdiff
path: root/include/clang
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
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')
-rw-r--r--include/clang/AST/ASTContext.h2
-rw-r--r--include/clang/Basic/SourceManager.h24
-rw-r--r--include/clang/Frontend/ASTUnit.h2
3 files changed, 11 insertions, 17 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index ffd0dec6b9..d12a182078 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -357,7 +357,7 @@ public:
TranslationUnitDecl *getTranslationUnitDecl() const { return TUDecl; }
- const char *getCommentForDecl(const Decl *D, Diagnostic &Diags);
+ const char *getCommentForDecl(const Decl *D);
// Builtin Types.
CanQualType VoidTy;
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;
//===--------------------------------------------------------------------===//
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index 7f11c85ae3..27ec12e4e4 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -121,7 +121,7 @@ public:
};
friend class ConcurrencyCheck;
- ASTUnit(bool MainFileIsAST);
+ ASTUnit(Diagnostic &Diag, bool MainFileIsAST);
~ASTUnit();
bool isMainFileAST() const { return MainFileIsAST; }