================
@@ -2068,7 +2068,8 @@ bool Lexer::LexNumericConstant(Token &Result, const char 
*CurPtr) {
   }
 
   // If we have a digit separator, continue.
-  if (C == '\'' && (LangOpts.CPlusPlus14 || LangOpts.C23)) {
+  if (C == '\'' &&
+      (LangOpts.CPlusPlus14 || LangOpts.C23 || ParsingPreprocessorDirective)) {
----------------
cor3ntin wrote:

> We've been trying to avoid specializing Clang itself for dependency scanning

Except the only reason for these flags to exists is because of dependency 
scanning.
The sad reality is that there are preprocessor divergence across language modes 
and the only way we can avoid that is by creating a dialect.

I do agree with you that we should 1/ Try to minimize such divergences and 2/ 
Document the preprocessor as understood by the dependency scanner.

As this PR shows, Clang cannot ignore the existence of this dialect, and I 
think being coy about it isn't in fact making maintenance either: ultimately, 
there is a tension between C and C++ preprocessor evolving and sometimes 
diverging, and tooling needing to pretend the preprocessor is not affected by 
language mode.

Clang needs to deal with that and I don't think it's wide to bury that in the 
driver or to add lots of very targeted flags that will only ever make sense in 
context of dependency scanning.

https://github.com/llvm/llvm-project/pull/95798
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to