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


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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to