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

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Mar 18 15:55:24 PDT 2013


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;
+}





More information about the cfe-commits mailing list