]> granicus.if.org Git - clang/commitdiff
AST import for character literals
authorDouglas Gregor <dgregor@apple.com>
Thu, 18 Feb 2010 02:21:22 +0000 (02:21 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 18 Feb 2010 02:21:22 +0000 (02:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96557 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTImporter.cpp
test/ASTMerge/Inputs/exprs1.c [new file with mode: 0644]
test/ASTMerge/Inputs/exprs2.c [new file with mode: 0644]
test/ASTMerge/exprs.c [new file with mode: 0644]

index e064e78c1ce862c8931310bb6554940e75b0bf2c..b57ef52f94b05a9d91aa7e8551c7da9ef5fc45eb 100644 (file)
@@ -108,6 +108,7 @@ namespace {
     // Importing expressions
     Expr *VisitExpr(Expr *E);
     Expr *VisitIntegerLiteral(IntegerLiteral *E);
+    Expr *VisitCharacterLiteral(CharacterLiteral *E);
     Expr *VisitImplicitCastExpr(ImplicitCastExpr *E);
   };
 }
@@ -2598,6 +2599,16 @@ Expr *ASTNodeImporter::VisitIntegerLiteral(IntegerLiteral *E) {
     IntegerLiteral(E->getValue(), T, Importer.Import(E->getLocation()));
 }
 
+Expr *ASTNodeImporter::VisitCharacterLiteral(CharacterLiteral *E) {
+  QualType T = Importer.Import(E->getType());
+  if (T.isNull())
+    return 0;
+  
+  return new (Importer.getToContext()) CharacterLiteral(E->getValue(), 
+                                                        E->isWide(), T,
+                                          Importer.Import(E->getLocation()));
+}
+
 Expr *ASTNodeImporter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
   QualType T = Importer.Import(E->getType());
   if (T.isNull())
diff --git a/test/ASTMerge/Inputs/exprs1.c b/test/ASTMerge/Inputs/exprs1.c
new file mode 100644 (file)
index 0000000..f9de8df
--- /dev/null
@@ -0,0 +1,5 @@
+// Matching
+enum E0 {
+  E0_Val0 = 'a'
+};
+
diff --git a/test/ASTMerge/Inputs/exprs2.c b/test/ASTMerge/Inputs/exprs2.c
new file mode 100644 (file)
index 0000000..f9de8df
--- /dev/null
@@ -0,0 +1,5 @@
+// Matching
+enum E0 {
+  E0_Val0 = 'a'
+};
+
diff --git a/test/ASTMerge/exprs.c b/test/ASTMerge/exprs.c
new file mode 100644 (file)
index 0000000..0a4e1e5
--- /dev/null
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/exprs1.c
+// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/exprs2.c
+// RUN: %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only -verify %s
+