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 | d90c3c92d58a2757aab06b5d6d034a8f199c1ab5 (patch) | |
tree | 8c825a3fa27aabf8888ece680c40231084389129 /clang/lib/Lex/Preprocessor.cpp | |
parent | d22f9b395b8247020cea7d013429e895e7468f74 (diff) | |
download | bcm5719-llvm-d90c3c92d58a2757aab06b5d6d034a8f199c1ab5.tar.gz bcm5719-llvm-d90c3c92d58a2757aab06b5d6d034a8f199c1ab5.zip |
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.
llvm-svn: 138704
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 1d1687d84b9..51908bdb878 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/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) { |