// this as "foo / bar" and langauges with Line comments would lex it as
// "foo". Check to see if the character after the second slash is a '*'.
// If so, we will lex that as a "/" instead of the start of a comment.
- // However, we never do this in -traditional-cpp mode.
- if ((LangOpts.LineComment ||
- getCharAndSize(CurPtr+SizeTmp, SizeTmp2) != '*') &&
- !LangOpts.TraditionalCPP) {
+ // However, we never do this if we are just preprocessing.
+ bool TreatAsComment = LangOpts.LineComment && !LangOpts.TraditionalCPP;
+ if (!TreatAsComment)
+ if (!(PP && PP->isPreprocessedOutput()))
+ TreatAsComment = getCharAndSize(CurPtr+SizeTmp, SizeTmp2) != '*';
+
+ if (TreatAsComment) {
if (SkipLineComment(Result, ConsumeChar(CurPtr, SizeTmp, Result)))
return; // There is a token to return.
/* RUN: %clang_cc1 %s -std=c89 -Eonly -verify -pedantic-errors
+ * RUN: %clang_cc1 %s -std=c89 -E | FileCheck %s
*/
/* PR3919 */
#define foo3$bar /* expected-error {{'$' in identifier}} */
+/* CHECK-NOT: this comment should be missing
+ * CHECK: {{^}}// this comment should be present{{$}}
+ */
+// this comment should be present
/* CHECK-NOT: {{^}}a b c in skipped block{{$}}
* CHECK-NOT: {{^}}/* Comments are whitespace too
*/
+
+Preserve URLs: http://clang.llvm.org
+/* CHECK: {{^}}Preserve URLs: http://clang.llvm.org{{$}}
+ */