[clang-tidy] Use actual LangOptions.
authorAlexander Kornienko <alexfh@google.com>
Thu, 22 Jan 2015 12:40:47 +0000 (12:40 +0000)
committerAlexander Kornienko <alexfh@google.com>
Thu, 22 Jan 2015 12:40:47 +0000 (12:40 +0000)
llvm-svn: 226812

clang-tools-extra/clang-tidy/readability/ContainerSizeEmpty.cpp
clang-tools-extra/clang-tidy/readability/RedundantSmartptrGet.cpp

index aa983d8e9bc69d54f1640cf27ea54a8b5fda4624..407da55aee0455e1fdd0cca47fd8df471cca22aa 100644 (file)
@@ -94,9 +94,9 @@ void ContainerSizeEmptyCheck::check(const MatchFinder::MatchResult &Result) {
   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
index 8cf427fdb5c3cbb1aea181f751b7c2babff19678..82eb18cc418b1d70f5a5fa8c32b0c5f931981274 100644 (file)
@@ -111,7 +111,7 @@ void RedundantSmartptrGet::check(const MatchFinder::MatchResult &Result) {
 
   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.")