From 28b45ce151f3d4248646f2395c5319caa93cd015 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 8 Mar 2015 16:06:46 +0000 Subject: [PATCH] Make constant static variables const so they can go into a read-only section NFC. llvm-svn: 231597 --- clang/lib/Format/Format.cpp | 11 ++++++----- clang/lib/Format/TokenAnnotator.cpp | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 035dc73..d312e8d 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -642,11 +642,12 @@ private: if (tryMergeTemplateString()) return; - static tok::TokenKind JSIdentity[] = {tok::equalequal, tok::equal}; - static tok::TokenKind JSNotIdentity[] = {tok::exclaimequal, tok::equal}; - static tok::TokenKind JSShiftEqual[] = {tok::greater, tok::greater, - tok::greaterequal}; - static tok::TokenKind JSRightArrow[] = {tok::equal, tok::greater}; + static const tok::TokenKind JSIdentity[] = {tok::equalequal, tok::equal}; + static const tok::TokenKind JSNotIdentity[] = {tok::exclaimequal, + tok::equal}; + static const tok::TokenKind JSShiftEqual[] = {tok::greater, tok::greater, + tok::greaterequal}; + static const tok::TokenKind JSRightArrow[] = {tok::equal, tok::greater}; // FIXME: We probably need to change token type to mimic operator with the // correct priority. if (tryMergeTokens(JSIdentity)) diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 1688568..b8f8b99 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1119,8 +1119,8 @@ private: const AdditionalKeywords &Keywords; }; -static int PrecedenceUnaryOperator = prec::PointerToMember + 1; -static int PrecedenceArrowAndPeriod = prec::PointerToMember + 2; +static const int PrecedenceUnaryOperator = prec::PointerToMember + 1; +static const int PrecedenceArrowAndPeriod = prec::PointerToMember + 2; /// \brief Parses binary expressions by inserting fake parenthesis based on /// operator precedence. -- 2.7.4