Meinersbur updated this revision to Diff 362611. Meinersbur added a comment.
- Fix embrassing mistakes in skip-empty-lines test (misspelled "LINEMARKES", MINWS<->MINCOL, absolute path) - Skip-empty-lines now also checks leading whitespace behavior - Fix typos in comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D106924/new/ https://reviews.llvm.org/D106924 Files: clang/lib/Frontend/PrintPreprocessedOutput.cpp clang/test/Preprocessor/minimize-whitespace.c clang/test/Preprocessor/skip-empty-lines.c
Index: clang/test/Preprocessor/skip-empty-lines.c =================================================================== --- clang/test/Preprocessor/skip-empty-lines.c +++ clang/test/Preprocessor/skip-empty-lines.c @@ -1,44 +1,45 @@ -int a ; -int b ; + int a ; + int b ; // A single empty line -int c ; + int c ; /* more than 8 empty lines - +(forces a line marker instead of newline padding) */ -int d ; + int d ; -// RUN: %clang_cc1 -E %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=LINEMARKES +// RUN: %clang_cc1 -E %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=LINEMARKERS // RUN: %clang_cc1 -E -P %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=COLSONLY -// RUN: %clang_cc1 -E -fminimize-whitespace %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=MINWS -// RUN: %clang_cc1 -E -P -fminimize-whitespace %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=MINCOL +// RUN: %clang_cc1 -E -fminimize-whitespace %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=MINCOL +// RUN: %clang_cc1 -E -P -fminimize-whitespace %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=MINWS -// Check behavior after variying number of lines without emitted tokens. +// Check behavior after varying number of lines without emitted tokens. -// LINEMARKES: # 1 "{{.*}}skip-empty-lines.c" 2 -// LINEMARKERS-NEXT: int a ; -// LINEMARKERS-NEXT: int b ; +// LINEMARKERS: {{^}}# 1 "{{.*}}skip-empty-lines.c" 2 +// LINEMARKERS-NEXT: {{^}} int a ; +// LINEMARKERS-NEXT: {{^}} int b ; // LINEMARKERS-EMPTY: -// LINEMARKERS-NEXT: int c ; -// LINEMARKERS-NEXT: # 14 "/c/Users/meinersbur/src/llvm-project/clang/test/Preprocessor/skip-empty-lines.c" -// LINEMARKERS-NEXT: int d ; - -// COLSONLY: int a ; -// COLSONLY-NEXT: int b ; -// COLSONLY-NEXT: int c ; -// COLSONLY-NEXT: int d ; - -// MINWS: # 1 "{{.*}}skip-empty-lines.c" 2 -// MINWS-NEXT: int a; -// MINWS-NEXT: int b; -// MINWS-EMPTY: -// MINWS-NEXT: int c; -// MINWS-NEXT: # 14 "{{.*}}skip-empty-lines.c" -// MINWS-NEXT: int d; - -// MINCOL: int a;int b;int c;int d; +// LINEMARKERS-NEXT: {{^}} int c ; +// LINEMARKERS-NEXT: {{^}}# 14 "{{.*}}skip-empty-lines.c" +// LINEMARKERS-NEXT: {{^}} int d ; + +// COLSONLY: {{^}} int a ; +// COLSONLY-NEXT: {{^}} int b ; +// COLSONLY-NEXT: {{^}} int c ; +// COLSONLY-NEXT: {{^}} int d ; + +// MINCOL: {{^}}# 1 "{{.*}}skip-empty-lines.c" 2 +// MINCOL-NEXT: {{^}}int a; +// MINCOL-NEXT: {{^}}int b; +// MINCOL-EMPTY: +// MINCOL-NEXT: {{^}}int c; +// MINCOL-NEXT: {{^}}# 14 "{{.*}}skip-empty-lines.c" +// MINCOL-NEXT: {{^}}int d; + +// MINWS: {{^}}int a;int b;int c;int d; + Index: clang/test/Preprocessor/minimize-whitespace.c =================================================================== --- clang/test/Preprocessor/minimize-whitespace.c +++ clang/test/Preprocessor/minimize-whitespace.c @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fminimize-whitespace -E -C %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=MINCCOL // RUN: %clang_cc1 -fminimize-whitespace -E -P %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=MINWS // RUN: %clang_cc1 -fminimize-whitespace -E -C -P %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=MINCWS -// The follow empty lines ensure that a #line directive is emitted instead of newline padding after the RUN lines +// The follow empty lines ensure that a #line directive is emitted instead of newline padding after the RUN comments. Index: clang/lib/Frontend/PrintPreprocessedOutput.cpp =================================================================== --- clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -294,8 +294,8 @@ } StartedNewLine = true; } else if (!StartedNewLine) { - // If we are not on the correct line and don't need to be line-correct, at - // least ensure we start on a new line. + // If we are not on the correct line and don't need to be line-correct, + // at least ensure we start on a new line. OS << '\n'; StartedNewLine = true; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits