diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-11-12 07:15:47 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-11-12 07:15:47 +0000 |
commit | 453b012513e67aa99b3d4c5f7712231012efeca3 (patch) | |
tree | f50a2385ab797dfb12f0745b98f0fe697332b5c2 /clang/lib/Lex/PPDirectives.cpp | |
parent | ea18d8ec2d4c153511d38f85e65c78c3e637d3c6 (diff) | |
download | bcm5719-llvm-453b012513e67aa99b3d4c5f7712231012efeca3.tar.gz bcm5719-llvm-453b012513e67aa99b3d4c5f7712231012efeca3.zip |
Make sure to always check the result of
SourceManager::getPresumedLoc(), so that we don't try to make use of
an invalid presumed location. Doing so can cause crashes.
llvm-svn: 118885
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 7d428402db4..7aa3b31bc73 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -804,7 +804,9 @@ static bool ReadLineMarkerFlags(bool &IsFileEntry, bool &IsFileExit, FileID CurFileID = SM.getDecomposedInstantiationLoc(FlagTok.getLocation()).first; PresumedLoc PLoc = SM.getPresumedLoc(FlagTok.getLocation()); - + if (PLoc.isInvalid()) + return true; + // If there is no include loc (main file) or if the include loc is in a // different physical file, then we aren't in a "1" line marker flag region. SourceLocation IncLoc = PLoc.getIncludeLoc(); |