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.
llvm-svn: 252211
diff --git a/clang/lib/CodeGen/Address.h b/clang/lib/CodeGen/Address.h
index b1aa630..9d145fa 100644
--- a/clang/lib/CodeGen/Address.h
+++ b/clang/lib/CodeGen/Address.h
@@ -116,4 +116,11 @@
}
}
+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
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp
index c977399..bbd04dd 100644
--- a/clang/lib/CodeGen/CGExprConstant.cpp
+++ b/clang/lib/CodeGen/CGExprConstant.cpp
@@ -1038,7 +1038,7 @@
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");
}