zygoloid wrote:

> > I guess the general question is - is it acceptable to have the Scanner 
> > operating in a language standard different than the passed in language mode 
> > and different than the compiler language standard?
> 
> I think that is acceptable. It is kinda hacky, but the lexer and preprocessor 
> are largely independent of the language and the standard. When they do depend 
> on those settings, taking the union of the features and letting the compiler 
> trim it down is still a perfectly sound thing to do.

You can certainly construct cases where the different lexing rules in different 
language modes allow you to detect which language you're in from within the 
preprocessor ([1](https://eel.is/c++draft/diff.cpp11.lex) 
[2](https://eel.is/c++draft/diff.cpp14.lex#2) 
[3](https://eel.is/c++draft/diff.cpp03.lex#1)) or where enabling more language 
mode flags may reject valid code. It may be good enough for what the scanner is 
trying to do, but I think it's a stretch to say that it's sound.

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

Reply via email to