]> granicus.if.org Git - clang/commitdiff
Bugfix for predefined expressions in dependent context.
authorAlexey Bataev <a.bataev@hotmail.com>
Fri, 10 Oct 2014 18:58:13 +0000 (18:58 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Fri, 10 Oct 2014 18:58:13 +0000 (18:58 +0000)
This bug break compilation with precompiled headers and predefined expressions in dependent context.

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

lib/AST/Expr.cpp
test/CodeGenCXX/predefined-expr-cxx14.cpp

index 8410bad88d9b4583144b8bbebc2f35d017891726..bc5498ad9acd7c99f7b62cc7b360f93ee0eaaca5 100644 (file)
@@ -457,7 +457,7 @@ PredefinedExpr::PredefinedExpr(SourceLocation L, QualType FNTy, IdentType IT,
       Loc(L), Type(IT), FnName(SL) {}
 
 StringLiteral *PredefinedExpr::getFunctionName() {
-  return cast<StringLiteral>(FnName);
+  return cast_or_null<StringLiteral>(FnName);
 }
 
 StringRef PredefinedExpr::getIdentTypeName(PredefinedExpr::IdentType IT) {
index 62c86df294c4e372e8dca137ac02002621c51a25..73b9295e128ad224bd3f760207d8bebe92772b4a 100644 (file)
@@ -1,4 +1,9 @@
 // RUN: %clang_cc1 -std=c++14 %s -triple %itanium_abi_triple -fblocks -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -x c++ -std=c++14 -triple %itanium_abi_triple -fblocks -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -triple %itanium_abi_triple -std=c++14 -fblocks -include-pch %t %s -emit-llvm -o - | FileCheck %s
+
+#ifndef HEADER
+#define HEADER
 
 // CHECK-DAG: @__func__._ZN13ClassTemplateIiE21classTemplateFunctionERi = private unnamed_addr constant [22 x i8] c"classTemplateFunction\00"
 // CHECK-DAG: @__PRETTY_FUNCTION__._ZN13ClassTemplateIiE21classTemplateFunctionERi = private unnamed_addr constant [69 x i8] c"const auto &ClassTemplate<int>::classTemplateFunction(T &) [T = int]\00"
@@ -81,3 +86,5 @@ int main() {
   t.classTemplateFunction(a);
   return 0;
 }
+#endif
+