This website requires JavaScript.
Explore
Help
Sign In
maxjhandsome
/
llvm-project
forked from
OSchip/llvm-project
Watch
1
Star
0
Fork
You've already forked llvm-project
0
Code
Issues
Pull Requests
Packages
Releases
Wiki
Activity
3aac38e90f
llvm-project
/
clang
/
test
/
Modules
/
Inputs
/
diamond_right.h
8 lines
103 B
C
Raw
Normal View
History
Unescape
Escape
Switch __import__ over to __import_module__, so we don't conflict with existing practice with Python extension modules. Not that Python extension modules should be using a double-underscored identifier anyway, but... llvm-svn: 138870
2011-09-01 02:19:09 +08:00
__import_module__
diamond_top
;
Introduce support for a simple module import declaration, which loads the named module. The syntax itself is intentionally hideous and will be replaced at some later point with something more palatable. For now, we're focusing on the semantics: - Module imports are handled first by the preprocessor (to get macro definitions) and then the same tokens are also handled by the parser (to get declarations). If both happen (as in normal compilation), the second one is redundant, because we currently have no way to hide macros or declarations when loading a module. Chris gets credit for this mad-but-workable scheme. - The Preprocessor now holds on to a reference to a module loader, which is responsible for loading named modules. CompilerInstance is the only important module loader: it now knows how to create and wire up an AST reader on demand to actually perform the module load. - We search for modules in the include path, using the module name with the suffix ".pcm" (precompiled module) for the file name. This is a temporary hack; we hope to improve the situation in the future. llvm-svn: 138679
2011-08-27 07:56:07 +08:00
Teach ModuleManager::addModule() to check whether a particular module has already been loaded before allocating a new Module structure. If the module has already been loaded (uniquing based on file name), then just return the existing module rather than trying to load it again. This allows us to load a DAG of modules. Introduce a simple test case that forms a diamond-shaped module graph, and illustrates that a source file importing the bottom of the diamond can see declarations in all four of the modules that make up the diamond. Note that this version moves the file-opening logic into the module manager, rather than splitting it between the module manager and the AST reader. More importantly, it properly handles the weird-but-possibly-useful case of loading an AST file from "-". llvm-svn: 138030
2011-08-19 10:29:29 +08:00
double
right
(
double
*
)
;
Make the loading of multiple records for the same identifier (from different modules) more robust. It already handled (simple) merges of the set of declarations attached to that identifier, so add a test case that shows us getting two different declarations for the same identifier (one struct, one function) from different modules, and are able to use both of them. llvm-svn: 138189
2011-08-20 13:09:43 +08:00
struct
left_and_right
{
int
left
,
right
;
}
;