diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-16 20:46:42 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-16 20:46:42 +0000 |
commit | 42fe858cd6fff76fc8f3e7f6c0c58116782bd246 (patch) | |
tree | 189b2b29bf6a7b0470a196f0742c2445d4accb9a /clang/lib/Lex/PPDirectives.cpp | |
parent | f2e4b5dd7f6e2e80bdfec64205dbf9120eef728f (diff) | |
download | bcm5719-llvm-42fe858cd6fff76fc8f3e7f6c0c58116782bd246.tar.gz bcm5719-llvm-42fe858cd6fff76fc8f3e7f6c0c58116782bd246.zip |
Audit all callers of SourceManager::getCharacterData(); update some of
them to recover more gracefully on failure.
llvm-svn: 98672
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index cddc6cff727..3bf3fc4af91 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -204,7 +204,12 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc, // to spell an i/e in a strange way that is another letter. Skipping this // allows us to avoid looking up the identifier info for #define/#undef and // other common directives. - const char *RawCharData = SourceMgr.getCharacterData(Tok.getLocation()); + bool Invalid = false; + const char *RawCharData = SourceMgr.getCharacterData(Tok.getLocation(), + &Invalid); + if (Invalid) + return; + char FirstChar = RawCharData[0]; if (FirstChar >= 'a' && FirstChar <= 'z' && FirstChar != 'i' && FirstChar != 'e') { |