diff options
Diffstat (limited to 'lib/Lex/Pragma.cpp')
| -rw-r--r-- | lib/Lex/Pragma.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Lex/Pragma.cpp b/lib/Lex/Pragma.cpp index 1819f4f06bc53..3bdd31b26ff8b 100644 --- a/lib/Lex/Pragma.cpp +++ b/lib/Lex/Pragma.cpp @@ -354,7 +354,9 @@ void Preprocessor::HandleMicrosoft__pragma(Token &Tok) { /// HandlePragmaOnce - Handle \#pragma once. OnceTok is the 'once'. /// void Preprocessor::HandlePragmaOnce(Token &OnceTok) { - if (isInPrimaryFile()) { + // Don't honor the 'once' when handling the primary source file, unless + // this is a prefix to a TU, which indicates we're generating a PCH file. + if (isInPrimaryFile() && TUKind != TU_Prefix) { Diag(OnceTok, diag::pp_pragma_once_in_main_file); return; } |
