summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PrintPreprocessedOutput.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend/PrintPreprocessedOutput.cpp')
-rw-r--r--clang/lib/Frontend/PrintPreprocessedOutput.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
index 5dd7980d81b..9524b58e3a2 100644
--- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -326,8 +326,18 @@ void PrintPPOutputPPCallbacks::InclusionDirective(SourceLocation HashLoc,
if (Imported) {
startNewLineIfNeeded();
MoveToLine(HashLoc);
- OS << "@import " << Imported->getFullModuleName() << ";"
- << " /* clang -E: implicit import for \"" << File->getName() << "\" */";
+ if (PP.getLangOpts().ObjC2) {
+ OS << "@import " << Imported->getFullModuleName() << ";"
+ << " /* clang -E: implicit import for \"" << File->getName()
+ << "\" */";
+ } else {
+ // FIXME: Preseve whether this was a
+ // #include/#include_next/#include_macros/#import.
+ OS << "#include "
+ << (IsAngled ? '<' : '"')
+ << FileName
+ << (IsAngled ? '>' : '"');
+ }
// Since we want a newline after the @import, but not a #<line>, start a new
// line immediately.
EmittedTokensOnThisLine = true;
OpenPOWER on IntegriCloud