Skip to content

Commit f78e603

Browse files
committed
move some content around to make README more focused
llvm-svn: 39130
1 parent 9fe24d7 commit f78e603

File tree

2 files changed

+82
-92
lines changed

2 files changed

+82
-92
lines changed

clang/NOTES.txt

Lines changed: 78 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,85 @@ This is similar to -Eonly.
3131

3232
//===---------------------------------------------------------------------===//
3333

34-
Interesting fact:
35-
clang -Eonly INPUTS/carbon-header-C-E.c
34+
TODO: File Manager Speedup:
35+
36+
We currently do a lot of stat'ing for files that don't exist, particularly
37+
when lots of -I paths exist (e.g. see the <iostream> example, check for
38+
failures in stat in FileManager::getFile). It would be far better to make
39+
the following changes:
40+
1. FileEntry contains a sys::Path instead of a std::string for Name.
41+
2. sys::Path contains timestamp and size, lazily computed. Eliminate from
42+
FileEntry.
43+
3. File UIDs are created on request, not when files are opened.
44+
These changes make it possible to efficiently have FileEntry objects for
45+
files that exist on the file system, but have not been used yet.
46+
47+
Once this is done:
48+
1. DirectoryEntry gets a boolean value "has read entries". When false, not
49+
all entries in the directory are in the file mgr, when true, they are.
50+
2. Instead of stat'ing the file in FileManager::getFile, check to see if
51+
the dir has been read. If so, fail immediately, if not, read the dir,
52+
then retry.
53+
3. Reading the dir uses the getdirentries syscall, creating an FileEntry
54+
for all files found.
55+
56+
//===---------------------------------------------------------------------===//
57+
58+
TODO: Fast #Import:
59+
60+
* Get frameworks that don't use #import to do so, e.g.
61+
DirectoryService, AudioToolbox, CoreFoundation, etc. Why not using #import?
62+
Because they work in C mode? C has #import.
63+
* Have the lexer return a token for #import instead of handling it itself.
64+
- Create a new preprocessor object with no external state (no -D/U options
65+
from the command line, etc). Alternatively, keep track of exactly which
66+
external state is used by a #import: declare it somehow.
67+
* When having reading a #import file, keep track of whether we have (and/or
68+
which) seen any "configuration" macros. Various cases:
69+
- Uses of target args (__POWERPC__, __i386): Header has to be parsed
70+
multiple times, per-target. What about #ifndef checks? How do we know?
71+
- "Configuration" preprocessor macros not defined: POWERPC, etc. What about
72+
things like __STDC__ etc? What is and what isn't allowed.
73+
* Special handling for "umbrella" headers, which just contain #import stmts:
74+
- Cocoa.h/AppKit.h - Contain pointers to digests instead of entire digests
75+
themselves? Foundation.h isn't pure umbrella!
76+
* Frameworks digests:
77+
- Can put "digest" of a framework-worth of headers into the framework
78+
itself. To open AppKit, just mmap
79+
/System/Library/Frameworks/AppKit.framework/"digest", which provides a
80+
symbol table in a well defined format. Lazily unstream stuff that is
81+
needed. Contains declarations, macros, and debug information.
82+
- System frameworks ship with digests. How do we handle configuration
83+
information? How do we handle stuff like:
84+
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
85+
which guards a bunch of decls? Should there be a couple of default
86+
configs, then have the UI fall back to building/caching its own?
87+
- GUI automatically builds digests when UI is idle, both of system
88+
frameworks if they aren't not available in the right config, and of app
89+
frameworks.
90+
- GUI builds dependence graph of frameworks/digests based on #imports. If a
91+
digest is out date, dependent digests are automatically invalidated.
92+
93+
* New constraints on #import for objc-v3:
94+
- #imported file must not define non-inline function bodies.
95+
- Alternatively, they can, and these bodies get compiled/linked *once*
96+
per app into a dylib. What about building user dylibs?
97+
- Restrictions on ObjC grammar: can't #import the body of a for stmt or fn.
98+
- Compiler must detect and reject these cases.
99+
- #defines defined within a #import have two behaviors:
100+
- By default, they escape the header. These macros *cannot* be #undef'd
101+
by other code: this is enforced by the front-end.
102+
- Optionally, user can specify what macros escape (whitelist) or can use
103+
#undef.
104+
105+
//===---------------------------------------------------------------------===//
106+
107+
TODO: New language feature: Configuration queries:
108+
- Instead of #ifdef __POWERPC__, use "if (strcmp(`cpu`, __POWERPC__))", or
109+
some other, better, syntax.
110+
- Use it to increase the number of "architecture-clean" #import'd files,
111+
allowing a single index to be used for all fat slices.
36112

37-
is much faster than:
38-
wc -w INPUTS/carbon-header-C-E.c
39-
!!
40-
41113
//===---------------------------------------------------------------------===//
42114

43115
The 'portability' model in clang is sufficient to catch translation units (or

clang/README.txt

Lines changed: 4 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -115,25 +115,7 @@ clang driver:
115115
* Include search paths are hard-coded into the driver.
116116

117117
File Manager:
118-
* We currently do a lot of stat'ing for files that don't exist, particularly
119-
when lots of -I paths exist (e.g. see the <iostream> example, check for
120-
failures in stat in FileManager::getFile). It would be far better to make
121-
the following changes:
122-
1. FileEntry contains a sys::Path instead of a std::string for Name.
123-
2. sys::Path contains timestamp and size, lazily computed. Eliminate from
124-
FileEntry.
125-
3. File UIDs are created on request, not when files are opened.
126-
These changes make it possible to efficiently have FileEntry objects for
127-
files that exist on the file system, but have not been used yet.
128-
129-
Once this is done:
130-
1. DirectoryEntry gets a boolean value "has read entries". When false, not
131-
all entries in the directory are in the file mgr, when true, they are.
132-
2. Instead of stat'ing the file in FileManager::getFile, check to see if
133-
the dir has been read. If so, fail immediately, if not, read the dir,
134-
then retry.
135-
3. Reading the dir uses the getdirentries syscall, creating an FileEntry
136-
for all files found.
118+
* Reduce syscalls, see NOTES.txt.
137119

138120
Lexer:
139121
* Source character mapping. GCC supports ASCII and UTF-8.
@@ -149,6 +131,7 @@ Preprocessor:
149131
* MSExtension: "L#param" stringizes to a wide string literal.
150132
* Consider merging the parser's expression parser into the preprocessor to
151133
eliminate duplicate code.
134+
* Add support for -M*
152135

153136
Traditional Preprocessor:
154137
* All.
@@ -161,6 +144,7 @@ Parser:
161144

162145
Parser Actions:
163146
* All that are missing.
147+
* SemaActions vs MinimalActions.
164148
* Would like to either lazily resolve types [refactoring] or aggressively
165149
resolve them [c compiler]. Need to know whether something is a type or not
166150
to compile, but don't need to know what it is.
@@ -169,70 +153,4 @@ Parser Actions:
169153
AST Builder:
170154
* Implement more nodes as actions are available.
171155
* Types.
172-
* Allow the AST Builder to be subclassed. This will allow clients to extend it
173-
and create their own specialized nodes for specific scenarios. Maybe the
174-
"full loc info" use case is just one extension.
175-
176-
Fast #Import:
177-
* All.
178-
* Get frameworks that don't use #import to do so, e.g.
179-
DirectoryService, AudioToolbox, CoreFoundation, etc. Why not using #import?
180-
Because they work in C mode? C has #import.
181-
* Have the lexer return a token for #import instead of handling it itself.
182-
- Create a new preprocessor object with no external state (no -D/U options
183-
from the command line, etc). Alternatively, keep track of exactly which
184-
external state is used by a #import: declare it somehow.
185-
* When having reading a #import file, keep track of whether we have (and/or
186-
which) seen any "configuration" macros. Various cases:
187-
- Uses of target args (__POWERPC__, __i386): Header has to be parsed
188-
multiple times, per-target. What about #ifndef checks? How do we know?
189-
- "Configuration" preprocessor macros not defined: POWERPC, etc. What about
190-
things like __STDC__ etc? What is and what isn't allowed.
191-
* Special handling for "umbrella" headers, which just contain #import stmts:
192-
- Cocoa.h/AppKit.h - Contain pointers to digests instead of entire digests
193-
themselves? Foundation.h isn't pure umbrella!
194-
* Frameworks digests:
195-
- Can put "digest" of a framework-worth of headers into the framework
196-
itself. To open AppKit, just mmap
197-
/System/Library/Frameworks/AppKit.framework/"digest", which provides a
198-
symbol table in a well defined format. Lazily unstream stuff that is
199-
needed. Contains declarations, macros, and debug information.
200-
- System frameworks ship with digests. How do we handle configuration
201-
information? How do we handle stuff like:
202-
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
203-
which guards a bunch of decls? Should there be a couple of default
204-
configs, then have the UI fall back to building/caching its own?
205-
- GUI automatically builds digests when UI is idle, both of system
206-
frameworks if they aren't not available in the right config, and of app
207-
frameworks.
208-
- GUI builds dependence graph of frameworks/digests based on #imports. If a
209-
digest is out date, dependent digests are automatically invalidated.
210-
211-
* New constraints on #import for objc-v3:
212-
- #imported file must not define non-inline function bodies.
213-
- Alternatively, they can, and these bodies get compiled/linked *once*
214-
per app into a dylib. What about building user dylibs?
215-
- Restrictions on ObjC grammar: can't #import the body of a for stmt or fn.
216-
- Compiler must detect and reject these cases.
217-
- #defines defined within a #import have two behaviors:
218-
- By default, they escape the header. These macros *cannot* be #undef'd
219-
by other code: this is enforced by the front-end.
220-
- Optionally, user can specify what macros escape (whitelist) or can use
221-
#undef.
222-
223-
New language feature: Configuration queries:
224-
- Instead of #ifdef __POWERPC__, use "if (strcmp(`cpu`, __POWERPC__))", or
225-
some other, better, syntax.
226-
- Use it to increase the number of "architecture-clean" #import'd files,
227-
allowing a single index to be used for all fat slices.
228-
229-
Cocoa GUI Front-end:
230-
* All.
231-
* Start with very simple "textedit" GUI.
232-
* Trivial project model: list of files, list of cmd line options.
233-
* Build simple developer examples.
234-
* Tight integration with compiler components.
235-
* Primary advantage: batch compiles, keeping digests in memory, dependency mgmt
236-
between app frameworks, building code/digests in the background, etc.
237-
* Interesting idea: http://nickgravgaard.com/elastictabstops/
238-
156+
* Decls.

0 commit comments

Comments
 (0)