]> granicus.if.org Git - clang/commitdiff
fix 7320: we can't delete a trailing space if it doesn't exist.
authorChris Lattner <sabre@nondot.org>
Sun, 5 Sep 2010 23:16:09 +0000 (23:16 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 5 Sep 2010 23:16:09 +0000 (23:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113125 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/Pragma.cpp

index 7975da58b6bd68c6fa3a7e98f3cf4257f92fec86..a7b289e137ebf73dd7a05b87e2fcaa90b5a59b65 100644 (file)
@@ -384,7 +384,9 @@ void Preprocessor::HandlePragmaDependency(Token &DependencyTok) {
       Lex(DependencyTok);
     }
 
-    Message.erase(Message.end()-1);
+    // Remove the trailing ' ' if present.
+    if (!Message.empty())
+      Message.erase(Message.end()-1);
     Diag(FilenameTok, diag::pp_out_of_date_dependency) << Message;
   }
 }