Previously, an #error directive with quoted, multi-line content, along with CR+LF line endings wasn't handled correctly.
Details
- Reviewers
arphaman dexonsmith Bigcheese rsmith - Commits
- rG3c307370c8f8: Try fixing CRLF issues in Git with [clang-scan-deps] Minimizer: Correctly…
rC370219: Try fixing CRLF issues in Git with [clang-scan-deps] Minimizer: Correctly…
rL370219: Try fixing CRLF issues in Git with [clang-scan-deps] Minimizer: Correctly…
rG57b4e107e43a: Re-land [clang-scan-deps] Minimizer: Correctly handle multi-line content with…
rC370129: Re-land [clang-scan-deps] Minimizer: Correctly handle multi-line content with…
rL370129: Re-land [clang-scan-deps] Minimizer: Correctly handle multi-line content with…
rG2abca4f06cfe: [clang-scan-deps] Minimizer: Correctly handle multi-line content with CR+LF…
rC369986: [clang-scan-deps] Minimizer: Correctly handle multi-line content with CR+LF…
rL369986: [clang-scan-deps] Minimizer: Correctly handle multi-line content with CR+LF…
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Lex/DependencyDirectivesSourceMinimizer.cpp | ||
---|---|---|
213 ↗ | (On Diff #216474) | Nit: Please add && "expected newline") to the assert. |
240 ↗ | (On Diff #216474) | This return now changes behavior of skipToNewlineRaw for the clients, as First is now right after the newline if this return is taken, as opposed to right before the newline, like it used to be before this patch. I think you need to move First += Len after this return. |
Can we count on tr when we have shell? If so, I suggest this instead:
// REQUIRES: shell // RUN: tr '\n' '\r\n' <%s | %clang_cc1 -DOTHER -print-dependency-directives-minimized-source 2>&1 | FileCheck %s
Eh, nevermind, tr doesn't handle multi-character replacements. Better to answer Alex's question.
I'm not sure what happens, but I see you added .gitattributes. I'd commit it as is. Buildbots using svn will keep working. You can check that the monorepo has the right line endings afterwards, and try again if not.
This broke users of the monorepo, where the file would show up as having changed locally, and with no way to reset it. I'm guessing that's because it was checked in with LF endings and then because of the .gitattributes file, it changes at checkout. I think the correct solution would be to check in the file with CRLF endings and not set any attributes or stuff. (Though this is all super confusing and I might have got it wrong.)
I've deleted the test file in r370175 to unblock development in the meantime.
It already had CRLF endings locally before commit.
It is strange, the file shows up as having CRLF endings in the old revision in git, before the revert: https://raw.githubusercontent.com/llvm/llvm-project/9774a2ba279aea35f166b8ca489d0e8292026c38/clang/test/Lexer/minimize_source_to_dependency_directives_invalid_error.c
The same kind of problem occured in rL311683, later fixed by rL311732.
If you're fine with that, I'll do the same thing: remove .gitattributes and just re-commit the file minimize_source_to_dependency_directives_invalid_error.c with svn:eol-style CRLF.
Fwiw, this seems to me somewhat like a git bug; if I edit the .gitattributes file and comment out the problematic line, do a git diff, then uncomment the line again, then git diff suddenly shows no changes.