[PATCH] D60283: [clang-cl] Don't emit checksums when compiling a preprocessed CPP
Alexandre Ganea via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 5 08:50:15 PDT 2019
aganea updated this revision to Diff 193886.
aganea marked 2 inline comments as done.
aganea edited the summary of this revision.
aganea added a comment.
I made a more elegant change, where no additional lookups or string compares are required.
I noted btw that clang /E does not generate `#line` directives, but simply `#`. In contrast, MSVC cl /E generates `#line` in the preprocessed output. The issue is that MSVC doesn't like `#` alone and throws an error. ie:
$ cat test.cpp
void test() { }
$ clang-cl /c /E test.cpp >test-pre.cpp
$ cat test-pre.cpp
# 1 "C:\\Users\\aganea\\Desktop\\test\\test.cpp"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 361 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "C:\\Users\\aganea\\Desktop\\test\\test.cpp" 2
void test() { }
$ cl /c test-pre.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27027.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
test-pre.cpp
C:\Users\aganea\Desktop\test\test-pre.cpp(1): error C2019: expected preprocessor directive, found '1'
C:\Users\aganea\Desktop\test\test-pre.cpp(2): error C2019: expected preprocessor directive, found '1'
C:\Users\aganea\Desktop\test\test-pre.cpp(3): error C2019: expected preprocessor directive, found '1'
C:\Users\aganea\Desktop\test\test-pre.cpp(4): error C2019: expected preprocessor directive, found '3'
C:\Users\aganea\Desktop\test\test-pre.cpp(5): error C2019: expected preprocessor directive, found '1'
C:\Users\aganea\Desktop\test\test-pre.cpp(6): error C2019: expected preprocessor directive, found '1'
C:\Users\aganea\Desktop\test\test-pre.cpp(7): error C2019: expected preprocessor directive, found '1'
$ cl /c /E test.cpp >test-pre.cpp
$ cat test-pre.cpp
#line 1 "C:\\Users\\aganea\\Desktop\\test\\test.cpp"
void test() { }
$ cl /c test-pre.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27027.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
test-pre.cpp
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60283/new/
https://reviews.llvm.org/D60283
Files:
include/clang/Basic/SourceLocation.h
lib/Basic/SourceManager.cpp
lib/CodeGen/CGDebugInfo.cpp
test/CodeGen/Inputs/debug-info-file-checksum-pre.cpp
test/CodeGen/debug-info-file-checksum.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60283.193886.patch
Type: text/x-patch
Size: 4566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190405/f2be2192/attachment-0001.bin>
More information about the cfe-commits
mailing list