forked from OSchip/llvm-project
AsmParser: add a warning for compatibility parsing
This adds a warning when linker_private or linker_private_weak is provided and we handle it in a compatible manner. Suggested by Chris Lattner! llvm-svn: 205681
This commit is contained in:
parent
2f7711242a
commit
efa31a9831
|
@ -34,6 +34,10 @@ bool LLLexer::Error(LocTy ErrorLoc, const Twine &Msg) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
void LLLexer::Warning(LocTy WarningLoc, const Twine &Msg) const {
|
||||
SM.PrintMessage(WarningLoc, SourceMgr::DK_Warning, Msg);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Helper functions.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -63,6 +63,10 @@ namespace llvm {
|
|||
|
||||
bool Error(LocTy L, const Twine &Msg) const;
|
||||
bool Error(const Twine &Msg) const { return Error(getLoc(), Msg); }
|
||||
|
||||
void Warning(LocTy WarningLoc, const Twine &Msg) const;
|
||||
void Warning(const Twine &Msg) const { return Warning(getLoc(), Msg); }
|
||||
|
||||
std::string getFilename() const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -1312,6 +1312,8 @@ bool LLParser::ParseOptionalLinkage(unsigned &Res, bool &HasLinkage) {
|
|||
|
||||
case lltok::kw_linker_private:
|
||||
case lltok::kw_linker_private_weak:
|
||||
Lex.Warning("'" + Lex.getStrVal() + "' is deprecated, treating as"
|
||||
" PrivateLinkage");
|
||||
Lex.Lex();
|
||||
// treat linker_private and linker_private_weak as PrivateLinkage
|
||||
Res = GlobalValue::PrivateLinkage;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; RUN: llvm-as -o - %s | llvm-dis | FileCheck %s
|
||||
; RUN: llvm-as -o /dev/null %s 2>&1 | FileCheck %s -check-prefix CHECK-WARNINGS
|
||||
|
||||
@.linker_private = linker_private unnamed_addr constant [15 x i8] c"linker_private\00", align 64
|
||||
@.linker_private_weak = linker_private_weak unnamed_addr constant [20 x i8] c"linker_private_weak\00", align 64
|
||||
|
@ -6,3 +7,11 @@
|
|||
; CHECK: @.linker_private = private unnamed_addr constant [15 x i8] c"linker_private\00", align 64
|
||||
; CHECK: @.linker_private_weak = private unnamed_addr constant [20 x i8] c"linker_private_weak\00", align 64
|
||||
|
||||
; CHECK-WARNINGS: warning: '.linker_private' is deprecated, treating as PrivateLinkage
|
||||
; CHECK-WARNINGS: @.linker_private = linker_private unnamed_addr constant [15 x i8] c"linker_private\00", align 64
|
||||
; CHECK-WARNINGS: ^
|
||||
|
||||
; CHECK-WARNINGS: warning: '.linker_private_weak' is deprecated, treating as PrivateLinkage
|
||||
; CHECK-WARNINGS: @.linker_private_weak = linker_private_weak unnamed_addr constant [20 x i8] c"linker_private_weak\00", align 64
|
||||
; CHECK-WARNINGS: ^
|
||||
|
||||
|
|
Loading…
Reference in New Issue