summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Serialization/ASTReader.h5
-rw-r--r--clang/lib/Serialization/ASTReader.cpp19
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp12
-rw-r--r--clang/test/Modules/Inputs/macro-hiding/a1.h1
-rw-r--r--clang/test/Modules/Inputs/macro-hiding/a2.h0
-rw-r--r--clang/test/Modules/Inputs/macro-hiding/b1.h0
-rw-r--r--clang/test/Modules/Inputs/macro-hiding/b2.h2
-rw-r--r--clang/test/Modules/Inputs/macro-hiding/c1.h2
-rw-r--r--clang/test/Modules/Inputs/macro-hiding/module.modulemap11
-rw-r--r--clang/test/Modules/macro-hiding.cpp6
10 files changed, 10 insertions, 48 deletions
diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h
index 3f44440d4b9..0698b98abbe 100644
--- a/clang/include/clang/Serialization/ASTReader.h
+++ b/clang/include/clang/Serialization/ASTReader.h
@@ -1366,8 +1366,7 @@ public:
bool Complain);
/// \brief Make the names within this set of hidden names visible.
- void makeNamesVisible(const HiddenNames &Names, Module *Owner,
- bool FromFinalization);
+ void makeNamesVisible(const HiddenNames &Names, Module *Owner);
/// \brief Set the AST callbacks listener.
void setListener(ASTReaderListener *listener) {
@@ -1832,7 +1831,7 @@ public:
ModuleFile &M, uint64_t Offset);
void installImportedMacro(IdentifierInfo *II, ModuleMacroInfo *MMI,
- Module *Owner, bool FromFinalization);
+ Module *Owner);
typedef llvm::TinyPtrVector<DefMacroDirective *> AmbiguousMacros;
llvm::DenseMap<IdentifierInfo*, AmbiguousMacros> AmbiguousMacroDefs;
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 419f6b32008..f18122dd941 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -1790,7 +1790,7 @@ void ASTReader::resolvePendingMacro(IdentifierInfo *II,
// install if we make this module visible.
HiddenNamesMap[Owner].HiddenMacros.insert(std::make_pair(II, MMI));
} else {
- installImportedMacro(II, MMI, Owner, /*FromFinalization*/false);
+ installImportedMacro(II, MMI, Owner);
}
}
@@ -1941,11 +1941,11 @@ ASTReader::removeOverriddenMacros(IdentifierInfo *II,
}
void ASTReader::installImportedMacro(IdentifierInfo *II, ModuleMacroInfo *MMI,
- Module *Owner, bool FromFinalization) {
+ Module *Owner) {
assert(II && Owner);
SourceLocation ImportLoc = Owner->MacroVisibilityLoc;
- if (ImportLoc.isInvalid() && !FromFinalization) {
+ if (ImportLoc.isInvalid()) {
// FIXME: If we made macros from this module visible but didn't provide a
// source location for the import, we don't have a location for the macro.
// Use the location at which the containing module file was first imported
@@ -3320,9 +3320,7 @@ static void moveMethodToBackOfGlobalList(Sema &S, ObjCMethodDecl *Method) {
}
}
-void ASTReader::makeNamesVisible(const HiddenNames &Names, Module *Owner,
- bool FromFinalization) {
- // FIXME: Only do this if Owner->NameVisibility == AllVisible.
+void ASTReader::makeNamesVisible(const HiddenNames &Names, Module *Owner) {
for (unsigned I = 0, N = Names.HiddenDecls.size(); I != N; ++I) {
Decl *D = Names.HiddenDecls[I];
bool wasHidden = D->Hidden;
@@ -3335,12 +3333,10 @@ void ASTReader::makeNamesVisible(const HiddenNames &Names, Module *Owner,
}
}
- assert((FromFinalization || Owner->NameVisibility >= Module::MacrosVisible) &&
- "nothing to make visible?");
for (HiddenMacrosMap::const_iterator I = Names.HiddenMacros.begin(),
E = Names.HiddenMacros.end();
I != E; ++I)
- installImportedMacro(I->first, I->second, Owner, FromFinalization);
+ installImportedMacro(I->first, I->second, Owner);
}
void ASTReader::makeModuleVisible(Module *Mod,
@@ -3374,8 +3370,7 @@ void ASTReader::makeModuleVisible(Module *Mod,
// mark them as visible.
HiddenNamesMapType::iterator Hidden = HiddenNamesMap.find(Mod);
if (Hidden != HiddenNamesMap.end()) {
- makeNamesVisible(Hidden->second, Hidden->first,
- /*FromFinalization*/false);
+ makeNamesVisible(Hidden->second, Hidden->first);
HiddenNamesMap.erase(Hidden);
}
@@ -3902,7 +3897,7 @@ void ASTReader::finalizeForWriting() {
for (HiddenNamesMapType::iterator Hidden = HiddenNamesMap.begin(),
HiddenEnd = HiddenNamesMap.end();
Hidden != HiddenEnd; ++Hidden) {
- makeNamesVisible(Hidden->second, Hidden->first, /*FromFinalization*/true);
+ makeNamesVisible(Hidden->second, Hidden->first);
}
HiddenNamesMap.clear();
}
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index f0b17523682..97a5d0e9d28 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -3089,17 +3089,7 @@ class ASTIdentifierTableTrait {
}
SubmoduleID getSubmoduleID(MacroDirective *MD) {
- if (MD->getLocation().isValid())
- return Writer.inferSubmoduleIDFromLocation(MD->getLocation());
-
- // If we have no directive location, this macro was installed when
- // finalizing the ASTReader.
- if (DefMacroDirective *DefMD = dyn_cast<DefMacroDirective>(MD))
- return DefMD->getInfo()->getOwningModuleID();
-
- // Skip imports that only produce #undefs for now.
- // FIXME: We should still re-export them!
- return 0;
+ return Writer.inferSubmoduleIDFromLocation(MD->getLocation());
}
public:
diff --git a/clang/test/Modules/Inputs/macro-hiding/a1.h b/clang/test/Modules/Inputs/macro-hiding/a1.h
deleted file mode 100644
index b17c8eeb69a..00000000000
--- a/clang/test/Modules/Inputs/macro-hiding/a1.h
+++ /dev/null
@@ -1 +0,0 @@
-#define assert(x)
diff --git a/clang/test/Modules/Inputs/macro-hiding/a2.h b/clang/test/Modules/Inputs/macro-hiding/a2.h
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/clang/test/Modules/Inputs/macro-hiding/a2.h
+++ /dev/null
diff --git a/clang/test/Modules/Inputs/macro-hiding/b1.h b/clang/test/Modules/Inputs/macro-hiding/b1.h
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/clang/test/Modules/Inputs/macro-hiding/b1.h
+++ /dev/null
diff --git a/clang/test/Modules/Inputs/macro-hiding/b2.h b/clang/test/Modules/Inputs/macro-hiding/b2.h
deleted file mode 100644
index 83918489e92..00000000000
--- a/clang/test/Modules/Inputs/macro-hiding/b2.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "a2.h"
-#define assert(x)
diff --git a/clang/test/Modules/Inputs/macro-hiding/c1.h b/clang/test/Modules/Inputs/macro-hiding/c1.h
deleted file mode 100644
index 4b78b3c2734..00000000000
--- a/clang/test/Modules/Inputs/macro-hiding/c1.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "b1.h"
-#define assert(x)
diff --git a/clang/test/Modules/Inputs/macro-hiding/module.modulemap b/clang/test/Modules/Inputs/macro-hiding/module.modulemap
deleted file mode 100644
index 2657ab1692a..00000000000
--- a/clang/test/Modules/Inputs/macro-hiding/module.modulemap
+++ /dev/null
@@ -1,11 +0,0 @@
-module a {
- module a1 { header "a1.h" export * }
- module a2 { header "a2.h" export * }
-}
-module b {
- module b1 { header "b1.h" export * }
- module b2 { header "b2.h" export * }
-}
-module c {
- module c1 { header "c1.h" export * }
-}
diff --git a/clang/test/Modules/macro-hiding.cpp b/clang/test/Modules/macro-hiding.cpp
deleted file mode 100644
index a7a6064e64d..00000000000
--- a/clang/test/Modules/macro-hiding.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/macro-hiding %s
-#include "c1.h"
-#include "b2.h"
-
-void h() { assert(true); }
OpenPOWER on IntegriCloud