[PATCH] [lld] [LinkerScript] Implement linker script expression evaluation
Rui Ueyama
ruiu at google.com
Sun Mar 8 19:01:45 PDT 2015
================
Comment at: lib/ReaderWriter/LinkerScript.cpp:545
@@ +544,3 @@
+ return LinkerScriptReaderError::unknown_symbol_in_expr;
+ return symbolTable[_name];
+}
----------------
Maybe you want to use find and compare the return value with end, so that you don't look up the table twice.
================
Comment at: lib/ReaderWriter/LinkerScript.cpp:582
@@ +581,3 @@
+ case Unary::Minus:
+ return 0 - childRes;
+ case Unary::Not:
----------------
nit: return -childRes;
================
Comment at: lib/ReaderWriter/LinkerScript.cpp:588
@@ +587,3 @@
+ llvm_unreachable("");
+ return 0;
+}
----------------
Remove this line. I believe llvm_unreachable has __attribute__((noreturn)), so no warning would be issued.
================
Comment at: lib/ReaderWriter/LinkerScript.cpp:674
@@ +673,3 @@
+ llvm_unreachable("");
+ return 0;
+}
----------------
Ditto
================
Comment at: lib/ReaderWriter/LinkerScript.cpp:705
@@ +704,3 @@
+ return falseExprRes;
+}
+
----------------
Is it okay to compute both "then" and "else" clauses regardless of a condition value? In a normal programming language, we don't do that -- for example, if (true) {} else { 1 / 0; } doesn't fail.
http://reviews.llvm.org/D8156
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list