From d56638180014e60538cd666cd11fde6d4698e051 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 3 May 2010 13:08:54 +0000 Subject: [PATCH] Replace a char*/size pair with stringref. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102902 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Parse/Action.h | 3 +-- lib/Parse/ParseDeclCXX.cpp | 2 +- lib/Sema/Sema.h | 3 +-- lib/Sema/SemaDeclCXX.cpp | 7 +++---- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index 6b16522848..3d68d80ef9 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -580,8 +580,7 @@ public: virtual DeclPtrTy ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc, SourceLocation LangLoc, - const char *Lang, - unsigned StrSize, + llvm::StringRef Lang, SourceLocation LBraceLoc) { return DeclPtrTy(); } diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 60aee6abd1..015ac5b5dd 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -178,7 +178,7 @@ Parser::DeclPtrTy Parser::ParseLinkage(ParsingDeclSpec &DS, DeclPtrTy LinkageSpec = Actions.ActOnStartLinkageSpecification(CurScope, /*FIXME: */SourceLocation(), - Loc, Lang.data(), Lang.size(), + Loc, Lang, Tok.is(tok::l_brace)? Tok.getLocation() : SourceLocation()); diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 8a9be3ab01..6c52ae5cee 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -2485,8 +2485,7 @@ public: virtual DeclPtrTy ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc, SourceLocation LangLoc, - const char *Lang, - unsigned StrSize, + llvm::StringRef Lang, SourceLocation LBraceLoc); virtual DeclPtrTy ActOnFinishLinkageSpecification(Scope *S, DeclPtrTy LinkageSpec, diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index d628d44077..1ca7a728f0 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -5180,13 +5180,12 @@ FinishedParams: Sema::DeclPtrTy Sema::ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc, SourceLocation LangLoc, - const char *Lang, - unsigned StrSize, + llvm::StringRef Lang, SourceLocation LBraceLoc) { LinkageSpecDecl::LanguageIDs Language; - if (strncmp(Lang, "\"C\"", StrSize) == 0) + if (Lang == "\"C\"") Language = LinkageSpecDecl::lang_c; - else if (strncmp(Lang, "\"C++\"", StrSize) == 0) + else if (Lang == "\"C++\"") Language = LinkageSpecDecl::lang_cxx; else { Diag(LangLoc, diag::err_bad_language); -- 2.40.0