romanovvlad added a comment.

Hi @Meinersbur,

It seems the patch introduces one more regression. The following test doesn't 
pass on Windows:

  // RUN: %clang -E %s -o %t.ii
  // RUN: %clang %t.ii
  
  #include "string.h"
  
  int main() {
    return 0;
  }

The following macro from vcruntime.h:

  #define _CRT_BEGIN_C_HEADER            \
      __pragma(pack(push, _CRT_PACKING)) \
      extern "C" {

Becomes

  #pragma pack(push, 8) extern "C" {

in the preprocessed file.

I'm not an expert in this code, but partially returning old behavior helped 
with that:

diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp 
b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
index b725956..b49b247 100644

- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp

+++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -772,6 +772,7 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token 
&Tok,

  bool IsStartOfLine = false;
  char Buffer[256];
  while (1) {

+    Callbacks->MoveToLine(Tok.getLocation(), /*RequireStartOfLine=*/false);

  // Two lines joined with line continuation ('\' as last character on the
  // line) must be emitted as one line even though Tok.getLine() returns two
  // different values. In this situation Tok.isAtStartOfLine() is false even

Could you please take a look?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104601/new/

https://reviews.llvm.org/D104601

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to