diff options
| author | Douglas Gregor <dgregor@apple.com> | 2012-10-11 00:46:49 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2012-10-11 00:46:49 +0000 |
| commit | 5a4649b034dd247a8e47792e4026036576ab7863 (patch) | |
| tree | 8ab1c702997a85a6d960254300e625fb53d8bfbd /clang/test/Modules/Inputs | |
| parent | 45df60c1f3289dd3061f613644815f745b76cce6 (diff) | |
| download | bcm5719-llvm-5a4649b034dd247a8e47792e4026036576ab7863.tar.gz bcm5719-llvm-5a4649b034dd247a8e47792e4026036576ab7863.zip | |
Deserialize macro history when we deserialize an identifier that has
macro history.
When deserializing macro history, we arrange history such that the
macros that have definitions (that haven't been #undef'd) and are
visible come at the beginning of the list, which is what the
preprocessor and other clients of Preprocessor::getMacroInfo()
expect. If additional macro definitions become visible later, they'll
be moved toward the front of the list. Note that it's possible to have
ambiguities, but we don't diagnose them yet.
There is a partially-implemented design decision here that, if a
particular identifier has been defined or #undef'd within the
translation unit, that definition (or #undef) hides any macro
definitions that come from imported modules. There's still a little
work to do to ensure that the right #undef'ing happens.
Additionally, we'll need to scope the update records for #undefs, so
they only kick in when the submodule containing that update record
becomes visible.
llvm-svn: 165682
Diffstat (limited to 'clang/test/Modules/Inputs')
| -rw-r--r-- | clang/test/Modules/Inputs/macros_left.h | 7 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/macros_right.h | 9 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/module.map | 11 |
3 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/macros_left.h b/clang/test/Modules/Inputs/macros_left.h index dfe56052bfc..919dc20ebc9 100644 --- a/clang/test/Modules/Inputs/macros_left.h +++ b/clang/test/Modules/Inputs/macros_left.h @@ -3,3 +3,10 @@ #undef TOP_LEFT_UNDEF + + + +#define LEFT_RIGHT_IDENTICAL int +#define LEFT_RIGHT_DIFFERENT float +#define LEFT_RIGHT_DIFFERENT2 float +#define LEFT_RIGHT_DIFFERENT3 float diff --git a/clang/test/Modules/Inputs/macros_right.h b/clang/test/Modules/Inputs/macros_right.h index 3351e9796c4..8e9688223bc 100644 --- a/clang/test/Modules/Inputs/macros_right.h +++ b/clang/test/Modules/Inputs/macros_right.h @@ -4,3 +4,12 @@ #undef TOP_RIGHT_REDEF #define TOP_RIGHT_REDEF float + + + + +#define LEFT_RIGHT_IDENTICAL int +#define LEFT_RIGHT_DIFFERENT int +#define LEFT_RIGHT_DIFFERENT2 int +#define LEFT_RIGHT_DIFFERENT3 int + diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map index 9044922799a..b26234382b1 100644 --- a/clang/test/Modules/Inputs/module.map +++ b/clang/test/Modules/Inputs/module.map @@ -18,6 +18,17 @@ module lookup_left_cxx { header "lookup_left.hpp" } module lookup_right_cxx { header "lookup_right.hpp" } module module_private_left { header "module_private_left.h" } module module_private_right { header "module_private_right.h" } +module macros_top { + header "macros_top.h" +} +module macros_left { + header "macros_left.h" + export * +} +module macros_right { + header "macros_right.h" + export * +} module macros { header "macros.h" } module category_top { header "category_top.h" } module category_left { |

