r177336 - [frontend] Initialize the diagnostic client before loading an ast file.

Benyei, Guy guy.benyei at intel.com
Tue Mar 19 06:15:29 PDT 2013

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?


-----Original Message-----
From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-bounces at cs.uiuc.edu] On Behalf Of Argyrios Kyrtzidis
Sent: Tuesday, March 19, 2013 00:55
To: cfe-commits at cs.uiuc.edu
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
[frontend] Initialize the diagnostic client before loading an ast file.

Issue reported by Tom Honermann!


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.

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
cfe-commits at cs.uiuc.edu
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.

More information about the cfe-commits mailing list