diff options
author | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2019-08-26 23:28:05 +0000 |
---|---|---|
committer | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2019-08-26 23:28:05 +0000 |
commit | 6137cecf87cc29e924d0bfb9f8f4bbe98b7c0f2b (patch) | |
tree | 5ff589822bdf3719f1a70ea91c9d6b664d0e6216 /clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp | |
parent | ba7e191e434f6a0988e67ff3fa02b7756684c74f (diff) | |
download | bcm5719-llvm-6137cecf87cc29e924d0bfb9f8f4bbe98b7c0f2b.tar.gz bcm5719-llvm-6137cecf87cc29e924d0bfb9f8f4bbe98b7c0f2b.zip |
[clang-scan-deps] Minimizer: Correctly skip over double slashes in angle bracket #include
Previously, double slashes (//) occurring in angle brackets #include were incorrectly interpreted as comments. eg. #include <dir//file.h>
Differential Revision: https://reviews.llvm.org/D66550
llvm-svn: 369988
Diffstat (limited to 'clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp')
-rw-r--r-- | clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp b/clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp index 396d49bcdaf..265a6e44e33 100644 --- a/clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp +++ b/clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp @@ -186,8 +186,8 @@ static void skipRawString(const char *&First, const char *const End) { } static void skipString(const char *&First, const char *const End) { - assert(*First == '\'' || *First == '"'); - const char Terminator = *First; + assert(*First == '\'' || *First == '"' || *First == '<'); + const char Terminator = *First == '<' ? '>' : *First; for (++First; First != End && *First != Terminator; ++First) if (*First == '\\') if (++First == End) @@ -363,7 +363,8 @@ void Minimizer::printToNewline(const char *&First, const char *const End) { const char *Last = First; do { // Iterate over strings correctly to avoid comments and newlines. - if (*Last == '"' || *Last == '\'') { + if (*Last == '"' || *Last == '\'' || + (*Last == '<' && top() == pp_include)) { if (LLVM_UNLIKELY(isRawStringLiteral(First, Last))) skipRawString(Last, End); else |