summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-15 22:54:52 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-15 22:54:52 +0000
commit802b77601e50161f0b0d2451a722e11f3b49cdfb (patch)
treefa9b72b5282af43966aff1b27012e481accbf26b /clang/lib/Sema/SemaChecking.cpp
parent45c1505bf60a17a02846a823fac6d8544a27501c (diff)
downloadbcm5719-llvm-802b77601e50161f0b0d2451a722e11f3b49cdfb.tar.gz
bcm5719-llvm-802b77601e50161f0b0d2451a722e11f3b49cdfb.zip
Introduce a new BufferResult class to act as the return type of
SourceManager's getBuffer() (and similar) operations. This abstract can be used to force callers to cope with errors in getBuffer(), such as missing files and changed files. Fix a bunch of callers to use the new interface. Add some very basic checks for file consistency (file size, modification time) into ContentCache::getBuffer(), although these checks don't help much until we've updated the main callers (e.g., SourceManager::getSpelling()). llvm-svn: 98585
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 544d66b503e..7e66d7e910d 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -60,7 +60,10 @@ SourceLocation Sema::getLocationOfStringLiteralByte(const StringLiteral *SL,
std::pair<FileID, unsigned> LocInfo =
SourceMgr.getDecomposedLoc(StrTokSpellingLoc);
std::pair<const char *,const char *> Buffer =
- SourceMgr.getBufferData(LocInfo.first);
+ SourceMgr.getBufferData(LocInfo.first, Diags);
+ if (!Buffer.first)
+ return StrTokSpellingLoc;
+
const char *StrData = Buffer.first+LocInfo.second;
// Create a langops struct and enable trigraphs. This is sufficient for
OpenPOWER on IntegriCloud