summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseAST.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-08-26 00:14:38 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-08-26 00:14:38 +0000
commitbbcc9f0462c1b56e0bd6bdd830bd0250ec8ad2d4 (patch)
tree707cccea7fa2a04369d734745e2af81e860a1fde /clang/lib/Parse/ParseAST.cpp
parent7c5ae7cbc60f1196bd4cde77c68f4b6995596215 (diff)
downloadbcm5719-llvm-bbcc9f0462c1b56e0bd6bdd830bd0250ec8ad2d4.tar.gz
bcm5719-llvm-bbcc9f0462c1b56e0bd6bdd830bd0250ec8ad2d4.zip
C++ Modules TS: add frontend support for building pcm files from module
interface files. At the moment, all declarations (and no macros) are exported, and 'export' declarations are not supported yet. llvm-svn: 279794
Diffstat (limited to 'clang/lib/Parse/ParseAST.cpp')
-rw-r--r--clang/lib/Parse/ParseAST.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/clang/lib/Parse/ParseAST.cpp b/clang/lib/Parse/ParseAST.cpp
index bab3dbefb0d..d018d4c08ed 100644
--- a/clang/lib/Parse/ParseAST.cpp
+++ b/clang/lib/Parse/ParseAST.cpp
@@ -138,26 +138,18 @@ void clang::ParseAST(Sema &S, bool PrintStats, bool SkipFunctionBodies) {
S.getPreprocessor().EnterMainSourceFile();
P.Initialize();
- // C11 6.9p1 says translation units must have at least one top-level
- // declaration. C++ doesn't have this restriction. We also don't want to
- // complain if we have a precompiled header, although technically if the PCH
- // is empty we should still emit the (pedantic) diagnostic.
Parser::DeclGroupPtrTy ADecl;
ExternalASTSource *External = S.getASTContext().getExternalSource();
if (External)
External->StartTranslationUnit(Consumer);
- if (P.ParseFirstTopLevelDecl(ADecl)) {
- if (!External && !S.getLangOpts().CPlusPlus)
- P.Diag(diag::ext_empty_translation_unit);
- } else {
- do {
- // If we got a null return and something *was* parsed, ignore it. This
- // is due to a top-level semicolon, an action override, or a parse error
- // skipping something.
- if (ADecl && !Consumer->HandleTopLevelDecl(ADecl.get()))
- return;
- } while (!P.ParseTopLevelDecl(ADecl));
+ for (bool AtEOF = P.ParseFirstTopLevelDecl(ADecl); !AtEOF;
+ AtEOF = P.ParseTopLevelDecl(ADecl)) {
+ // If we got a null return and something *was* parsed, ignore it. This
+ // is due to a top-level semicolon, an action override, or a parse error
+ // skipping something.
+ if (ADecl && !Consumer->HandleTopLevelDecl(ADecl.get()))
+ return;
}
// Process any TopLevelDecls generated by #pragma weak.
OpenPOWER on IntegriCloud