r252211 - PR25368: Replace workaround for build failure with modules enabled with a fix

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 5 13:16:22 PST 2015


Author: rsmith
Date: Thu Nov  5 15:16:22 2015
New Revision: 252211

URL: http://llvm.org/viewvc/llvm-project?rev=252211&view=rev
Log:
PR25368: Replace workaround for build failure with modules enabled with a fix
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.

Modified:
    cfe/trunk/lib/CodeGen/Address.h
    cfe/trunk/lib/CodeGen/CGExprConstant.cpp

Modified: cfe/trunk/lib/CodeGen/Address.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Address.h?rev=252211&r1=252210&r2=252211&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Address.h (original)
+++ cfe/trunk/lib/CodeGen/Address.h Thu Nov  5 15:16:22 2015
@@ -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

Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=252211&r1=252210&r2=252211&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Thu Nov  5 15:16:22 2015
@@ -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");
       }




More information about the cfe-commits mailing list