[PATCH] D16819: Remove llvm::(cast|isa) from lib/CodeGen/Address.h to fix build with gcc-4.8.1

Igor Sugak via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 2 12:58:43 PST 2016


sugak created this revision.
sugak added reviewers: rsmith, rjmccall.
sugak added subscribers: hans, cfe-commits.

gcc-4.8.1 fails to build clang because of a regression in that version of gcc
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58022). See details about the
generated error in https://llvm.org/bugs/show_bug.cgi?id=26362. To work around
the build error, this diff moves definitions `cast(clang::CodeGen::Address)` and
`isa(clang::CodeGen::Address)` from llvm to clang namespace. No build errors
are introduced with this change.

I've tested this with gcc-4.8.1 and gcc-4.9.0 both on master and release_38.

http://reviews.llvm.org/D16819

Files:
  lib/CodeGen/Address.h

Index: lib/CodeGen/Address.h
===================================================================
--- lib/CodeGen/Address.h
+++ lib/CodeGen/Address.h
@@ -104,23 +104,15 @@
 };
 
 }
-}
 
-namespace llvm {
-  // Present a minimal LLVM-like casting interface.
-  template <class U> inline U cast(clang::CodeGen::Address addr) {
-    return U::castImpl(addr);
-  }
-  template <class U> inline bool isa(clang::CodeGen::Address addr) {
-    return U::isaImpl(addr);
-  }
+// Present a minimal LLVM-like casting interface.
+template <class U> inline U cast(CodeGen::Address addr) {
+  return U::castImpl(addr);
+}
+template <class U> inline bool isa(CodeGen::Address addr) {
+  return U::isaImpl(addr);
 }
 
-namespace clang {
-  // Make our custom isa and cast available in namespace clang, to mirror
-  // what we do for LLVM's versions in Basic/LLVM.h.
-  using llvm::isa;
-  using llvm::cast;
 }
 
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16819.46690.patch
Type: text/x-patch
Size: 903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160202/c0f16166/attachment.bin>


More information about the cfe-commits mailing list