diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-08-27 06:37:51 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-08-27 06:37:51 +0000 |
commit | 6be16fe900bdd1e5f677d23ae34fffead5bcfc77 (patch) | |
tree | 7f294f558d6190ba441ff9fe78931781e5fefa57 /lib/Lex/Preprocessor.cpp | |
parent | 72e4d0c0bffd48eb76dabffbc044ee6f19dad6f8 (diff) |
Take an entirely different approach to handling the "parsing" of
__import__ within the preprocessor, since the prior one foolishly
assumed that Preprocessor::Lex() was re-entrant. We now handle
__import__ at the top level (only), after macro expansion. This should
fix the buildbot failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 1d1687d84b..51908bdb87 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -88,6 +88,8 @@ Preprocessor::Preprocessor(Diagnostic &diags, const LangOptions &opts, // We haven't read anything from the external source. ReadMacrosFromExternalSource = false; + LexDepth = 0; + // "Poison" __VA_ARGS__, which can only appear in the expansion of a macro. // This gets unpoisoned where it is allowed. (Ident__VA_ARGS__ = getIdentifierInfo("__VA_ARGS__"))->setIsPoisoned(); @@ -484,7 +486,7 @@ void Preprocessor::HandleIdentifier(Token &Identifier) { if (!DisableMacroExpansion && !Identifier.isExpandDisabled()) { if (MI->isEnabled()) { if (!HandleMacroExpandedIdentifier(Identifier, MI)) - goto finish; + return; } else { // C99 6.10.3.4p2 says that a disabled macro may never again be // expanded, even if it's in a context where it could be expanded in the @@ -506,12 +508,6 @@ void Preprocessor::HandleIdentifier(Token &Identifier) { // like "#define TY typeof", "TY(1) x". if (II.isExtensionToken() && !DisableMacroExpansion) Diag(Identifier, diag::ext_token_used); - -finish: - // If we have the start of a module import, handle it now. - if (Identifier.is(tok::kw___import__) && - !InMacroArgs && !DisableMacroExpansion) - HandleModuleImport(Identifier); } void Preprocessor::HandleModuleImport(Token &Import) { |