aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-18 20:06:41 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-18 20:06:41 +0000
commit33e4e70c8c0a17e0ccb7465d96556b077a68ecb1 (patch)
tree7f65080a9221d10495e43911e7bbaeb2724084f7 /lib/Basic/SourceManager.cpp
parent9313aac61d425f14fa0b82c3dfe1eb2c3626d38c (diff)
Refactoring of Diagnostic class.
-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class. -DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units. -The rest of the state in Diagnostic object is considered related and tied to one translation unit. -Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a SourceLocation instead of a FullSourceLoc. -Reflect the changes to various interfaces. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
-rw-r--r--lib/Basic/SourceManager.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index e576b8dc6a..4fa7d1d879 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -100,7 +100,7 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag,
Diag.SetDelayedDiagnostic(diag::err_cannot_open_file,
Entry->getName(), ErrorStr);
else
- Diag.Report(FullSourceLoc(Loc, SM), diag::err_cannot_open_file)
+ Diag.Report(Loc, diag::err_cannot_open_file)
<< Entry->getName() << ErrorStr;
Buffer.setInt(Buffer.getInt() | InvalidFlag);
@@ -120,7 +120,7 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag,
Diag.SetDelayedDiagnostic(diag::err_file_modified,
Entry->getName());
else
- Diag.Report(FullSourceLoc(Loc, SM), diag::err_file_modified)
+ Diag.Report(Loc, diag::err_file_modified)
<< Entry->getName();
Buffer.setInt(Buffer.getInt() | InvalidFlag);
@@ -147,7 +147,7 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag,
.Default(0);
if (BOM) {
- Diag.Report(FullSourceLoc(Loc, SM), diag::err_unsupported_bom)
+ Diag.Report(Loc, diag::err_unsupported_bom)
<< BOM << Entry->getName();
Buffer.setInt(1);
}
@@ -342,6 +342,15 @@ LineTableInfo &SourceManager::getLineTable() {
// Private 'Create' methods.
//===----------------------------------------------------------------------===//
+SourceManager::SourceManager(Diagnostic &Diag, FileManager &FileMgr,
+ const FileSystemOptions &FSOpts)
+ : Diag(Diag), FileMgr(FileMgr), FileSystemOpts(FSOpts),
+ ExternalSLocEntries(0), LineTable(0), NumLinearScans(0),
+ NumBinaryProbes(0) {
+ clearIDTables();
+ Diag.setSourceManager(this);
+}
+
SourceManager::~SourceManager() {
delete LineTable;