[PATCH] D52502: [Lex] TokenConcatenation now takes const Preprocessor

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 27 05:44:08 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL343204: [Lex] TokenConcatenation now takes const Preprocessor (authored by Szelethus, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D52502?vs=166927&id=167301#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52502

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


Index: cfe/trunk/include/clang/Lex/TokenConcatenation.h
===================================================================
--- cfe/trunk/include/clang/Lex/TokenConcatenation.h
+++ cfe/trunk/include/clang/Lex/TokenConcatenation.h
@@ -29,7 +29,7 @@
   /// 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 @@
     /// method.
     char TokenInfo[tok::NUM_TOKENS];
   public:
-    TokenConcatenation(Preprocessor &PP);
+    TokenConcatenation(const Preprocessor &PP);
 
     bool AvoidConcat(const Token &PrevPrevTok,
                      const Token &PrevTok,
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
@@ -79,9 +79,9 @@
 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) {}
Index: cfe/trunk/lib/Lex/TokenConcatenation.cpp
===================================================================
--- cfe/trunk/lib/Lex/TokenConcatenation.cpp
+++ cfe/trunk/lib/Lex/TokenConcatenation.cpp
@@ -67,7 +67,7 @@
   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 @@
 
 /// 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];


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52502.167301.patch
Type: text/x-patch
Size: 2490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180927/96ec5bcb/attachment-0001.bin>


More information about the cfe-commits mailing list