diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-06-28 01:57:04 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-06-28 01:57:04 +0000 |
commit | f5262c638565ca86ca7f3e7e47a2960c2e82aa53 (patch) | |
tree | 732003c760c967dd836c6537346263d6a7e1bc93 /clang/lib/Sema/Sema.cpp | |
parent | ec5d568ac128bde27488bc44969f1fbc8c8a0c7a (diff) | |
download | bcm5719-llvm-f5262c638565ca86ca7f3e7e47a2960c2e82aa53.tar.gz bcm5719-llvm-f5262c638565ca86ca7f3e7e47a2960c2e82aa53.zip |
[modules] Do not serialize / deserialize pending new/delete mismatch
checks across module boundaries. This was causing us to load constructor
definitions for all consumers of a module with a pending check.
(In one case we saw ~7% of total frontend time spent loading
constructors for this check.)
llvm-svn: 335807
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 7a8cd1ca4e6..d6d105c3b04 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1010,11 +1010,6 @@ void Sema::ActOnEndOfTranslationUnit() { // Warnings emitted in ActOnEndOfTranslationUnit() should be emitted for // modules when they are built, not every time they are used. emitAndClearUnusedLocalTypedefWarnings(); - - // Modules don't need any of the checking below. - if (!PP.isIncrementalProcessingEnabled()) - TUScope = nullptr; - return; } // C99 6.9.2p2: @@ -1032,8 +1027,7 @@ void Sema::ActOnEndOfTranslationUnit() { for (TentativeDefinitionsType::iterator T = TentativeDefinitions.begin(ExternalSource), TEnd = TentativeDefinitions.end(); - T != TEnd; ++T) - { + T != TEnd; ++T) { VarDecl *VD = (*T)->getActingDefinition(); // If the tentative definition was completed, getActingDefinition() returns @@ -1060,12 +1054,13 @@ void Sema::ActOnEndOfTranslationUnit() { // Notify the consumer that we've completed a tentative definition. if (!VD->isInvalidDecl()) Consumer.CompleteTentativeDefinition(VD); - } // If there were errors, disable 'unused' warnings since they will mostly be - // noise. - if (!Diags.hasErrorOccurred()) { + // noise. Don't warn for a use from a module: either we should warn on all + // file-scope declarations in modules or not at all, but whether the + // declaration is used is immaterial. + if (!Diags.hasErrorOccurred() && TUKind != TU_Module) { // Output warning for unused file scoped decls. for (UnusedFileScopedDeclsType::iterator I = UnusedFileScopedDecls.begin(ExternalSource), @@ -1133,6 +1128,8 @@ void Sema::ActOnEndOfTranslationUnit() { } if (!Diags.isIgnored(diag::warn_unused_private_field, SourceLocation())) { + // FIXME: Load additional unused private field candidates from the external + // source. RecordCompleteMap RecordsComplete; RecordCompleteMap MNCComplete; for (NamedDeclSetType::iterator I = UnusedPrivateFields.begin(), |