Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Allow ! and // comments after some preprocessing directives
Old-style C /*comments*/ are omitted from preprocessor directive token sequences by the prescanner, but line-ending C++ and Fortran free-form comments are not since their handling might depend on the directive. Add code to skip these line-ending comments as appropriate in place of existing code that just skipped blanks. Reviewed By: sscalpone Differential Revision: https://reviews.llvm.org/D84061
- Loading branch information
Showing
4 changed files
with
55 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
! RUN: %f18 -funparse %s 2>&1 | FileCheck %s | ||
|
||
#define pmk | ||
#ifdef pmk // comment | ||
! CHECK: t1 | ||
real t1 | ||
#endif // comment | ||
#undef pmk ! comment | ||
#ifndef pmk ! comment | ||
! CHECK: t2 | ||
real t2 | ||
#endif // comment | ||
#if 0 /* C comment */ + 0 | ||
! CHECK-NOT: misinterpreted | ||
# error misinterpreted #if | ||
#else // comment | ||
! CHECK: END PROGRAM | ||
end | ||
#endif ! comment |