]> granicus.if.org Git - clang/commitdiff
[Lex] TokenConcatenation now takes const Preprocessor
authorKristof Umann <dkszelethus@gmail.com>
Thu, 27 Sep 2018 12:40:16 +0000 (12:40 +0000)
committerKristof Umann <dkszelethus@gmail.com>
Thu, 27 Sep 2018 12:40:16 +0000 (12:40 +0000)
Differential Revision: https://reviews.llvm.org/D52502

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343204 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Lex/TokenConcatenation.h
lib/Lex/TokenConcatenation.cpp
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h

index 60c182b509a4d5022850bd6936da7524bac5af4c..3199e36f0d2697df3282c35f7332573d30d76c3c 100644 (file)
@@ -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,
index ec73479cb54f17f5c8c40205e6afe265da455dd6..f810c28ccdf1d2a6d6da73a038829404a2f7a31a 100644 (file)
@@ -67,7 +67,7 @@ bool TokenConcatenation::IsIdentifierStringPrefix(const Token &Tok) const {
   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(Preprocessor &pp) : PP(pp) {
 
 /// 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];
index d10b862ea0832c8139046777cfa33f22e476996d..828955dc100c2baa4db3431a844cc588c9cd09a6 100644 (file)
@@ -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) {}