Hi Argyrios,
The test you've added here fails when I build it on Windows. For some reason, 
when compiling C++ to AST and then compiling AST to llvm, the S<T>::mf function 
is declared but not defined in the resulting module. It seems to me a buggy 
behavior.

Any insights on this issue?

Thanks
   Guy

-----Original Message-----
From: [email protected] [mailto:[email protected]] 
On Behalf Of Argyrios Kyrtzidis
Sent: Tuesday, March 19, 2013 00:55
To: [email protected]
Subject: r177336 - [frontend] Initialize the diagnostic client before loading 
an ast file.

Author: akirtzidis
Date: Mon Mar 18 17:55:24 2013
New Revision: 177336

URL: http://llvm.org/viewvc/llvm-project?rev=177336&view=rev
Log:
[frontend] Initialize the diagnostic client before loading an ast file.

Issue reported by Tom Honermann!
http://llvm.org/bugs/show_bug.cgi?id=15377

Added:
    cfe/trunk/test/Frontend/ast-main.cpp
Modified:
    cfe/trunk/lib/Frontend/FrontendAction.cpp

Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=177336&r1=177335&r2=177336&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Mon Mar 18 17:55:24 2013
@@ -188,6 +188,10 @@ bool FrontendAction::BeginSourceFile(Com
 
     setCurrentInput(Input, AST);
 
+    // Inform the diagnostic client we are processing a source file.
+    CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(), 0);
+    HasBegunSourceFile = true;
+
     // Set the shared objects, these are reset when we finish processing the
     // file, otherwise the CompilerInstance will happily destroy them.
     CI.setFileManager(&AST->getFileManager());

Added: cfe/trunk/test/Frontend/ast-main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/ast-main.cpp?rev=177336&view=auto
==============================================================================
--- cfe/trunk/test/Frontend/ast-main.cpp (added)
+++ cfe/trunk/test/Frontend/ast-main.cpp Mon Mar 18 17:55:24 2013
@@ -0,0 +1,22 @@
+// RUN: %clang -emit-llvm -S -o %t1.ll -x c++ - < %s // RUN: %clang 
+-emit-ast -o %t.ast %s // RUN: %clang -emit-llvm -S -o %t2.ll -x ast - 
+< %t.ast // RUN: diff %t1.ll %t2.ll
+
+// http://llvm.org/bugs/show_bug.cgi?id=15377
+template<typename T>
+struct S {
+    T *mf();
+};
+template<typename T>
+T *S<T>::mf() {
+    // warning: control reaches end of non-void function 
+[-Wreturn-type] }
+
+void f() {
+    S<int>().mf();
+}
+
+int main() {
+  return 0;
+}


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to