-
Notifications
You must be signed in to change notification settings - Fork 182
[CIR] Add support for SourceLocExpr (__builtin_LINE, etc.) #1988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gh/lanza/2/base
Are you sure you want to change the base?
Conversation
bcardosolopes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one minor nit!
| @@ -0,0 +1,73 @@ | |||
| // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -emit-cir %s -o %t.cir | |||
| // RUN: FileCheck --input-file=%t.cir %s | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add LLVM and OGCG checks too!
|
The windows failure seems exposed after rebase, we should probably REQUIRES linux / darwin for it right now |
Stack from ghstack (oldest at bottom):
This patch implements SourceLocExpr code generation, which enables
support for the following builtin functions:
These builtins are evaluated at compile-time and emit constant values
or global string literals. The implementation follows the traditional
CodeGen approach of using ConstantEmitter to emit abstract constants
from evaluated APValues.
A key challenge was handling synthetic StringLiterals created during
constant evaluation (for __builtin_FILE and __builtin_FUNCTION).
These synthetic literals don't have valid source locations, which
caused assertion failures when creating global string constants.
The fix adds a check in getGlobalForStringLiteral to use
UnknownLoc when the StringLiteral has an invalid source range.
This feature unblocks:
Test coverage includes: