зеркало из https://github.com/microsoft/clang-1.git
[modules] Make sure enabled diagnostic pragmas inside the module don't affect the translation unit that
imports the module. Getting diagnostic sections from modules properly working is a fixme. rdar://13516663 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178151 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
94b748ff16
Коммит
ea744ab5f3
|
@ -432,7 +432,8 @@ private:
|
|||
void WritePreprocessorDetail(PreprocessingRecord &PPRec);
|
||||
void WriteSubmodules(Module *WritingModule);
|
||||
|
||||
void WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag);
|
||||
void WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag,
|
||||
bool isModule);
|
||||
void WriteCXXBaseSpecifiersOffsets();
|
||||
void WriteType(QualType T);
|
||||
uint64_t WriteDeclContextLexicalBlock(ASTContext &Context, DeclContext *DC);
|
||||
|
|
|
@ -2444,8 +2444,14 @@ ASTWriter::inferSubmoduleIDFromLocation(SourceLocation Loc) {
|
|||
return getSubmoduleID(OwningMod);
|
||||
}
|
||||
|
||||
void ASTWriter::WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag) {
|
||||
// FIXME: Make it work properly with modules.
|
||||
void ASTWriter::WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag,
|
||||
bool isModule) {
|
||||
// Make sure set diagnostic pragmas don't affect the translation unit that
|
||||
// imports the module.
|
||||
// FIXME: Make diagnostic pragma sections work properly with modules.
|
||||
if (isModule)
|
||||
return;
|
||||
|
||||
llvm::SmallDenseMap<const DiagnosticsEngine::DiagState *, unsigned, 64>
|
||||
DiagStateIDMap;
|
||||
unsigned CurrID = 0;
|
||||
|
@ -4048,7 +4054,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef,
|
|||
WriteOpenCLExtensions(SemaRef);
|
||||
|
||||
WriteTypeDeclOffsets();
|
||||
WritePragmaDiagnosticMappings(Context.getDiagnostics());
|
||||
WritePragmaDiagnosticMappings(Context.getDiagnostics(), isModule);
|
||||
|
||||
WriteCXXBaseSpecifiersOffsets();
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#define DIAG_PRAGMA_MACRO 1
|
||||
|
||||
#pragma clang diagnostic ignored "-Wparentheses"
|
|
@ -188,3 +188,7 @@ module config {
|
|||
header "config.h"
|
||||
config_macros [exhaustive] WANT_FOO, WANT_BAR
|
||||
}
|
||||
|
||||
module diag_pragma {
|
||||
header "diag_pragma.h"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodules-cache-path=%t -fmodule-name=diag_pragma %S/Inputs/module.map
|
||||
// RUN: %clang_cc1 -fmodules -x objective-c -verify -fmodules-cache-path=%t %s
|
||||
// FIXME: When we have a syntax for modules in C, use that.
|
||||
|
||||
@import diag_pragma;
|
||||
|
||||
int foo(int x) {
|
||||
if (x = DIAG_PRAGMA_MACRO) // expected-warning {{using the result of an assignment as a condition without parentheses}} \
|
||||
// expected-note {{place parentheses}} expected-note {{use '=='}}
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
Загрузка…
Ссылка в новой задаче