summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-01 22:52:33 +0000
committerChris Lattner <sabre@nondot.org>2009-12-01 22:52:33 +0000
commited3b360290c4652c8e96bc6869354c73975afe05 (patch)
tree36f2fb40876c17613aee57705d28cc992ec13ced /clang/lib/Basic/SourceManager.cpp
parent0e3b78a6c21b27eb1d73351a6d856778b57de54b (diff)
downloadbcm5719-llvm-ed3b360290c4652c8e96bc6869354c73975afe05.tar.gz
bcm5719-llvm-ed3b360290c4652c8e96bc6869354c73975afe05.zip
pass the reason for failure up from MemoryBuffer and report it
in diagnostics when we fail to open a file. This allows us to report things like: $ clang test.c -I. test.c:2:10: fatal error: error opening file './foo.h': Permission denied #include "foo.h" ^ llvm-svn: 90276
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index a85bef0f29e..394f493fa90 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -47,12 +47,12 @@ unsigned ContentCache::getSize() const {
return Buffer ? Buffer->getBufferSize() : Entry->getSize();
}
-const llvm::MemoryBuffer *ContentCache::getBuffer() const {
+const llvm::MemoryBuffer *ContentCache::getBuffer(std::string *ErrorStr) const {
// Lazily create the Buffer for ContentCaches that wrap files.
if (!Buffer && Entry) {
// FIXME: Should we support a way to not have to do this check over
// and over if we cannot open the file?
- Buffer = MemoryBuffer::getFile(Entry->getName(), 0, Entry->getSize());
+ Buffer = MemoryBuffer::getFile(Entry->getName(), ErrorStr,Entry->getSize());
if (isTruncated())
const_cast<ContentCache *>(this)->truncateAt(TruncateAtLine,
TruncateAtColumn);
OpenPOWER on IntegriCloud