[PATCH] D96478: [clang][cli] Fix gcc warning (NFC)

Yang Fan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 10 19:04:55 PST 2021


nullptr.cpp created this revision.
nullptr.cpp requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

GCC warning:

  /llvm-project/clang/lib/Frontend/TestModuleFileExtension.cpp:131:20: warning: ‘llvm::raw_ostream& clang::operator<<(llvm::raw_ostream&, const clang::TestModuleFileExtension&)’ has not been declared within ‘clang’
    131 | llvm::raw_ostream &clang::operator<<(llvm::raw_ostream &OS,
        |                    ^~~~~
  In file included from /llvm-project/clang/lib/Frontend/TestModuleFileExtension.cpp:8:
  /llvm-project/clang/lib/Frontend/TestModuleFileExtension.h:75:3: note: only here as a ‘friend’
     75 |   operator<<(llvm::raw_ostream &OS, const TestModuleFileExtension &Extension);
        |   ^~~~~~~~


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96478

Files:
  clang/lib/Frontend/TestModuleFileExtension.cpp


Index: clang/lib/Frontend/TestModuleFileExtension.cpp
===================================================================
--- clang/lib/Frontend/TestModuleFileExtension.cpp
+++ clang/lib/Frontend/TestModuleFileExtension.cpp
@@ -128,9 +128,11 @@
                                                     new TestModuleFileExtension::Reader(this, Stream));
 }
 
-llvm::raw_ostream &clang::operator<<(llvm::raw_ostream &OS,
+namespace clang {
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
                                      const TestModuleFileExtension &Extension) {
   return OS << Extension.BlockName << ":" << Extension.MajorVersion << ":"
             << Extension.MinorVersion << ":" << Extension.Hashed << ":"
             << Extension.UserInfo;
 }
+} // namespace clang


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96478.322893.patch
Type: text/x-patch
Size: 781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210211/e050a9f1/attachment.bin>


More information about the cfe-commits mailing list