зеркало из https://github.com/microsoft/clang-1.git
Remove nondeterminism introduced in r178950.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178952 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
0024937dbb
Коммит
6797204b89
|
@ -1732,13 +1732,15 @@ void CodeGenModule::MaybeHandleStaticInExternC(const SomeDecl *D,
|
||||||
// OK, this is an internal linkage entity inside an extern "C" linkage
|
// OK, this is an internal linkage entity inside an extern "C" linkage
|
||||||
// specification. Make a note of that so we can give it the "expected"
|
// specification. Make a note of that so we can give it the "expected"
|
||||||
// mangled name if nothing else is using that name.
|
// mangled name if nothing else is using that name.
|
||||||
StaticExternCMap::iterator I =
|
std::pair<StaticExternCMap::iterator, bool> R =
|
||||||
StaticExternCValues.insert(std::make_pair(D->getIdentifier(), GV)).first;
|
StaticExternCValues.insert(std::make_pair(D->getIdentifier(), GV));
|
||||||
|
|
||||||
// If we have multiple internal linkage entities with the same name
|
// If we have multiple internal linkage entities with the same name
|
||||||
// in extern "C" regions, none of them gets that name.
|
// in extern "C" regions, none of them gets that name.
|
||||||
if (I->second != GV)
|
if (!R.second)
|
||||||
I->second = 0;
|
R.first->second = 0;
|
||||||
|
else
|
||||||
|
StaticExternCIdents.push_back(D->getIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
|
void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
|
||||||
|
@ -2947,13 +2949,13 @@ static void EmitGlobalDeclMetadata(CodeGenModule &CGM,
|
||||||
/// to such functions with an unmangled name from inline assembly within the
|
/// to such functions with an unmangled name from inline assembly within the
|
||||||
/// same translation unit.
|
/// same translation unit.
|
||||||
void CodeGenModule::EmitStaticExternCAliases() {
|
void CodeGenModule::EmitStaticExternCAliases() {
|
||||||
for (StaticExternCMap::iterator I = StaticExternCValues.begin(),
|
for (unsigned I = 0, N = StaticExternCIdents.size(); I != N; ++I) {
|
||||||
E = StaticExternCValues.end();
|
IdentifierInfo *Name = StaticExternCIdents[I];
|
||||||
I != E; ++I)
|
llvm::GlobalValue *Val = StaticExternCValues[Name];
|
||||||
if (I->second && !getModule().getNamedValue(I->first->getName()))
|
if (Val && !getModule().getNamedValue(Name->getName()))
|
||||||
AddUsedGlobal(
|
AddUsedGlobal(new llvm::GlobalAlias(Val->getType(), Val->getLinkage(),
|
||||||
new llvm::GlobalAlias(I->second->getType(), I->second->getLinkage(),
|
Name->getName(), Val, &getModule()));
|
||||||
I->first->getName(), I->second, &getModule()));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Emits metadata nodes associating all the global values in the
|
/// Emits metadata nodes associating all the global values in the
|
||||||
|
|
|
@ -310,6 +310,7 @@ class CodeGenModule : public CodeGenTypeCache {
|
||||||
typedef llvm::DenseMap<IdentifierInfo *,
|
typedef llvm::DenseMap<IdentifierInfo *,
|
||||||
llvm::GlobalValue *> StaticExternCMap;
|
llvm::GlobalValue *> StaticExternCMap;
|
||||||
StaticExternCMap StaticExternCValues;
|
StaticExternCMap StaticExternCValues;
|
||||||
|
std::vector<IdentifierInfo*> StaticExternCIdents;
|
||||||
|
|
||||||
/// CXXGlobalInits - Global variables with initializers that need to run
|
/// CXXGlobalInits - Global variables with initializers that need to run
|
||||||
/// before main.
|
/// before main.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче