[LLVMbugs] [Bug 5935] New: TargetOptions::Target is documented wrong.

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Jan 4 09:57:28 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=5935

           Summary: TargetOptions::Target is documented wrong.
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Documentation
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: wlynch at wlynch.cx
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=4002)
 --> (http://llvm.org/bugs/attachment.cgi?id=4002)
Code to show the problem.

Currently, the doxygen string for TargetOptions::Target is as follows:

If given, the name of the target triple to compile for. If not given the target
will be selected to match the host.

I'm reading that as:

if (TargetOptions.Target == "")
    TargetOptions.Target = llvm::sys::getHostTriple();

However, it appears that the system instead leaves the triple as the empty
string, which causes later code to throw errors (expecting a target when
instead given the empty string).

Attached is some code that has this occur. There are two versions included, one
using CompilerInstance, and one breaking that down. 

It appears that the best place to fix this would be in the constructor to the
llvm::Triple class. See:
http://clang.llvm.org/doxygen/Targets_8cpp-source.html#l02194

Of course, the other alternative fix is to change the documentation.

Other comments include:
 * Compiling with LLVM and Clang trunks.
 * Compile command: g++ `/Users/wlynch/Downloads/llvm/_/bin/llvm-config
--cxxflags` -fno-rtti -gstabs+ `/Users/wlynch/Downloads/llvm/_/bin/llvm-config
--ldflags --libs`  -lclangAST  -lclangAnalysis  -lclangBasic  -lclangCodeGen 
-lclangDriver  -lclangFrontend  -lclangIndex  -lclangLex  -lclangParse 
-lclangRewrite  -lclangSema  foo.cpp   -o foo
 * For the doxygen comment of TargetOptions, see:
http://clang.llvm.org/doxygen/TargetOptions_8h-source.html#l00022


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list