r343204 - [Lex] TokenConcatenation now takes const Preprocessor

Kristof Umann via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 27 05:40:16 PDT 2018


Author: szelethus
Date: Thu Sep 27 05:40:16 2018
New Revision: 343204

URL: http://llvm.org/viewvc/llvm-project?rev=343204&view=rev
Log:
[Lex] TokenConcatenation now takes const Preprocessor

Differential Revision: https://reviews.llvm.org/D52502

Modified:
    cfe/trunk/include/clang/Lex/TokenConcatenation.h
    cfe/trunk/lib/Lex/TokenConcatenation.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h

Modified: cfe/trunk/include/clang/Lex/TokenConcatenation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/TokenConcatenation.h?rev=343204&r1=343203&r2=343204&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/TokenConcatenation.h (original)
+++ cfe/trunk/include/clang/Lex/TokenConcatenation.h Thu Sep 27 05:40:16 2018
@@ -29,7 +29,7 @@ namespace clang {
   /// and ")" next to each other is safe.
   ///
   class TokenConcatenation {
-    Preprocessor &PP;
+    const Preprocessor &PP;
 
     enum AvoidConcatInfo {
       /// By default, a token never needs to avoid concatenation.  Most tokens
@@ -56,7 +56,7 @@ namespace clang {
     /// method.
     char TokenInfo[tok::NUM_TOKENS];
   public:
-    TokenConcatenation(Preprocessor &PP);
+    TokenConcatenation(const Preprocessor &PP);
 
     bool AvoidConcat(const Token &PrevPrevTok,
                      const Token &PrevTok,

Modified: cfe/trunk/lib/Lex/TokenConcatenation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenConcatenation.cpp?rev=343204&r1=343203&r2=343204&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/TokenConcatenation.cpp (original)
+++ cfe/trunk/lib/Lex/TokenConcatenation.cpp Thu Sep 27 05:40:16 2018
@@ -67,7 +67,7 @@ bool TokenConcatenation::IsIdentifierStr
   return IsStringPrefix(StringRef(PP.getSpelling(Tok)), LangOpts.CPlusPlus11);
 }
 
-TokenConcatenation::TokenConcatenation(Preprocessor &pp) : PP(pp) {
+TokenConcatenation::TokenConcatenation(const Preprocessor &pp) : PP(pp) {
   memset(TokenInfo, 0, sizeof(TokenInfo));
 
   // These tokens have custom code in AvoidConcat.
@@ -126,7 +126,7 @@ TokenConcatenation::TokenConcatenation(P
 
 /// GetFirstChar - Get the first character of the token \arg Tok,
 /// avoiding calls to getSpelling where possible.
-static char GetFirstChar(Preprocessor &PP, const Token &Tok) {
+static char GetFirstChar(const Preprocessor &PP, const Token &Tok) {
   if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
     // Avoid spelling identifiers, the most common form of token.
     return II->getNameStart()[0];

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h?rev=343204&r1=343203&r2=343204&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h Thu Sep 27 05:40:16 2018
@@ -79,9 +79,9 @@ class FieldNode {
 protected:
   const FieldRegion *FR;
 
-  /// FieldNodes are never meant to be created on the heap, see
-  /// FindUninitializedFields::addFieldToUninits().
-  /* non-virtual */ ~FieldNode() = default;
+  // TODO: This destructor shouldn't be virtual, but breaks buildbots with
+  // -Werror -Wnon-virtual-dtor.
+  virtual ~FieldNode() = default;
 
 public:
   FieldNode(const FieldRegion *FR) : FR(FR) {}




More information about the cfe-commits mailing list