[PATCH] [lld] Add basic linker script parsing.
Shankar Kalpathi Easwaran
shankarke at gmail.com
Wed Feb 27 21:58:02 PST 2013
================
Comment at: lib/ReaderWriter/LinkerScript.cpp:55
@@ +54,3 @@
+ switch (_buffer[0]) {
+ case 0:
+ tok = Token(_buffer.substr(0, 1), Token::eof);
----------------
should this be \0 ?
How about scripts having multiple lines of these ? Should that be handled too ?
Might be good to raise an EOF only when you reached the eof while reading the file.
================
Comment at: lib/ReaderWriter/LinkerScript.cpp:69-70
@@ +68,4 @@
+ /// keyword or identifer.
+ StringRef::size_type end =
+ _buffer.find_first_of(" !@#$%^&*?><,~`\t\r\n()+={}[]\"':;\0");
+ if (end == StringRef::npos || end == 0) {
----------------
Why these characters, !@#$%... ? The tokens can only be seperated only by spaces or tabs right ?
================
Comment at: lib/ReaderWriter/LinkerScript.cpp:101
@@ +100,3 @@
+ case '/':
+ if (_buffer.size() >= 2 && _buffer[1] == '*') {
+ // Skip starting /*
----------------
It would be good to support // comments too ??
================
Comment at: lib/ReaderWriter/LinkerScript.cpp:116-117
@@ +115,4 @@
+ }
+ } else
+ return;
+ break;
----------------
should this return an error, if the comment is not formatted properly?
http://llvm-reviews.chandlerc.com/D477
More information about the llvm-commits
mailing list