]> granicus.if.org Git - clang/commitdiff
PR25368: Replace workaround for build failure with modules enabled with a fix
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 5 Nov 2015 21:16:22 +0000 (21:16 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 5 Nov 2015 21:16:22 +0000 (21:16 +0000)
for the root cause. The 'using llvm::isa;' declaration in Basic/LLVM.h only
pulls the declarations of llvm::isa that were declared prior to it into
namespace clang. In a modules build, this is a hermetic set of just the
declarations from LLVM. In a non-modules build, we happened to also pull the
declaration from lib/CodeGen/Address.h into namespace clang, which made the
code in question accidentally compile.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252211 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/Address.h
lib/CodeGen/CGExprConstant.cpp

index b1aa6307e3662ab1466a4a0d0fe29974d9df20c1..9d145fa26b5f8f0013f24a4e8f8707d26121d5a5 100644 (file)
@@ -116,4 +116,11 @@ namespace llvm {
   }
 }
 
+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 c97739915dac5c6ece4b130457f46e73508e3ec9..bbd04dd751485a61129778d2502550200bc00347 100644 (file)
@@ -1038,7 +1038,7 @@ public:
       unsigned Type = cast<PredefinedExpr>(E)->getIdentType();
       if (CGF) {
         LValue Res = CGF->EmitPredefinedLValue(cast<PredefinedExpr>(E));
-        return llvm::cast<ConstantAddress>(Res.getAddress());
+        return cast<ConstantAddress>(Res.getAddress());
       } else if (Type == PredefinedExpr::PrettyFunction) {
         return CGM.GetAddrOfConstantCString("top level", ".tmp");
       }