[PATCH] [clang-tidy] Handle c-style casts from/to enums.

Manuel Klimek klimek at google.com
Wed Oct 1 05:39:40 PDT 2014


lg

================
Comment at: clang-tidy/google/AvoidCStyleCastsCheck.cpp:85-89
@@ -84,3 +84,7 @@
 
-  std::string DestTypeString = CastExpr->getTypeAsWritten().getAsString();
+  StringRef DestTypeString = Lexer::getSourceText(
+      CharSourceRange::getTokenRange(
+          CastExpr->getLParenLoc().getLocWithOffset(1),
+          CastExpr->getRParenLoc().getLocWithOffset(-1)),
+      *Result.SourceManager, Result.Context->getLangOpts());
 
----------------
Why does getTypeAsWritten not work any more? Perhaps add a comment explaining that...

http://reviews.llvm.org/D5558






More information about the cfe-commits mailing list