On 08/04/16 03:24, Richard Smith via cfe-commits wrote:
Author: rsmith
Date: Thu Apr 7 20:23:59 2016
New Revision: 265766
URL: http://llvm.org/viewvc/llvm-project?rev=265766&view=rev
Log:
[modules] Add a comment to explain why -E leaves some #includes in the
preprocessed output.
Modified:
cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
cfe/trunk/test/Modules/preprocess.cpp
Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=265766&r1=265765&r2=265766&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Thu Apr 7 20:23:59 2016
@@ -336,7 +336,9 @@ void PrintPPOutputPPCallbacks::Inclusion
OS << "#include "
<< (IsAngled ? '<' : '"')
<< FileName
- << (IsAngled ? '>' : '"');
+ << (IsAngled ? '>' : '"')
+ << " /* clang -E: implicit import for module "
+ << Imported->getFullModuleName() << " */";
It seems that in some cases the FileName needs to be tweaked to be able
to compile the output back. For instance:
clang -I folder/ file.cxx
cat file.cxx
#include "subfolder/A.h"
cat folder/subfolder/A.h
#include "B.h"
B.h resides in folder/subfolder/ and FileName argument would be B.h
causing the printer to generate #include "B.h" /* clang -E: implicit
import for... */ which cannot be compiled back.
}
// Since we want a newline after the @import, but not a #<line>, start a
new
// line immediately.
Modified: cfe/trunk/test/Modules/preprocess.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/preprocess.cpp?rev=265766&r1=265765&r2=265766&view=diff
==============================================================================
--- cfe/trunk/test/Modules/preprocess.cpp (original)
+++ cfe/trunk/test/Modules/preprocess.cpp Thu Apr 7 20:23:59 2016
@@ -1,6 +1,6 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t
-I %S/Inputs -x c++ -E %s | \
-// RUN: FileCheck -strict-whitespace %s --check-prefix=CHECK
--check-prefix=CXX
+// RUN: FileCheck -strict-whitespace %s --check-prefix=CHECK
--check-prefix=CXX --check-prefix=CXX-DASHE
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t
-I %S/Inputs -x objective-c -E %s | \
// RUN: FileCheck -strict-whitespace %s --check-prefix=CHECK
--check-prefix=OBJC
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t
-I %S/Inputs -x c++ -E -frewrite-includes %s | \
@@ -14,7 +14,9 @@ foo bar baz
// The weird {{ }} here is to prevent the -frewrite-includes test from
matching its own CHECK lines.
// CXX: #include{{ }}"dummy.h"
+// CXX-DASHE-SAME: /* clang -E: implicit import for module dummy */
// CXX: #include{{ }}"dummy.h"
+// CXX-DASHE-SAME: /* clang -E: implicit import for module dummy */
// CXX: foo bar baz
// OBJC: @import{{ }}dummy; /* clang
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits