[PATCH] D62202: Work around a Visual C++ bug

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 21 08:17:52 PDT 2019


probinson created this revision.
probinson added reviewers: aaron.ballman, rnk.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Put up for review because I'm not clear whether this should be considered a permanent fix, or if I should put some sort of comment here indicating it's a workaround.


Repository:
  rC Clang

https://reviews.llvm.org/D62202

Files:
  clang/lib/Tooling/Refactoring/RangeSelector.cpp


Index: clang/lib/Tooling/Refactoring/RangeSelector.cpp
===================================================================
--- clang/lib/Tooling/Refactoring/RangeSelector.cpp
+++ clang/lib/Tooling/Refactoring/RangeSelector.cpp
@@ -218,37 +218,43 @@
 };
 } // namespace
 
+namespace {
 // Returns the range of the statements (all source between the braces).
-static CharSourceRange getStatementsRange(const MatchResult &,
-                                          const CompoundStmt &CS) {
+CharSourceRange getStatementsRange(const MatchResult &,
+                                   const CompoundStmt &CS) {
   return CharSourceRange::getCharRange(CS.getLBracLoc().getLocWithOffset(1),
                                        CS.getRBracLoc());
 }
+} // namespace
 
 RangeSelector tooling::statements(StringRef ID) {
   return RelativeSelector<CompoundStmt, getStatementsRange>(ID);
 }
 
+namespace {
 // Returns the range of the source between the call's parentheses.
-static CharSourceRange getCallArgumentsRange(const MatchResult &Result,
-                                             const CallExpr &CE) {
+CharSourceRange getCallArgumentsRange(const MatchResult &Result,
+                                      const CallExpr &CE) {
   return CharSourceRange::getCharRange(
       findOpenParen(CE, *Result.SourceManager, Result.Context->getLangOpts())
           .getLocWithOffset(1),
       CE.getRParenLoc());
 }
+} // namespace
 
 RangeSelector tooling::callArgs(StringRef ID) {
   return RelativeSelector<CallExpr, getCallArgumentsRange>(ID);
 }
 
+namespace {
 // Returns the range of the elements of the initializer list. Includes all
 // source between the braces.
-static CharSourceRange getElementsRange(const MatchResult &,
-                                        const InitListExpr &E) {
+CharSourceRange getElementsRange(const MatchResult &,
+                                 const InitListExpr &E) {
   return CharSourceRange::getCharRange(E.getLBraceLoc().getLocWithOffset(1),
                                        E.getRBraceLoc());
 }
+} // namespace
 
 RangeSelector tooling::initListElements(StringRef ID) {
   return RelativeSelector<InitListExpr, getElementsRange>(ID);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62202.200516.patch
Type: text/x-patch
Size: 2199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190521/92090808/attachment.bin>


More information about the cfe-commits mailing list