Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: src/PNaClTranslator.cpp

Issue 1392273002: Add correction message to bad linkage error. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nit. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTargetLoweringX86BaseImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/PNaClTranslator.cpp
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index 7124da08a74b232d530b0aff7e9d57000f64802d..755971d3df5c898ec88d1addedd5ff8cbd2ab892 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -473,18 +473,23 @@ private:
}
}
+ void reportLinkageError(const char *Kind,
+ const Ice::GlobalDeclaration &Decl) {
+ std::string Buffer;
+ raw_string_ostream StrBuf(Buffer);
+ StrBuf << Kind << " " << Decl.getName()
+ << " has incorrect linkage: " << Decl.getLinkageName();
+ if (Decl.isExternal())
+ StrBuf << "\n Use flag -allow-externally-defined-symbols to override";
+ Error(StrBuf.str());
+ }
+
// Converts function declarations into constant value IDs.
void createValueIDsForFunctions() {
Ice::GlobalContext *Ctx = getTranslator().getContext();
for (const Ice::FunctionDeclaration *Func : FunctionDeclarations) {
- if (!Func->verifyLinkageCorrect(Ctx)) {
- std::string Buffer;
- raw_string_ostream StrBuf(Buffer);
- StrBuf << "Function " << Func->getName()
- << " has incorrect linkage: " << Func->getLinkageName();
- Error(StrBuf.str());
- continue;
- }
+ if (!Func->verifyLinkageCorrect(Ctx))
+ reportLinkageError("Function", *Func);
Ice::Constant *C = nullptr;
if (!isIRGenerationDisabled()) {
C = getConstantSym(Func->getName(), Func->getSuppressMangling(),
@@ -498,13 +503,8 @@ private:
void createValueIDsForGlobalVars() {
Ice::GlobalContext *Ctx = getTranslator().getContext();
for (const Ice::VariableDeclaration *Decl : *VariableDeclarations) {
- if (!Decl->verifyLinkageCorrect(Ctx)) {
- std::string Buffer;
- raw_string_ostream StrBuf(Buffer);
- StrBuf << "Global " << Decl->getName()
- << " has incorrect linkage: " << Decl->getLinkageName();
- Error(StrBuf.str());
- }
+ if (!Decl->verifyLinkageCorrect(Ctx))
+ reportLinkageError("Global", *Decl);
Ice::Constant *C = nullptr;
if (!isIRGenerationDisabled()) {
C = getConstantSym(Decl->getName(), Decl->getSuppressMangling(),
« no previous file with comments | « src/IceTargetLoweringX86BaseImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698