[clang-tools-extra] r226812 - [clang-tidy] Use actual LangOptions.

Alexander Kornienko alexfh at google.com
Thu Jan 22 04:40:47 PST 2015


Author: alexfh
Date: Thu Jan 22 06:40:47 2015
New Revision: 226812

URL: http://llvm.org/viewvc/llvm-project?rev=226812&view=rev
Log:
[clang-tidy] Use actual LangOptions.

Modified:
    clang-tools-extra/trunk/clang-tidy/readability/ContainerSizeEmpty.cpp
    clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGet.cpp

Modified: clang-tools-extra/trunk/clang-tidy/readability/ContainerSizeEmpty.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/ContainerSizeEmpty.cpp?rev=226812&r1=226811&r2=226812&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/ContainerSizeEmpty.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/ContainerSizeEmpty.cpp Thu Jan 22 06:40:47 2015
@@ -94,9 +94,9 @@ void ContainerSizeEmptyCheck::check(cons
   const auto *BinaryOp = Result.Nodes.getNodeAs<BinaryOperator>("SizeBinaryOp");
   const auto *E = Result.Nodes.getNodeAs<Expr>("STLObject");
   FixItHint Hint;
-  std::string ReplacementText =
-      Lexer::getSourceText(CharSourceRange::getTokenRange(E->getSourceRange()),
-                           *Result.SourceManager, LangOptions());
+  std::string ReplacementText = Lexer::getSourceText(
+      CharSourceRange::getTokenRange(E->getSourceRange()),
+      *Result.SourceManager, Result.Context->getLangOpts());
   if (E->getType()->isPointerType())
     ReplacementText += "->empty()";
   else

Modified: clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGet.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGet.cpp?rev=226812&r1=226811&r2=226812&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGet.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGet.cpp Thu Jan 22 06:40:47 2015
@@ -111,7 +111,7 @@ void RedundantSmartptrGet::check(const M
 
   StringRef SmartptrText = Lexer::getSourceText(
       CharSourceRange::getTokenRange(Smartptr->getSourceRange()),
-      *Result.SourceManager, LangOptions());
+      *Result.SourceManager, Result.Context->getLangOpts());
   // Replace foo->get() with *foo, and foo.get() with foo.
   std::string Replacement = Twine(IsPtrToPtr ? "*" : "", SmartptrText).str();
   diag(GetCall->getLocStart(), "Redundant get() call on smart pointer.")





More information about the cfe-commits mailing list