aboutsummaryrefslogtreecommitdiff
path: root/src/all_types.hpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-03-18 11:24:58 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-03-18 11:28:43 -0400
commitfa7c64ccd511703fef9971c4d07c447c9aeda49c (patch)
tree6f41eb742160ec1584b6adb719ec1327f9e3c831 /src/all_types.hpp
parentaf536ac343564e5120f99cbf3b7fc9efa984eb93 (diff)
downloadzig-fa7c64ccd511703fef9971c4d07c447c9aeda49c.tar.gz
zig-fa7c64ccd511703fef9971c4d07c447c9aeda49c.zip
lazy analysis of top level declarations
previously, we had lazy analysis of top level declarations, but if a declaration was referenced within a compile-time if or switch statement, that would still add the top level declaration to the resolution queue. now we have a declref ir instruction, which is only resolved if we analyze the instruction. this takes into account comptime branching. closes #270
Diffstat (limited to 'src/all_types.hpp')
-rw-r--r--src/all_types.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/all_types.hpp b/src/all_types.hpp
index 48777b6df0..b3faff2212 100644
--- a/src/all_types.hpp
+++ b/src/all_types.hpp
@@ -1610,6 +1610,12 @@ struct IrBasicBlock {
IrInstruction *must_be_comptime_source_instr;
};
+struct LVal {
+ bool is_ptr;
+ bool is_const;
+ bool is_volatile;
+};
+
enum IrInstructionId {
IrInstructionIdInvalid,
IrInstructionIdBr,
@@ -1701,6 +1707,7 @@ enum IrInstructionId {
IrInstructionIdCanImplicitCast,
IrInstructionIdSetGlobalAlign,
IrInstructionIdSetGlobalSection,
+ IrInstructionIdDeclRef,
};
struct IrInstruction {
@@ -2421,6 +2428,13 @@ struct IrInstructionSetGlobalSection {
IrInstruction *value;
};
+struct IrInstructionDeclRef {
+ IrInstruction base;
+
+ Tld *tld;
+ LVal lval;
+};
+
static const size_t slice_ptr_index = 0;
static const size_t slice_len_index = 1;